Replaces CLEAN_ON_MOVE_1 flag with cleaning component

CLEAN_ON_MOVE_1 is a flag checked on every atom movable's Moved() and
triggers a janiborg/upgraded janicart clean on the turf if present.

Replacing this with a component does the same thing and frees up a flag
slot.

Also fixes a bug where a spawned in "upgraded" janicart wouldn't
actually clean the floors.
This commit is contained in:
Jack Edge
2017-12-05 20:20:44 +00:00
parent 6f2e27f7ee
commit 04a4a7e76b
6 changed files with 45 additions and 36 deletions
+36
View File
@@ -0,0 +1,36 @@
/datum/component/cleaning
/datum/component/cleaning/Initialize()
RegisterSignal(list(COMSIG_MOVABLE_MOVED), .proc/Clean)
/datum/component/cleaning/proc/Clean()
var/atom/movable/AM = parent
if(!istype(AM))
return
var/turf/tile = AM.loc
if(isturf(tile))
tile.clean_blood()
for(var/A in tile)
if(is_cleanable(A))
qdel(A)
else if(istype(A, /obj/item))
var/obj/item/cleaned_item = A
cleaned_item.clean_blood()
else if(ishuman(A))
var/mob/living/carbon/human/cleaned_human = A
if(cleaned_human.lying)
if(cleaned_human.head)
cleaned_human.head.clean_blood()
cleaned_human.update_inv_head()
if(cleaned_human.wear_suit)
cleaned_human.wear_suit.clean_blood()
cleaned_human.update_inv_wear_suit()
else if(cleaned_human.w_uniform)
cleaned_human.w_uniform.clean_blood()
cleaned_human.update_inv_w_uniform()
if(cleaned_human.shoes)
cleaned_human.shoes.clean_blood()
cleaned_human.update_inv_shoes()
cleaned_human.clean_blood()
cleaned_human.wash_cream()
to_chat(cleaned_human, "<span class='danger'>[AM] cleans your face!</span>")