Update DamageableSystem to modern standards (#39417)

* Update DamageableSystem to modern standards

* DamageContainerId -> DamageContainerID with lint flag

* Replace strings with protoids

* Make CVar subscription declarations all consistently whitespaced

* ChangeDamage -> TryChangeDamage, cope with C# jank

* Revert event signature changes

* Restore a comment

* Re-add two queries

* Init the queries

* Use appearanceQuery in DamageChanged

* Use damageableQuery in TryChangeDamage

* Use damageableQuery in SetDamageModifierSetId

* Final cleanup, fix sandboxing

* Rectify ExplosionSystem:::ProcessEntity's call to TryChangeDamage

* Re-organize DamageableSystem

* first big fuck you breaking change.

* THATS A LOT OF DAMAGE!!!

* Fix test fails

* test fixes 2

* push it

---------

Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
This commit is contained in:
Hannah Giovanna Dawson
2025-10-27 19:53:04 +00:00
committed by GitHub
parent cf66dd7b35
commit cdbe92d37d
157 changed files with 1127 additions and 967 deletions

View File

@@ -1,4 +1,3 @@
using System.Linq;
using Content.Shared.NPC.Prototypes;
using Content.Server.Actions;
using Content.Server.Body.Systems;
@@ -11,7 +10,7 @@ using Content.Shared.Armor;
using Content.Shared.Bed.Sleep;
using Content.Shared.Cloning.Events;
using Content.Shared.Chat;
using Content.Shared.Damage;
using Content.Shared.Damage.Systems;
using Content.Shared.Humanoid;
using Content.Shared.Inventory;
using Content.Shared.Mind;
@@ -118,7 +117,7 @@ namespace Content.Server.Zombies
var curTime = _timing.CurTime;
// Hurt the living infected
var query = EntityQueryEnumerator<PendingZombieComponent, DamageableComponent, MobStateComponent>();
var query = EntityQueryEnumerator<PendingZombieComponent, Shared.Damage.Components.DamageableComponent, MobStateComponent>();
while (query.MoveNext(out var uid, out var comp, out var damage, out var mobState))
{
// Process only once per second
@@ -138,11 +137,11 @@ namespace Content.Server.Zombies
? comp.CritDamageMultiplier
: 1f;
_damageable.TryChangeDamage(uid, comp.Damage * multiplier, true, false, damage);
_damageable.ChangeDamage((uid, damage), comp.Damage * multiplier, true, false);
}
// Heal the zombified
var zombQuery = EntityQueryEnumerator<ZombieComponent, DamageableComponent, MobStateComponent>();
var zombQuery = EntityQueryEnumerator<ZombieComponent, Shared.Damage.Components.DamageableComponent, MobStateComponent>();
while (zombQuery.MoveNext(out var uid, out var comp, out var damage, out var mobState))
{
// Process only once per second
@@ -159,7 +158,7 @@ namespace Content.Server.Zombies
: 1f;
// Gradual healing for living zombies.
_damageable.TryChangeDamage(uid, comp.PassiveHealing * multiplier, true, false, damage);
_damageable.ChangeDamage((uid, damage), comp.PassiveHealing * multiplier, true, false);
}
}