Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions Content.Server/Stunnable/Components/StunOnCollideComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,25 @@ public sealed partial class StunOnCollideComponent : Component
// Begin DeltaV Additions
[DataField]
public EntityWhitelist? Blacklist;

/// <summary>
/// Use the protection threshold
/// </summary>
[DataField]
public bool UseProtectionThreshold;

/// <summary>
/// Stuns if the target has ranged stun protection below the threshold, does stamina damage if above
/// </summary>
[DataField]
public short ProtectionThreshold = 45;

/// <summary>
/// The stamina damage dealt if the target has enough protection to avoid the stun
/// </summary>
[DataField]
public float StaminaDamage = 30;

// End DeltaV Additions
}

25 changes: 23 additions & 2 deletions Content.Server/Stunnable/Systems/StunOnCollideSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
using JetBrains.Annotations;
using Content.Shared.Throwing;
using Robust.Shared.Physics.Events;
using Content.Shared.Whitelist; // DeltaV
// Begin DeltaV
using Content.Shared.Whitelist;
using Content.Shared.Damage.Events;
using Content.Shared.Damage.Systems;
// End DeltaV

namespace Content.Server.Stunnable.Systems;

Expand All @@ -12,7 +16,11 @@ internal sealed class StunOnCollideSystem : EntitySystem
{
[Dependency] private readonly StunSystem _stunSystem = default!;
[Dependency] private readonly MovementModStatusSystem _movementMod = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelist = default!; // DeltaV

// Begin DeltaV
[Dependency] private readonly EntityWhitelistSystem _whitelist = default!;
[Dependency] private readonly SharedStaminaSystem _sharedStaminaSystem = default!;
// End DeltaV

public override void Initialize()
{
Expand All @@ -27,6 +35,19 @@ private void TryDoCollideStun(Entity<StunOnCollideComponent> ent, EntityUid targ
// Begin DeltaV Additions
if (!_whitelist.IsWhitelistFailOrNull(ent.Comp.Blacklist, target))
return;

// If the target is heavily protected, just deal stamina damage, no knockdown etc.
if (ent.Comp.UseProtectionThreshold)
{
var beforeStaminaDamageEvent = new BeforeStaminaDamageEvent(100f, FromMelee: false);
RaiseLocalEvent(target, ref beforeStaminaDamageEvent);

if (beforeStaminaDamageEvent.Value < ent.Comp.ProtectionThreshold)
{
_sharedStaminaSystem.TakeStaminaDamage(target, ent.Comp.StaminaDamage);
return;
}
}
// End DeltaV Additions

_stunSystem.TryKnockdown(target, ent.Comp.KnockdownAmount, ent.Comp.Refresh, ent.Comp.AutoStand, ent.Comp.Drop, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,9 @@
walkSpeedModifier: 0.5
sprintSpeedModifier: 0.5
# Begin DeltaV Additions
useProtectionThreshold: true
protectionThreshold: 45
staminaDamage: 30
blacklist:
tags:
- TaserImmune
Expand Down
Loading