Files
tbd-station-14/Content.Shared/Actions/SharedActionSystem.cs
Pieter-Jan Briers a0af197259 Set outside prediction flags on system/inputs to work without prediction.
This needs to be gone through more thoroughly but it works somewhat.
2021-12-30 03:12:04 +01:00

36 lines
988 B
C#

using Content.Shared.Actions.Components;
using Robust.Shared.GameObjects;
namespace Content.Shared.Actions
{
/// <summary>
/// Evicts action states with expired cooldowns.
/// </summary>
public class SharedActionSystem : EntitySystem
{
private const float CooldownCheckIntervalSeconds = 10;
private float _timeSinceCooldownCheck;
public override void Initialize()
{
base.Initialize();
UpdatesOutsidePrediction = true;
}
public override void Update(float frameTime)
{
base.Update(frameTime);
_timeSinceCooldownCheck += frameTime;
if (_timeSinceCooldownCheck < CooldownCheckIntervalSeconds) return;
foreach (var comp in EntityManager.EntityQuery<SharedActionsComponent>(false))
{
comp.ExpireCooldowns();
}
_timeSinceCooldownCheck -= CooldownCheckIntervalSeconds;
}
}
}