Remove misc Startup/Shutdown overrides (#8113)
Co-authored-by: ike709 <ike709@github.com>
This commit is contained in:
@@ -7,6 +7,7 @@ using Robust.Shared.Localization;
|
||||
|
||||
namespace Content.Server.Ghost.Roles.Components
|
||||
{
|
||||
[Friend(typeof(GhostRoleSystem))]
|
||||
public abstract class GhostRoleComponent : Component
|
||||
{
|
||||
[DataField("name")] public string _roleName = "Unknown";
|
||||
@@ -69,21 +70,6 @@ namespace Content.Server.Ghost.Roles.Components
|
||||
[DataField("reregister")]
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +53,8 @@ namespace Content.Server.Ghost.Roles
|
||||
SubscribeLocalEvent<GhostTakeoverAvailableComponent, MindAddedMessage>(OnMindAdded);
|
||||
SubscribeLocalEvent<GhostTakeoverAvailableComponent, MindRemovedMessage>(OnMindRemoved);
|
||||
SubscribeLocalEvent<GhostTakeoverAvailableComponent, MobStateChangedEvent>(OnMobStateChanged);
|
||||
SubscribeLocalEvent<GhostRoleComponent, ComponentInit>(OnInit);
|
||||
SubscribeLocalEvent<GhostRoleComponent, ComponentShutdown>(OnShutdown);
|
||||
_playerManager.PlayerStatusChanged += PlayerStatusChanged;
|
||||
}
|
||||
|
||||
@@ -266,6 +268,18 @@ namespace Content.Server.Ghost.Roles
|
||||
_ghostRoles.Clear();
|
||||
_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]
|
||||
|
||||
Reference in New Issue
Block a user