This commit is contained in:
WoolyAypa
2023-02-07 22:21:21 -03:00
parent 524525c5f5
commit 8ebd985f4b
2 changed files with 56 additions and 67 deletions
@@ -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()