Remove misc Startup/Shutdown overrides (#8113)

Co-authored-by: ike709 <ike709@github.com>
This commit is contained in:
ike709
2022-05-12 06:11:50 -05:00
committed by GitHub
parent 834e29d76a
commit a9c18acd35
7 changed files with 58 additions and 50 deletions

View File

@@ -8,14 +8,5 @@ namespace Content.Client.Pointing.Components
[ComponentReference(typeof(SharedPointingArrowComponent))]
public sealed class PointingArrowComponent : SharedPointingArrowComponent
{
protected override void Startup()
{
base.Startup();
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out SpriteComponent? sprite))
{
sprite.DrawDepth = (int) DrawDepth.Overlays;
}
}
}
}

View File

@@ -9,14 +9,5 @@ namespace Content.Client.Pointing.Components
[RegisterComponent]
public sealed class RoguePointingArrowComponent : SharedRoguePointingArrowComponent
{
protected override void Startup()
{
base.Startup();
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out SpriteComponent? sprite))
{
sprite.DrawDepth = (int) DrawDepth.Overlays;
}
}
}
}

View File

@@ -2,6 +2,8 @@ using Content.Client.Pointing.Components;
using Content.Shared.MobState.Components;
using Content.Shared.Pointing;
using Content.Shared.Verbs;
using Robust.Client.GameObjects;
using DrawDepth = Content.Shared.DrawDepth.DrawDepth;
namespace Content.Client.Pointing;
@@ -12,6 +14,9 @@ internal sealed class PointingSystem : EntitySystem
base.Initialize();
SubscribeLocalEvent<GetVerbsEvent<Verb>>(AddPointingVerb);
SubscribeLocalEvent<PointingArrowComponent, ComponentStartup>(OnArrowStartup);
SubscribeLocalEvent<RoguePointingArrowComponent, ComponentStartup>(OnRogueArrowStartup);
}
private void AddPointingVerb(GetVerbsEvent<Verb> args)
@@ -44,4 +49,20 @@ internal sealed class PointingSystem : EntitySystem
args.Verbs.Add(verb);
}
private void OnArrowStartup(EntityUid uid, PointingArrowComponent arrow, ComponentStartup args)
{
if (EntityManager.TryGetComponent(uid, out SpriteComponent? sprite))
{
sprite.DrawDepth = (int) DrawDepth.Overlays;
}
}
private void OnRogueArrowStartup(EntityUid uid, RoguePointingArrowComponent arrow, ComponentStartup args)
{
if (EntityManager.TryGetComponent(uid, out SpriteComponent? sprite))
{
sprite.DrawDepth = (int) DrawDepth.Overlays;
}
}
}