Audits wash/cleaning signals + refactors wash() to ensure no needless mob updates occur (#91259)

## About The Pull Request

This has the potential to create a lot of needless mob updates which is
not great. Now should only update a mob's clothing if it was actually
washed.

This PR

1) ensures that all wash() procs return a bitflag.
2) ensures that `wash()` proccalls which result in expensive operations
like icon updates only do so when it is necessary

## Why It's Good For The Game

Updating mob sprites is expensive, and doing it when nothing has been
changed is bad.

## Changelog

Nothing really player facing
This commit is contained in:
Bloop
2025-06-05 20:05:19 -04:00
committed by Roxy
parent e7dd5fada9
commit c906b85d30
48 changed files with 156 additions and 79 deletions
@@ -249,21 +249,24 @@
/obj/item/gun_control/CanItemAutoclick()
return TRUE
/obj/item/gun_control/attack_atom(obj/O, mob/living/user, list/modifiers, list/attack_modifiers)
/obj/item/gun_control/attack_atom(obj/attacked_obj, mob/living/user, list/modifiers, list/attack_modifiers)
user.changeNext_move(CLICK_CD_MELEE)
O.attacked_by(src, user, modifiers)
attacked_obj.attacked_by(src, user, modifiers)
/obj/item/gun_control/attack(mob/living/M, mob/living/user, list/modifiers, list/attack_modifiers)
M.lastattacker = user.real_name
M.lastattackerckey = user.ckey
M.attacked_by(src, user, modifiers)
/obj/item/gun_control/attack(mob/living/target_mob, mob/living/user, list/modifiers, list/attack_modifiers)
target_mob.lastattacker = user.real_name
target_mob.lastattackerckey = user.ckey
target_mob.attacked_by(src, user, modifiers)
add_fingerprint(user)
/obj/item/gun_control/ranged_interact_with_atom(atom/interacting_with, mob/living/user, list/modifiers)
var/obj/machinery/deployable_turret/E = user.buckled
E.calculated_projectile_vars = calculate_projectile_angle_and_pixel_offsets(user, interacting_with, modifiers)
E.direction_track(user, interacting_with)
E.checkfire(interacting_with, user)
var/obj/machinery/deployable_turret/buckled_turret = user.buckled
if(!istype(buckled_turret))
return NONE
buckled_turret.calculated_projectile_vars = calculate_projectile_angle_and_pixel_offsets(user, interacting_with, modifiers)
buckled_turret.direction_track(user, interacting_with)
buckled_turret.checkfire(interacting_with, user)
return ITEM_INTERACT_SUCCESS
/obj/item/gun_control/interact_with_atom(atom/interacting_with, mob/living/user, list/modifiers)
return ranged_interact_with_atom(interacting_with, user, modifiers)
@@ -143,12 +143,12 @@
///What layer we set it to
var/target_layer = DUCT_LAYER_DEFAULT
/obj/item/plunger/attack_atom(obj/O, mob/living/user, list/modifiers, list/attack_modifiers)
/obj/item/plunger/attack_atom(obj/attacked_obj, mob/living/user, list/modifiers, list/attack_modifiers)
if(layer_mode)
SEND_SIGNAL(O, COMSIG_MOVABLE_CHANGE_DUCT_LAYER, O, target_layer)
SEND_SIGNAL(attacked_obj, COMSIG_MOVABLE_CHANGE_DUCT_LAYER, attacked_obj, target_layer)
return ..()
else
if(!O.plunger_act(src, user, reinforced))
if(!attacked_obj.plunger_act(src, user, reinforced))
return ..()
/obj/item/plunger/throw_impact(atom/hit_atom, datum/thrownthing/tt)
+7
View File
@@ -136,6 +136,13 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/shower, (-16))
to_chat(user, span_notice("The water temperature seems to be [current_temperature]."))
return TRUE
/obj/machinery/shower/plunger_act(obj/item/plunger/attacking_plunger, mob/living/user, reinforced)
user.balloon_alert_to_viewers("furiously plunging...", "plunging shower...")
if(do_after(user, 3 SECONDS, target = src))
user.balloon_alert_to_viewers("finished plunging")
reagents.expose(get_turf(src), TOUCH) //splash on the floor
reagents.clear_reagents()
/obj/machinery/shower/attackby(obj/item/tool, mob/user, list/modifiers, list/attack_modifiers)
if(istype(tool, /obj/item/stock_parts/water_recycler))
if(has_water_reclaimer)
+7 -3
View File
@@ -375,13 +375,17 @@
. = ..()
if(!(clean_types & CLEAN_SCRUB))
return
set_opacity(initial(opacity))
remove_atom_colour(WASHABLE_COLOUR_PRIORITY)
var/initial_opacity = initial(opacity)
if(opacity != initial_opacity)
set_opacity(initial_opacity)
. |= COMPONENT_CLEANED|COMPONENT_CLEANED_GAIN_XP
for(var/atom/movable/cleanables as anything in src)
if(cleanables == src)
continue
if(!cleanables.wash(clean_types))
var/cleanable_washed = cleanables.wash(clean_types)
if(!cleanable_washed)
continue
. |= cleanable_washed
vis_contents -= cleanables
/obj/structure/window/Destroy()