mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-21 21:17:44 +01:00
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:
@@ -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,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>")
|
||||
@@ -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)
|
||||
|
||||
@@ -991,9 +991,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
|
||||
|
||||
|
||||
@@ -47,7 +47,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 ..()
|
||||
@@ -70,3 +70,7 @@
|
||||
|
||||
/obj/vehicle/ridden/janicart/upgraded
|
||||
floorbuffer = TRUE
|
||||
|
||||
/obj/vehicle/ridden/janicart/upgraded/Initialize(mapload)
|
||||
. = ..()
|
||||
AddComponent(/datum/component/cleaning)
|
||||
|
||||
@@ -308,6 +308,7 @@
|
||||
#include "code\datums\components\archaeology.dm"
|
||||
#include "code\datums\components\caltrop.dm"
|
||||
#include "code\datums\components\chasm.dm"
|
||||
#include "code\datums\components\cleaning.dm"
|
||||
#include "code\datums\components\decal.dm"
|
||||
#include "code\datums\components\infective.dm"
|
||||
#include "code\datums\components\jousting.dm"
|
||||
|
||||
Reference in New Issue
Block a user