Armor (#4934)
* Armor * radiation tweaks * asphyxiation ignore resistances
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user