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
This commit is contained in:
SyncIt21
2024-01-02 01:28:34 +05:30
committed by GitHub
parent c7c8427324
commit 926d000d76
20 changed files with 38 additions and 48 deletions

View File

@@ -877,9 +877,6 @@ or shoot a gun to move around via Newton's 3rd Law of Motion."
time_left_overlay.maptext = MAPTEXT("<span style='color: [(timeleft <= 10 SECONDS) ? "red" : "white"]'><b>[CEILING(timeleft / (1 SECONDS), 1)]</b></span>")
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)
. = ..()

View File

@@ -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)
. = ..()

View File

@@ -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)

View File

@@ -2025,7 +2025,6 @@
if(prob(50))
radiate()
last_event = world.time
..()
/obj/machinery/door/airlock/uranium/proc/radiate()
radiation_pulse(

View File

@@ -152,7 +152,6 @@
. += span_warning("[recharging_text]")
/obj/machinery/drone_dispenser/process()
..()
if((machine_stat & (NOPOWER|BROKEN)) || !anchored)
return

View File

@@ -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)

View File

@@ -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()

View File

@@ -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))

View File

@@ -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

View File

@@ -232,7 +232,6 @@
metabolization_amount = REAGENTS_METABOLISM
/obj/item/food/bubblegum/bubblegum/process()
. = ..()
if(iscarbon(loc))
hallucinate(loc)

View File

@@ -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)

View File

@@ -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))

View File

@@ -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("<span class='infoplain'>[icon2html(src, hearers(src))] *beep* *beep* *beep*</span>")
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("<span class='infoplain'>[icon2html(src, hearers(src))] *beep* *beep* *beep*</span>")
playsound(src, 'sound/machines/triple_beep.ogg', ASSEMBLY_BEEP_VOLUME, TRUE)
toggle_scan()
/obj/item/assembly/health/proc/toggle_scan()
if(!secured)

View File

@@ -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))

View File

@@ -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

View File

@@ -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 = ""

View File

@@ -22,7 +22,6 @@
connect_to_network()
/obj/machinery/power/rtg/process()
..()
add_avail(power_gen)
/obj/machinery/power/rtg/RefreshParts()

View File

@@ -77,7 +77,6 @@
/obj/machinery/smoke_machine/process()
..()
if(reagents.total_volume == 0)
on = FALSE
update_appearance()

View File

@@ -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

View File

@@ -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)