Crawling Fixes Part 5: Holy Fuck (#39109)

Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
This commit is contained in:
Princess Cheeseballs
2025-07-21 02:08:04 -07:00
committed by GitHub
parent a69fe53bee
commit 8f7e6096f2
3 changed files with 0 additions and 113 deletions

View File

@@ -1,4 +1,3 @@
using Content.Shared.Damage;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
@@ -33,24 +32,6 @@ public sealed partial class HandcuffComponent : Component
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float StunBonus = 2f;
/// <summary>
/// Modifier for the amount of time it takes an entity to stand up if cuffed.
/// </summary>
[DataField]
public float StandupMod = 5f;
/// <summary>
/// Modifier to the speed of an entity who is cuffed, does not stack with KnockedMovementMod
/// </summary>
[DataField]
public float MovementMod = 1f;
/// <summary>
/// Modifier to the knocked down speed of an entity who is cuffed
/// </summary>
[DataField]
public float KnockedMovementMod = 0.4f;
/// <summary>
/// Will the cuffs break when removed?
/// </summary>

View File

@@ -21,7 +21,6 @@ using Content.Shared.Inventory.VirtualItem;
using Content.Shared.Item;
using Content.Shared.Movement.Events;
using Content.Shared.Movement.Pulling.Events;
using Content.Shared.Movement.Systems;
using Content.Shared.Popups;
using Content.Shared.Pulling.Events;
using Content.Shared.Rejuvenate;
@@ -46,7 +45,6 @@ namespace Content.Shared.Cuffs
[Dependency] private readonly ISharedAdminLogManager _adminLog = default!;
[Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
[Dependency] private readonly AlertsSystem _alerts = default!;
[Dependency] private readonly MovementSpeedModifierSystem _move = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedContainerSystem _container = default!;
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
@@ -58,14 +56,10 @@ namespace Content.Shared.Cuffs
[Dependency] private readonly UseDelaySystem _delay = default!;
[Dependency] private readonly SharedCombatModeSystem _combatMode = default!;
private EntityQuery<HandcuffComponent> _cuffQuery;
public override void Initialize()
{
base.Initialize();
_cuffQuery = GetEntityQuery<HandcuffComponent>();
SubscribeLocalEvent<CuffableComponent, HandCountChangedEvent>(OnHandCountChanged);
SubscribeLocalEvent<UncuffAttemptEvent>(OnUncuffAttempt);
@@ -95,9 +89,6 @@ namespace Content.Shared.Cuffs
SubscribeLocalEvent<HandcuffComponent, MeleeHitEvent>(OnCuffMeleeHit);
SubscribeLocalEvent<HandcuffComponent, AddCuffDoAfterEvent>(OnAddCuffDoAfter);
SubscribeLocalEvent<HandcuffComponent, VirtualItemDeletedEvent>(OnCuffVirtualItemDeleted);
SubscribeLocalEvent<CuffableComponent, GetStandUpTimeEvent>(OnCuffableStandupArgs);
SubscribeLocalEvent<CuffableComponent, KnockedDownRefreshEvent>(OnCuffableKnockdownRefresh);
SubscribeLocalEvent<CuffableComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshMovementSpeedModifiers);
}
private void CheckInteract(Entity<CuffableComponent> ent, ref InteractionAttemptEvent args)
@@ -375,9 +366,6 @@ namespace Content.Shared.Cuffs
_adminLog.Add(LogType.Action, LogImpact.High,
$"{ToPrettyString(user):player} has cuffed {ToPrettyString(target):player}");
}
if (!MathHelper.CloseTo(component.MovementMod, 1f))
_move.RefreshMovementSpeedModifiers(target);
}
else
{
@@ -432,72 +420,6 @@ namespace Content.Shared.Cuffs
}
}
/// <summary>
/// Takes longer to stand up when cuffed
/// </summary>
private void OnCuffableStandupArgs(Entity<CuffableComponent> ent, ref GetStandUpTimeEvent time)
{
if (!HasComp<KnockedDownComponent>(ent) || !IsCuffed(ent))
return;
var cuffs = GetAllCuffs(ent.Comp);
var mod = 1f;
if (cuffs.Count == 0)
return;
foreach (var cuff in cuffs)
{
if (!_cuffQuery.TryComp(cuff, out var comp))
continue;
// Get the worst modifier
mod = Math.Max(mod, comp.StandupMod);
}
time.DoAfterTime *= mod;
}
private void OnCuffableKnockdownRefresh(Entity<CuffableComponent> ent, ref KnockedDownRefreshEvent args)
{
var cuffs = GetAllCuffs(ent.Comp);
var mod = 1f;
if (cuffs.Count == 0)
return;
foreach (var cuff in cuffs)
{
if (!_cuffQuery.TryComp(cuff, out var comp))
continue;
// Get the worst modifier
mod = Math.Min(mod, comp.KnockedMovementMod);
}
args.SpeedModifier *= mod;
}
private void OnRefreshMovementSpeedModifiers(Entity<CuffableComponent> ent, ref RefreshMovementSpeedModifiersEvent args)
{
var cuffs = GetAllCuffs(ent.Comp);
var mod = 1f;
if (cuffs.Count == 0)
return;
foreach (var cuff in cuffs)
{
if (!_cuffQuery.TryComp(cuff, out var comp))
continue;
// Get the worst modifier
mod = Math.Min(mod, comp.MovementMod);
}
args.ModifySpeed(mod);
}
/// <summary>
/// Adds virtual cuff items to the user's hands.
/// </summary>
@@ -814,9 +736,6 @@ namespace Content.Shared.Cuffs
shoved = true;
}
if (!MathHelper.CloseTo(cuff.MovementMod, 1f))
_move.RefreshMovementSpeedModifiers(target);
if (cuffable.CuffedHandCount == 0)
{
if (user != null)

View File

@@ -4,7 +4,6 @@ using Content.Shared.Damage;
using Content.Shared.Damage.Components;
using Content.Shared.Database;
using Content.Shared.DoAfter;
using Content.Shared.Hands;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Input;
using Content.Shared.Movement.Events;
@@ -58,8 +57,6 @@ public abstract partial class SharedStunSystem
SubscribeLocalEvent<KnockedDownComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshKnockedSpeed);
SubscribeLocalEvent<KnockedDownComponent, RefreshFrictionModifiersEvent>(OnRefreshFriction);
SubscribeLocalEvent<KnockedDownComponent, TileFrictionEvent>(OnKnockedTileFriction);
SubscribeLocalEvent<KnockedDownComponent, DidEquipHandEvent>(OnHandEquipped);
SubscribeLocalEvent<KnockedDownComponent, DidUnequipHandEvent>(OnHandUnequipped);
// DoAfter event subscriptions
SubscribeLocalEvent<KnockedDownComponent, TryStandDoAfterEvent>(OnStandDoAfter);
@@ -518,15 +515,5 @@ public abstract partial class SharedStunSystem
args.ModifyAcceleration(entity.Comp.FrictionModifier);
}
private void OnHandEquipped(Entity<KnockedDownComponent> entity, ref DidEquipHandEvent args)
{
RefreshKnockedMovement(entity);
}
private void OnHandUnequipped(Entity<KnockedDownComponent> entity, ref DidUnequipHandEvent args)
{
RefreshKnockedMovement(entity);
}
#endregion
}