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

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