Fix bola stam damage, bring back old construction requirements (#21340)

This commit is contained in:
Subversionary
2023-10-30 00:27:43 +02:00
committed by GitHub
parent 00523b5260
commit a6448cb87d
4 changed files with 28 additions and 7 deletions

View File

@@ -1,8 +1,9 @@
using System.Linq;
using Content.Server.Body.Systems;
using Content.Shared.Alert;
using Content.Shared.Body.Components;
using Content.Shared.Body.Part;
using Content.Shared.Damage.Components;
using Content.Shared.Damage.Systems;
using Content.Shared.DoAfter;
using Content.Shared.Ensnaring;
using Content.Shared.Ensnaring.Components;
@@ -17,6 +18,7 @@ public sealed partial class EnsnareableSystem
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
[Dependency] private readonly AlertsSystem _alerts = default!;
[Dependency] private readonly BodySystem _body = default!;
[Dependency] private readonly StaminaSystem _stamina = default!;
public void InitializeEnsnaring()
{
@@ -72,6 +74,15 @@ public sealed partial class EnsnareableSystem
if (freeLegs <= 0)
return;
// Apply stamina damage to target if they weren't ensnared before.
if (ensnareable.IsEnsnared != true)
{
if (TryComp<StaminaComponent>(target, out var stamina))
{
_stamina.TakeStaminaDamage(target, component.StaminaDamage, with: ensnare);
}
}
component.Ensnared = target;
ensnareable.Container.Insert(ensnare);
ensnareable.IsEnsnared = true;