Method: Punk::Human.make

Defined in:
lib/punkmaker/type/human.rb

.make(color = nil, shine: true, eye_color: nil, gender: 'm') ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/punkmaker/type/human.rb', line 39

def self.make( color=nil,
               shine: true,
               eye_color: nil,
               gender: 'm'  )

  punk =  base( gender: gender )
  
  skintone = color ? parse_skintone( color ) : nil 
  if skintone    ## change skin tone (& eyebrows)?

    color_map = derive_color_map( skintone )  
    punk = punk.change_colors( color_map )
  end

  if eye_color    ## change eye color?

     eye_color = parse_eye_color( eye_color ) 
     if gender == 'm'
       punk[9,12]  = eye_color
       punk[14,12] = eye_color
     else
       punk[9,13] = eye_color
       punk[14,13] = eye_color
     end
  end

  if shine     ## add shine?

     # note: default shine color is white

     shine_color =   skintone ? derive_shine( skintone ) : 0xffffffff
     if gender == 'm'
       punk[9,7] = shine_color
       punk[8,8] = shine_color
     else 
       punk[9,9] = shine_color
    end   
  end

  punk
end