ID:153447
 
I'm looking for a way to create a variety of icons from a base icon. I'm not sure the way I've gone about it is the most efficient. I created icons using simple colors for reference, for instance skintones are blue (rgb(0,0,255)). Then I can swap the colors with a datum type Template that I created which stores rgb values.
example:
Template
var
skin = rgb(0,0,255)
pants = rgb(255,255,0)
Dark
skin = rgb(102,51,0)


My problem is an easy way to manage these templates to change the icons efficiently. Here is the proc I'm working on.

proc/mob_fromTemplate(mob/player/M,Template/T,Template/t)
var/Template/temp = new T
var/Template/T1=new t
var/mob/player/P = new M.type
var/icon/I=new(P.icon,P.icon_state)
if(T1.skin)
I.SwapColor(temp.skin,T1.skin)
if(T1.shirt)
I.SwapColor(temp.shirt,T1.shirt)
if(T1.shirt1)
I.SwapColor(temp.shirt1,T1.shirt1)
if(T1.misc)
I.SwapColor(temp.misc,T1.misc)
if(T1.pants)
I.SwapColor(temp.pants,T1.pants)
P.icon=I
return P


This system works fine actually. I'm just wondering what criticisms or suggestions anyone might have. It's gonna be nice when I get it implemented.

Cadence
If that's the method you want to use, go for it. If you wanted more shading on the icons, breaking the the icons up into more parts (one per colour), making them greyscale and use Blend() to set the colour would be a more comprehensive solution.

But there's no point doing that if you've already done your method, and you're happy with what it does. Go for it!