Unfuck shields by not making them process a huge list constantly. (#21428)

Ship shields currently occupy something like 40% of every machinery
process ticks. Basically generators make a fuckhuge list of all
generated shields (1.5k in the Horizon's case) and then they iterate
over this list every tick strengthening the shields.

The idea in this PR is to shunt shield logic to an abstract datum.
Fields no longer store strength individually; they store damage taken.
They only process once they take damage, they reduce that damage by the
field gain tick value every tick, and then they stop processing when
they no longer need to. Shield strengthening is shunted off to a signal,
so we only need to traverse the big ass list once every round probably.

---------

Co-authored-by: Matt Atlas <liermattia@gmail.com>
This commit is contained in:
Matt Atlas
2025-10-07 12:34:20 +00:00
committed by GitHub
co-authored by Matt Atlas
parent 8ce0b27e04
commit 1af71a7c45
13 changed files with 262 additions and 202 deletions
@@ -439,7 +439,7 @@ ABSTRACT_TYPE(/mob/living/simple_animal/hostile)
found_obj = locate(/obj/effect/energy_field) in target_turf
if(found_obj && !found_obj.invisibility && found_obj.density)
var/obj/effect/energy_field/e = found_obj
e.Stress(rand(0.5, 1.5))
e.damage_field(rand(0.5, 1.5))
visible_message(SPAN_DANGER("[capitalize_first_letters(src.name)] [attacktext] \the [e]!"))
src.do_attack_animation(e)
set_last_found_target(e)
@@ -91,7 +91,7 @@
return
if(istype(last_found_target, /obj/effect/energy_field))
var/obj/effect/energy_field/e = last_found_target
e.Stress(rand(1,2))
e.damage_field(rand(1,2))
visible_message(SPAN_DANGER("\the [src] bites \the [e]!"))
src.do_attack_animation(e)
return e