Godmode refactor (#14651)

This commit is contained in:
Kara
2023-03-23 11:57:15 -07:00
committed by GitHub
parent 31320a9e9a
commit 48cefca4e4
6 changed files with 114 additions and 64 deletions

View File

@@ -159,6 +159,12 @@ namespace Content.Shared.Damage
return damage;
}
var before = new BeforeDamageChangedEvent(damage);
RaiseLocalEvent(uid.Value, ref before);
if (before.Cancelled)
return null;
// Apply resistances
if (!ignoreResistances)
{
@@ -283,6 +289,12 @@ namespace Content.Shared.Damage
}
}
/// <summary>
/// Raised before damage is done, so stuff can cancel it if necessary.
/// </summary>
[ByRefEvent]
public record struct BeforeDamageChangedEvent(DamageSpecifier Delta, bool Cancelled=false);
/// <summary>
/// Raised on an entity when damage is about to be dealt,
/// in case anything else needs to modify it other than the base