Files
OldThink/Content.Server/Cooldown/ItemCooldownSystem.cs

33 lines
952 B
C#
Raw Normal View History

2022-05-13 00:59:03 -07:00
using Content.Shared.Cooldown;
2021-06-09 22:19:39 +02:00
namespace Content.Server.Cooldown
{
public sealed class ItemCooldownSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ItemCooldownComponent, RefreshItemCooldownEvent>(OnItemCooldownRefreshed);
}
public void OnItemCooldownRefreshed(EntityUid uid, ItemCooldownComponent comp, RefreshItemCooldownEvent args)
{
comp.CooldownStart = args.LastAttackTime;
comp.CooldownEnd = args.CooldownEnd;
}
}
public sealed class RefreshItemCooldownEvent : EntityEventArgs
{
public TimeSpan LastAttackTime { get; }
public TimeSpan CooldownEnd { get; }
public RefreshItemCooldownEvent(TimeSpan lastAttackTime, TimeSpan cooldownEnd)
{
LastAttackTime = lastAttackTime;
CooldownEnd = cooldownEnd;
}
}
}