Merge pull request #33306 from coiax/replace-clean-flag-with-component
Replaces CLEAN_ON_MOVE_1 flag with cleaning component
This commit is contained in:
committed by
CitadelStationBot
parent
94e02ddeed
commit
af1f13e114
@@ -22,7 +22,7 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204
|
||||
#define ON_BORDER_1 512 // item has priority to check when entering or leaving
|
||||
|
||||
#define NOSLIP_1 1024 //prevents from slipping on wet floors, in space etc
|
||||
#define CLEAN_ON_MOVE_1 2048
|
||||
#define _UNUSED_1 2048
|
||||
|
||||
// BLOCK_GAS_SMOKE_EFFECT_1 only used in masks at the moment.
|
||||
#define BLOCK_GAS_SMOKE_EFFECT_1 4096 // blocks the effect that chemical clouds would have on a mob --glasses, mask and helmets ONLY!
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/datum/component/cleaning
|
||||
dupe_mode = COMPONENT_DUPE_UNIQUE_PASSARGS
|
||||
|
||||
/datum/component/cleaning/Initialize()
|
||||
if(!ismovableatom(parent))
|
||||
. = COMPONENT_INCOMPATIBLE
|
||||
CRASH("[type] added to a [parent.type]")
|
||||
RegisterSignal(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
|
||||
|
||||
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>")
|
||||
@@ -132,44 +132,12 @@
|
||||
if (orbiting)
|
||||
orbiting.Check()
|
||||
|
||||
if(flags_1 & CLEAN_ON_MOVE_1)
|
||||
clean_on_move()
|
||||
|
||||
var/datum/proximity_monitor/proximity_monitor = src.proximity_monitor
|
||||
if(proximity_monitor)
|
||||
proximity_monitor.HandleMove()
|
||||
|
||||
return 1
|
||||
|
||||
/atom/movable/proc/clean_on_move()
|
||||
var/turf/tile = 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'>[src] cleans your face!</span>")
|
||||
|
||||
/atom/movable/Destroy(force)
|
||||
var/inform_admins = (flags_2 & INFORM_ADMINS_ON_RELOCATE_2)
|
||||
var/stationloving = (flags_2 & STATIONLOVING_2)
|
||||
|
||||
@@ -1029,9 +1029,9 @@
|
||||
status_flags &= ~CANPUSH
|
||||
|
||||
if(module.clean_on_move)
|
||||
flags_1 |= CLEAN_ON_MOVE_1
|
||||
AddComponent(/datum/component/cleaning)
|
||||
else
|
||||
flags_1 &= ~CLEAN_ON_MOVE_1
|
||||
qdel(GetComponent(/datum/component/cleaning))
|
||||
|
||||
hat_offset = module.hat_offset
|
||||
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
var/datum/component/riding/D = LoadComponent(/datum/component/riding)
|
||||
D.set_riding_offsets(RIDING_OFFSET_ALL, list(TEXT_NORTH = list(0, 4), TEXT_SOUTH = list(0, 7), TEXT_EAST = list(-12, 7), TEXT_WEST = list( 12, 7)))
|
||||
|
||||
if(floorbuffer)
|
||||
AddComponent(/datum/component/cleaning)
|
||||
|
||||
/obj/vehicle/ridden/janicart/Destroy()
|
||||
if(mybag)
|
||||
qdel(mybag)
|
||||
@@ -47,7 +50,7 @@
|
||||
floorbuffer = TRUE
|
||||
qdel(I)
|
||||
to_chat(user, "<span class='notice'>You upgrade [src] with the floor buffer.</span>")
|
||||
flags_1 |= CLEAN_ON_MOVE_1
|
||||
AddComponent(/datum/component/cleaning)
|
||||
update_icon()
|
||||
else
|
||||
return ..()
|
||||
|
||||
Reference in New Issue
Block a user