Godmode refactor (#14651)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user