diff --git a/code/modules/client/preferences/species.dm b/code/modules/client/preferences/species.dm index 9e4923d2b11d..148c0a4c87d6 100644 --- a/code/modules/client/preferences/species.dm +++ b/code/modules/client/preferences/species.dm @@ -27,7 +27,8 @@ return values /datum/preference/choiced/species/apply_to_human(mob/living/carbon/human/target, value) - target.set_species(value, icon_update = FALSE, pref_load = TRUE) + if(target.dna?.species?.type != value) // don't set species if we're already that species!!! + target.set_species(value, icon_update = FALSE, pref_load = TRUE) /datum/preference/choiced/species/compile_constant_data() var/list/data = list() diff --git a/code/modules/mob/living/carbon/human/_species.dm b/code/modules/mob/living/carbon/human/_species.dm index be75d401e534..a82d77bdd44f 100644 --- a/code/modules/mob/living/carbon/human/_species.dm +++ b/code/modules/mob/living/carbon/human/_species.dm @@ -757,12 +757,12 @@ GLOBAL_LIST_EMPTY(features_by_species) if(mutant_bodyparts["ears"]) - if(!source.dna.features["ears"] || source.dna.features["ears"] == "None" || source.head && (source.head.flags_inv & HIDEHAIR) || (source.wear_mask && (source.wear_mask.flags_inv & HIDEHAIR)) || !noggin || !IS_ORGANIC_LIMB(noggin)) + if(!source.dna.features["ears"] || source.dna.features["ears"] == "None" || (source.head && (source.head.flags_inv & HIDEHAIR)) || (source.wear_mask && (source.wear_mask.flags_inv & HIDEHAIR)) || !noggin || !IS_ORGANIC_LIMB(noggin)) bodyparts_to_add -= "ears" // MONKESTATION ADDITION START - if(mutant_bodyparts["ipc_screen"]) - if(!source.dna.features["ipc_screen"] || source.dna.features["ipc_screen"] == "None" || source.head && (source.head.flags_inv & HIDEFACE) || (source.wear_mask && (source.head.flags_inv & HIDEFACE)) || !noggin) + if(mutant_bodyparts["ipc_screen"]) + if(!source.dna.features["ipc_screen"] || source.dna.features["ipc_screen"] == "None" || (source.head && (source.head.flags_inv & HIDEFACE)) || (source.wear_mask && (source.head.flags_inv & HIDEFACE)) || !noggin) bodyparts_to_add -= "ipc_screen" // MONKESTATION ADDITION END diff --git a/monkestation/code/datums/quirks/neutral_quirks/anime.dm b/monkestation/code/datums/quirks/neutral_quirks/anime.dm index 8bc582563d3f..6b408e84c6e5 100644 --- a/monkestation/code/datums/quirks/neutral_quirks/anime.dm +++ b/monkestation/code/datums/quirks/neutral_quirks/anime.dm @@ -2,7 +2,7 @@ name = "Anime" desc = "You are an anime enjoyer! Show your enthusiasm with some fashionable attire." value = 0 - quirk_flags = QUIRK_CHANGES_APPEARANCE | QUIRK_HIDE_FROM_SCAN + quirk_flags = QUIRK_HUMAN_ONLY | QUIRK_CHANGES_APPEARANCE | QUIRK_HIDE_FROM_SCAN mob_trait = TRAIT_ANIME icon = FA_ICON_PAW @@ -13,24 +13,32 @@ ) /datum/quirk/anime/add(client/client_source) + var/mob/living/carbon/human/quirk_holder = src.quirk_holder RegisterSignal(quirk_holder, COMSIG_SPECIES_GAIN_PRE, PROC_REF(on_species_gain)) - var/datum/species/species = quirk_holder.has_dna()?.species - if(species) - for(var/obj/item/organ/external/organ_path as anything in anime_list) - if (!should_external_organ_apply_to(organ_path, quirk_holder)) - continue - //Load a persons preferences from DNA - var/obj/item/organ/external/new_organ = SSwardrobe.provide_type(organ_path) - new_organ.Insert(quirk_holder, special = TRUE, drop_if_replaced = FALSE) - species.external_organs |= organ_path + var/datum/species/species = quirk_holder?.dna?.species + if(QDELETED(species)) + return + for(var/obj/item/organ/external/organ_path as anything in anime_list) + if (!should_external_organ_apply_to(organ_path, quirk_holder)) + continue + //Load a persons preferences from DNA + var/obj/item/organ/external/new_organ = SSwardrobe.provide_type(organ_path) + new_organ.Insert(quirk_holder, special = TRUE, drop_if_replaced = FALSE) + species.external_organs |= organ_path /datum/quirk/anime/remove() + var/mob/living/carbon/human/quirk_holder = src.quirk_holder UnregisterSignal(quirk_holder, COMSIG_SPECIES_GAIN_PRE) - var/datum/species/species = quirk_holder.has_dna()?.species - if(species) - for(var/obj/item/organ/external/organ_path as anything in anime_list) - species.external_organs -= organ_path + var/datum/species/species = quirk_holder?.dna?.species + if(QDELETED(species)) + return + for(var/obj/item/organ/external/organ_path as anything in anime_list) + species.external_organs -= organ_path + var/obj/item/organ/external/anime_organ = quirk_holder.get_organ_by_type(organ_path) + if(!QDELETED(anime_organ)) + anime_organ.Remove(quirk_holder, special = TRUE) + SSwardrobe.stash_object(anime_organ) /datum/quirk/anime/proc/on_species_gain(datum/source, datum/species/new_species, datum/species/old_species) for(var/obj/item/organ/external/organ_path as anything in anime_list) diff --git a/monkestation/code/modules/client/preferences/body.dm b/monkestation/code/modules/client/preferences/body.dm index fa46983e55c7..f5c8ea245b51 100644 --- a/monkestation/code/modules/client/preferences/body.dm +++ b/monkestation/code/modules/client/preferences/body.dm @@ -12,3 +12,4 @@ /datum/preference/choiced/body_height/apply_to_human(mob/living/carbon/human/target, value) target.dna.body_height = value + target.update_mob_height() diff --git a/monkestation/code/modules/client/preferences/species_features/ipc.dm b/monkestation/code/modules/client/preferences/species_features/ipc.dm index abf177cc3387..cf55b976a0aa 100644 --- a/monkestation/code/modules/client/preferences/species_features/ipc.dm +++ b/monkestation/code/modules/client/preferences/species_features/ipc.dm @@ -61,8 +61,13 @@ return values /datum/preference/choiced/ipc_chassis/apply_to_human(mob/living/carbon/human/target, value) - target.dna.features["ipc_chassis"] = value - target.regenerate_icons() + var/list/features = target.dna.features + if(features["ipc_chassis"] == value) + return + features["ipc_chassis"] = value + var/datum/species/ipc/ipc = target.dna?.species + if(istype(ipc)) // this is awful. i'm sorry. + ipc.update_chassis(target) /datum/preference/choiced/ipc_screen savefile_key = "feature_ipc_screen" diff --git a/monkestation/code/modules/loadouts/loadout_outfit_helper.dm b/monkestation/code/modules/loadouts/loadout_outfit_helper.dm index dba71dee25b3..e2d51a09f995 100644 --- a/monkestation/code/modules/loadouts/loadout_outfit_helper.dm +++ b/monkestation/code/modules/loadouts/loadout_outfit_helper.dm @@ -101,7 +101,7 @@ continue item.on_equip_item(preference_source, src, visuals_only) - regenerate_icons() + //regenerate_icons() return TRUE /* diff --git a/monkestation/code/modules/mob/living/carbon/human/species_type/ipc.dm b/monkestation/code/modules/mob/living/carbon/human/species_type/ipc.dm index 983056a6239a..aa006c32d655 100644 --- a/monkestation/code/modules/mob/living/carbon/human/species_type/ipc.dm +++ b/monkestation/code/modules/mob/living/carbon/human/species_type/ipc.dm @@ -160,12 +160,10 @@ addtimer(CALLBACK(src, PROC_REF(switch_to_screen), transformer, "Blank"), 5 SECONDS) -/datum/species/ipc/on_species_loss(mob/living/carbon/C) +/datum/species/ipc/on_species_loss(mob/living/carbon/target) . = ..() - UnregisterSignal(C, COMSIG_ATOM_EMAG_ACT) - if(change_screen) - change_screen.Remove(C) - UnregisterSignal(C, COMSIG_LIVING_DEATH) + UnregisterSignal(target, list(COMSIG_ATOM_EMAG_ACT, COMSIG_LIVING_DEATH)) + change_screen?.Remove(target) /datum/species/ipc/proc/handle_speech(datum/source, list/speech_args) speech_args[SPEECH_SPANS] |= SPAN_ROBOT //beep @@ -215,21 +213,31 @@ H.visible_message(span_notice("[H]'s [change_screen ? "monitor lights up" : "eyes flicker to life"]!"), span_notice("All systems nominal. You're back online!")) return -/datum/species/ipc/replace_body(mob/living/carbon/C, datum/species/new_species) - ..() +/datum/species/ipc/replace_body(mob/living/carbon/target, datum/species/new_species) + . = ..() + update_chassis(target) - var/datum/sprite_accessory/ipc_chassis/chassis_of_choice = GLOB.ipc_chassis_list[C.dna.features["ipc_chassis"]] +/datum/species/ipc/proc/update_chassis(mob/living/carbon/target) + if(!iscarbon(target) || QDELING(target)) + return + var/list/features = target.dna?.features + if(!features) + return + var/datum/sprite_accessory/ipc_chassis/chassis_of_choice = GLOB.ipc_chassis_list[features["ipc_chassis"]] if(!chassis_of_choice) - chassis_of_choice = GLOB.ipc_chassis_list[pick(GLOB.ipc_chassis_list)] - C.dna.features["ipc_chassis"] = pick(GLOB.ipc_chassis_list) - - for(var/obj/item/bodypart/BP as() in C.bodyparts) //Override bodypart data as necessary - BP.limb_id = chassis_of_choice.icon_state - BP.name = "\improper[chassis_of_choice.name] [parse_zone(BP.body_zone)]" - BP.update_limb() + var/random_chassis = pick(GLOB.ipc_chassis_list) + chassis_of_choice = GLOB.ipc_chassis_list[random_chassis] + features["ipc_chassis"] = random_chassis + + for(var/obj/item/bodypart/bodypart as anything in target.bodyparts) //Override bodypart data as necessary + if(QDELETED(bodypart)) + return + bodypart.limb_id = chassis_of_choice.icon_state + bodypart.name = "\improper[chassis_of_choice.name] [parse_zone(bodypart.body_zone)]" + bodypart.update_limb() if(chassis_of_choice.palette_key == MUTANT_COLOR) - BP.should_draw_greyscale = TRUE + bodypart.should_draw_greyscale = TRUE /datum/species/ipc/proc/on_emag_act(mob/living/carbon/human/owner, mob/user) SIGNAL_HANDLER