Remove misc Startup/Shutdown overrides (#8113)
Co-authored-by: ike709 <ike709@github.com>
This commit is contained in:
@@ -7,21 +7,5 @@ namespace Content.Client.Markers
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public sealed class MarkerComponent : Component
|
public sealed class MarkerComponent : Component
|
||||||
{
|
{
|
||||||
protected override void Startup()
|
|
||||||
{
|
|
||||||
base.Startup();
|
|
||||||
|
|
||||||
UpdateVisibility();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateVisibility()
|
|
||||||
{
|
|
||||||
var system = EntitySystem.Get<MarkerSystem>();
|
|
||||||
|
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ISpriteComponent? sprite))
|
|
||||||
{
|
|
||||||
sprite.Visible = system.MarkersVisible;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
|
||||||
namespace Content.Client.Markers
|
namespace Content.Client.Markers
|
||||||
@@ -16,11 +17,31 @@ namespace Content.Client.Markers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
base.Initialize();
|
||||||
|
|
||||||
|
SubscribeLocalEvent<MarkerComponent, ComponentStartup>(OnStartup);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnStartup(EntityUid uid, MarkerComponent marker, ComponentStartup args)
|
||||||
|
{
|
||||||
|
UpdateVisibility(marker);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateVisibility(MarkerComponent marker)
|
||||||
|
{
|
||||||
|
if (EntityManager.TryGetComponent(marker.Owner, out SpriteComponent? sprite))
|
||||||
|
{
|
||||||
|
sprite.Visible = MarkersVisible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void UpdateMarkers()
|
private void UpdateMarkers()
|
||||||
{
|
{
|
||||||
foreach (var markerComponent in EntityManager.EntityQuery<MarkerComponent>(true))
|
foreach (var markerComponent in EntityManager.EntityQuery<MarkerComponent>(true))
|
||||||
{
|
{
|
||||||
markerComponent.UpdateVisibility();
|
UpdateVisibility(markerComponent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,14 +8,5 @@ namespace Content.Client.Pointing.Components
|
|||||||
[ComponentReference(typeof(SharedPointingArrowComponent))]
|
[ComponentReference(typeof(SharedPointingArrowComponent))]
|
||||||
public sealed class PointingArrowComponent : 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,14 +9,5 @@ namespace Content.Client.Pointing.Components
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public sealed class RoguePointingArrowComponent : SharedRoguePointingArrowComponent
|
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ using Content.Client.Pointing.Components;
|
|||||||
using Content.Shared.MobState.Components;
|
using Content.Shared.MobState.Components;
|
||||||
using Content.Shared.Pointing;
|
using Content.Shared.Pointing;
|
||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
|
using Robust.Client.GameObjects;
|
||||||
|
using DrawDepth = Content.Shared.DrawDepth.DrawDepth;
|
||||||
|
|
||||||
namespace Content.Client.Pointing;
|
namespace Content.Client.Pointing;
|
||||||
|
|
||||||
@@ -12,6 +14,9 @@ internal sealed class PointingSystem : EntitySystem
|
|||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
SubscribeLocalEvent<GetVerbsEvent<Verb>>(AddPointingVerb);
|
SubscribeLocalEvent<GetVerbsEvent<Verb>>(AddPointingVerb);
|
||||||
|
SubscribeLocalEvent<PointingArrowComponent, ComponentStartup>(OnArrowStartup);
|
||||||
|
SubscribeLocalEvent<RoguePointingArrowComponent, ComponentStartup>(OnRogueArrowStartup);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddPointingVerb(GetVerbsEvent<Verb> args)
|
private void AddPointingVerb(GetVerbsEvent<Verb> args)
|
||||||
@@ -44,4 +49,20 @@ internal sealed class PointingSystem : EntitySystem
|
|||||||
|
|
||||||
args.Verbs.Add(verb);
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using Robust.Shared.Localization;
|
|||||||
|
|
||||||
namespace Content.Server.Ghost.Roles.Components
|
namespace Content.Server.Ghost.Roles.Components
|
||||||
{
|
{
|
||||||
|
[Friend(typeof(GhostRoleSystem))]
|
||||||
public abstract class GhostRoleComponent : Component
|
public abstract class GhostRoleComponent : Component
|
||||||
{
|
{
|
||||||
[DataField("name")] public string _roleName = "Unknown";
|
[DataField("name")] public string _roleName = "Unknown";
|
||||||
@@ -69,21 +70,6 @@ namespace Content.Server.Ghost.Roles.Components
|
|||||||
[DataField("reregister")]
|
[DataField("reregister")]
|
||||||
public bool ReregisterOnGhost { get; set; } = true;
|
public bool ReregisterOnGhost { get; set; } = true;
|
||||||
|
|
||||||
protected override void Initialize()
|
|
||||||
{
|
|
||||||
base.Initialize();
|
|
||||||
if (_roleRules == "")
|
|
||||||
_roleRules = Loc.GetString("ghost-role-component-default-rules");
|
|
||||||
EntitySystem.Get<GhostRoleSystem>().RegisterGhostRole(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Shutdown()
|
|
||||||
{
|
|
||||||
base.Shutdown();
|
|
||||||
|
|
||||||
EntitySystem.Get<GhostRoleSystem>().UnregisterGhostRole(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract bool Take(IPlayerSession session);
|
public abstract bool Take(IPlayerSession session);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,6 +53,8 @@ namespace Content.Server.Ghost.Roles
|
|||||||
SubscribeLocalEvent<GhostTakeoverAvailableComponent, MindAddedMessage>(OnMindAdded);
|
SubscribeLocalEvent<GhostTakeoverAvailableComponent, MindAddedMessage>(OnMindAdded);
|
||||||
SubscribeLocalEvent<GhostTakeoverAvailableComponent, MindRemovedMessage>(OnMindRemoved);
|
SubscribeLocalEvent<GhostTakeoverAvailableComponent, MindRemovedMessage>(OnMindRemoved);
|
||||||
SubscribeLocalEvent<GhostTakeoverAvailableComponent, MobStateChangedEvent>(OnMobStateChanged);
|
SubscribeLocalEvent<GhostTakeoverAvailableComponent, MobStateChangedEvent>(OnMobStateChanged);
|
||||||
|
SubscribeLocalEvent<GhostRoleComponent, ComponentInit>(OnInit);
|
||||||
|
SubscribeLocalEvent<GhostRoleComponent, ComponentShutdown>(OnShutdown);
|
||||||
_playerManager.PlayerStatusChanged += PlayerStatusChanged;
|
_playerManager.PlayerStatusChanged += PlayerStatusChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,6 +268,18 @@ namespace Content.Server.Ghost.Roles
|
|||||||
_ghostRoles.Clear();
|
_ghostRoles.Clear();
|
||||||
_nextRoleIdentifier = 0;
|
_nextRoleIdentifier = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnInit(EntityUid uid, GhostRoleComponent role, ComponentInit args)
|
||||||
|
{
|
||||||
|
if (role.RoleRules == "")
|
||||||
|
role.RoleRules = Loc.GetString("ghost-role-component-default-rules");
|
||||||
|
RegisterGhostRole(role);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnShutdown(EntityUid uid, GhostRoleComponent role, ComponentShutdown args)
|
||||||
|
{
|
||||||
|
UnregisterGhostRole(role);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[AnyCommand]
|
[AnyCommand]
|
||||||
|
|||||||
Reference in New Issue
Block a user