2021-02-12 04:35:56 +01:00
|
|
|
|
using Content.Server.GameObjects.EntitySystems;
|
2021-02-12 10:45:22 +01:00
|
|
|
|
using Robust.Server.Player;
|
2021-02-12 04:35:56 +01:00
|
|
|
|
using Robust.Shared.GameObjects;
|
2021-03-05 01:08:38 +01:00
|
|
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
2021-02-12 04:35:56 +01:00
|
|
|
|
using Robust.Shared.ViewVariables;
|
|
|
|
|
|
|
2021-02-16 09:51:27 +01:00
|
|
|
|
namespace Content.Server.GameObjects.Components.Observer.GhostRoles
|
2021-02-12 04:35:56 +01:00
|
|
|
|
{
|
|
|
|
|
|
public abstract class GhostRoleComponent : Component
|
|
|
|
|
|
{
|
2021-03-05 01:08:38 +01:00
|
|
|
|
[DataField("name")] private string _roleName = "Unknown";
|
|
|
|
|
|
|
|
|
|
|
|
[DataField("description")] private string _roleDescription = "Unknown";
|
2021-02-12 04:35:56 +01:00
|
|
|
|
|
|
|
|
|
|
// We do this so updating RoleName and RoleDescription in VV updates the open EUIs.
|
|
|
|
|
|
|
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
|
public string RoleName
|
|
|
|
|
|
{
|
2021-02-16 09:51:27 +01:00
|
|
|
|
get => _roleName;
|
|
|
|
|
|
set
|
2021-02-12 04:35:56 +01:00
|
|
|
|
{
|
|
|
|
|
|
_roleName = value;
|
|
|
|
|
|
EntitySystem.Get<GhostRoleSystem>().UpdateAllEui();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
|
public string RoleDescription
|
|
|
|
|
|
{
|
2021-02-16 09:51:27 +01:00
|
|
|
|
get => _roleDescription;
|
|
|
|
|
|
set
|
2021-02-12 04:35:56 +01:00
|
|
|
|
{
|
|
|
|
|
|
_roleDescription = value;
|
|
|
|
|
|
EntitySystem.Get<GhostRoleSystem>().UpdateAllEui();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[ViewVariables(VVAccess.ReadOnly)]
|
|
|
|
|
|
public bool Taken { get; protected set; }
|
|
|
|
|
|
|
|
|
|
|
|
[ViewVariables]
|
|
|
|
|
|
public uint Identifier { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public override void Initialize()
|
|
|
|
|
|
{
|
|
|
|
|
|
base.Initialize();
|
|
|
|
|
|
|
|
|
|
|
|
EntitySystem.Get<GhostRoleSystem>().RegisterGhostRole(this);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void Shutdown()
|
|
|
|
|
|
{
|
|
|
|
|
|
base.Shutdown();
|
|
|
|
|
|
|
|
|
|
|
|
EntitySystem.Get<GhostRoleSystem>().UnregisterGhostRole(this);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public abstract bool Take(IPlayerSession session);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|