2022-01-04 02:17:39 -07:00
|
|
|
|
using Content.Server.Mind.Commands;
|
2023-09-20 08:54:53 +01:00
|
|
|
|
using Content.Shared.Roles;
|
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
|
|
|
|
{
|
2023-04-12 06:32:14 -07:00
|
|
|
|
[RegisterComponent]
|
2022-06-07 15:26:28 +02:00
|
|
|
|
[Access(typeof(GhostRoleSystem))]
|
2023-08-22 18:14:33 -07:00
|
|
|
|
public sealed partial class GhostRoleComponent : Component
|
2021-02-12 04:35:56 +01:00
|
|
|
|
{
|
2023-06-18 11:33:19 -07:00
|
|
|
|
[DataField("name")] private string _roleName = "Unknown";
|
2021-03-05 01:08:38 +01:00
|
|
|
|
|
|
|
|
|
|
[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 = "";
|
|
|
|
|
|
|
2023-09-20 08:54:53 +01:00
|
|
|
|
[DataField("requirements")]
|
|
|
|
|
|
public HashSet<JobRequirement>? Requirements;
|
|
|
|
|
|
|
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")]
|
2023-04-12 06:32:14 -07:00
|
|
|
|
public bool MakeSentient = true;
|
2021-12-03 20:31:14 +11:00
|
|
|
|
|
2022-07-14 22:20:37 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// The probability that this ghost role will be available after init.
|
|
|
|
|
|
/// Used mostly for takeover roles that want some probability of being takeover, but not 100%.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[DataField("prob")]
|
|
|
|
|
|
public float Probability = 1f;
|
|
|
|
|
|
|
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)]
|
2022-06-07 15:26:28 +02:00
|
|
|
|
[Access(typeof(GhostRoleSystem), Other = AccessPermissions.ReadWriteExecute)] // FIXME Friends
|
2021-02-12 04:35:56 +01:00
|
|
|
|
public string RoleName
|
|
|
|
|
|
{
|
2022-08-02 16:40:53 +03:00
|
|
|
|
get => Loc.GetString(_roleName);
|
2021-02-16 09:51:27 +01:00
|
|
|
|
set
|
2021-02-12 04:35:56 +01:00
|
|
|
|
{
|
|
|
|
|
|
_roleName = value;
|
|
|
|
|
|
EntitySystem.Get<GhostRoleSystem>().UpdateAllEui();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
2022-06-07 15:26:28 +02:00
|
|
|
|
[Access(typeof(GhostRoleSystem), Other = AccessPermissions.ReadWriteExecute)] // FIXME Friends
|
2021-02-12 04:35:56 +01:00
|
|
|
|
public string RoleDescription
|
|
|
|
|
|
{
|
2022-08-02 16:40:53 +03:00
|
|
|
|
get => Loc.GetString(_roleDescription);
|
2021-02-16 09:51:27 +01:00
|
|
|
|
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)]
|
2022-06-07 15:26:28 +02:00
|
|
|
|
[Access(typeof(GhostRoleSystem), Other = AccessPermissions.ReadWriteExecute)] // FIXME Friends
|
2021-11-02 00:42:04 +00:00
|
|
|
|
public string RoleRules
|
|
|
|
|
|
{
|
2023-07-29 21:56:58 +03:00
|
|
|
|
get => Loc.GetString(_roleRules);
|
2021-11-02 00:42:04 +00:00
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
_roleRules = value;
|
|
|
|
|
|
EntitySystem.Get<GhostRoleSystem>().UpdateAllEui();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-13 20:46:49 -07:00
|
|
|
|
[DataField("allowSpeech")]
|
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
|
public bool AllowSpeech { get; set; } = true;
|
|
|
|
|
|
|
|
|
|
|
|
[DataField("allowMovement")]
|
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
|
public bool AllowMovement { get; set; }
|
|
|
|
|
|
|
2021-02-12 04:35:56 +01:00
|
|
|
|
[ViewVariables(VVAccess.ReadOnly)]
|
2022-01-01 08:48:45 -08:00
|
|
|
|
public bool Taken { get; set; }
|
2021-02-12 04:35:56 +01:00
|
|
|
|
|
|
|
|
|
|
[ViewVariables]
|
|
|
|
|
|
public uint Identifier { get; set; }
|
|
|
|
|
|
|
2022-01-01 08:48:45 -08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Reregisters the ghost role when the current player ghosts.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
|
[DataField("reregister")]
|
|
|
|
|
|
public bool ReregisterOnGhost { get; set; } = true;
|
2021-02-12 04:35:56 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|