diff --git a/Content.Server/Hands/Systems/HandsSystem.cs b/Content.Server/Hands/Systems/HandsSystem.cs index e3e66995373..a74a30d0c76 100644 --- a/Content.Server/Hands/Systems/HandsSystem.cs +++ b/Content.Server/Hands/Systems/HandsSystem.cs @@ -23,6 +23,7 @@ using Robust.Shared.Input.Binding; using Robust.Shared.Map; using Robust.Shared.Player; +using Robust.Shared.Timing; using Robust.Shared.Utility; namespace Content.Server.Hands.Systems @@ -39,6 +40,7 @@ public sealed class HandsSystem : SharedHandsSystem [Dependency] private readonly PullingSystem _pullingSystem = default!; [Dependency] private readonly ThrowingSystem _throwingSystem = default!; [Dependency] private readonly StorageSystem _storageSystem = default!; + [Dependency] private readonly IGameTiming _timing = default!; // Frontier public override void Initialize() { @@ -171,6 +173,14 @@ hands.ActiveHandEntity is not { } throwEnt || !_actionBlockerSystem.CanThrow(player, throwEnt)) return false; + // Frontier: limit amount of items thrown per second + if (hands.NextThrowAfter > _timing.CurTime) + { + hands.NextThrowAfter = _timing.CurTime + TimeSpan.FromSeconds(0.67); // Punishment + return false; + } + hands.NextThrowAfter = _timing.CurTime + TimeSpan.FromSeconds(0.25); // Up to 4 throws per second. + if (EntityManager.TryGetComponent(throwEnt, out StackComponent? stack) && stack.Count > 1 && stack.ThrowIndividually) { var splitStack = _stackSystem.Split(throwEnt, 1, EntityManager.GetComponent(player).Coordinates, stack); diff --git a/Content.Shared/Hands/Components/HandsComponent.cs b/Content.Shared/Hands/Components/HandsComponent.cs index 0bece1d141a..d5d1a73d807 100644 --- a/Content.Shared/Hands/Components/HandsComponent.cs +++ b/Content.Shared/Hands/Components/HandsComponent.cs @@ -57,6 +57,12 @@ public sealed partial class HandsComponent : Component /// Used by the client. /// public readonly Dictionary> RevealedLayers = new(); + + // Frontier + /// + /// The moment in time until which another item cannot be thrown. + /// + public TimeSpan NextThrowAfter; } [Serializable, NetSerializable]