* Armor

* radiation tweaks

* asphyxiation ignore resistances
This commit is contained in:
mirrorcult
2021-10-18 16:24:37 -07:00
committed by GitHub
parent 47954e1565
commit 636a04eccd
13 changed files with 148 additions and 8 deletions

View File

@@ -118,13 +118,18 @@ namespace Content.Shared.Damage
}
// Apply resistances
if (!ignoreResistances && damageable.DamageModifierSetId != null)
if (!ignoreResistances)
{
if (_prototypeManager.TryIndex<DamageModifierSetPrototype>(damageable.DamageModifierSetId, out var modifierSet))
if (damageable.DamageModifierSetId != null &&
_prototypeManager.TryIndex<DamageModifierSetPrototype>(damageable.DamageModifierSetId, out var modifierSet))
{
damage = DamageSpecifier.ApplyModifierSet(damage, modifierSet);
}
var ev = new DamageModifyEvent(damage);
RaiseLocalEvent(uid, ev, false);
damage = ev.Damage;
if (damage.Empty)
{
return damage;
@@ -199,6 +204,23 @@ namespace Content.Shared.Damage
}
}
/// <summary>
/// Raised on an entity when damage is about to be dealt,
/// in case anything else needs to modify it other than the base
/// damageable component.
///
/// For example, armor.
/// </summary>
public class DamageModifyEvent : EntityEventArgs
{
public DamageSpecifier Damage;
public DamageModifyEvent(DamageSpecifier damage)
{
Damage = damage;
}
}
public class DamageChangedEvent : EntityEventArgs
{
/// <summary>