Port medibot + bot spawners from nyano (#9854)
* Port medibot + bot spawners from nyano * Make the injection thresholds constants * Remove warning * Check against const in system too * resolving systems just isn't worth it * only resolve entity manager once * Reduceother resolves too * fix post-merge * woops
This commit is contained in:
25
Content.Server/AI/Tracking/RecentlyInjectedSystem.cs
Normal file
25
Content.Server/AI/Tracking/RecentlyInjectedSystem.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
namespace Content.Server.AI.Tracking
|
||||
{
|
||||
public sealed class RecentlyInjectedSystem : EntitySystem
|
||||
{
|
||||
|
||||
Queue<EntityUid> RemQueue = new();
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
base.Update(frameTime);
|
||||
foreach (var toRemove in RemQueue)
|
||||
{
|
||||
RemComp<RecentlyInjectedComponent>(toRemove);
|
||||
}
|
||||
RemQueue.Clear();
|
||||
foreach (var entity in EntityQuery<RecentlyInjectedComponent>())
|
||||
{
|
||||
entity.Accumulator += frameTime;
|
||||
if (entity.Accumulator < entity.RemoveTime.TotalSeconds)
|
||||
continue;
|
||||
entity.Accumulator = 0;
|
||||
RemQueue.Enqueue(entity.Owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user