Melee refactor (#10897)
Co-authored-by: metalgearsloth <metalgearsloth@gmail.com>
This commit is contained in:
@@ -7,10 +7,4 @@ public sealed class StaminaDamageOnHitComponent : Component
|
||||
{
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("damage")]
|
||||
public float Damage = 30f;
|
||||
|
||||
/// <summary>
|
||||
/// Play a sound when this knocks down an entity.
|
||||
/// </summary>
|
||||
[DataField("knockdownSound")]
|
||||
public SoundSpecifier? KnockdownSound;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using Content.Server.Damage.Components;
|
||||
using Content.Server.Damage.Events;
|
||||
using Content.Server.Popups;
|
||||
using Content.Server.Weapon.Melee;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.CombatMode;
|
||||
using Content.Server.Weapons.Melee.Events;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Rounding;
|
||||
using Content.Shared.Stunnable;
|
||||
@@ -123,7 +123,7 @@ public sealed class StaminaSystem : EntitySystem
|
||||
foreach (var comp in toHit)
|
||||
{
|
||||
var oldDamage = comp.StaminaDamage;
|
||||
TakeStaminaDamage(comp.Owner, damage / toHit.Count, comp, component.KnockdownSound);
|
||||
TakeStaminaDamage(comp.Owner, damage / toHit.Count, comp);
|
||||
if (comp.StaminaDamage.Equals(oldDamage))
|
||||
{
|
||||
_popup.PopupEntity(Loc.GetString("stamina-resist"), comp.Owner, Filter.Entities(args.User));
|
||||
@@ -150,7 +150,7 @@ public sealed class StaminaSystem : EntitySystem
|
||||
_alerts.ShowAlert(uid, AlertType.Stamina, (short) severity);
|
||||
}
|
||||
|
||||
public void TakeStaminaDamage(EntityUid uid, float value, StaminaComponent? component = null, SoundSpecifier? knockdownSound = null)
|
||||
public void TakeStaminaDamage(EntityUid uid, float value, StaminaComponent? component = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component, false) || component.Critical) return;
|
||||
|
||||
@@ -181,8 +181,6 @@ public sealed class StaminaSystem : EntitySystem
|
||||
{
|
||||
if (component.StaminaDamage >= component.CritThreshold)
|
||||
{
|
||||
if (knockdownSound != null)
|
||||
SoundSystem.Play(knockdownSound.GetSound(), Filter.Pvs(uid, entityManager: EntityManager), uid, knockdownSound.Params);
|
||||
EnterStamCrit(uid, component);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user