Files
tbd-station-14/Content.Client/HotPotato/HotPotatoSystem.cs
metalgearsloth a9502be29e Revert "Fix chat bubbles (#25643)" (#25645)
* Revert "Fix chat bubbles (#25643)"

This reverts commit 23d2c4d924.

* Revert "Fixes obsolete Transform warnings in Content. (#25256)"

This reverts commit f284b43ff6.
2024-02-28 00:51:20 +11:00

30 lines
980 B
C#

using Content.Shared.HotPotato;
using Robust.Shared.Random;
using Robust.Shared.Timing;
namespace Content.Client.HotPotato;
public sealed class HotPotatoSystem : SharedHotPotatoSystem
{
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
public override void Update(float frameTime)
{
base.Update(frameTime);
if (!_timing.IsFirstTimePredicted)
return;
var query = AllEntityQuery<ActiveHotPotatoComponent>();
while (query.MoveNext(out var uid, out var comp))
{
if (_timing.CurTime < comp.TargetTime)
continue;
comp.TargetTime = _timing.CurTime + TimeSpan.FromSeconds(comp.EffectCooldown);
Spawn("HotPotatoEffect", _transform.GetMapCoordinates(uid).Offset(_random.NextVector2(0.25f)));
}
}
}