2021-06-09 22:19:39 +02: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-11-02 00:42:04 +00:00
|
|
|
|
using Robust.Shared.Localization;
|
2021-02-12 04:35:56 +01:00
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
|
namespace Content.Server.Ghost.Roles.Components
|
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
|
|
|
|
|
2021-11-02 00:42:04 +00:00
|
|
|
|
[DataField("rules")] private string _roleRules = "";
|
|
|
|
|
|
|
2021-12-03 20:31:14 +11:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Whether the <see cref="MakeSentientCommand"/> should run on the mob.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)] [DataField("makeSentient")]
|
|
|
|
|
|
protected bool MakeSentient = true;
|
|
|
|
|
|
|
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();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-11-02 00:42:04 +00:00
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
|
public string RoleRules
|
|
|
|
|
|
{
|
|
|
|
|
|
get => _roleRules;
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
_roleRules = value;
|
|
|
|
|
|
EntitySystem.Get<GhostRoleSystem>().UpdateAllEui();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-02-12 04:35:56 +01:00
|
|
|
|
[ViewVariables(VVAccess.ReadOnly)]
|
|
|
|
|
|
public bool Taken { get; protected set; }
|
|
|
|
|
|
|
|
|
|
|
|
[ViewVariables]
|
|
|
|
|
|
public uint Identifier { get; set; }
|
|
|
|
|
|
|
2021-06-19 19:41:26 -07:00
|
|
|
|
protected override void Initialize()
|
2021-02-12 04:35:56 +01:00
|
|
|
|
{
|
|
|
|
|
|
base.Initialize();
|
2021-11-02 00:42:04 +00:00
|
|
|
|
if (_roleRules == "")
|
|
|
|
|
|
_roleRules = Loc.GetString("ghost-role-component-default-rules");
|
2021-02-12 04:35:56 +01:00
|
|
|
|
EntitySystem.Get<GhostRoleSystem>().RegisterGhostRole(this);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void Shutdown()
|
|
|
|
|
|
{
|
|
|
|
|
|
base.Shutdown();
|
|
|
|
|
|
|
|
|
|
|
|
EntitySystem.Get<GhostRoleSystem>().UnregisterGhostRole(this);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public abstract bool Take(IPlayerSession session);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|