Fix SpawnAndDirtyAllEntities test (#15771)

This commit is contained in:
Leon Friedrich
2023-04-25 21:27:57 +12:00
committed by GitHub
parent 8563f12a7c
commit db8a48ba33
6 changed files with 46 additions and 34 deletions

View File

@@ -18,7 +18,8 @@ public sealed class StealthSystem : SharedStealthSystem
base.Initialize();
_shader = _protoMan.Index<ShaderPrototype>("Stealth").InstanceUnique();
SubscribeLocalEvent<StealthComponent, ComponentRemove>(OnRemove);
SubscribeLocalEvent<StealthComponent, ComponentShutdown>(OnShutdown);
SubscribeLocalEvent<StealthComponent, ComponentStartup>(OnStartup);
SubscribeLocalEvent<StealthComponent, BeforePostShaderRenderEvent>(OnShaderRender);
}
@@ -44,7 +45,7 @@ public sealed class StealthSystem : SharedStealthSystem
if (!enabled)
{
if (component.HadOutline)
AddComp<InteractionOutlineComponent>(uid);
EnsureComp<InteractionOutlineComponent>(uid);
return;
}
@@ -55,13 +56,12 @@ public sealed class StealthSystem : SharedStealthSystem
}
}
protected override void OnInit(EntityUid uid, StealthComponent component, ComponentInit args)
private void OnStartup(EntityUid uid, StealthComponent component, ComponentStartup args)
{
base.OnInit(uid, component, args);
SetShader(uid, component.Enabled, component);
}
private void OnRemove(EntityUid uid, StealthComponent component, ComponentRemove args)
private void OnShutdown(EntityUid uid, StealthComponent component, ComponentShutdown args)
{
SetShader(uid, false, component);
}