using Content.Server.NPC.Components; using Content.Server.StationEvents.Events; using Content.Shared.Dataset; using Content.Shared.Roles; using Robust.Shared.Map; using Robust.Shared.Players; using Robust.Shared.Prototypes; using Robust.Shared.Serialization.TypeSerializers.Implementations; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; using Robust.Shared.Utility; namespace Content.Server.GameTicking.Rules.Components; [RegisterComponent, Access(typeof(NukeopsRuleSystem), typeof(LoneOpsSpawnRule))] public sealed partial class NukeopsRuleComponent : Component { /// /// The minimum needed amount of players /// [DataField("minPlayers")] public int MinPlayers = 20; /// /// This INCLUDES the operatives. So a value of 3 is satisfied by 2 players & 1 operative /// [DataField("playersPerOperative")] public int PlayersPerOperative = 10; [DataField("maxOps")] public int MaxOperatives = 5; /// /// Whether or not all of the nuclear operatives dying will end the round. Used by LoneOpsSpawn event. /// [DataField("endsRound")] public bool EndsRound = true; /// /// Whether or not to spawn the nuclear operative outpost. Used by LoneOpsSpawn event. /// [DataField("spawnOutpost")] public bool SpawnOutpost = true; /// /// Whether or not nukie left their outpost /// [DataField("leftOutpost")] public bool LeftOutpost = false; /// /// Enables opportunity to get extra TC for war declaration /// [DataField("canEnableWarOps")] public bool CanEnableWarOps = true; /// /// Indicates time when war has been declared, null if not declared /// [DataField("warDeclaredTime", customTypeSerializer: typeof(TimeOffsetSerializer))] public TimeSpan? WarDeclaredTime; /// /// This amount of TC will be given to each nukie /// [DataField("warTCAmountPerNukie")] public int WarTCAmountPerNukie = 40; /// /// Time allowed for declaration of war /// [DataField("warDeclarationDelay")] public TimeSpan WarDeclarationDelay = TimeSpan.FromMinutes(6); /// /// Delay between war declaration and nuke ops arrival on station map. Gives crew time to prepare /// [DataField("warNukieArriveDelay")] public TimeSpan? WarNukieArriveDelay = TimeSpan.FromMinutes(15); /// /// Minimal operatives count for war declaration /// [DataField("warDeclarationMinOps")] public int WarDeclarationMinOps = 4; [DataField("spawnPointProto", customTypeSerializer: typeof(PrototypeIdSerializer))] public string SpawnPointPrototype = "SpawnPointNukies"; [DataField("ghostSpawnPointProto", customTypeSerializer: typeof(PrototypeIdSerializer))] public string GhostSpawnPointProto = "SpawnPointGhostNukeOperative"; [DataField("commanderRoleProto", customTypeSerializer: typeof(PrototypeIdSerializer))] public string CommanderRolePrototype = "NukeopsCommander"; [DataField("operativeRoleProto", customTypeSerializer: typeof(PrototypeIdSerializer))] public string OperativeRoleProto = "Nukeops"; [DataField("medicRoleProto", customTypeSerializer: typeof(PrototypeIdSerializer))] public string MedicRoleProto = "NukeopsMedic"; [DataField("commanderStartingGearProto", customTypeSerializer: typeof(PrototypeIdSerializer))] public string CommanderStartGearPrototype = "SyndicateCommanderGearFull"; [DataField("medicStartGearProto", customTypeSerializer: typeof(PrototypeIdSerializer))] public string MedicStartGearPrototype = "SyndicateOperativeMedicFull"; [DataField("operativeStartGearProto", customTypeSerializer: typeof(PrototypeIdSerializer))] public string OperativeStartGearPrototype = "SyndicateOperativeGearFull"; [DataField("eliteNames", customTypeSerializer: typeof(PrototypeIdSerializer))] public string EliteNames = "SyndicateNamesElite"; [DataField("normalNames", customTypeSerializer: typeof(PrototypeIdSerializer))] public string NormalNames = "SyndicateNamesNormal"; [DataField("outpostMap", customTypeSerializer: typeof(ResPathSerializer))] public ResPath NukieOutpostMap = new("/Maps/nukieplanet.yml"); [DataField("shuttleMap", customTypeSerializer: typeof(ResPathSerializer))] public ResPath NukieShuttleMap = new("/Maps/infiltrator.yml"); [DataField("winType")] public WinType WinType = WinType.Neutral; [DataField("winConditions")] public List WinConditions = new (); public MapId? NukiePlanet; // TODO: use components, don't just cache entity UIDs // There have been (and probably still are) bugs where these refer to deleted entities from old rounds. public EntityUid? NukieOutpost; public EntityUid? NukieShuttle; public EntityUid? TargetStation; /// /// Cached starting gear prototypes. /// [DataField("startingGearPrototypes")] public Dictionary StartingGearPrototypes = new (); /// /// Cached operator name prototypes. /// [DataField("operativeNames")] public Dictionary> OperativeNames = new(); /// /// Data to be used in for an operative once the Mind has been added. /// [DataField("operativeMindPendingData")] public Dictionary OperativeMindPendingData = new(); /// /// Players who played as an operative at some point in the round. /// Stores the mind as well as the entity name /// [DataField("operativePlayers")] public Dictionary OperativePlayers = new(); [DataField("faction", customTypeSerializer: typeof(PrototypeIdSerializer), required: true)] public string Faction = default!; } public enum WinType : byte { /// /// Operative major win. This means they nuked the station. /// OpsMajor, /// /// Minor win. All nukies were alive at the end of the round. /// Alternatively, some nukies were alive, but the disk was left behind. /// OpsMinor, /// /// Neutral win. The nuke exploded, but on the wrong station. /// Neutral, /// /// Crew minor win. The nuclear authentication disk escaped on the shuttle, /// but some nukies were alive. /// CrewMinor, /// /// Crew major win. This means they either killed all nukies, /// or the bomb exploded too far away from the station, or on the nukie moon. /// CrewMajor } public enum WinCondition : byte { NukeExplodedOnCorrectStation, NukeExplodedOnNukieOutpost, NukeExplodedOnIncorrectLocation, NukeActiveInStation, NukeActiveAtCentCom, NukeDiskOnCentCom, NukeDiskNotOnCentCom, NukiesAbandoned, AllNukiesDead, SomeNukiesAlive, AllNukiesAlive }