Files
CHOMPStation2/code/modules/mob/living/silicon/robot/custom_sprites.dm
Mechoid 1363fb49c3 Allows individuals to have multiple custom borg sprite-sets without using multiple ckeys.
Small modification of robot.dm to make both custom sprite set-ings compliant with one-another.
2017-01-19 01:35:33 -08:00

33 lines
1.3 KiB
Plaintext

//list(ckey = real_name,)
//Since the ckey is used as the icon_state, the current system will only permit a single custom robot sprite per ckey.
//While it might be possible for a ckey to use that custom sprite for several real_names, it seems rather pointless to support it. ~Mech: We found it wasn't pointless.
var/list/robot_custom_icons
/hook/startup/proc/load_robot_custom_sprites()
var/config_file = file2text("config/custom_sprites.txt")
var/list/lines = splittext(config_file, "\n")
robot_custom_icons = list()
for(var/line in lines)
//split entry into ckey and real_name
var/list/split_idx = splittext(line, "-") //this works if ckeys and borg names cannot contain dashes, and splittext starts from the beginning ~Mech
if(!split_idx || !split_idx.len)
continue //bad entry
var/ckey = split_idx[1]
//Prevents the CKEY from being considered a borg name / being processed into the name list. ~Mech
split_idx.Remove(ckey)
for(var/name in split_idx)
robot_custom_icons[name] = ckey
return 1
/mob/living/silicon/robot/proc/set_custom_sprite()
var/sprite_owner = robot_custom_icons[real_name]
if(sprite_owner && sprite_owner == ckey)
custom_sprite = 1
icon = CUSTOM_ITEM_SYNTH
if(icon_state == "robot")
icon_state = "[ckey]-[name]-Standard" //Compliant with robot.dm line 236 ~Mech