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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
# File 'lib/punks/pixelart/generator.rb', line 40
def to_recs( *values, style: nil, patch: nil )
recs = []
archetype_name = values[0]
if archetype_name.is_a?( Image )
archetype = archetype_name
recs << archetype
attribute_gender = 'm'
attribute_size = 'l'
elsif patch && img=patch[ normalize_key(archetype_name) ]
archetype = img
recs << archetype
if archetype_name.downcase.index( 'female' )
attribute_gender = 'f'
attribute_size = 's'
else
attribute_gender = 'm'
attribute_size = 'l'
end
else archetype = @sheet.find_meta_by( name: archetype_name )
if archetype.nil?
puts "!! ERROR - archetype >#{archetype}< not found; sorry"
exit 1
end
recs << archetype
attribute_gender = archetype.gender
attribute_size = archetype.size
end
attribute_names = values[1..-1]
attribute_names.each do |attribute_name|
if attribute_name.is_a?( Image )
recs << attribute_name
elsif patch && img=patch[ normalize_key(attribute_name) ]
recs << img
else
rec = @sheet.find_meta_by( name: attribute_name,
gender: attribute_gender,
size: attribute_size,
style: style )
if rec.nil?
puts "!! ERROR - attribute >#{attribute_name}< for (#{attribute_gender}+#{attribute_size}) not found; sorry"
exit 1
end
recs << rec
end
end
recs
end
|