From be8c5ac631781dbb40f724db80423847ccfeadc1 Mon Sep 17 00:00:00 2001 From: KorPhaeron Date: Tue, 24 Oct 2017 14:35:19 -0500 Subject: [PATCH 1/2] Dullahans (#31855) * Dullahans * Vision toggle * The worst part of the code right here * No wings * to_chat * Hearing relay that works, vision toggle that works * Fixes hair not appearing on severed heads * Halloween event * Moves dullahans to their own file * Forgot to commit a file * Fixes deafness and backpack issues * Don't need to breath because you dont have a head * Breaking the dullahan rules * Encourage dullahans to lose their heads * Cyberboss doing his job to head off any bad code trying to enter the repo * Committing while compiling again * Can't eat * Halloween! * qdeleted * Get rid of the head var entirely, just track the easily deletable relay * Moves the stuff out of process to destroy --- .../carbon/human/species_types/dullahan.dm | 144 ++++++++++++++++++ code/modules/surgery/bodyparts/head.dm | 32 ++-- tgstation.dme | 1 + 3 files changed, 160 insertions(+), 17 deletions(-) create mode 100644 code/modules/mob/living/carbon/human/species_types/dullahan.dm diff --git a/code/modules/mob/living/carbon/human/species_types/dullahan.dm b/code/modules/mob/living/carbon/human/species_types/dullahan.dm new file mode 100644 index 0000000000..eea5dd8709 --- /dev/null +++ b/code/modules/mob/living/carbon/human/species_types/dullahan.dm @@ -0,0 +1,144 @@ +/datum/species/dullahan + name = "dullahan" + id = "dullahan" + default_color = "FFFFFF" + species_traits = list(EYECOLOR,HAIR,FACEHAIR,LIPS,NOBREATH,NOHUNGER) + mutant_bodyparts = list("tail_human", "ears", "wings") + default_features = list("mcolor" = "FFF", "tail_human" = "None", "ears" = "None", "wings" = "None") + use_skintones = TRUE + mutant_brain = /obj/item/organ/brain/dullahan + mutanteyes = /obj/item/organ/eyes/dullahan + mutanttongue = /obj/item/organ/tongue/dullahan + mutantears = /obj/item/organ/ears/dullahan + blacklisted = TRUE + limbs_id = "human" + skinned_type = /obj/item/stack/sheet/animalhide/human + + var/obj/item/dullahan_relay/myhead + + +/datum/species/dullahan/check_roundstart_eligible() + if(SSevents.holidays && SSevents.holidays[HALLOWEEN]) + return TRUE + return FALSE + +/datum/species/dullahan/on_species_gain(mob/living/carbon/human/H, datum/species/old_species) + . = ..() + var/obj/item/bodypart/head/head = H.get_bodypart("head") + if(head) + head.drop_limb() + head.flags_1 = HEAR_1 + head.throwforce = 25 + myhead = new /obj/item/dullahan_relay (head, H) + +/datum/species/dullahan/on_species_loss(mob/living/carbon/human/H) + if(myhead) + var/obj/item/dullahan_relay/DR = myhead + myhead = null + DR.owner = null + qdel(DR) + ..() + +/datum/species/dullahan/spec_life(mob/living/carbon/human/H) + if(!QDELETED(myhead)) + update_vision_perspective(H) + + var/turf/Me = get_turf(H) + var/turf/Head = get_turf(myhead) + if(Me == Head || (Head in oview(7, Me))) + H.disabilities &= ~DEAF + else + H.disabilities |= DEAF + else + myhead = null + H.gib() + var/obj/item/bodypart/head/head2 = H.get_bodypart("head") + if(head2) + myhead = null + H.gib() + +/datum/species/dullahan/proc/update_vision_perspective(mob/living/carbon/human/H) + var/obj/item/organ/eyes/eyes = H.getorganslot(ORGAN_SLOT_EYES) + if(eyes) + H.update_tint() + if(eyes.tint) + H.reset_perspective(H) + else + H.reset_perspective(myhead) + +/obj/item/organ/brain/dullahan + decoy_override = TRUE + vital = FALSE + +/obj/item/organ/tongue/dullahan + zone = "abstract" + +/obj/item/organ/tongue/dullahan/TongueSpeech(var/message) + if(ishuman(owner)) + var/mob/living/carbon/human/H = owner + if(H.dna.species.id == "dullahan") + var/datum/species/dullahan/D = H.dna.species + if(isobj(D.myhead.loc)) + var/obj/O = D.myhead.loc + O.say(message) + message = "" + return message + +/obj/item/organ/ears/dullahan + zone = "abstract" + +/obj/item/organ/eyes/dullahan + name = "head vision" + desc = "An abstraction." + actions_types = list(/datum/action/item_action/organ_action/dullahan) + zone = "abstract" + +/datum/action/item_action/organ_action/dullahan/Trigger() + . = ..() + var/obj/item/organ/eyes/dullahan/DE = target + if(DE.tint) + DE.tint = 0 + else + DE.tint = INFINITY + + if(ishuman(owner)) + var/mob/living/carbon/human/H = owner + if(H.dna.species.id == "dullahan") + var/datum/species/dullahan/D = H.dna.species + D.update_vision_perspective(H) + +/obj/item/dullahan_relay + var/mob/living/owner + flags_1 = HEAR_1 + +/obj/item/dullahan_relay/Initialize(mapload,new_owner) + . = ..() + owner = new_owner + START_PROCESSING(SSobj, src) + +/obj/item/dullahan_relay/process() + if(!istype(loc, /obj/item/bodypart/head) || QDELETED(owner)) + . = PROCESS_KILL + qdel(src) + +/obj/item/dullahan_relay/Hear(message, atom/movable/speaker, message_language, raw_message, radio_freq, list/spans, message_mode) + if(!QDELETED(owner)) + var/turf/T = get_turf(speaker) + var/turf/owner_turf = get_turf(owner) + if(T == owner_turf || (T in oview(7, owner_turf))) //Do not relay things we can already hear + return + message = compose_message(speaker, message_language, raw_message, radio_freq, spans, message_mode) + to_chat(owner,message) + else + qdel(src) + + +/obj/item/dullahan_relay/Destroy() + if(!QDELETED(owner)) + var/mob/living/carbon/human/H = owner + if(H.dna.species.id == "dullahan") + var/datum/species/dullahan/D = H.dna.species + D.myhead = null + owner.gib() + owner = null + ..() \ No newline at end of file diff --git a/code/modules/surgery/bodyparts/head.dm b/code/modules/surgery/bodyparts/head.dm index c0b69e658c..a4d317ad2a 100644 --- a/code/modules/surgery/bodyparts/head.dm +++ b/code/modules/surgery/bodyparts/head.dm @@ -124,39 +124,37 @@ cut_overlays() . = ..() if(dropped) //certain overlays only appear when the limb is being detached from its owner. - var/datum/sprite_accessory/S if(status != BODYPART_ROBOTIC) //having a robotic head hides certain features. //facial hair if(facial_hair_style) - S = GLOB.facial_hair_styles_list[facial_hair_style] + var/datum/sprite_accessory/S = GLOB.facial_hair_styles_list[facial_hair_style] if(S) var/image/facial_overlay = image(S.icon, "[S.icon_state]", -HAIR_LAYER, SOUTH) facial_overlay.color = "#" + facial_hair_color facial_overlay.alpha = hair_alpha . += facial_overlay - var/image/hair_overlay = image(layer = -HAIR_LAYER, dir = SOUTH) - . += hair_overlay //Applies the debrained overlay if there is no brain if(!brain) + var/image/debrain_overlay = image(layer = -HAIR_LAYER, dir = SOUTH) if(animal_origin == ALIEN_BODYPART) - hair_overlay.icon = 'icons/mob/animal_parts.dmi' - hair_overlay.icon_state = "debrained_alien" + debrain_overlay.icon = 'icons/mob/animal_parts.dmi' + debrain_overlay.icon_state = "debrained_alien" else if(animal_origin == LARVA_BODYPART) - hair_overlay.icon = 'icons/mob/animal_parts.dmi' - hair_overlay.icon_state = "debrained_larva" + debrain_overlay.icon = 'icons/mob/animal_parts.dmi' + debrain_overlay.icon_state = "debrained_larva" else if(!(NOBLOOD in species_flags_list)) - hair_overlay.icon = 'icons/mob/human_face.dmi' - hair_overlay.icon_state = "debrained" + debrain_overlay.icon = 'icons/mob/human_face.dmi' + debrain_overlay.icon_state = "debrained" + . += debrain_overlay else - if(hair_style) - S = GLOB.hair_styles_list[hair_style] - if(S) - hair_overlay.icon = icon - hair_overlay.icon_state = "[S.icon_state]" - hair_overlay.color = "#" + hair_color - hair_overlay.alpha = hair_alpha + var/datum/sprite_accessory/S2 = GLOB.hair_styles_list[hair_style] + if(S2) + var/image/hair_overlay = image(S2.icon, "[S2.icon_state]", -HAIR_LAYER, SOUTH) + hair_overlay.color = "#" + hair_color + hair_overlay.alpha = hair_alpha + . += hair_overlay // lipstick diff --git a/tgstation.dme b/tgstation.dme index d6eea16986..6d3ba7c7cb 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -1720,6 +1720,7 @@ #include "code\modules\mob\living\carbon\human\species_types\android.dm" #include "code\modules\mob\living\carbon\human\species_types\angel.dm" #include "code\modules\mob\living\carbon\human\species_types\corporate.dm" +#include "code\modules\mob\living\carbon\human\species_types\dullahan.dm" #include "code\modules\mob\living\carbon\human\species_types\flypeople.dm" #include "code\modules\mob\living\carbon\human\species_types\furrypeople.dm" #include "code\modules\mob\living\carbon\human\species_types\golems.dm"