Fixes a bug w/ frankenstein limbs and Excises mob icobase/deform so the organs handle it.

Fixes a bug w/ the first commit where frankenstein limbs got converted to the owner's appearance (icobase/deform) if the owner HAS_ICON_SKIN_TONE.
This commit is contained in:
KasparoVy
2017-02-14 20:55:37 -05:00
parent 6b50f16a12
commit 87aa937d8d
8 changed files with 49 additions and 28 deletions
@@ -1515,8 +1515,6 @@
if(oldspecies.default_genes.len)
oldspecies.handle_dna(src,1) // Remove any genes that belong to the old species
icobase = species.icobase
deform = species.deform
tail = species.tail
if(vessel)
@@ -2055,6 +2053,10 @@
return .
/mob/living/carbon/human/proc/change_icobase(var/new_icobase, var/new_deform, var/owner_sensitive)
for(var/obj/item/organ/external/O in organs)
O.change_organ_icobase(new_icobase, new_deform, owner_sensitive) //Change the icobase/deform of all our organs. If owner_sensitive is set, that means the proc won't mess with frankenstein limbs.
/mob/living/carbon/human/serialize()
// Currently: Limbs/organs only
var/list/data = ..()
@@ -72,6 +72,4 @@ var/global/default_martial_art = new/datum/martial_art
var/fire_sprite = "Standing"
var/datum/body_accessory/body_accessory = null
var/icobase = 'icons/mob/human_races/r_human.dmi' // Normal icon set.
var/deform = 'icons/mob/human_races/r_def_human.dmi' // Mutated icon set.
var/tail // Name of tail image in species effects icon file.
var/tail // Name of tail image in species effects icon file.
@@ -360,34 +360,35 @@
//H.verbs += /mob/living/carbon/human/proc/leap
..()
/datum/species/vox/updatespeciescolor(var/mob/living/carbon/human/H) //Handling species-specific skin-tones for the Vox race.
/datum/species/vox/updatespeciescolor(var/mob/living/carbon/human/H, var/owner_sensitive = 1) //Handling species-specific skin-tones for the Vox race.
if(H.species.name == "Vox") //Making sure we don't break Armalis.
var/new_icobase = 'icons/mob/human_races/vox/r_vox.dmi' //Default Green Vox.
var/new_deform = 'icons/mob/human_races/vox/r_def_vox.dmi' //Default Green Vox.
switch(H.s_tone)
if(6) //Azure Vox.
H.icobase = 'icons/mob/human_races/vox/r_voxazu.dmi'
H.deform = 'icons/mob/human_races/vox/r_def_voxazu.dmi'
new_icobase = 'icons/mob/human_races/vox/r_voxazu.dmi'
new_deform = 'icons/mob/human_races/vox/r_def_voxazu.dmi'
H.tail = "voxtail_azu"
if(5) //Emerald Vox.
H.icobase = 'icons/mob/human_races/vox/r_voxemrl.dmi'
H.deform = 'icons/mob/human_races/vox/r_def_voxemrl.dmi'
new_icobase = 'icons/mob/human_races/vox/r_voxemrl.dmi'
new_deform = 'icons/mob/human_races/vox/r_def_voxemrl.dmi'
H.tail = "voxtail_emrl"
if(4) //Grey Vox.
H.icobase = 'icons/mob/human_races/vox/r_voxgry.dmi'
H.deform = 'icons/mob/human_races/vox/r_def_voxgry.dmi'
new_icobase = 'icons/mob/human_races/vox/r_voxgry.dmi'
new_deform = 'icons/mob/human_races/vox/r_def_voxgry.dmi'
H.tail = "voxtail_gry"
if(3) //Brown Vox.
H.icobase = 'icons/mob/human_races/vox/r_voxbrn.dmi'
H.deform = 'icons/mob/human_races/vox/r_def_voxbrn.dmi'
new_icobase = 'icons/mob/human_races/vox/r_voxbrn.dmi'
new_deform = 'icons/mob/human_races/vox/r_def_voxbrn.dmi'
H.tail = "voxtail_brn"
if(2) //Dark Green Vox.
H.icobase = 'icons/mob/human_races/vox/r_voxdgrn.dmi'
H.deform = 'icons/mob/human_races/vox/r_def_voxdgrn.dmi'
new_icobase = 'icons/mob/human_races/vox/r_voxdgrn.dmi'
new_deform = 'icons/mob/human_races/vox/r_def_voxdgrn.dmi'
H.tail = "voxtail_dgrn"
else //Default Green Vox.
H.icobase = 'icons/mob/human_races/vox/r_vox.dmi'
H.deform = 'icons/mob/human_races/vox/r_def_vox.dmi'
H.tail = "voxtail" //Ensures they get an appropriately coloured tail depending on the skin-tone.
H.change_icobase(new_icobase, new_deform, owner_sensitive) //Update the icobase/deform of all our organs, but make sure we don't mess with frankenstein limbs in doing so.
H.update_dna()
/datum/species/vox/armalis/handle_post_spawn(var/mob/living/carbon/human/H)
@@ -298,9 +298,9 @@ var/global/list/damage_icon_parts = list()
base_icon.MapColors(rgb(tone[1],0,0),rgb(0,tone[2],0),rgb(0,0,tone[3]))
//Handle husk overlay.
if(husk && ("overlay_husk" in icon_states(icobase)))
if(husk && ("overlay_husk" in icon_states(chest.icobase)))
var/icon/mask = new(base_icon)
var/icon/husk_over = new(icobase,"overlay_husk")
var/icon/husk_over = new(chest.icobase,"overlay_husk")
mask.MapColors(0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,0)
husk_over.Blend(mask, ICON_ADD)
base_icon.Blend(husk_over, ICON_OVERLAY)
@@ -241,8 +241,9 @@
var/mob/living/carbon/human/H = new
H.species = current_species
H.s_tone = s_tone
H.species.updatespeciescolor(H)
icobase = H.icobase ? H.icobase : H.species.icobase
H.species.updatespeciescolor(H, 0) //The mob's species wasn't set, so it's almost certainly different than the character's species at the moment. Thus, we need to be owner-insensitive.
var/obj/item/organ/external/chest/C = H.get_organ("chest")
icobase = C.icobase ? C.icobase : C.species.icobase
if(H.species.bodyflags & HAS_TAIL)
coloured_tail = H.tail ? H.tail : H.species.tail
@@ -18,6 +18,9 @@
var/model
var/force_icon
var/icobase = 'icons/mob/human_races/r_human.dmi' // Normal icon set.
var/deform = 'icons/mob/human_races/r_def_human.dmi' // Mutated icon set.
var/damage_state = "00"
var/brute_dam = 0
var/burn_dam = 0
@@ -127,9 +130,12 @@
/obj/item/organ/external/New(var/mob/living/carbon/holder)
..()
if(istype(holder, /mob/living/carbon/human))
replaced(holder)
sync_colour_to_human(holder)
var/mob/living/carbon/human/H = holder
icobase = species.icobase
deform = species.deform
if(istype(H))
replaced(H)
sync_colour_to_human(H)
spawn(1)
get_icon()
+15 -2
View File
@@ -14,6 +14,16 @@ var/global/list/limb_icon_cache = list()
overlays += organ.mob_icon
child_icons += organ.mob_icon
/obj/item/organ/external/proc/change_organ_icobase(var/new_icobase, var/new_deform, var/owner_sensitive) //Change the icobase/deform of this organ. If owner_sensitive is set, that means the proc won't mess with frankenstein limbs.
if(owner_sensitive) //This and the below statements mean that the icobase/deform will only get updated if the limb is the same species as and is owned by the mob it's attached to.
if(species && owner.species && species.name != owner.species.name)
return
if(dna.unique_enzymes != owner.dna.unique_enzymes) // This isn't MY arm
return
icobase = new_icobase ? new_icobase : icobase
deform = new_deform ? new_deform : deform
/obj/item/organ/external/proc/sync_colour_to_human(var/mob/living/carbon/human/H)
if(status & ORGAN_ROBOT && !(species && species.name == "Machine")) //machine people get skin color
return
@@ -29,6 +39,9 @@ var/global/list/limb_icon_cache = list()
if(H.species.bodyflags & HAS_SKIN_COLOR)
s_tone = null
s_col = list(H.r_skin, H.g_skin, H.b_skin)
if(H.species.bodyflags & HAS_ICON_SKIN_TONE)
var/obj/item/organ/external/chest/C = H.get_organ("chest")
change_organ_icobase(C.icobase, C.deform)
/obj/item/organ/external/proc/sync_colour_to_dna()
if(status & ORGAN_ROBOT)
@@ -171,10 +184,10 @@ var/global/list/limb_icon_cache = list()
icon_file = 'icons/mob/human_races/robotic.dmi'
else
if(status & ORGAN_MUTATED)
icon_file = owner ? owner.deform : species.deform
icon_file = deform
else
// Congratulations, you are normal
icon_file = owner ? owner.icobase : species.icobase
icon_file = icobase
return list(icon_file, new_icon_state)
/obj/item/organ/external/chest/get_icon_state(skeletal)