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:
committed by
GitHub
parent
cf66dd7b35
commit
cdbe92d37d
@@ -1,13 +1,10 @@
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Explosion.Components;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Damage.Components;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Explosion;
|
||||
using Content.Shared.Explosion.Components;
|
||||
using Content.Shared.Explosion.EntitySystems;
|
||||
using Content.Shared.Maps;
|
||||
using Content.Shared.Physics;
|
||||
using Content.Shared.Projectiles;
|
||||
@@ -17,7 +14,6 @@ using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Physics.Dynamics;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -439,28 +435,25 @@ public sealed partial class ExplosionSystem
|
||||
float? fireStacksOnIgnite,
|
||||
EntityUid? cause)
|
||||
{
|
||||
if (originalDamage != null)
|
||||
if (originalDamage is not null)
|
||||
{
|
||||
GetEntitiesToDamage(uid, originalDamage, id);
|
||||
foreach (var (entity, damage) in _toDamage)
|
||||
{
|
||||
if (_actorQuery.HasComp(entity))
|
||||
{
|
||||
// Log damage to player entities only, cause this will create a massive amount of log spam otherwise.
|
||||
if (cause != null)
|
||||
{
|
||||
_adminLogger.Add(LogType.ExplosionHit, LogImpact.Medium, $"Explosion of {ToPrettyString(cause):actor} dealt {damage.GetTotal()} damage to {ToPrettyString(entity):subject}");
|
||||
}
|
||||
else
|
||||
{
|
||||
_adminLogger.Add(LogType.ExplosionHit, LogImpact.Medium, $"Explosion at {epicenter:epicenter} dealt {damage.GetTotal()} damage to {ToPrettyString(entity):subject}");
|
||||
}
|
||||
|
||||
}
|
||||
if (!_damageableQuery.TryComp(entity, out var damageable))
|
||||
continue;
|
||||
|
||||
// TODO EXPLOSIONS turn explosions into entities, and pass the the entity in as the damage origin.
|
||||
_damageableSystem.TryChangeDamage(entity, damage, ignoreResistances: true, ignoreGlobalModifiers: true);
|
||||
_damageableSystem.TryChangeDamage((entity, damageable), damage, ignoreResistances: true, ignoreGlobalModifiers: true);
|
||||
|
||||
if (_actorQuery.HasComp(entity))
|
||||
{
|
||||
// Log damage to player entities only; this will create a massive amount of log spam otherwise.
|
||||
if (cause is not null)
|
||||
_adminLogger.Add(LogType.ExplosionHit, LogImpact.Medium, $"Explosion of {ToPrettyString(cause):actor} dealt {damage.GetTotal()} damage to {ToPrettyString(entity):subject}");
|
||||
else
|
||||
_adminLogger.Add(LogType.ExplosionHit, LogImpact.Medium, $"Explosion at {epicenter:epicenter} dealt {damage.GetTotal()} damage to {ToPrettyString(entity):subject}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -666,7 +659,7 @@ sealed class Explosion
|
||||
private readonly IEntityManager _entMan;
|
||||
private readonly ExplosionSystem _system;
|
||||
private readonly SharedMapSystem _mapSystem;
|
||||
private readonly DamageableSystem _damageable;
|
||||
private readonly Shared.Damage.Systems.DamageableSystem _damageable;
|
||||
|
||||
public readonly EntityUid VisualEnt;
|
||||
|
||||
@@ -690,7 +683,7 @@ sealed class Explosion
|
||||
EntityUid visualEnt,
|
||||
EntityUid? cause,
|
||||
SharedMapSystem mapSystem,
|
||||
DamageableSystem damageable)
|
||||
Shared.Damage.Systems.DamageableSystem damageable)
|
||||
{
|
||||
VisualEnt = visualEnt;
|
||||
Cause = cause;
|
||||
|
||||
Reference in New Issue
Block a user