UseDelay + ItemCooldown merge (#22502)

This commit is contained in:
AJCM-git
2024-01-03 21:33:09 -04:00
committed by GitHub
parent 42ec9b2967
commit 9c522c8b19
80 changed files with 324 additions and 589 deletions

View File

@@ -39,15 +39,12 @@ public sealed class SignallerSystem : EntitySystem
private void OnTrigger(EntityUid uid, SignallerComponent component, TriggerEvent args)
{
// if on cooldown, do nothing
var hasUseDelay = TryComp<UseDelayComponent>(uid, out var useDelay);
if (hasUseDelay && _useDelay.ActiveDelay(uid, useDelay))
if (!TryComp(uid, out UseDelayComponent? useDelay)
// if on cooldown, do nothing
// and set cooldown to prevent clocks
|| !_useDelay.TryResetDelay((uid, useDelay), true))
return;
// set cooldown to prevent clocks
if (hasUseDelay)
_useDelay.BeginDelay(uid, useDelay);
_link.InvokePort(uid, component.Port);
args.Handled = true;
}