Blunt melee weapons now deal stamina damage (#9897)

This commit is contained in:
Level10Cybermancer
2022-08-07 19:38:04 -07:00
committed by GitHub
parent 189d49a51f
commit 0d9b3743cd
3 changed files with 16 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
using Content.Shared.Damage;
using Robust.Shared.Audio;
using Content.Shared.FixedPoint;
namespace Content.Server.Weapon.Melee.Components
{
@@ -52,5 +53,9 @@ namespace Content.Server.Weapon.Melee.Components
[DataField("damage", required:true)]
[ViewVariables(VVAccess.ReadWrite)]
public DamageSpecifier Damage = default!;
[DataField("bluntStaminaDamageFactor")]
[ViewVariables(VVAccess.ReadWrite)]
public FixedPoint2 BluntStaminaDamageFactor { get; set; } = 0.5f;
}
}

View File

@@ -5,6 +5,8 @@ using Content.Server.Body.Systems;
using Content.Server.Chemistry.Components;
using Content.Server.Chemistry.EntitySystems;
using Content.Server.Cooldown;
using Content.Server.Damage.Components;
using Content.Server.Damage.Systems;
using Content.Server.Weapon.Melee.Components;
using Content.Shared.Damage;
using Content.Shared.Audio;
@@ -28,6 +30,7 @@ namespace Content.Server.Weapon.Melee
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IPrototypeManager _protoManager = default!;
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
[Dependency] private readonly StaminaSystem _staminaSystem = default!;
[Dependency] private readonly SolutionContainerSystem _solutionsSystem = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly BloodstreamSystem _bloodstreamSystem = default!;
@@ -101,6 +104,13 @@ namespace Content.Server.Weapon.Melee
if (damageResult != null && damageResult.Total > FixedPoint2.Zero)
{
FixedPoint2 bluntDamage;
// If the target has stamina and is taking blunt damage, they should also take stamina damage based on their blunt to stamina factor
if (damageResult.DamageDict.TryGetValue("Blunt", out bluntDamage))
{
_staminaSystem.TakeStaminaDamage(target, (bluntDamage * comp.BluntStaminaDamageFactor).Float());
}
if (args.Used == args.User)
_adminLogger.Add(LogType.MeleeHit,
$"{ToPrettyString(args.User):user} melee attacked {ToPrettyString(args.Target.Value):target} using their hands and dealt {damageResult.Total:damage} damage");

View File

@@ -16,6 +16,7 @@
damage:
types:
Blunt: 5
bluntStaminaDamageFactor: 2.0
range: 1.5
arcwidth: 60
arc: default