diff --git a/code/datums/components/dullahan.dm b/code/datums/components/dullahan.dm index dfe7acd767..94733636c7 100644 --- a/code/datums/components/dullahan.dm +++ b/code/datums/components/dullahan.dm @@ -18,10 +18,6 @@ dullahan_head.owner = H RegisterSignal(H, COMSIG_LIVING_REGENERATE_LIMBS, .proc/unlist_head) - //SPLURT edit - RegisterSignal(dullahan_head, COMSIG_MOUSEDROPPED_ONTO, .proc/on_mouse_dropped) - RegisterSignal(dullahan_head, COMSIG_MOUSEDROP_ONTO, .proc/on_mouse_drop) - // // make sure the brain can't decay or fall out var/obj/item/organ/brain/B = H.getorganslot(ORGAN_SLOT_BRAIN) @@ -92,7 +88,7 @@ desc = "An abstraction." actions_types = list(/datum/action/item_action/organ_action/dullahan) zone = "abstract" - //tint = INFINITY // used to switch the vision perspective to the head on species_gain(). //SPLURT edit + tint = INFINITY // used to switch the vision perspective to the head on species_gain(). organ_flags = ORGAN_NO_SPOIL | ORGAN_NO_DISMEMBERMENT /obj/item/dullahan_head @@ -118,7 +114,7 @@ cut_overlays() /obj/item/dullahan_head/proc/add_head_overlay(var/overlay) - overlays_standing += overlay + LAZYADD(overlays_standing, overlay) //SPLURT edit add_overlay(overlay) /obj/item/dullahan_head/update_appearance() @@ -155,24 +151,6 @@ name = "Toggle Perspective" desc = "Switch between seeing normally from your head, or blindly from your body." -//SPLURT edit -/datum/action/item_action/organ_action/dullahan/proc/toggle_monochromacy() - var/obj/item/organ/eyes/eyes = owner.getorganslot(ORGAN_SLOT_EYES) - - if(eyes.monochromacy_on) - owner.remove_client_colour(/datum/client_colour/monochrome) - else - owner.add_client_colour(/datum/client_colour/monochrome) - - eyes.monochromacy_on = !eyes.monochromacy_on - -/obj/item/organ/eyes - var/monochromacy_on = FALSE - -/datum/action/item_action/organ_action/dullahan/Grant(mob/M) - . = ..() - toggle_monochromacy() -// /datum/action/item_action/organ_action/dullahan/Trigger() . = ..() var/mob/living/carbon/human/H = owner diff --git a/modular_splurt/code/datums/components/dullahan.dm b/modular_splurt/code/datums/components/dullahan.dm index 0ab97c306a..6fae1b981d 100644 --- a/modular_splurt/code/datums/components/dullahan.dm +++ b/modular_splurt/code/datums/components/dullahan.dm @@ -1,30 +1,15 @@ -/* -* Add new worn icons to modular_splurt/icons/mob/clothing/current_head_accessories.dmi and their type to this list -* with the same icon_state from it's respective item -* "welding" if the item gives flash protection -* "none" if it's a normal item -* (subtypes included) -*/ -#define HEAD_ACCESSORIES_LIST list(\ - /obj/item/clothing/head/welding = "welding",\ - /obj/item/clothing/glasses/welding = "welding",\ - /obj/item/clothing/head/beret = "none",\ - /obj/item/clothing/head/caphat = "none",\ - /obj/item/clothing/head/hopcap = "none",\ - /obj/item/clothing/head/fedora = "none",\ - /obj/item/clothing/head/centhat = "none",\ - /obj/item/clothing/head/pirate/captain,\ - /obj/item/clothing/head/chefhat = "none",\ - /obj/item/reagent_containers/glass/bucket = "none",\ - /obj/item/reagent_containers/rag/towel = "none",\ - /obj/item/paper = "none",\ - /obj/item/clothing/head/cowboyhat = "none",\ - /obj/item/clothing/head/morningstar = "none",\ - /obj/item/nullrod/fedora = "none",\ - /obj/item/clothing/head/maid = "none",\ - /obj/item/clothing/head/crown = "none"\ +#define HEAD_ACCESSORIES_PATHS list(\ + /obj/item/clothing/head = 'icons/mob/clothing/head.dmi',\ + /obj/item/clothing/glasses = 'icons/mob/clothing/eyes.dmi',\ + /obj/item/reagent_containers/glass/bucket = 'icons/mob/clothing/head.dmi',\ + /obj/item/reagent_containers/rag/towel = 'icons/mob/clothing/head.dmi',\ + /obj/item/paper = 'icons/mob/clothing/head.dmi',\ + /obj/item/nullrod/fedora = 'icons/mob/clothing/head.dmi',\ ) +/obj/item/organ/eyes/dullahan + tint = 0 + /datum/component/neckfire var/mutable_appearance/neck_fire @@ -104,8 +89,13 @@ var/obj/item/clothing/head_accessory var/mutable_appearance/head_accessory_MA -/datum/component/dullahan/proc/add_head_accessory(obj/item/clothing/I) - head_accessory_MA = mutable_appearance('modular_splurt/icons/mob/clothing/current_head_accessories.dmi') +/datum/component/dullahan/Initialize() + . = ..() + RegisterSignal(dullahan_head, COMSIG_MOUSEDROPPED_ONTO, .proc/on_mouse_dropped) + RegisterSignal(dullahan_head, COMSIG_MOUSEDROP_ONTO, .proc/on_mouse_drop) + +/datum/component/dullahan/proc/add_head_accessory(obj/item/clothing/I, item_path) + head_accessory_MA = mutable_appearance(I.mob_overlay_icon || HEAD_ACCESSORIES_PATHS[item_path]) head_accessory_MA.icon_state = I.icon_state I.forceMove(dullahan_head) @@ -118,16 +108,23 @@ /datum/component/dullahan/proc/on_mouse_dropped(datum/source, obj/item/I, mob/living/user) var/mob/living/carbon/owner = dullahan_head.owner + var/item_path - if(istype(I, /obj/item) && !head_accessory) - if(I.type in HEAD_ACCESSORIES_LIST) - if(HEAD_ACCESSORIES_LIST[I.type] == "welding") - var/obj/item/organ/eyes/dullahan/DE = owner.getorganslot(ORGAN_SLOT_EYES) - DE.flash_protect = 2 - DE.tint = 2 - owner.update_tint() + for(var/type in HEAD_ACCESSORIES_PATHS) + if(istype(I, type)) + item_path = type + break - add_head_accessory(I) + if(item_path && !head_accessory) + if(istype(I, /obj/item/clothing)) + var/obj/item/organ/eyes/dullahan/eyes = owner.getorganslot(ORGAN_SLOT_EYES) + var/obj/item/clothing/clothing = I + + eyes.flash_protect = clothing.flash_protect + eyes.tint = clothing.tint + owner.update_tint() + + add_head_accessory(I, item_path) else to_chat(user, span_notice("You can't put \the [I.name] on the head of \the [owner.name]")) return @@ -145,12 +142,26 @@ else return - for(var/accessory in HEAD_ACCESSORIES_LIST) - if(istype(head_accessory, accessory)) - if(HEAD_ACCESSORIES_LIST[accessory] == "welding") - var/obj/item/organ/eyes/dullahan/DE = owner.getorganslot(ORGAN_SLOT_EYES) - DE.flash_protect = 0 - DE.tint = 0 - owner.update_tint() + var/obj/item/organ/eyes/dullahan/eyes = owner.getorganslot(ORGAN_SLOT_EYES) + eyes.flash_protect = 0 + eyes.tint = 0 + owner.update_tint() - remove_head_accessory(head_accessory) + remove_head_accessory(head_accessory) + +/datum/action/item_action/organ_action/dullahan/proc/toggle_monochromacy() + var/obj/item/organ/eyes/eyes = owner.getorganslot(ORGAN_SLOT_EYES) + + if(eyes.monochromacy_on) + owner.remove_client_colour(/datum/client_colour/monochrome) + else + owner.add_client_colour(/datum/client_colour/monochrome) + + eyes.monochromacy_on = !eyes.monochromacy_on + +/obj/item/organ/eyes + var/monochromacy_on = FALSE + +/datum/action/item_action/organ_action/dullahan/Grant(mob/M) + . = ..() + toggle_monochromacy()