mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
Datums know what signals are being listened for and components can now be registered to listen for signals on more than one object.
40 lines
1.4 KiB
Plaintext
40 lines
1.4 KiB
Plaintext
/datum/component/cleaning
|
|
dupe_mode = COMPONENT_DUPE_UNIQUE_PASSARGS
|
|
|
|
/datum/component/cleaning/Initialize()
|
|
if(!ismovableatom(parent))
|
|
return COMPONENT_INCOMPATIBLE
|
|
RegisterSignal(parent, list(COMSIG_MOVABLE_MOVED), .proc/Clean)
|
|
|
|
/datum/component/cleaning/proc/Clean()
|
|
var/atom/movable/AM = parent
|
|
var/turf/tile = AM.loc
|
|
if(!isturf(tile))
|
|
return
|
|
|
|
SEND_SIGNAL(tile, COMSIG_COMPONENT_CLEAN_ACT, CLEAN_STRENGTH_BLOOD)
|
|
for(var/A in tile)
|
|
if(is_cleanable(A))
|
|
qdel(A)
|
|
else if(istype(A, /obj/item))
|
|
var/obj/item/I = A
|
|
SEND_SIGNAL(I, COMSIG_COMPONENT_CLEAN_ACT, CLEAN_STRENGTH_BLOOD)
|
|
if(ismob(I.loc))
|
|
var/mob/M = I.loc
|
|
M.regenerate_icons()
|
|
else if(ishuman(A))
|
|
var/mob/living/carbon/human/cleaned_human = A
|
|
if(cleaned_human.lying)
|
|
if(cleaned_human.head)
|
|
SEND_SIGNAL(cleaned_human.head, COMSIG_COMPONENT_CLEAN_ACT, CLEAN_STRENGTH_BLOOD)
|
|
if(cleaned_human.wear_suit)
|
|
SEND_SIGNAL(cleaned_human.wear_suit, COMSIG_COMPONENT_CLEAN_ACT, CLEAN_STRENGTH_BLOOD)
|
|
else if(cleaned_human.w_uniform)
|
|
SEND_SIGNAL(cleaned_human.w_uniform, COMSIG_COMPONENT_CLEAN_ACT, CLEAN_STRENGTH_BLOOD)
|
|
if(cleaned_human.shoes)
|
|
SEND_SIGNAL(cleaned_human.shoes, COMSIG_COMPONENT_CLEAN_ACT, CLEAN_STRENGTH_BLOOD)
|
|
SEND_SIGNAL(cleaned_human, COMSIG_COMPONENT_CLEAN_ACT, CLEAN_STRENGTH_BLOOD)
|
|
cleaned_human.wash_cream()
|
|
cleaned_human.regenerate_icons()
|
|
to_chat(cleaned_human, "<span class='danger'>[AM] cleans your face!</span>")
|