From 926d000d76d27f7d68e3e23a35e778e69665ea3f Mon Sep 17 00:00:00 2001
From: SyncIt21 <110812394+SyncIt21@users.noreply.github.com>
Date: Tue, 2 Jan 2024 01:28:34 +0530
Subject: [PATCH] Some Processing improvements (#80693)
## About The Pull Request
Got the idea from #80682. A lot of parent procs don't do anything, some
are just formatted in a bad way, and others early return and do no ops,
it's bad in general but this should give us a head start.
Some good overhead saved here
---
code/_onclick/hud/alert.dm | 3 --
.../fields/projectile_dampener.dm | 1 -
code/game/machinery/camera/motion.dm | 3 +-
code/game/machinery/doors/airlock.dm | 1 -
code/game/machinery/droneDispenser.dm | 1 -
code/game/machinery/sleepers.dm | 1 -
.../items/devices/scanners/t_scanner.dm | 3 +-
code/game/objects/items/dualsaber.dm | 2 +-
code/game/objects/items/flamethrower.dm | 3 +-
code/game/objects/items/food/sweets.dm | 1 -
.../pirate/pirate_shuttle_equipment.dm | 23 +++++++-------
.../antagonists/wizard/equipment/artefact.dm | 1 +
code/modules/assembly/health.dm | 31 +++++++++++--------
.../modules/mining/lavaland/megafauna_loot.dm | 1 -
.../file_system/programs/radar.dm | 4 +--
code/modules/power/generator.dm | 1 -
code/modules/power/rtg.dm | 1 -
.../chemistry/machinery/smoke_machine.dm | 1 -
.../xenobiology/crossbreeding/stabilized.dm | 2 +-
code/modules/station_goals/meteor_shield.dm | 2 +-
20 files changed, 38 insertions(+), 48 deletions(-)
diff --git a/code/_onclick/hud/alert.dm b/code/_onclick/hud/alert.dm
index be94d82e516..e73cebf14c0 100644
--- a/code/_onclick/hud/alert.dm
+++ b/code/_onclick/hud/alert.dm
@@ -877,9 +877,6 @@ or shoot a gun to move around via Newton's 3rd Law of Motion."
time_left_overlay.maptext = MAPTEXT("[CEILING(timeleft / (1 SECONDS), 1)]")
time_left_overlay.transform = time_left_overlay.transform.Translate(4, 19)
add_overlay(time_left_overlay)
- if(isnull(poll))
- return
- ..()
/atom/movable/screen/alert/poll_alert/Click(location, control, params)
. = ..()
diff --git a/code/datums/proximity_monitor/fields/projectile_dampener.dm b/code/datums/proximity_monitor/fields/projectile_dampener.dm
index 7f625d64524..705ac6bface 100644
--- a/code/datums/proximity_monitor/fields/projectile_dampener.dm
+++ b/code/datums/proximity_monitor/fields/projectile_dampener.dm
@@ -35,7 +35,6 @@
for(var/obj/projectile/projectile in tracked)
if(!(projectile in ranged) || !projectile.loc)
release_projectile(projectile)
- ..()
/datum/proximity_monitor/advanced/projectile_dampener/setup_edge_turf(turf/target)
. = ..()
diff --git a/code/game/machinery/camera/motion.dm b/code/game/machinery/camera/motion.dm
index f73a786865c..ec01c2365f8 100644
--- a/code/game/machinery/camera/motion.dm
+++ b/code/game/machinery/camera/motion.dm
@@ -8,8 +8,7 @@
/obj/machinery/camera/process()
// motion camera event loop
if(!isMotion())
- . = PROCESS_KILL
- return
+ return PROCESS_KILL
if(machine_stat & EMPED)
return
if (detectTime > 0)
diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm
index 8608a00f074..9ef0f95966c 100644
--- a/code/game/machinery/doors/airlock.dm
+++ b/code/game/machinery/doors/airlock.dm
@@ -2025,7 +2025,6 @@
if(prob(50))
radiate()
last_event = world.time
- ..()
/obj/machinery/door/airlock/uranium/proc/radiate()
radiation_pulse(
diff --git a/code/game/machinery/droneDispenser.dm b/code/game/machinery/droneDispenser.dm
index 802608e47a5..1d428e7547e 100644
--- a/code/game/machinery/droneDispenser.dm
+++ b/code/game/machinery/droneDispenser.dm
@@ -152,7 +152,6 @@
. += span_warning("[recharging_text]")
/obj/machinery/drone_dispenser/process()
- ..()
if((machine_stat & (NOPOWER|BROKEN)) || !anchored)
return
diff --git a/code/game/machinery/sleepers.dm b/code/game/machinery/sleepers.dm
index 42a6c0d1948..daa474029f6 100644
--- a/code/game/machinery/sleepers.dm
+++ b/code/game/machinery/sleepers.dm
@@ -178,7 +178,6 @@
. += span_notice("Alt-click [src] to [state_open ? "close" : "open"] it.")
/obj/machinery/sleeper/process()
- ..()
use_power(idle_power_usage)
/obj/machinery/sleeper/nap_violation(mob/violator)
diff --git a/code/game/objects/items/devices/scanners/t_scanner.dm b/code/game/objects/items/devices/scanners/t_scanner.dm
index b034c954811..c9f1ae0fd9d 100644
--- a/code/game/objects/items/devices/scanners/t_scanner.dm
+++ b/code/game/objects/items/devices/scanners/t_scanner.dm
@@ -35,8 +35,7 @@
/obj/item/t_scanner/process()
if(!on)
- STOP_PROCESSING(SSobj, src)
- return null
+ return PROCESS_KILL
scan()
/obj/item/t_scanner/proc/scan()
diff --git a/code/game/objects/items/dualsaber.dm b/code/game/objects/items/dualsaber.dm
index 8eed258f0da..19cd7e96da8 100644
--- a/code/game/objects/items/dualsaber.dm
+++ b/code/game/objects/items/dualsaber.dm
@@ -172,7 +172,7 @@
set_light_color(pick(COLOR_SOFT_RED, LIGHT_COLOR_GREEN, LIGHT_COLOR_LIGHT_CYAN, LIGHT_COLOR_LAVENDER))
open_flame()
else
- STOP_PROCESSING(SSobj, src)
+ return PROCESS_KILL
/obj/item/dualsaber/IsReflect()
if(HAS_TRAIT(src, TRAIT_WIELDED) && prob(block_chance))
diff --git a/code/game/objects/items/flamethrower.dm b/code/game/objects/items/flamethrower.dm
index 35f76ab89a1..b7896c64381 100644
--- a/code/game/objects/items/flamethrower.dm
+++ b/code/game/objects/items/flamethrower.dm
@@ -52,8 +52,7 @@
/obj/item/flamethrower/process()
if(!lit || !igniter)
- STOP_PROCESSING(SSobj, src)
- return null
+ return PROCESS_KILL
var/turf/location = loc
if(ismob(location))
var/mob/M = location
diff --git a/code/game/objects/items/food/sweets.dm b/code/game/objects/items/food/sweets.dm
index 98f9417811a..5c638077d16 100644
--- a/code/game/objects/items/food/sweets.dm
+++ b/code/game/objects/items/food/sweets.dm
@@ -232,7 +232,6 @@
metabolization_amount = REAGENTS_METABOLISM
/obj/item/food/bubblegum/bubblegum/process()
- . = ..()
if(iscarbon(loc))
hallucinate(loc)
diff --git a/code/modules/antagonists/pirate/pirate_shuttle_equipment.dm b/code/modules/antagonists/pirate/pirate_shuttle_equipment.dm
index 3696b4ba976..84f3a151dd2 100644
--- a/code/modules/antagonists/pirate/pirate_shuttle_equipment.dm
+++ b/code/modules/antagonists/pirate/pirate_shuttle_equipment.dm
@@ -18,18 +18,17 @@
update_appearance()
/obj/machinery/shuttle_scrambler/process()
- if(active)
- if(is_station_level(z))
- var/datum/bank_account/account = SSeconomy.get_dep_account(ACCOUNT_CAR)
- if(account)
- var/siphoned = min(account.account_balance,siphon_per_tick)
- account.adjust_money(-siphoned)
- credits_stored += siphoned
- interrupt_research()
- else
- return
- else
- STOP_PROCESSING(SSobj,src)
+ if(!active)
+ return PROCESS_KILL
+
+ if(!is_station_level(z))
+ return
+
+ var/datum/bank_account/account = SSeconomy.get_dep_account(ACCOUNT_CAR)
+ var/siphoned = min(account.account_balance,siphon_per_tick)
+ account.adjust_money(-siphoned)
+ credits_stored += siphoned
+ interrupt_research()
///Turns on the siphoning, and its various side effects
/obj/machinery/shuttle_scrambler/proc/toggle_on(mob/user)
diff --git a/code/modules/antagonists/wizard/equipment/artefact.dm b/code/modules/antagonists/wizard/equipment/artefact.dm
index 4783daffb8b..44d00f3c170 100644
--- a/code/modules/antagonists/wizard/equipment/artefact.dm
+++ b/code/modules/antagonists/wizard/equipment/artefact.dm
@@ -60,6 +60,7 @@
spawn_amt_left--
if(spawn_amt_left <= 0)
qdel(src)
+ return PROCESS_KILL
/obj/effect/rend/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/nullrod))
diff --git a/code/modules/assembly/health.dm b/code/modules/assembly/health.dm
index e4518155153..6bb12f327ea 100644
--- a/code/modules/assembly/health.dm
+++ b/code/modules/assembly/health.dm
@@ -46,25 +46,30 @@
to_chat(user, span_notice("You toggle [src] to \"detect critical state\" mode."))
/obj/item/assembly/health/process()
+ //not ready yet
if(!scanning || !secured)
return
- var/atom/A = src
+ //look for a mob in either our location or in the connected holder
+ var/atom/object = src
if(connected?.holder)
- A = connected.holder
- for(A, A && !ismob(A), A=A.loc);
- // like get_turf(), but for mobs.
- var/mob/living/M = A
+ object = connected.holder
+ while(!ismob(object))
+ object = object.loc
+ if(isnull(object)) //we went too far
+ return
- if(M)
- health_scan = M.health
- if(health_scan <= alarm_health)
- pulse()
- audible_message("[icon2html(src, hearers(src))] *beep* *beep* *beep*")
- playsound(src, 'sound/machines/triple_beep.ogg', ASSEMBLY_BEEP_VOLUME, TRUE)
- toggle_scan()
+ //only do the pulse if we are within alarm thresholds
+ var/mob/living/target_mob = object
+ health_scan = target_mob.health
+ if(health_scan > alarm_health)
return
- return
+
+ //do the pulse & the scan
+ pulse()
+ audible_message("[icon2html(src, hearers(src))] *beep* *beep* *beep*")
+ playsound(src, 'sound/machines/triple_beep.ogg', ASSEMBLY_BEEP_VOLUME, TRUE)
+ toggle_scan()
/obj/item/assembly/health/proc/toggle_scan()
if(!secured)
diff --git a/code/modules/mining/lavaland/megafauna_loot.dm b/code/modules/mining/lavaland/megafauna_loot.dm
index e63d26634dc..45c62ebd0a0 100644
--- a/code/modules/mining/lavaland/megafauna_loot.dm
+++ b/code/modules/mining/lavaland/megafauna_loot.dm
@@ -285,7 +285,6 @@
AddElement(/datum/element/gags_recolorable)
/obj/item/clothing/suit/hooded/hostile_environment/process(seconds_per_tick)
- . = ..()
var/mob/living/carbon/wearer = loc
if(istype(wearer) && SPT_PROB(1, seconds_per_tick)) //cursed by bubblegum
if(prob(7.5))
diff --git a/code/modules/modular_computers/file_system/programs/radar.dm b/code/modules/modular_computers/file_system/programs/radar.dm
index 59647db7dce..5e32a212bac 100644
--- a/code/modules/modular_computers/file_system/programs/radar.dm
+++ b/code/modules/modular_computers/file_system/programs/radar.dm
@@ -173,8 +173,8 @@
//We use SSfastprocess for the program icon state because it runs faster than process_tick() does.
/datum/computer_file/program/radar/process()
if(computer.active_program != src)
- STOP_PROCESSING(SSfastprocess, src) //We're not the active program, it's time to stop.
- return
+ //We're not the active program, it's time to stop.
+ return PROCESS_KILL
if(!selected)
return
diff --git a/code/modules/power/generator.dm b/code/modules/power/generator.dm
index 6fa17d8dbe9..d86b178ea0c 100644
--- a/code/modules/power/generator.dm
+++ b/code/modules/power/generator.dm
@@ -96,7 +96,6 @@
add_avail(power_output)
lastgenlev = power_output
lastgen -= power_output
- ..()
/obj/machinery/power/generator/proc/get_menu(include_link = TRUE)
var/t = ""
diff --git a/code/modules/power/rtg.dm b/code/modules/power/rtg.dm
index af48e9c5944..f79eb808a87 100644
--- a/code/modules/power/rtg.dm
+++ b/code/modules/power/rtg.dm
@@ -22,7 +22,6 @@
connect_to_network()
/obj/machinery/power/rtg/process()
- ..()
add_avail(power_gen)
/obj/machinery/power/rtg/RefreshParts()
diff --git a/code/modules/reagents/chemistry/machinery/smoke_machine.dm b/code/modules/reagents/chemistry/machinery/smoke_machine.dm
index 272ff5bd687..a8d1765891b 100644
--- a/code/modules/reagents/chemistry/machinery/smoke_machine.dm
+++ b/code/modules/reagents/chemistry/machinery/smoke_machine.dm
@@ -77,7 +77,6 @@
/obj/machinery/smoke_machine/process()
- ..()
if(reagents.total_volume == 0)
on = FALSE
update_appearance()
diff --git a/code/modules/research/xenobiology/crossbreeding/stabilized.dm b/code/modules/research/xenobiology/crossbreeding/stabilized.dm
index eb49f5dc2c3..ad5750de9ff 100644
--- a/code/modules/research/xenobiology/crossbreeding/stabilized.dm
+++ b/code/modules/research/xenobiology/crossbreeding/stabilized.dm
@@ -53,7 +53,7 @@ Stabilized extracts:
if (holder.has_status_effect(effectpath))
return
holder.apply_status_effect(effectpath, src)
- STOP_PROCESSING(SSobj,src)
+ return PROCESS_KILL
//Colors and subtypes:
/obj/item/slimecross/stabilized/grey
diff --git a/code/modules/station_goals/meteor_shield.dm b/code/modules/station_goals/meteor_shield.dm
index 7b16606013b..3b87ef74578 100644
--- a/code/modules/station_goals/meteor_shield.dm
+++ b/code/modules/station_goals/meteor_shield.dm
@@ -89,7 +89,7 @@
/obj/machinery/satellite/meteor_shield/process()
if(obj_flags & EMAGGED)
//kills the processing because emagged meteor shields no longer stop meteors in any way
- return ..()
+ return PROCESS_KILL
if(!active)
return
for(var/obj/effect/meteor/meteor_to_destroy in GLOB.meteor_list)