Fix spreader test (#15303)

This commit is contained in:
metalgearsloth
2023-04-11 20:02:24 +10:00
committed by GitHub
parent 3bb2b27169
commit 793a09336e
2 changed files with 14 additions and 12 deletions

View File

@@ -32,12 +32,19 @@ public sealed class SpreaderSystem : EntitySystem
{
SubscribeLocalEvent<AirtightChanged>(OnAirtightChanged);
SubscribeLocalEvent<GridInitializeEvent>(OnGridInit);
SubscribeLocalEvent<SpreaderGridComponent, MapInitEvent>(OnSpreaderGridMapInit);
SubscribeLocalEvent<SpreaderGridComponent, EntityUnpausedEvent>(OnGridUnpaused);
SetupPrototypes();
_prototype.PrototypesReloaded += OnPrototypeReload;
}
private void OnSpreaderGridMapInit(EntityUid uid, SpreaderGridComponent component, MapInitEvent args)
{
component.NextUpdate = _timing.CurTime;
}
public override void Shutdown()
{
base.Shutdown();
@@ -80,12 +87,7 @@ public sealed class SpreaderSystem : EntitySystem
private void OnGridInit(GridInitializeEvent ev)
{
var comp = EnsureComp<SpreaderGridComponent>(ev.EntityUid);
var nextUpdate = _timing.CurTime;
// TODO: I believe we need grid mapinit events so we can set the time correctly only on mapinit
// and not touch it on regular init.
if (comp.NextUpdate < nextUpdate)
comp.NextUpdate = nextUpdate;
}
/// <inheritdoc/>