2024-09-02 08:32:49 +03:00
|
|
|
using Content.Server.Ghost.Roles.Raffles;
|
2024-05-07 03:48:16 +02:00
|
|
|
using Content.Server.Mind.Commands;
|
2023-09-20 08:54:53 +01:00
|
|
|
using Content.Shared.Roles;
|
2024-09-02 08:32:49 +03:00
|
|
|
using Robust.Shared.Prototypes;
|
2021-02-12 04:35:56 +01:00
|
|
|
|
2024-08-15 20:26:57 +02:00
|
|
|
namespace Content.Server.Ghost.Roles.Components;
|
|
|
|
|
|
|
|
|
|
[RegisterComponent]
|
|
|
|
|
[Access(typeof(GhostRoleSystem))]
|
|
|
|
|
public sealed partial class GhostRoleComponent : Component
|
2021-02-12 04:35:56 +01:00
|
|
|
{
|
2024-08-15 20:26:57 +02:00
|
|
|
[DataField("name")] private string _roleName = "Unknown";
|
2021-03-05 01:08:38 +01:00
|
|
|
|
2024-08-15 20:26:57 +02:00
|
|
|
[DataField("description")] private string _roleDescription = "Unknown";
|
2021-02-12 04:35:56 +01:00
|
|
|
|
2024-08-15 20:26:57 +02:00
|
|
|
[DataField("rules")] private string _roleRules = "ghost-role-component-default-rules";
|
2021-11-02 00:42:04 +00:00
|
|
|
|
2024-08-15 20:26:57 +02:00
|
|
|
// Actually make use of / enforce this requirement?
|
|
|
|
|
// Why is this even here.
|
|
|
|
|
// Move to ghost role prototype & respect CCvars.GameRoleTimerOverride
|
|
|
|
|
[DataField("requirements")]
|
|
|
|
|
public HashSet<JobRequirement>? Requirements;
|
2023-09-20 08:54:53 +01:00
|
|
|
|
2024-08-15 20:26:57 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// Whether the <see cref="MakeSentientCommand"/> should run on the mob.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)] [DataField("makeSentient")]
|
|
|
|
|
public bool MakeSentient = true;
|
2021-12-03 20:31:14 +11:00
|
|
|
|
2024-08-15 20:26:57 +02: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;
|
2022-07-14 22:20:37 -07:00
|
|
|
|
2024-08-15 20:26:57 +02:00
|
|
|
// We do this so updating RoleName and RoleDescription in VV updates the open EUIs.
|
2021-02-12 04:35:56 +01:00
|
|
|
|
2024-08-15 20:26:57 +02:00
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
[Access(typeof(GhostRoleSystem), Other = AccessPermissions.ReadWriteExecute)] // FIXME Friends
|
|
|
|
|
public string RoleName
|
|
|
|
|
{
|
|
|
|
|
get => Loc.GetString(_roleName);
|
|
|
|
|
set
|
2021-02-12 04:35:56 +01:00
|
|
|
{
|
2024-08-15 20:26:57 +02:00
|
|
|
_roleName = value;
|
|
|
|
|
IoCManager.Resolve<IEntityManager>().System<GhostRoleSystem>().UpdateAllEui();
|
2021-02-12 04:35:56 +01:00
|
|
|
}
|
2024-08-15 20:26:57 +02:00
|
|
|
}
|
2021-02-12 04:35:56 +01:00
|
|
|
|
2024-08-15 20:26:57 +02:00
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
[Access(typeof(GhostRoleSystem), Other = AccessPermissions.ReadWriteExecute)] // FIXME Friends
|
|
|
|
|
public string RoleDescription
|
|
|
|
|
{
|
|
|
|
|
get => Loc.GetString(_roleDescription);
|
|
|
|
|
set
|
2021-02-12 04:35:56 +01:00
|
|
|
{
|
2024-08-15 20:26:57 +02:00
|
|
|
_roleDescription = value;
|
|
|
|
|
IoCManager.Resolve<IEntityManager>().System<GhostRoleSystem>().UpdateAllEui();
|
2021-02-12 04:35:56 +01:00
|
|
|
}
|
2024-08-15 20:26:57 +02:00
|
|
|
}
|
2021-02-12 04:35:56 +01:00
|
|
|
|
2024-08-15 20:26:57 +02:00
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
[Access(typeof(GhostRoleSystem), Other = AccessPermissions.ReadWriteExecute)] // FIXME Friends
|
|
|
|
|
public string RoleRules
|
|
|
|
|
{
|
|
|
|
|
get => Loc.GetString(_roleRules);
|
|
|
|
|
set
|
2021-11-02 00:42:04 +00:00
|
|
|
{
|
2024-08-15 20:26:57 +02:00
|
|
|
_roleRules = value;
|
|
|
|
|
IoCManager.Resolve<IEntityManager>().System<GhostRoleSystem>().UpdateAllEui();
|
2021-11-02 00:42:04 +00:00
|
|
|
}
|
2021-02-12 04:35:56 +01:00
|
|
|
}
|
2024-08-15 20:26:57 +02:00
|
|
|
|
|
|
|
|
[DataField("allowSpeech")]
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
public bool AllowSpeech { get; set; } = true;
|
|
|
|
|
|
|
|
|
|
[DataField("allowMovement")]
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
public bool AllowMovement { get; set; }
|
|
|
|
|
|
|
|
|
|
[ViewVariables(VVAccess.ReadOnly)]
|
|
|
|
|
public bool Taken { get; set; }
|
|
|
|
|
|
|
|
|
|
[ViewVariables]
|
|
|
|
|
public uint Identifier { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Reregisters the ghost role when the current player ghosts.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
[DataField("reregister")]
|
|
|
|
|
public bool ReregisterOnGhost { get; set; } = true;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// If set, ghost role is raffled, otherwise it is first-come-first-serve.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField("raffle")]
|
|
|
|
|
[Access(typeof(GhostRoleSystem), Other = AccessPermissions.ReadWriteExecute)] // FIXME Friends
|
|
|
|
|
public GhostRoleRaffleConfig? RaffleConfig { get; set; }
|
2024-09-02 08:32:49 +03:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Job the entity will receive after adding the mind.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField("job")]
|
|
|
|
|
[Access(typeof(GhostRoleSystem), Other = AccessPermissions.ReadWriteExecute)] // also FIXME Friends
|
|
|
|
|
public ProtoId<JobPrototype>? JobProto = null;
|
2021-02-12 04:35:56 +01:00
|
|
|
}
|