Emp more effects (#14550)
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
24
Content.Client/Emp/EmpSystem.cs
Normal file
24
Content.Client/Emp/EmpSystem.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Content.Shared.Emp;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Client.Emp;
|
||||
|
||||
public sealed class EmpSystem : SharedEmpSystem
|
||||
{
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
base.Update(frameTime);
|
||||
|
||||
var query = EntityQueryEnumerator<EmpDisabledComponent, TransformComponent>();
|
||||
while (query.MoveNext(out var uid, out var comp, out var transform))
|
||||
{
|
||||
if (Timing.CurTime > comp.TargetTime)
|
||||
{
|
||||
comp.TargetTime = Timing.CurTime + _random.NextFloat(0.8f, 1.2f) * TimeSpan.FromSeconds(comp.EffectCooldown);
|
||||
Spawn(EmpDisabledEffectPrototype, transform.Coordinates);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user