Direct pressure and asphyxiation damage do not interrupt DoAfters anymore (#5459)
This commit is contained in:
@@ -103,7 +103,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
goto default;
|
goto default;
|
||||||
|
|
||||||
// Deal damage and ignore resistances. Resistance to pressure damage should be done via pressure protection gear.
|
// Deal damage and ignore resistances. Resistance to pressure damage should be done via pressure protection gear.
|
||||||
_damageableSystem.TryChangeDamage(uid, barotrauma.Damage * Atmospherics.LowPressureDamage, true);
|
_damageableSystem.TryChangeDamage(uid, barotrauma.Damage * Atmospherics.LowPressureDamage, true, false);
|
||||||
|
|
||||||
if (status == null) break;
|
if (status == null) break;
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
var damageScale = MathF.Min((pressure / Atmospherics.HazardHighPressure) * Atmospherics.PressureDamageCoefficient, Atmospherics.MaxHighPressureDamage);
|
var damageScale = MathF.Min((pressure / Atmospherics.HazardHighPressure) * Atmospherics.PressureDamageCoefficient, Atmospherics.MaxHighPressureDamage);
|
||||||
|
|
||||||
// Deal damage and ignore resistances. Resistance to pressure damage should be done via pressure protection gear.
|
// Deal damage and ignore resistances. Resistance to pressure damage should be done via pressure protection gear.
|
||||||
_damageableSystem.TryChangeDamage(uid, barotrauma.Damage * damageScale, true);
|
_damageableSystem.TryChangeDamage(uid, barotrauma.Damage * damageScale, true, false);
|
||||||
|
|
||||||
if (status == null) break;
|
if (status == null) break;
|
||||||
|
|
||||||
|
|||||||
@@ -320,7 +320,7 @@ namespace Content.Server.Body.Components
|
|||||||
alertsComponent.ShowAlert(AlertType.LowOxygen);
|
alertsComponent.ShowAlert(AlertType.LowOxygen);
|
||||||
}
|
}
|
||||||
|
|
||||||
EntitySystem.Get<DamageableSystem>().TryChangeDamage(Owner.Uid, Damage, true);
|
EntitySystem.Get<DamageableSystem>().TryChangeDamage(Owner.Uid, Damage, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StopSuffocation()
|
private void StopSuffocation()
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace Content.Server.DoAfter
|
|||||||
|
|
||||||
public void HandleDamage(EntityUid _, DoAfterComponent component, DamageChangedEvent args)
|
public void HandleDamage(EntityUid _, DoAfterComponent component, DamageChangedEvent args)
|
||||||
{
|
{
|
||||||
if (component.DoAfters.Count == 0 || !args.DamageIncreased)
|
if (component.DoAfters.Count == 0 || !args.InterruptsDoAfters)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ namespace Content.Shared.Damage
|
|||||||
/// This updates cached damage information, flags the component as dirty, and raises a damage changed event.
|
/// This updates cached damage information, flags the component as dirty, and raises a damage changed event.
|
||||||
/// The damage changed event is used by other systems, such as damage thresholds.
|
/// The damage changed event is used by other systems, such as damage thresholds.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public void DamageChanged(DamageableComponent component, DamageSpecifier? damageDelta = null)
|
public void DamageChanged(DamageableComponent component, DamageSpecifier? damageDelta = null, bool interruptsDoAfters = true)
|
||||||
{
|
{
|
||||||
component.DamagePerGroup = component.Damage.GetDamagePerGroup();
|
component.DamagePerGroup = component.Damage.GetDamagePerGroup();
|
||||||
SetTotalDamage(component, component.Damage.Total);
|
SetTotalDamage(component, component.Damage.Total);
|
||||||
@@ -121,7 +121,7 @@ namespace Content.Shared.Damage
|
|||||||
|
|
||||||
if (EntityManager.TryGetComponent<SharedAppearanceComponent>(component.OwnerUid, out var appearance) && damageDelta != null)
|
if (EntityManager.TryGetComponent<SharedAppearanceComponent>(component.OwnerUid, out var appearance) && damageDelta != null)
|
||||||
appearance.SetData(DamageVisualizerKeys.DamageUpdateGroups, damageDelta.GetDamagePerGroup().Keys.ToList());
|
appearance.SetData(DamageVisualizerKeys.DamageUpdateGroups, damageDelta.GetDamagePerGroup().Keys.ToList());
|
||||||
RaiseLocalEvent(component.OwnerUid, new DamageChangedEvent(component, damageDelta), false);
|
RaiseLocalEvent(component.OwnerUid, new DamageChangedEvent(component, damageDelta, interruptsDoAfters), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -136,7 +136,7 @@ namespace Content.Shared.Damage
|
|||||||
/// Returns a <see cref="DamageSpecifier"/> with information about the actual damage changes. This will be
|
/// Returns a <see cref="DamageSpecifier"/> with information about the actual damage changes. This will be
|
||||||
/// null if the user had no applicable components that can take damage.
|
/// null if the user had no applicable components that can take damage.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public DamageSpecifier? TryChangeDamage(EntityUid uid, DamageSpecifier damage, bool ignoreResistances = false)
|
public DamageSpecifier? TryChangeDamage(EntityUid uid, DamageSpecifier damage, bool ignoreResistances = false, bool interruptsDoAfters = true)
|
||||||
{
|
{
|
||||||
if (!EntityManager.TryGetComponent<DamageableComponent>(uid, out var damageable))
|
if (!EntityManager.TryGetComponent<DamageableComponent>(uid, out var damageable))
|
||||||
{
|
{
|
||||||
@@ -185,7 +185,7 @@ namespace Content.Shared.Damage
|
|||||||
|
|
||||||
if (!delta.Empty)
|
if (!delta.Empty)
|
||||||
{
|
{
|
||||||
DamageChanged(damageable, delta);
|
DamageChanged(damageable, delta, interruptsDoAfters);
|
||||||
}
|
}
|
||||||
|
|
||||||
return delta;
|
return delta;
|
||||||
@@ -282,7 +282,14 @@ namespace Content.Shared.Damage
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly bool DamageIncreased = false;
|
public readonly bool DamageIncreased = false;
|
||||||
|
|
||||||
public DamageChangedEvent(DamageableComponent damageable, DamageSpecifier? damageDelta)
|
/// <summary>
|
||||||
|
/// Does this event interrupt DoAfters?
|
||||||
|
/// Note: As provided in the constructor, this *does not* account for DamageIncreased.
|
||||||
|
/// As written into the event, this *does* account for DamageIncreased.
|
||||||
|
/// </summary>
|
||||||
|
public readonly bool InterruptsDoAfters = false;
|
||||||
|
|
||||||
|
public DamageChangedEvent(DamageableComponent damageable, DamageSpecifier? damageDelta, bool interruptsDoAfters)
|
||||||
{
|
{
|
||||||
Damageable = damageable;
|
Damageable = damageable;
|
||||||
DamageDelta = damageDelta;
|
DamageDelta = damageDelta;
|
||||||
@@ -298,6 +305,7 @@ namespace Content.Shared.Damage
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
InterruptsDoAfters = interruptsDoAfters && DamageIncreased;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user