using Content.Server.Ghost.Roles.Raffles;
using Content.Server.Mind.Commands;
using Content.Shared.Roles;
using Robust.Shared.Prototypes;
namespace Content.Server.Ghost.Roles.Components;
[RegisterComponent]
[Access(typeof(GhostRoleSystem))]
public sealed partial class GhostRoleComponent : Component
{
[DataField("name")] private string _roleName = "Unknown";
[DataField("description")] private string _roleDescription = "Unknown";
[DataField("rules")] private string _roleRules = "ghost-role-component-default-rules";
///
/// Whether the should run on the mob.
///
[ViewVariables(VVAccess.ReadWrite)] [DataField("makeSentient")]
public bool MakeSentient = true;
///
/// 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%.
///
[DataField("prob")]
public float Probability = 1f;
// We do this so updating RoleName and RoleDescription in VV updates the open EUIs.
[ViewVariables(VVAccess.ReadWrite)]
[Access(typeof(GhostRoleSystem), Other = AccessPermissions.ReadWriteExecute)] // FIXME Friends
public string RoleName
{
get => Loc.GetString(_roleName);
set
{
_roleName = value;
IoCManager.Resolve().System().UpdateAllEui();
}
}
[ViewVariables(VVAccess.ReadWrite)]
[Access(typeof(GhostRoleSystem), Other = AccessPermissions.ReadWriteExecute)] // FIXME Friends
public string RoleDescription
{
get => Loc.GetString(_roleDescription);
set
{
_roleDescription = value;
IoCManager.Resolve().System().UpdateAllEui();
}
}
[ViewVariables(VVAccess.ReadWrite)]
[Access(typeof(GhostRoleSystem), Other = AccessPermissions.ReadWriteExecute)] // FIXME Friends
public string RoleRules
{
get => Loc.GetString(_roleRules);
set
{
_roleRules = value;
IoCManager.Resolve().System().UpdateAllEui();
}
}
///
/// The mind roles that will be added to the mob's mind entity
///
[DataField, Access(typeof(GhostRoleSystem), Other = AccessPermissions.ReadWriteExecute)] // Don't make eye contact
public List MindRoles = new() { "MindRoleGhostRoleNeutral" };
[DataField]
public bool AllowSpeech { get; set; } = true;
[DataField]
public bool AllowMovement { get; set; }
[ViewVariables(VVAccess.ReadOnly)]
public bool Taken { get; set; }
[ViewVariables]
public uint Identifier { get; set; }
///
/// Reregisters the ghost role when the current player ghosts.
///
[ViewVariables(VVAccess.ReadWrite)]
[DataField("reregister")]
public bool ReregisterOnGhost { get; set; } = true;
///
/// If set, ghost role is raffled, otherwise it is first-come-first-serve.
///
[DataField("raffle")]
[Access(typeof(GhostRoleSystem), Other = AccessPermissions.ReadWriteExecute)] // FIXME Friends
public GhostRoleRaffleConfig? RaffleConfig { get; set; }
///
/// Job the entity will receive after adding the mind.
///
[DataField("job")]
[Access(typeof(GhostRoleSystem), Other = AccessPermissions.ReadWriteExecute)] // also FIXME Friends
public ProtoId? JobProto = null;
}