From 4fef6011de416314ce56cf7599f72bfc8bb09228 Mon Sep 17 00:00:00 2001 From: Dvir Date: Tue, 10 Dec 2024 19:20:30 +0200 Subject: [PATCH 01/13] POI Split --- .../Presets/GamePresetPrototype.cs | 2 +- .../Components/AdventureRuleComponent.cs | 5 +- .../_NF/GameRule/NfAdventureRuleSystem.cs | 236 +---------------- .../_NF/GameRule/PointOfInterestSystem.cs | 249 ++++++++++++++++++ .../_NF/GameRule/PointOfInterestPrototype.cs | 44 ++-- 5 files changed, 283 insertions(+), 253 deletions(-) create mode 100644 Content.Server/_NF/GameRule/PointOfInterestSystem.cs diff --git a/Content.Server/GameTicking/Presets/GamePresetPrototype.cs b/Content.Server/GameTicking/Presets/GamePresetPrototype.cs index 4731364ace2..bd8bf6be1ca 100644 --- a/Content.Server/GameTicking/Presets/GamePresetPrototype.cs +++ b/Content.Server/GameTicking/Presets/GamePresetPrototype.cs @@ -7,7 +7,7 @@ namespace Content.Server.GameTicking.Presets { /// - /// A round-start setup preset, such as which antagonists to spawn. + /// A round-start setup preset, such as which antagonists to spawn. /// [Prototype("gamePreset")] public sealed partial class GamePresetPrototype : IPrototype diff --git a/Content.Server/_NF/GameRule/Components/AdventureRuleComponent.cs b/Content.Server/_NF/GameRule/Components/AdventureRuleComponent.cs index fc85a5209c6..821bc298ed9 100644 --- a/Content.Server/_NF/GameRule/Components/AdventureRuleComponent.cs +++ b/Content.Server/_NF/GameRule/Components/AdventureRuleComponent.cs @@ -1,9 +1,6 @@ -using Content.Shared.Procedural; -using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List; - namespace Content.Server._NF.GameRule.Components; -[RegisterComponent, Access(typeof(NfAdventureRuleSystem))] +[RegisterComponent, Access(typeof(NFAdventureRuleSystem))] public sealed partial class AdventureRuleComponent : Component { public List NFPlayerMinds = new(); diff --git a/Content.Server/_NF/GameRule/NfAdventureRuleSystem.cs b/Content.Server/_NF/GameRule/NfAdventureRuleSystem.cs index 5ee7e6e8b7a..65de5df8de2 100644 --- a/Content.Server/_NF/GameRule/NfAdventureRuleSystem.cs +++ b/Content.Server/_NF/GameRule/NfAdventureRuleSystem.cs @@ -8,16 +8,13 @@ using Content.Shared._NF.GameRule; using Content.Server._NF.GameTicking.Events; using Robust.Server.GameObjects; -using Robust.Server.Maps; using Content.Shared.GameTicking.Components; using Robust.Shared.Map; using Robust.Shared.Prototypes; using Robust.Shared.Random; -using Content.Server.Shuttles.Systems; using Content.Server.Cargo.Components; using Content.Server.GameTicking; using Content.Server.GameTicking.Rules; -using Content.Server.Maps; using Content.Server.Station.Systems; using Content.Shared._NF.CCVar; // Frontier using Robust.Shared.Configuration; @@ -29,14 +26,13 @@ using Content.Shared.GameTicking; using Robust.Shared.Enums; using Robust.Server.Player; -using Content.Server.Warps; namespace Content.Server._NF.GameRule; /// /// This handles the dungeon and trading post spawning, as well as round end capitalism summary /// -public sealed class NfAdventureRuleSystem : GameRuleSystem +public sealed class NFAdventureRuleSystem : GameRuleSystem { [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IRobustRandom _random = default!; @@ -45,10 +41,9 @@ public sealed class NfAdventureRuleSystem : GameRuleSystem depotPrototypes, out List depotStations) - { - //For depots, we want them to fill a circular type dystance formula to try to keep them as far apart as possible - //Therefore, we will be taking our range properties and treating them as magnitudes of a direction vector divided - //by the number of depots set in our corresponding cvar - - depotStations = new List(); - var depotCount = _configurationManager.GetCVar(NFCCVars.CargoDepots); - var rotation = 2 * Math.PI / depotCount; - var rotationOffset = _random.NextAngle() / depotCount; - - for (int i = 0; i < depotCount && depotPrototypes.Count > 0; i++) - { - var proto = _random.Pick(depotPrototypes); - Vector2i offset = new Vector2i((int) (_random.Next(proto.MinimumDistance, proto.MaximumDistance) * _distanceOffset), 0); - offset = offset.Rotate(rotationOffset); - rotationOffset += rotation; - // Append letter to depot name. - - string overrideName = proto.Name; - if (i < 26) - overrideName += $" {(char) ('A' + i)}"; // " A" ... " Z" - else - overrideName += $" {i + 1}"; // " 27", " 28"... - if (TrySpawnPoiGrid(proto, offset, out var depotUid, overrideName: overrideName) && depotUid is { Valid: true } depot) - { - depotStations.Add(depot); - AddStationCoordsToSet(offset); // adjust list of actual station coords - } - } - } - - private void GenerateMarkets(List marketPrototypes, out List marketStations) - { - //For market stations, we are going to allow for a bit of randomness and a different offset configuration. We dont - //want copies of this one, since these can be more themed and duplicate names, for instance, can make for a less - //ideal world - - marketStations = new List(); - var marketCount = _configurationManager.GetCVar(NFCCVars.MarketStations); - _random.Shuffle(marketPrototypes); - int marketsAdded = 0; - foreach (var proto in marketPrototypes) - { - if (marketsAdded >= marketCount) - break; - - var offset = GetRandomPOICoord(proto.MinimumDistance, proto.MaximumDistance, true); - - if (TrySpawnPoiGrid(proto, offset, out var marketUid) && marketUid is { Valid: true } market) - { - marketStations.Add(market); - marketsAdded++; - AddStationCoordsToSet(offset); - } - } - } - - private void GenerateOptionals(List optionalPrototypes, out List optionalStations) - { - //Stations that do not have a defined grouping in their prototype get a default of "Optional" and get put into the - //generic random rotation of POIs. This should include traditional places like Tinnia's rest, the Science Lab, The Pit, - //and most RP places. This will essentially put them all into a pool to pull from, and still does not use the RNG function. - - optionalStations = new List(); - var optionalCount = _configurationManager.GetCVar(NFCCVars.OptionalStations); - _random.Shuffle(optionalPrototypes); - int optionalsAdded = 0; - foreach (var proto in optionalPrototypes) - { - if (optionalsAdded >= optionalCount) - break; - - var offset = GetRandomPOICoord(proto.MinimumDistance, proto.MaximumDistance, true); - - if (TrySpawnPoiGrid(proto, offset, out var optionalUid) && optionalUid is { Valid: true } uid) - { - optionalStations.Add(uid); - AddStationCoordsToSet(offset); - } - } - } - - private void GenerateRequireds(List requiredPrototypes, out List requiredStations) - { - //Stations are required are ones that are vital to function but otherwise still follow a generic random spawn logic - //Traditionally these would be stations like Expedition Lodge, NFSD station, Prison/Courthouse POI, etc. - //There are no limit to these, and any prototype marked alwaysSpawn = true will get pulled out of any list that isnt Markets/Depots - //And will always appear every time, and also will not be included in other optional/dynamic lists - - requiredStations = new List(); - foreach (var proto in requiredPrototypes) - { - var offset = GetRandomPOICoord(proto.MinimumDistance, proto.MaximumDistance, true); - - if (TrySpawnPoiGrid(proto, offset, out var requiredUid) && requiredUid is { Valid: true } uid) - { - requiredStations.Add(uid); - AddStationCoordsToSet(offset); - } - } - } - - private void GenerateUniques(Dictionary> uniquePrototypes, out List uniqueStations) - { - //Unique locations are semi-dynamic groupings of POIs that rely each independantly on the SpawnChance per POI prototype - //Since these are the remainder, and logically must have custom-designated groupings, we can then know to subdivide - //our random pool into these found groups. - //To do this with an equal distribution on a per-POI, per-round percentage basis, we are going to ensure a random - //pick order of which we analyze our weighted chances to spawn, and if successful, remove every entry of that group - //entirely. - - uniqueStations = new List(); - foreach (var prototypeList in uniquePrototypes.Values) - { - // Try to spawn - _random.Shuffle(prototypeList); - foreach (var proto in prototypeList) - { - var chance = _random.NextFloat(0, 1); - if (chance <= proto.SpawnChance) - { - var offset = GetRandomPOICoord(proto.MinimumDistance, proto.MaximumDistance, true); - - if (TrySpawnPoiGrid(proto, offset, out var optionalUid) && optionalUid is { Valid: true } uid) - { - uniqueStations.Add(uid); - AddStationCoordsToSet(offset); - break; - } - } - } - } - } - - private bool TrySpawnPoiGrid(PointOfInterestPrototype proto, Vector2 offset, out EntityUid? gridUid, string? overrideName = null) - { - gridUid = null; - if (_map.TryLoad(_mapId, proto.GridPath.ToString(), out var mapUids, - new MapLoadOptions - { - Offset = offset, - Rotation = _random.NextAngle() - })) - { - - string stationName = string.IsNullOrEmpty(overrideName) ? proto.Name : overrideName; - - EntityUid? stationUid = null; - if (_prototypeManager.TryIndex(proto.ID, out var stationProto)) - { - stationUid = _station.InitializeNewStation(stationProto.Stations[proto.ID], mapUids, stationName); - } - - foreach (var grid in mapUids) - { - var meta = EnsureComp(grid); - _meta.SetEntityName(grid, stationName, meta); - - EntityManager.AddComponents(grid, proto.AddComponents); - } - - // Rename warp points after set up if needed - if (proto.NameWarp) - { - bool? hideWarp = proto.HideWarp ? true : null; - if (stationUid != null) - _renameWarps.SyncWarpPointsToStation(stationUid.Value, forceAdminOnly: hideWarp); - else - _renameWarps.SyncWarpPointsToGrids(mapUids, forceAdminOnly: hideWarp); - } - - gridUid = mapUids[0]; - return true; - } - - return false; - } - - private Vector2 GetRandomPOICoord(float unscaledMinRange, float unscaledMaxRange, bool scaleRange) - { - int numRetries = int.Max(_configurationManager.GetCVar(NFCCVars.POIPlacementRetries), 0); - float minDistance = float.Max(_configurationManager.GetCVar(NFCCVars.MinPOIDistance), 0); // Constant at the end to avoid NaN weirdness - - Vector2 coords = _random.NextVector2(unscaledMinRange, unscaledMaxRange); - if (scaleRange) - coords *= _distanceOffset; - for (int i = 0; i < numRetries; i++) - { - bool positionIsValid = true; - foreach (var station in _stationCoords) - { - if (Vector2.Distance(station, coords) < minDistance) - { - positionIsValid = false; - break; - } - } - - // We have a valid position - if (positionIsValid) - break; - - // No vector yet, get next value. - coords = _random.NextVector2(unscaledMinRange, unscaledMaxRange); - if (scaleRange) - coords *= _distanceOffset; - } - - return coords; - } - - private void AddStationCoordsToSet(Vector2 coords) - { - _stationCoords.Add(coords); - } - private async Task ReportRound(string message, int color = 0x77DDE7) { Logger.InfoS("discord", message); diff --git a/Content.Server/_NF/GameRule/PointOfInterestSystem.cs b/Content.Server/_NF/GameRule/PointOfInterestSystem.cs new file mode 100644 index 00000000000..7d13786d3cd --- /dev/null +++ b/Content.Server/_NF/GameRule/PointOfInterestSystem.cs @@ -0,0 +1,249 @@ +using System.Numerics; +using Content.Shared._NF.GameRule; +using Robust.Server.GameObjects; +using Robust.Server.Maps; +using Robust.Shared.Map; +using Robust.Shared.Prototypes; +using Robust.Shared.Random; +using Content.Server.Maps; +using Content.Server.Station.Systems; +using Content.Shared._NF.CCVar; // Frontier +using Robust.Shared.Configuration; + +namespace Content.Server._NF.GameRule; + +/// +/// This handles the dungeon and trading post spawning, as well as round end capitalism summary +/// +//[Access(typeof(NfAdventureRuleSystem))] +public sealed class PointOfInterestSystem : EntitySystem +{ + [Dependency] private readonly IPrototypeManager _prototypeManager = default!; + [Dependency] private readonly IRobustRandom _random = default!; + [Dependency] private readonly IConfigurationManager _configurationManager = default!; + [Dependency] private readonly MapLoaderSystem _map = default!; + [Dependency] private readonly MetaDataSystem _meta = default!; + [Dependency] private readonly StationSystem _station = default!; + [Dependency] private readonly StationRenameWarpsSystems _renameWarps = default!; + + private float _distanceOffset = 1f; + private List _stationCoords = new(); + private MapId _mapId; + + private void AddStationCoordsToSet(Vector2 coords) + { + _stationCoords.Add(coords); + } + + public void GenerateDepots(List depotPrototypes, out List depotStations) + { + //For depots, we want them to fill a circular type dystance formula to try to keep them as far apart as possible + //Therefore, we will be taking our range properties and treating them as magnitudes of a direction vector divided + //by the number of depots set in our corresponding cvar + + depotStations = new List(); + var depotCount = _configurationManager.GetCVar(NFCCVars.CargoDepots); + var rotation = 2 * Math.PI / depotCount; + var rotationOffset = _random.NextAngle() / depotCount; + + for (int i = 0; i < depotCount && depotPrototypes.Count > 0; i++) + { + var proto = _random.Pick(depotPrototypes); + Vector2i offset = new Vector2i((int) (_random.Next(proto.MinimumDistance, proto.MaximumDistance) * _distanceOffset), 0); + offset = offset.Rotate(rotationOffset); + rotationOffset += rotation; + // Append letter to depot name. + + string overrideName = proto.Name; + if (i < 26) + overrideName += $" {(char) ('A' + i)}"; // " A" ... " Z" + else + overrideName += $" {i + 1}"; // " 27", " 28"... + if (TrySpawnPoiGrid(proto, offset, out var depotUid, overrideName: overrideName) && depotUid is { Valid: true } depot) + { + depotStations.Add(depot); + AddStationCoordsToSet(offset); // adjust list of actual station coords + } + } + } + + public void GenerateMarkets(List marketPrototypes, out List marketStations) + { + //For market stations, we are going to allow for a bit of randomness and a different offset configuration. We dont + //want copies of this one, since these can be more themed and duplicate names, for instance, can make for a less + //ideal world + + marketStations = new List(); + var marketCount = _configurationManager.GetCVar(NFCCVars.MarketStations); + _random.Shuffle(marketPrototypes); + int marketsAdded = 0; + foreach (var proto in marketPrototypes) + { + if (marketsAdded >= marketCount) + break; + + var offset = GetRandomPOICoord(proto.MinimumDistance, proto.MaximumDistance, true); + + if (TrySpawnPoiGrid(proto, offset, out var marketUid) && marketUid is { Valid: true } market) + { + marketStations.Add(market); + marketsAdded++; + AddStationCoordsToSet(offset); + } + } + } + + public void GenerateOptionals(List optionalPrototypes, out List optionalStations) + { + //Stations that do not have a defined grouping in their prototype get a default of "Optional" and get put into the + //generic random rotation of POIs. This should include traditional places like Tinnia's rest, the Science Lab, The Pit, + //and most RP places. This will essentially put them all into a pool to pull from, and still does not use the RNG function. + + optionalStations = new List(); + var optionalCount = _configurationManager.GetCVar(NFCCVars.OptionalStations); + _random.Shuffle(optionalPrototypes); + int optionalsAdded = 0; + foreach (var proto in optionalPrototypes) + { + if (optionalsAdded >= optionalCount) + break; + + var offset = GetRandomPOICoord(proto.MinimumDistance, proto.MaximumDistance, true); + + if (TrySpawnPoiGrid(proto, offset, out var optionalUid) && optionalUid is { Valid: true } uid) + { + optionalStations.Add(uid); + AddStationCoordsToSet(offset); + } + } + } + + public void GenerateRequireds(List requiredPrototypes, out List requiredStations) + { + //Stations are required are ones that are vital to function but otherwise still follow a generic random spawn logic + //Traditionally these would be stations like Expedition Lodge, NFSD station, Prison/Courthouse POI, etc. + //There are no limit to these, and any prototype marked alwaysSpawn = true will get pulled out of any list that isnt Markets/Depots + //And will always appear every time, and also will not be included in other optional/dynamic lists + + requiredStations = new List(); + foreach (var proto in requiredPrototypes) + { + var offset = GetRandomPOICoord(proto.MinimumDistance, proto.MaximumDistance, true); + + if (TrySpawnPoiGrid(proto, offset, out var requiredUid) && requiredUid is { Valid: true } uid) + { + requiredStations.Add(uid); + AddStationCoordsToSet(offset); + } + } + } + + public void GenerateUniques(Dictionary> uniquePrototypes, out List uniqueStations) + { + //Unique locations are semi-dynamic groupings of POIs that rely each independantly on the SpawnChance per POI prototype + //Since these are the remainder, and logically must have custom-designated groupings, we can then know to subdivide + //our random pool into these found groups. + //To do this with an equal distribution on a per-POI, per-round percentage basis, we are going to ensure a random + //pick order of which we analyze our weighted chances to spawn, and if successful, remove every entry of that group + //entirely. + + uniqueStations = new List(); + foreach (var prototypeList in uniquePrototypes.Values) + { + // Try to spawn + _random.Shuffle(prototypeList); + foreach (var proto in prototypeList) + { + var chance = _random.NextFloat(0, 1); + if (chance <= proto.SpawnChance) + { + var offset = GetRandomPOICoord(proto.MinimumDistance, proto.MaximumDistance, true); + + if (TrySpawnPoiGrid(proto, offset, out var optionalUid) && optionalUid is { Valid: true } uid) + { + uniqueStations.Add(uid); + AddStationCoordsToSet(offset); + break; + } + } + } + } + } + + private bool TrySpawnPoiGrid(PointOfInterestPrototype proto, Vector2 offset, out EntityUid? gridUid, string? overrideName = null) + { + gridUid = null; + if (_map.TryLoad(_mapId, proto.GridPath.ToString(), out var mapUids, + new MapLoadOptions + { + Offset = offset, + Rotation = _random.NextAngle() + })) + { + + string stationName = string.IsNullOrEmpty(overrideName) ? proto.Name : overrideName; + + EntityUid? stationUid = null; + if (_prototypeManager.TryIndex(proto.ID, out var stationProto)) + { + stationUid = _station.InitializeNewStation(stationProto.Stations[proto.ID], mapUids, stationName); + } + + foreach (var grid in mapUids) + { + var meta = EnsureComp(grid); + _meta.SetEntityName(grid, stationName, meta); + + EntityManager.AddComponents(grid, proto.AddComponents); + } + + // Rename warp points after set up if needed + if (proto.NameWarp) + { + bool? hideWarp = proto.HideWarp ? true : null; + if (stationUid != null) + _renameWarps.SyncWarpPointsToStation(stationUid.Value, forceAdminOnly: hideWarp); + else + _renameWarps.SyncWarpPointsToGrids(mapUids, forceAdminOnly: hideWarp); + } + + gridUid = mapUids[0]; + return true; + } + + return false; + } + + private Vector2 GetRandomPOICoord(float unscaledMinRange, float unscaledMaxRange, bool scaleRange) + { + int numRetries = int.Max(_configurationManager.GetCVar(NFCCVars.POIPlacementRetries), 0); + float minDistance = float.Max(_configurationManager.GetCVar(NFCCVars.MinPOIDistance), 0); // Constant at the end to avoid NaN weirdness + + Vector2 coords = _random.NextVector2(unscaledMinRange, unscaledMaxRange); + if (scaleRange) + coords *= _distanceOffset; + for (int i = 0; i < numRetries; i++) + { + bool positionIsValid = true; + foreach (var station in _stationCoords) + { + if (Vector2.Distance(station, coords) < minDistance) + { + positionIsValid = false; + break; + } + } + + // We have a valid position + if (positionIsValid) + break; + + // No vector yet, get next value. + coords = _random.NextVector2(unscaledMinRange, unscaledMaxRange); + if (scaleRange) + coords *= _distanceOffset; + } + + return coords; + } +} diff --git a/Content.Shared/_NF/GameRule/PointOfInterestPrototype.cs b/Content.Shared/_NF/GameRule/PointOfInterestPrototype.cs index b1b11cd5963..ff35143e35c 100644 --- a/Content.Shared/_NF/GameRule/PointOfInterestPrototype.cs +++ b/Content.Shared/_NF/GameRule/PointOfInterestPrototype.cs @@ -1,22 +1,22 @@ using Robust.Shared.Prototypes; -using Robust.Shared.Serialization; using Robust.Shared.Utility; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List; +using System.Collections.Immutable; namespace Content.Shared._NF.GameRule; /// -/// Describes information for a single point of interest to be spawned in the world +/// Describes information for a single point of interest to be spawned in the world /// [Prototype("pointOfInterest")] [Serializable] public sealed partial class PointOfInterestPrototype : IPrototype { - /// [IdDataField] public string ID { get; private set; } = default!; /// - /// The name of this point of interest + /// The name of this point of interest /// [DataField(required: true)] public string Name { get; private set; } = ""; @@ -34,13 +34,13 @@ public sealed partial class PointOfInterestPrototype : IPrototype public bool HideWarp { get; set; } = false; /// - /// Minimum range to spawn this POI at + /// Minimum range to spawn this POI at /// [DataField] public int MinimumDistance { get; private set; } = 5000; /// - /// Maximum range to spawn this POI at + /// Maximum range to spawn this POI at /// [DataField] public int MaximumDistance { get; private set; } = 10000; @@ -52,29 +52,35 @@ public sealed partial class PointOfInterestPrototype : IPrototype public ComponentRegistry AddComponents { get; set; } = new(); /// - /// If the POI does not belong to a pre-defined group, it will default to the "unique" internal category and will - /// use this float from 0-1 as a raw chance to spawn each round. + /// What gamepresets ID this POI is allowed to spawn on. + /// + [DataField] + public string[] SpawnGamePreset { get; private set; } = { "Adventure", "Pirates" }; + + /// + /// If the POI does not belong to a pre-defined group, it will default to the "unique" internal category and will + /// use this float from 0-1 as a raw chance to spawn each round. /// [DataField] public float SpawnChance { get; private set; } = 1; /// - /// The group that this POI belongs to. Currently, the default groups are: - /// "CargoDepot" - /// "MarketStation" - /// "Required" - /// "Optional" - /// Each POI labeled in the Required group will be spawned in every round. - /// Apart from that, each of thesehave corresponding CVARS by default, that set an optional # of this group to spawn. - /// Traditionally, it is 2 cargo depots, 1 trade station, and 8 optional POIs. - /// Dynamically added groups will default to 1 option chosen in that group, using the SpawnChance as a weighted chance - /// for the entire group to spawn on a per-POI basis. + /// The group that this POI belongs to. Currently, the default groups are: + /// "CargoDepot" + /// "MarketStation" + /// "Required" + /// "Optional" + /// Each POI labeled in the Required group will be spawned in every round. + /// Apart from that, each of thesehave corresponding CVARS by default, that set an optional # of this group to spawn. + /// Traditionally, it is 2 cargo depots, 1 trade station, and 8 optional POIs. + /// Dynamically added groups will default to 1 option chosen in that group, using the SpawnChance as a weighted chance + /// for the entire group to spawn on a per-POI basis. /// [DataField] public string SpawnGroup { get; private set; } = "Optional"; /// - /// the path to the grid + /// the path to the grid /// [DataField(required: true)] public ResPath GridPath { get; private set; } = default!; From 516560954df33dc8494e5d2e05fc28d7afb533e7 Mon Sep 17 00:00:00 2001 From: Dvir Date: Tue, 10 Dec 2024 20:01:24 +0200 Subject: [PATCH 02/13] Poi Split Working --- .../_NF/GameRule/NfAdventureRuleSystem.cs | 30 ++++--------- .../_NF/GameRule/PointOfInterestSystem.cs | 42 ++++++++----------- 2 files changed, 26 insertions(+), 46 deletions(-) diff --git a/Content.Server/_NF/GameRule/NfAdventureRuleSystem.cs b/Content.Server/_NF/GameRule/NfAdventureRuleSystem.cs index 65de5df8de2..f1b67c28525 100644 --- a/Content.Server/_NF/GameRule/NfAdventureRuleSystem.cs +++ b/Content.Server/_NF/GameRule/NfAdventureRuleSystem.cs @@ -7,15 +7,12 @@ using System.Threading.Tasks; using Content.Shared._NF.GameRule; using Content.Server._NF.GameTicking.Events; -using Robust.Server.GameObjects; using Content.Shared.GameTicking.Components; using Robust.Shared.Map; using Robust.Shared.Prototypes; -using Robust.Shared.Random; using Content.Server.Cargo.Components; using Content.Server.GameTicking; using Content.Server.GameTicking.Rules; -using Content.Server.Station.Systems; using Content.Shared._NF.CCVar; // Frontier using Robust.Shared.Configuration; using Content.Shared._NF.Bank; @@ -26,6 +23,8 @@ using Content.Shared.GameTicking; using Robust.Shared.Enums; using Robust.Server.Player; +using Robust.Server.GameObjects; +using Robust.Shared.Collections; namespace Content.Server._NF.GameRule; @@ -35,14 +34,9 @@ namespace Content.Server._NF.GameRule; public sealed class NFAdventureRuleSystem : GameRuleSystem { [Dependency] private readonly IPrototypeManager _prototypeManager = default!; - [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IConfigurationManager _configurationManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!; - [Dependency] private readonly MapLoaderSystem _map = default!; - [Dependency] private readonly MetaDataSystem _meta = default!; - [Dependency] private readonly StationSystem _station = default!; [Dependency] private readonly BankSystem _bank = default!; - [Dependency] private readonly StationRenameWarpsSystems _renameWarps = default!; [Dependency] private readonly PointOfInterestSystem _poi = default!; private readonly HttpClient _httpClient = new(); @@ -72,11 +66,6 @@ public PlayerRoundBankInformation(int startBalance, string name, NetUserId userI [ViewVariables] private Dictionary _players = new(); - private float _distanceOffset = 1f; - private List _stationCoords = new(); - - private MapId _mapId; - /// public override void Initialize() { @@ -203,10 +192,7 @@ private void OnRoundRestart(RoundRestartCleanupEvent ev) protected override void Started(EntityUid uid, AdventureRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args) { - _mapId = GameTicker.DefaultMap; - - _distanceOffset = _configurationManager.GetCVar(NFCCVars.POIDistanceModifier); - _stationCoords = new List(); + var mapUid = GameTicker.DefaultMap; //First, we need to grab the list and sort it into its respective spawning logics List depotProtos = new(); @@ -232,11 +218,11 @@ protected override void Started(EntityUid uid, AdventureRuleComponent component, remainingUniqueProtosBySpawnGroup[location.SpawnGroup].Add(location); } } - _poi.GenerateDepots(depotProtos, out component.CargoDepots); - _poi.GenerateMarkets(marketProtos, out component.MarketStations); - _poi.GenerateRequireds(requiredProtos, out component.RequiredPois); - _poi.GenerateOptionals(optionalProtos, out component.OptionalPois); - _poi.GenerateUniques(remainingUniqueProtosBySpawnGroup, out component.UniquePois); + _poi.GenerateDepots(mapUid, depotProtos, out component.CargoDepots); + _poi.GenerateMarkets(mapUid, marketProtos, out component.MarketStations); + _poi.GenerateRequireds(mapUid, requiredProtos, out component.RequiredPois); + _poi.GenerateOptionals(mapUid, optionalProtos, out component.OptionalPois); + _poi.GenerateUniques(mapUid, remainingUniqueProtosBySpawnGroup, out component.UniquePois); base.Started(uid, component, gameRule, args); diff --git a/Content.Server/_NF/GameRule/PointOfInterestSystem.cs b/Content.Server/_NF/GameRule/PointOfInterestSystem.cs index 7d13786d3cd..3c7d7f61188 100644 --- a/Content.Server/_NF/GameRule/PointOfInterestSystem.cs +++ b/Content.Server/_NF/GameRule/PointOfInterestSystem.cs @@ -26,16 +26,14 @@ public sealed class PointOfInterestSystem : EntitySystem [Dependency] private readonly StationSystem _station = default!; [Dependency] private readonly StationRenameWarpsSystems _renameWarps = default!; - private float _distanceOffset = 1f; private List _stationCoords = new(); - private MapId _mapId; private void AddStationCoordsToSet(Vector2 coords) { _stationCoords.Add(coords); } - public void GenerateDepots(List depotPrototypes, out List depotStations) + public void GenerateDepots(MapId mapUid, List depotPrototypes, out List depotStations) { //For depots, we want them to fill a circular type dystance formula to try to keep them as far apart as possible //Therefore, we will be taking our range properties and treating them as magnitudes of a direction vector divided @@ -49,7 +47,7 @@ public void GenerateDepots(List depotPrototypes, out L for (int i = 0; i < depotCount && depotPrototypes.Count > 0; i++) { var proto = _random.Pick(depotPrototypes); - Vector2i offset = new Vector2i((int) (_random.Next(proto.MinimumDistance, proto.MaximumDistance) * _distanceOffset), 0); + Vector2i offset = new Vector2i((int) _random.Next(proto.MinimumDistance, proto.MaximumDistance), 0); offset = offset.Rotate(rotationOffset); rotationOffset += rotation; // Append letter to depot name. @@ -59,7 +57,7 @@ public void GenerateDepots(List depotPrototypes, out L overrideName += $" {(char) ('A' + i)}"; // " A" ... " Z" else overrideName += $" {i + 1}"; // " 27", " 28"... - if (TrySpawnPoiGrid(proto, offset, out var depotUid, overrideName: overrideName) && depotUid is { Valid: true } depot) + if (TrySpawnPoiGrid(mapUid, proto, offset, out var depotUid, overrideName: overrideName) && depotUid is { Valid: true } depot) { depotStations.Add(depot); AddStationCoordsToSet(offset); // adjust list of actual station coords @@ -67,7 +65,7 @@ public void GenerateDepots(List depotPrototypes, out L } } - public void GenerateMarkets(List marketPrototypes, out List marketStations) + public void GenerateMarkets(MapId mapUid, List marketPrototypes, out List marketStations) { //For market stations, we are going to allow for a bit of randomness and a different offset configuration. We dont //want copies of this one, since these can be more themed and duplicate names, for instance, can make for a less @@ -82,9 +80,9 @@ public void GenerateMarkets(List marketPrototypes, out if (marketsAdded >= marketCount) break; - var offset = GetRandomPOICoord(proto.MinimumDistance, proto.MaximumDistance, true); + var offset = GetRandomPOICoord(proto.MinimumDistance, proto.MaximumDistance); - if (TrySpawnPoiGrid(proto, offset, out var marketUid) && marketUid is { Valid: true } market) + if (TrySpawnPoiGrid(mapUid, proto, offset, out var marketUid) && marketUid is { Valid: true } market) { marketStations.Add(market); marketsAdded++; @@ -93,7 +91,7 @@ public void GenerateMarkets(List marketPrototypes, out } } - public void GenerateOptionals(List optionalPrototypes, out List optionalStations) + public void GenerateOptionals(MapId mapUid, List optionalPrototypes, out List optionalStations) { //Stations that do not have a defined grouping in their prototype get a default of "Optional" and get put into the //generic random rotation of POIs. This should include traditional places like Tinnia's rest, the Science Lab, The Pit, @@ -108,9 +106,9 @@ public void GenerateOptionals(List optionalPrototypes, if (optionalsAdded >= optionalCount) break; - var offset = GetRandomPOICoord(proto.MinimumDistance, proto.MaximumDistance, true); + var offset = GetRandomPOICoord(proto.MinimumDistance, proto.MaximumDistance); - if (TrySpawnPoiGrid(proto, offset, out var optionalUid) && optionalUid is { Valid: true } uid) + if (TrySpawnPoiGrid(mapUid, proto, offset, out var optionalUid) && optionalUid is { Valid: true } uid) { optionalStations.Add(uid); AddStationCoordsToSet(offset); @@ -118,7 +116,7 @@ public void GenerateOptionals(List optionalPrototypes, } } - public void GenerateRequireds(List requiredPrototypes, out List requiredStations) + public void GenerateRequireds(MapId mapUid, List requiredPrototypes, out List requiredStations) { //Stations are required are ones that are vital to function but otherwise still follow a generic random spawn logic //Traditionally these would be stations like Expedition Lodge, NFSD station, Prison/Courthouse POI, etc. @@ -128,9 +126,9 @@ public void GenerateRequireds(List requiredPrototypes, requiredStations = new List(); foreach (var proto in requiredPrototypes) { - var offset = GetRandomPOICoord(proto.MinimumDistance, proto.MaximumDistance, true); + var offset = GetRandomPOICoord(proto.MinimumDistance, proto.MaximumDistance); - if (TrySpawnPoiGrid(proto, offset, out var requiredUid) && requiredUid is { Valid: true } uid) + if (TrySpawnPoiGrid(mapUid, proto, offset, out var requiredUid) && requiredUid is { Valid: true } uid) { requiredStations.Add(uid); AddStationCoordsToSet(offset); @@ -138,7 +136,7 @@ public void GenerateRequireds(List requiredPrototypes, } } - public void GenerateUniques(Dictionary> uniquePrototypes, out List uniqueStations) + public void GenerateUniques(MapId mapUid, Dictionary> uniquePrototypes, out List uniqueStations) { //Unique locations are semi-dynamic groupings of POIs that rely each independantly on the SpawnChance per POI prototype //Since these are the remainder, and logically must have custom-designated groupings, we can then know to subdivide @@ -157,9 +155,9 @@ public void GenerateUniques(Dictionary> u var chance = _random.NextFloat(0, 1); if (chance <= proto.SpawnChance) { - var offset = GetRandomPOICoord(proto.MinimumDistance, proto.MaximumDistance, true); + var offset = GetRandomPOICoord(proto.MinimumDistance, proto.MaximumDistance); - if (TrySpawnPoiGrid(proto, offset, out var optionalUid) && optionalUid is { Valid: true } uid) + if (TrySpawnPoiGrid(mapUid, proto, offset, out var optionalUid) && optionalUid is { Valid: true } uid) { uniqueStations.Add(uid); AddStationCoordsToSet(offset); @@ -170,10 +168,10 @@ public void GenerateUniques(Dictionary> u } } - private bool TrySpawnPoiGrid(PointOfInterestPrototype proto, Vector2 offset, out EntityUid? gridUid, string? overrideName = null) + private bool TrySpawnPoiGrid(MapId mapUid, PointOfInterestPrototype proto, Vector2 offset, out EntityUid? gridUid, string? overrideName = null) { gridUid = null; - if (_map.TryLoad(_mapId, proto.GridPath.ToString(), out var mapUids, + if (_map.TryLoad(mapUid, proto.GridPath.ToString(), out var mapUids, new MapLoadOptions { Offset = offset, @@ -214,14 +212,12 @@ private bool TrySpawnPoiGrid(PointOfInterestPrototype proto, Vector2 offset, out return false; } - private Vector2 GetRandomPOICoord(float unscaledMinRange, float unscaledMaxRange, bool scaleRange) + private Vector2 GetRandomPOICoord(float unscaledMinRange, float unscaledMaxRange) { int numRetries = int.Max(_configurationManager.GetCVar(NFCCVars.POIPlacementRetries), 0); float minDistance = float.Max(_configurationManager.GetCVar(NFCCVars.MinPOIDistance), 0); // Constant at the end to avoid NaN weirdness Vector2 coords = _random.NextVector2(unscaledMinRange, unscaledMaxRange); - if (scaleRange) - coords *= _distanceOffset; for (int i = 0; i < numRetries; i++) { bool positionIsValid = true; @@ -240,8 +236,6 @@ private Vector2 GetRandomPOICoord(float unscaledMinRange, float unscaledMaxRange // No vector yet, get next value. coords = _random.NextVector2(unscaledMinRange, unscaledMaxRange); - if (scaleRange) - coords *= _distanceOffset; } return coords; From 28e751b0399d7467ca95743470664610f41db15b Mon Sep 17 00:00:00 2001 From: Dvir Date: Tue, 10 Dec 2024 21:17:38 +0200 Subject: [PATCH 03/13] Pirates base line --- Content.IntegrationTests/PoolSettings.cs | 4 +-- ...mponent.cs => NFAdventureRuleComponent.cs} | 2 +- .../_NF/GameRule/NfAdventureRuleSystem.cs | 9 ++---- .../_NF/GameRule/PointOfInterestSystem.cs | 29 +++++++++++++++++++ Content.Shared/CCVar/CCVars.cs | 2 +- .../_NF/GameRule/PointOfInterestPrototype.cs | 2 +- .../Prototypes/_NF/GameRules/roundstart.yml | 4 +-- .../Prototypes/_NF/PointsOfInterest/cove.yml | 1 + Resources/Prototypes/_NF/game_presets.yml | 22 ++++++++++++-- 9 files changed, 60 insertions(+), 15 deletions(-) rename Content.Server/_NF/GameRule/Components/{AdventureRuleComponent.cs => NFAdventureRuleComponent.cs} (86%) diff --git a/Content.IntegrationTests/PoolSettings.cs b/Content.IntegrationTests/PoolSettings.cs index 187af4569f9..5cebda0bfa1 100644 --- a/Content.IntegrationTests/PoolSettings.cs +++ b/Content.IntegrationTests/PoolSettings.cs @@ -1,4 +1,4 @@ -#nullable enable +#nullable enable using Robust.Shared.Random; @@ -93,7 +93,7 @@ public sealed class PoolSettings /// /// Frontier: the preset to run the game in. /// Set to secret for upstream tests to mimic upstream behaviour. - /// If you need to check adventure game rule things, set this to Adventure. + /// If you need to check adventure game rule things, set this to nfadventure or nfpirate. /// public string GameLobbyDefaultPreset { get; set; } = "secret"; diff --git a/Content.Server/_NF/GameRule/Components/AdventureRuleComponent.cs b/Content.Server/_NF/GameRule/Components/NFAdventureRuleComponent.cs similarity index 86% rename from Content.Server/_NF/GameRule/Components/AdventureRuleComponent.cs rename to Content.Server/_NF/GameRule/Components/NFAdventureRuleComponent.cs index 821bc298ed9..2ea4339bb70 100644 --- a/Content.Server/_NF/GameRule/Components/AdventureRuleComponent.cs +++ b/Content.Server/_NF/GameRule/Components/NFAdventureRuleComponent.cs @@ -1,7 +1,7 @@ namespace Content.Server._NF.GameRule.Components; [RegisterComponent, Access(typeof(NFAdventureRuleSystem))] -public sealed partial class AdventureRuleComponent : Component +public sealed partial class NFAdventureRuleComponent : Component { public List NFPlayerMinds = new(); public List CargoDepots = new(); diff --git a/Content.Server/_NF/GameRule/NfAdventureRuleSystem.cs b/Content.Server/_NF/GameRule/NfAdventureRuleSystem.cs index f1b67c28525..81452e22ffb 100644 --- a/Content.Server/_NF/GameRule/NfAdventureRuleSystem.cs +++ b/Content.Server/_NF/GameRule/NfAdventureRuleSystem.cs @@ -8,7 +8,6 @@ using Content.Shared._NF.GameRule; using Content.Server._NF.GameTicking.Events; using Content.Shared.GameTicking.Components; -using Robust.Shared.Map; using Robust.Shared.Prototypes; using Content.Server.Cargo.Components; using Content.Server.GameTicking; @@ -23,15 +22,13 @@ using Content.Shared.GameTicking; using Robust.Shared.Enums; using Robust.Server.Player; -using Robust.Server.GameObjects; -using Robust.Shared.Collections; namespace Content.Server._NF.GameRule; /// /// This handles the dungeon and trading post spawning, as well as round end capitalism summary /// -public sealed class NFAdventureRuleSystem : GameRuleSystem +public sealed class NFAdventureRuleSystem : GameRuleSystem { [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IConfigurationManager _configurationManager = default!; @@ -76,7 +73,7 @@ public override void Initialize() _playerManager.PlayerStatusChanged += PlayerManagerOnPlayerStatusChanged; } - protected override void AppendRoundEndText(EntityUid uid, AdventureRuleComponent component, GameRuleComponent gameRule, ref RoundEndTextAppendEvent ev) + protected override void AppendRoundEndText(EntityUid uid, NFAdventureRuleComponent component, GameRuleComponent gameRule, ref RoundEndTextAppendEvent ev) { ev.AddLine(Loc.GetString("adventure-list-start")); var allScore = new List>(); @@ -190,7 +187,7 @@ private void OnRoundRestart(RoundRestartCleanupEvent ev) _players.Clear(); } - protected override void Started(EntityUid uid, AdventureRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args) + protected override void Started(EntityUid uid, NFAdventureRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args) { var mapUid = GameTicker.DefaultMap; diff --git a/Content.Server/_NF/GameRule/PointOfInterestSystem.cs b/Content.Server/_NF/GameRule/PointOfInterestSystem.cs index 3c7d7f61188..0bf56a5d7c6 100644 --- a/Content.Server/_NF/GameRule/PointOfInterestSystem.cs +++ b/Content.Server/_NF/GameRule/PointOfInterestSystem.cs @@ -9,6 +9,9 @@ using Content.Server.Station.Systems; using Content.Shared._NF.CCVar; // Frontier using Robust.Shared.Configuration; +using Content.Server.GameTicking.Presets; +using Content.Server.GameTicking; +using System.Linq; namespace Content.Server._NF.GameRule; @@ -25,6 +28,7 @@ public sealed class PointOfInterestSystem : EntitySystem [Dependency] private readonly MetaDataSystem _meta = default!; [Dependency] private readonly StationSystem _station = default!; [Dependency] private readonly StationRenameWarpsSystems _renameWarps = default!; + [Dependency] private readonly GameTicker _ticker = default!; private List _stationCoords = new(); @@ -47,6 +51,11 @@ public void GenerateDepots(MapId mapUid, List depotPro for (int i = 0; i < depotCount && depotPrototypes.Count > 0; i++) { var proto = _random.Pick(depotPrototypes); + var currentPreset = _ticker.CurrentPreset!.ID; + + if (!proto.SpawnGamePreset.Contains(currentPreset)) + continue; + Vector2i offset = new Vector2i((int) _random.Next(proto.MinimumDistance, proto.MaximumDistance), 0); offset = offset.Rotate(rotationOffset); rotationOffset += rotation; @@ -77,6 +86,11 @@ public void GenerateMarkets(MapId mapUid, List marketP int marketsAdded = 0; foreach (var proto in marketPrototypes) { + var currentPreset = _ticker.CurrentPreset!.ID; + + if (!proto.SpawnGamePreset.Contains(currentPreset)) + continue; + if (marketsAdded >= marketCount) break; @@ -103,6 +117,11 @@ public void GenerateOptionals(MapId mapUid, List optio int optionalsAdded = 0; foreach (var proto in optionalPrototypes) { + var currentPreset = _ticker.CurrentPreset!.ID; + + if (!proto.SpawnGamePreset.Contains(currentPreset)) + continue; + if (optionalsAdded >= optionalCount) break; @@ -126,6 +145,11 @@ public void GenerateRequireds(MapId mapUid, List requi requiredStations = new List(); foreach (var proto in requiredPrototypes) { + var currentPreset = _ticker.CurrentPreset!.ID; + + if (!proto.SpawnGamePreset.Contains(currentPreset)) + continue; + var offset = GetRandomPOICoord(proto.MinimumDistance, proto.MaximumDistance); if (TrySpawnPoiGrid(mapUid, proto, offset, out var requiredUid) && requiredUid is { Valid: true } uid) @@ -152,6 +176,11 @@ public void GenerateUniques(MapId mapUid, Dictionary /// Controls the default game preset. /// public static readonly CVarDef - GameLobbyDefaultPreset = CVarDef.Create("game.defaultpreset", "adventure", CVar.ARCHIVE); // Frontier: secret /// Controls if the game can force a different preset if the current preset's criteria are not met. diff --git a/Content.Shared/_NF/GameRule/PointOfInterestPrototype.cs b/Content.Shared/_NF/GameRule/PointOfInterestPrototype.cs index ff35143e35c..8d0b0eb2a19 100644 --- a/Content.Shared/_NF/GameRule/PointOfInterestPrototype.cs +++ b/Content.Shared/_NF/GameRule/PointOfInterestPrototype.cs @@ -55,7 +55,7 @@ public sealed partial class PointOfInterestPrototype : IPrototype /// What gamepresets ID this POI is allowed to spawn on. /// [DataField] - public string[] SpawnGamePreset { get; private set; } = { "Adventure", "Pirates" }; + public string[] SpawnGamePreset { get; private set; } = { "NFAdventure", "NFPirate" }; /// /// If the POI does not belong to a pre-defined group, it will default to the "unique" internal category and will diff --git a/Resources/Prototypes/_NF/GameRules/roundstart.yml b/Resources/Prototypes/_NF/GameRules/roundstart.yml index 836fcc0a69b..a2214693626 100644 --- a/Resources/Prototypes/_NF/GameRules/roundstart.yml +++ b/Resources/Prototypes/_NF/GameRules/roundstart.yml @@ -1,9 +1,9 @@ - type: entity - id: Adventure + id: NFAdventure parent: BaseGameRule categories: [ HideSpawnMenu ] components: - - type: AdventureRule + - type: NFAdventureRule - type: entity id: BluespaceEventScheduler diff --git a/Resources/Prototypes/_NF/PointsOfInterest/cove.yml b/Resources/Prototypes/_NF/PointsOfInterest/cove.yml index 3a6810a9a91..f41c3382e8a 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/cove.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/cove.yml @@ -13,6 +13,7 @@ name: Pirate Cove minimumDistance: 10000 maximumDistance: 15000 + spawnGamePreset: NFPirate spawnGroup: Required gridPath: /Maps/_NF/POI/cove.yml hideWarp: true diff --git a/Resources/Prototypes/_NF/game_presets.yml b/Resources/Prototypes/_NF/game_presets.yml index b87244e0a7f..9fe3ee6783a 100644 --- a/Resources/Prototypes/_NF/game_presets.yml +++ b/Resources/Prototypes/_NF/game_presets.yml @@ -1,12 +1,30 @@ - type: gamePreset - id: Adventure + id: NFAdventure alias: + - nfadventure - adventure name: adventure-title description: adventure-description showInVote: false rules: - - Adventure + - NFAdventure + - BasicStationEventScheduler + - BluespaceEventScheduler + - BluespaceDungeonEventScheduler + - BluespaceSalvageEventScheduler + - SmugglingEventScheduler + - FrontierRoundstartVariation + +- type: gamePreset + id: NFPirate + alias: + - nfpirate + - pirate + name: adventure-title + description: adventure-description + showInVote: false + rules: + - NFAdventure - BasicStationEventScheduler - BluespaceEventScheduler - BluespaceDungeonEventScheduler From 40d5e6bd3f4ff536ba8080a6a9d9d975eca94300 Mon Sep 17 00:00:00 2001 From: Dvir Date: Tue, 10 Dec 2024 21:26:18 +0200 Subject: [PATCH 04/13] Pain --- Content.Shared/_NF/GameRule/PointOfInterestPrototype.cs | 2 +- Resources/Prototypes/_NF/PointsOfInterest/anomalousgeode.yml | 1 + Resources/Prototypes/_NF/PointsOfInterest/anomalouslab.yml | 1 + Resources/Prototypes/_NF/PointsOfInterest/bahamamamas.yml | 1 + Resources/Prototypes/_NF/PointsOfInterest/caseys.yml | 1 + Resources/Prototypes/_NF/PointsOfInterest/courthouse.yml | 1 + Resources/Prototypes/_NF/PointsOfInterest/depots.yml | 1 + Resources/Prototypes/_NF/PointsOfInterest/edison.yml | 1 + Resources/Prototypes/_NF/PointsOfInterest/grifty.yml | 1 + Resources/Prototypes/_NF/PointsOfInterest/lodge.yml | 1 + Resources/Prototypes/_NF/PointsOfInterest/lpbravo.yml | 1 + Resources/Prototypes/_NF/PointsOfInterest/mchobo.yml | 1 + Resources/Prototypes/_NF/PointsOfInterest/nfsd.yml | 1 + Resources/Prototypes/_NF/PointsOfInterest/northpole.yml | 1 + Resources/Prototypes/_NF/PointsOfInterest/omnichurch.yml | 1 + Resources/Prototypes/_NF/PointsOfInterest/thepit.yml | 1 + Resources/Prototypes/_NF/PointsOfInterest/tinniasrest.yml | 1 + Resources/Prototypes/_NF/PointsOfInterest/trade.yml | 1 + Resources/Prototypes/_NF/PointsOfInterest/trademall.yml | 1 + 19 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Content.Shared/_NF/GameRule/PointOfInterestPrototype.cs b/Content.Shared/_NF/GameRule/PointOfInterestPrototype.cs index 8d0b0eb2a19..6e08208de1a 100644 --- a/Content.Shared/_NF/GameRule/PointOfInterestPrototype.cs +++ b/Content.Shared/_NF/GameRule/PointOfInterestPrototype.cs @@ -55,7 +55,7 @@ public sealed partial class PointOfInterestPrototype : IPrototype /// What gamepresets ID this POI is allowed to spawn on. /// [DataField] - public string[] SpawnGamePreset { get; private set; } = { "NFAdventure", "NFPirate" }; + public string[] SpawnGamePreset { get; private set; } = []; /// /// If the POI does not belong to a pre-defined group, it will default to the "unique" internal category and will diff --git a/Resources/Prototypes/_NF/PointsOfInterest/anomalousgeode.yml b/Resources/Prototypes/_NF/PointsOfInterest/anomalousgeode.yml index b52fb814288..75bd26a5378 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/anomalousgeode.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/anomalousgeode.yml @@ -13,6 +13,7 @@ name: 'Anomalous Geode' minimumDistance: 2100 maximumDistance: 3800 + spawnGamePreset: [ "NFAdventure", "NFPirate" ] spawnGroup: ScienceLab gridPath: /Maps/_NF/POI/anomalousgeode.yml addComponents: diff --git a/Resources/Prototypes/_NF/PointsOfInterest/anomalouslab.yml b/Resources/Prototypes/_NF/PointsOfInterest/anomalouslab.yml index b3c705241ce..7a66ec346a6 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/anomalouslab.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/anomalouslab.yml @@ -13,6 +13,7 @@ name: 'Anomalous Lab' minimumDistance: 2100 maximumDistance: 3800 + spawnGamePreset: [ "NFAdventure", "NFPirate" ] spawnGroup: ScienceLab gridPath: /Maps/_NF/POI/anomalouslab.yml addComponents: diff --git a/Resources/Prototypes/_NF/PointsOfInterest/bahamamamas.yml b/Resources/Prototypes/_NF/PointsOfInterest/bahamamamas.yml index 9c89370ccc4..2925d1db5da 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/bahamamamas.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/bahamamamas.yml @@ -13,6 +13,7 @@ name: "Bahama Mama's" minimumDistance: 1200 maximumDistance: 2900 + spawnGamePreset: [ "NFAdventure", "NFPirate" ] spawnGroup: RestStop gridPath: /Maps/_NF/POI/bahama.yml addComponents: diff --git a/Resources/Prototypes/_NF/PointsOfInterest/caseys.yml b/Resources/Prototypes/_NF/PointsOfInterest/caseys.yml index e4ff899c439..5f05acaae01 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/caseys.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/caseys.yml @@ -13,6 +13,7 @@ name: "Crazy Casey's Casino" minimumDistance: 3250 maximumDistance: 5600 + spawnGamePreset: [ "NFAdventure", "NFPirate" ] gridPath: /Maps/_NF/POI/caseyscasino.yml addComponents: - type: IFF diff --git a/Resources/Prototypes/_NF/PointsOfInterest/courthouse.yml b/Resources/Prototypes/_NF/PointsOfInterest/courthouse.yml index e56ca7a0ff5..4fbc8e2e3ba 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/courthouse.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/courthouse.yml @@ -13,6 +13,7 @@ name: "Courthouse" minimumDistance: 1150 maximumDistance: 2050 + spawnGamePreset: [ "NFAdventure", "NFPirate" ] spawnGroup: Required gridPath: /Maps/_NF/POI/courthouse.yml addComponents: diff --git a/Resources/Prototypes/_NF/PointsOfInterest/depots.yml b/Resources/Prototypes/_NF/PointsOfInterest/depots.yml index d46469c1348..da10527981c 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/depots.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/depots.yml @@ -13,6 +13,7 @@ name: Cargo Depot minimumDistance: 4500 maximumDistance: 6000 + spawnGamePreset: [ "NFAdventure", "NFPirate" ] spawnGroup: CargoDepot gridPath: /Maps/_NF/POI/cargodepot.yml addComponents: diff --git a/Resources/Prototypes/_NF/PointsOfInterest/edison.yml b/Resources/Prototypes/_NF/PointsOfInterest/edison.yml index c06777fa9bb..b681530f625 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/edison.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/edison.yml @@ -13,6 +13,7 @@ # name: 'Edison Power Plant' # minimumDistance: 3650 # maximumDistance: 6400 + # spawnGamePreset: [ "NFAdventure", "NFPirate" ] # spawnGroup: Required # gridPath: /Maps/_NF/POI/edison.yml # addComponents: diff --git a/Resources/Prototypes/_NF/PointsOfInterest/grifty.yml b/Resources/Prototypes/_NF/PointsOfInterest/grifty.yml index 4b9d434f497..180685cb041 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/grifty.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/grifty.yml @@ -13,6 +13,7 @@ name: "Grifty's Gas n Grub" minimumDistance: 3250 maximumDistance: 5600 + spawnGamePreset: [ "NFAdventure", "NFPirate" ] spawnGroup: Scrapyard gridPath: /Maps/_NF/POI/grifty.yml addComponents: diff --git a/Resources/Prototypes/_NF/PointsOfInterest/lodge.yml b/Resources/Prototypes/_NF/PointsOfInterest/lodge.yml index b9d5ce3ebac..457de645064 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/lodge.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/lodge.yml @@ -13,6 +13,7 @@ name: 'Expeditionary Lodge' minimumDistance: 1650 maximumDistance: 3400 + spawnGamePreset: [ "NFAdventure", "NFPirate" ] spawnGroup: Required gridPath: /Maps/_NF/POI/lodge.yml addComponents: diff --git a/Resources/Prototypes/_NF/PointsOfInterest/lpbravo.yml b/Resources/Prototypes/_NF/PointsOfInterest/lpbravo.yml index 478b777968f..db887fed650 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/lpbravo.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/lpbravo.yml @@ -13,6 +13,7 @@ name: 'Listening Point Bravo' minimumDistance: 4000 maximumDistance: 6000 + spawnGamePreset: [ "NFAdventure", "NFPirate" ] spawnGroup: SyndicateFOB gridPath: /Maps/_NF/POI/lpbravo.yml hideWarp: true diff --git a/Resources/Prototypes/_NF/PointsOfInterest/mchobo.yml b/Resources/Prototypes/_NF/PointsOfInterest/mchobo.yml index ef4b3ece947..e96f14f479a 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/mchobo.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/mchobo.yml @@ -14,6 +14,7 @@ name: Derelict McCargo minimumDistance: 3250 maximumDistance: 5600 + spawnGamePreset: [ "NFAdventure", "NFPirate" ] spawnGroup: Scrapyard gridPath: /Maps/_NF/POI/mchobo.yml addComponents: diff --git a/Resources/Prototypes/_NF/PointsOfInterest/nfsd.yml b/Resources/Prototypes/_NF/PointsOfInterest/nfsd.yml index 09336a02ce0..191efb3995a 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/nfsd.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/nfsd.yml @@ -13,6 +13,7 @@ name: 'NFSD Outpost' minimumDistance: 750 maximumDistance: 1000 + spawnGamePreset: [ "NFAdventure", "NFPirate" ] spawnGroup: Required gridPath: /Maps/_NF/POI/nfsd.yml addComponents: diff --git a/Resources/Prototypes/_NF/PointsOfInterest/northpole.yml b/Resources/Prototypes/_NF/PointsOfInterest/northpole.yml index 59324e7c148..4bc1fe15b56 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/northpole.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/northpole.yml @@ -13,6 +13,7 @@ name: "The North Pole" minimumDistance: 2150 maximumDistance: 4850 + spawnGamePreset: [ "NFAdventure", "NFPirate" ] spawnGroup: Christmas spawnChance: 0 gridPath: /Maps/_NF/POI/northpole.yml diff --git a/Resources/Prototypes/_NF/PointsOfInterest/omnichurch.yml b/Resources/Prototypes/_NF/PointsOfInterest/omnichurch.yml index 43a8df90949..1369c5be8d5 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/omnichurch.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/omnichurch.yml @@ -13,6 +13,7 @@ name: "Omnichurch Beacon" minimumDistance: 2200 maximumDistance: 4900 + spawnGamePreset: [ "NFAdventure", "NFPirate" ] gridPath: /Maps/_NF/POI/beacon.yml addComponents: - type: IFF diff --git a/Resources/Prototypes/_NF/PointsOfInterest/thepit.yml b/Resources/Prototypes/_NF/PointsOfInterest/thepit.yml index 80ceac9e771..8671beb348f 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/thepit.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/thepit.yml @@ -13,6 +13,7 @@ name: "The Pit" minimumDistance: 2200 maximumDistance: 4200 + spawnGamePreset: [ "NFAdventure", "NFPirate" ] spawnGroup: Arena gridPath: /Maps/_NF/POI/arena.yml addComponents: diff --git a/Resources/Prototypes/_NF/PointsOfInterest/tinniasrest.yml b/Resources/Prototypes/_NF/PointsOfInterest/tinniasrest.yml index 5ca2436ec0b..3da0e81dd26 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/tinniasrest.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/tinniasrest.yml @@ -13,6 +13,7 @@ name: "Tinnia's Rest" minimumDistance: 1200 maximumDistance: 2900 + spawnGamePreset: [ "NFAdventure", "NFPirate" ] spawnGroup: RestStop gridPath: /Maps/_NF/POI/tinnia.yml addComponents: diff --git a/Resources/Prototypes/_NF/PointsOfInterest/trade.yml b/Resources/Prototypes/_NF/PointsOfInterest/trade.yml index 475cd67bf6a..8f2b9129c88 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/trade.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/trade.yml @@ -13,6 +13,7 @@ name: Trade Outpost minimumDistance: 1500 maximumDistance: 2500 + spawnGamePreset: [ "NFAdventure", "NFPirate" ] spawnGroup: MarketStation gridPath: /Maps/_NF/POI/trade.yml addComponents: diff --git a/Resources/Prototypes/_NF/PointsOfInterest/trademall.yml b/Resources/Prototypes/_NF/PointsOfInterest/trademall.yml index 5c14ca2b5ae..6d80b3c1574 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/trademall.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/trademall.yml @@ -13,6 +13,7 @@ name: Trade Mall minimumDistance: 1500 maximumDistance: 2500 + spawnGamePreset: [ "NFAdventure", "NFPirate" ] spawnGroup: MarketStation gridPath: /Maps/_NF/POI/trademall.yml addComponents: From e6652d2cf7472c8914789b2899ee6cb18d7de0e3 Mon Sep 17 00:00:00 2001 From: Dvir <39403717+dvir001@users.noreply.github.com> Date: Mon, 16 Dec 2024 15:59:37 +0200 Subject: [PATCH 05/13] Update PointOfInterestPrototype.cs --- .../_NF/GameRule/PointOfInterestPrototype.cs | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/Content.Shared/_NF/GameRule/PointOfInterestPrototype.cs b/Content.Shared/_NF/GameRule/PointOfInterestPrototype.cs index 6e08208de1a..f42bccf9c33 100644 --- a/Content.Shared/_NF/GameRule/PointOfInterestPrototype.cs +++ b/Content.Shared/_NF/GameRule/PointOfInterestPrototype.cs @@ -6,7 +6,7 @@ namespace Content.Shared._NF.GameRule; /// -/// Describes information for a single point of interest to be spawned in the world +/// Describes information for a single point of interest to be spawned in the world /// [Prototype("pointOfInterest")] [Serializable] @@ -16,71 +16,71 @@ public sealed partial class PointOfInterestPrototype : IPrototype public string ID { get; private set; } = default!; /// - /// The name of this point of interest + /// The name of this point of interest /// [DataField(required: true)] public string Name { get; private set; } = ""; /// - /// Should we set the warppoint name based on the grid name. + /// Should we set the warppoint name based on the grid name. /// [DataField] public bool NameWarp { get; set; } = true; /// - /// If true, makes the warp point admin-only (hiding it for players). + /// If true, makes the warp point admin-only (hiding it for players). /// [DataField] public bool HideWarp { get; set; } = false; /// - /// Minimum range to spawn this POI at + /// Minimum range to spawn this POI at /// [DataField] public int MinimumDistance { get; private set; } = 5000; /// - /// Maximum range to spawn this POI at + /// Maximum range to spawn this POI at /// [DataField] public int MaximumDistance { get; private set; } = 10000; /// - /// Components to be added to any spawned grids. + /// Components to be added to any spawned grids. /// [DataField] public ComponentRegistry AddComponents { get; set; } = new(); /// - /// What gamepresets ID this POI is allowed to spawn on. + /// What gamepresets ID this POI is allowed to spawn on. /// [DataField] public string[] SpawnGamePreset { get; private set; } = []; /// - /// If the POI does not belong to a pre-defined group, it will default to the "unique" internal category and will - /// use this float from 0-1 as a raw chance to spawn each round. + /// If the POI does not belong to a pre-defined group, it will default to the "unique" internal category and will + /// use this float from 0-1 as a raw chance to spawn each round. /// [DataField] public float SpawnChance { get; private set; } = 1; /// - /// The group that this POI belongs to. Currently, the default groups are: - /// "CargoDepot" - /// "MarketStation" - /// "Required" - /// "Optional" - /// Each POI labeled in the Required group will be spawned in every round. - /// Apart from that, each of thesehave corresponding CVARS by default, that set an optional # of this group to spawn. - /// Traditionally, it is 2 cargo depots, 1 trade station, and 8 optional POIs. - /// Dynamically added groups will default to 1 option chosen in that group, using the SpawnChance as a weighted chance - /// for the entire group to spawn on a per-POI basis. + /// The group that this POI belongs to. Currently, the default groups are: + /// "CargoDepot" + /// "MarketStation" + /// "Required" + /// "Optional" + /// Each POI labeled in the Required group will be spawned in every round. + /// Apart from that, each of thesehave corresponding CVARS by default, that set an optional # of this group to spawn. + /// Traditionally, it is 2 cargo depots, 1 trade station, and 8 optional POIs. + /// Dynamically added groups will default to 1 option chosen in that group, using the SpawnChance as a weighted chance + /// for the entire group to spawn on a per-POI basis. /// [DataField] public string SpawnGroup { get; private set; } = "Optional"; /// - /// the path to the grid + /// the path to the grid /// [DataField(required: true)] public ResPath GridPath { get; private set; } = default!; From 856e9ee90a8ea8a3132d53294efc2da0b75870ae Mon Sep 17 00:00:00 2001 From: Dvir <39403717+dvir001@users.noreply.github.com> Date: Mon, 16 Dec 2024 16:00:03 +0200 Subject: [PATCH 06/13] Update GamePresetPrototype.cs --- Content.Server/GameTicking/Presets/GamePresetPrototype.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Content.Server/GameTicking/Presets/GamePresetPrototype.cs b/Content.Server/GameTicking/Presets/GamePresetPrototype.cs index bd8bf6be1ca..1b5d66b1880 100644 --- a/Content.Server/GameTicking/Presets/GamePresetPrototype.cs +++ b/Content.Server/GameTicking/Presets/GamePresetPrototype.cs @@ -7,7 +7,7 @@ namespace Content.Server.GameTicking.Presets { /// - /// A round-start setup preset, such as which antagonists to spawn. + /// A round-start setup preset, such as which antagonists to spawn. /// [Prototype("gamePreset")] public sealed partial class GamePresetPrototype : IPrototype @@ -37,8 +37,8 @@ public sealed partial class GamePresetPrototype : IPrototype public IReadOnlyList Rules { get; private set; } = Array.Empty(); /// - /// If specified, the gamemode will only be run with these maps. - /// If none are elligible, the global fallback will be used. + /// If specified, the gamemode will only be run with these maps. + /// If none are elligible, the global fallback will be used. /// [DataField("supportedMaps", customTypeSerializer: typeof(PrototypeIdSerializer))] public string? MapPool; From 2fe6be694fbce5ae62045d9ba6b01783a8aa3ef0 Mon Sep 17 00:00:00 2001 From: Whatstone Date: Fri, 20 Dec 2024 13:55:37 -0500 Subject: [PATCH 07/13] Suggestions --- .../Systems/ShipyardSystem.Consoles.cs | 1 - .../_NF/GameRule/NfAdventureRuleSystem.cs | 2 -- .../_NF/GameRule/PointOfInterestPrototype.cs | 7 +++--- .../_NF/GameRule/PointOfInterestSystem.cs | 23 ++++++++++++++----- .../_NF/PointsOfInterest/anomalousgeode.yml | 2 +- .../_NF/PointsOfInterest/anomalouslab.yml | 4 ++-- .../_NF/PointsOfInterest/bahamamamas.yml | 2 +- .../_NF/PointsOfInterest/caseys.yml | 4 ++-- .../_NF/PointsOfInterest/courthouse.yml | 4 ++-- .../_NF/PointsOfInterest/depots.yml | 4 ++-- .../_NF/PointsOfInterest/edison.yml | 10 ++++---- .../_NF/PointsOfInterest/grifty.yml | 4 ++-- .../Prototypes/_NF/PointsOfInterest/lodge.yml | 2 +- .../_NF/PointsOfInterest/lpbravo.yml | 6 ++--- .../_NF/PointsOfInterest/mchobo.yml | 4 ++-- .../Prototypes/_NF/PointsOfInterest/nfsd.yml | 2 +- .../_NF/PointsOfInterest/northpole.yml | 6 ++--- .../_NF/PointsOfInterest/omnichurch.yml | 6 ++--- .../_NF/PointsOfInterest/thepit.yml | 2 +- .../_NF/PointsOfInterest/tinniasrest.yml | 2 +- .../Prototypes/_NF/PointsOfInterest/trade.yml | 2 +- .../_NF/PointsOfInterest/trademall.yml | 2 +- 22 files changed, 54 insertions(+), 47 deletions(-) rename {Content.Shared => Content.Server}/_NF/GameRule/PointOfInterestPrototype.cs (92%) diff --git a/Content.Server/Shipyard/Systems/ShipyardSystem.Consoles.cs b/Content.Server/Shipyard/Systems/ShipyardSystem.Consoles.cs index 62d225badd7..923371f3b1e 100644 --- a/Content.Server/Shipyard/Systems/ShipyardSystem.Consoles.cs +++ b/Content.Server/Shipyard/Systems/ShipyardSystem.Consoles.cs @@ -3,7 +3,6 @@ using Content.Server.Radio.EntitySystems; using Content.Server._NF.Bank; using Content.Server.Shipyard.Components; -using Content.Shared._NF.GameRule; using Content.Shared.Bank.Components; using Content.Shared.Shipyard.Events; using Content.Shared.Shipyard.BUI; diff --git a/Content.Server/_NF/GameRule/NfAdventureRuleSystem.cs b/Content.Server/_NF/GameRule/NfAdventureRuleSystem.cs index 81452e22ffb..68062cdb598 100644 --- a/Content.Server/_NF/GameRule/NfAdventureRuleSystem.cs +++ b/Content.Server/_NF/GameRule/NfAdventureRuleSystem.cs @@ -1,11 +1,9 @@ using System.Linq; using System.Net.Http; -using System.Numerics; using System.Text; using System.Text.Json; using System.Text.Json.Serialization; using System.Threading.Tasks; -using Content.Shared._NF.GameRule; using Content.Server._NF.GameTicking.Events; using Content.Shared.GameTicking.Components; using Robust.Shared.Prototypes; diff --git a/Content.Shared/_NF/GameRule/PointOfInterestPrototype.cs b/Content.Server/_NF/GameRule/PointOfInterestPrototype.cs similarity index 92% rename from Content.Shared/_NF/GameRule/PointOfInterestPrototype.cs rename to Content.Server/_NF/GameRule/PointOfInterestPrototype.cs index f42bccf9c33..f29cf76474e 100644 --- a/Content.Shared/_NF/GameRule/PointOfInterestPrototype.cs +++ b/Content.Server/_NF/GameRule/PointOfInterestPrototype.cs @@ -1,9 +1,8 @@ +using Content.Server.GameTicking.Presets; using Robust.Shared.Prototypes; using Robust.Shared.Utility; -using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List; -using System.Collections.Immutable; -namespace Content.Shared._NF.GameRule; +namespace Content.Server._NF.GameRule; /// /// Describes information for a single point of interest to be spawned in the world @@ -55,7 +54,7 @@ public sealed partial class PointOfInterestPrototype : IPrototype /// What gamepresets ID this POI is allowed to spawn on. /// [DataField] - public string[] SpawnGamePreset { get; private set; } = []; + public ProtoId[] SpawnGamePreset { get; private set; } = []; /// /// If the POI does not belong to a pre-defined group, it will default to the "unique" internal category and will diff --git a/Content.Server/_NF/GameRule/PointOfInterestSystem.cs b/Content.Server/_NF/GameRule/PointOfInterestSystem.cs index 0bf56a5d7c6..4e3d1c069cd 100644 --- a/Content.Server/_NF/GameRule/PointOfInterestSystem.cs +++ b/Content.Server/_NF/GameRule/PointOfInterestSystem.cs @@ -1,17 +1,16 @@ +using System.Linq; using System.Numerics; -using Content.Shared._NF.GameRule; using Robust.Server.GameObjects; using Robust.Server.Maps; +using Robust.Shared.Configuration; using Robust.Shared.Map; using Robust.Shared.Prototypes; using Robust.Shared.Random; using Content.Server.Maps; using Content.Server.Station.Systems; -using Content.Shared._NF.CCVar; // Frontier -using Robust.Shared.Configuration; -using Content.Server.GameTicking.Presets; using Content.Server.GameTicking; -using System.Linq; +using Content.Shared._NF.CCVar; +using Content.Shared.GameTicking; namespace Content.Server._NF.GameRule; @@ -32,6 +31,18 @@ public sealed class PointOfInterestSystem : EntitySystem private List _stationCoords = new(); + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnRoundRestart); + } + + private void OnRoundRestart(RoundRestartCleanupEvent ev) + { + _stationCoords.Clear(); + } + private void AddStationCoordsToSet(Vector2 coords) { _stationCoords.Add(coords); @@ -63,7 +74,7 @@ public void GenerateDepots(MapId mapUid, List depotPro string overrideName = proto.Name; if (i < 26) - overrideName += $" {(char) ('A' + i)}"; // " A" ... " Z" + overrideName += $" {(char)('A' + i)}"; // " A" ... " Z" else overrideName += $" {i + 1}"; // " 27", " 28"... if (TrySpawnPoiGrid(mapUid, proto, offset, out var depotUid, overrideName: overrideName) && depotUid is { Valid: true } depot) diff --git a/Resources/Prototypes/_NF/PointsOfInterest/anomalousgeode.yml b/Resources/Prototypes/_NF/PointsOfInterest/anomalousgeode.yml index 75bd26a5378..00644f0686e 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/anomalousgeode.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/anomalousgeode.yml @@ -13,7 +13,7 @@ name: 'Anomalous Geode' minimumDistance: 2100 maximumDistance: 3800 - spawnGamePreset: [ "NFAdventure", "NFPirate" ] + spawnGamePreset: [ NFAdventure, NFPirate ] spawnGroup: ScienceLab gridPath: /Maps/_NF/POI/anomalousgeode.yml addComponents: diff --git a/Resources/Prototypes/_NF/PointsOfInterest/anomalouslab.yml b/Resources/Prototypes/_NF/PointsOfInterest/anomalouslab.yml index 7a66ec346a6..6d6a37e5db0 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/anomalouslab.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/anomalouslab.yml @@ -1,6 +1,6 @@ # Author Info # GitHub: RealIHANOfficial (??) -# Discord: +# Discord: # Maintainer Info # GitHub: ??? @@ -13,7 +13,7 @@ name: 'Anomalous Lab' minimumDistance: 2100 maximumDistance: 3800 - spawnGamePreset: [ "NFAdventure", "NFPirate" ] + spawnGamePreset: [ NFAdventure, NFPirate ] spawnGroup: ScienceLab gridPath: /Maps/_NF/POI/anomalouslab.yml addComponents: diff --git a/Resources/Prototypes/_NF/PointsOfInterest/bahamamamas.yml b/Resources/Prototypes/_NF/PointsOfInterest/bahamamamas.yml index 2925d1db5da..794d1c19e1f 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/bahamamamas.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/bahamamamas.yml @@ -13,7 +13,7 @@ name: "Bahama Mama's" minimumDistance: 1200 maximumDistance: 2900 - spawnGamePreset: [ "NFAdventure", "NFPirate" ] + spawnGamePreset: [ NFAdventure, NFPirate ] spawnGroup: RestStop gridPath: /Maps/_NF/POI/bahama.yml addComponents: diff --git a/Resources/Prototypes/_NF/PointsOfInterest/caseys.yml b/Resources/Prototypes/_NF/PointsOfInterest/caseys.yml index 5f05acaae01..bad9005947c 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/caseys.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/caseys.yml @@ -1,5 +1,5 @@ # Author Info -# GitHub: +# GitHub: # Discord: Terezi (??) # Maintainer Info @@ -13,7 +13,7 @@ name: "Crazy Casey's Casino" minimumDistance: 3250 maximumDistance: 5600 - spawnGamePreset: [ "NFAdventure", "NFPirate" ] + spawnGamePreset: [ NFAdventure, NFPirate ] gridPath: /Maps/_NF/POI/caseyscasino.yml addComponents: - type: IFF diff --git a/Resources/Prototypes/_NF/PointsOfInterest/courthouse.yml b/Resources/Prototypes/_NF/PointsOfInterest/courthouse.yml index 4fbc8e2e3ba..a35d46d3eda 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/courthouse.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/courthouse.yml @@ -7,13 +7,13 @@ # Discord: ??? # Notes: -# +# - type: pointOfInterest id: Courthouse name: "Courthouse" minimumDistance: 1150 maximumDistance: 2050 - spawnGamePreset: [ "NFAdventure", "NFPirate" ] + spawnGamePreset: [ NFAdventure, NFPirate ] spawnGroup: Required gridPath: /Maps/_NF/POI/courthouse.yml addComponents: diff --git a/Resources/Prototypes/_NF/PointsOfInterest/depots.yml b/Resources/Prototypes/_NF/PointsOfInterest/depots.yml index da10527981c..0b8eae5b82c 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/depots.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/depots.yml @@ -13,7 +13,7 @@ name: Cargo Depot minimumDistance: 4500 maximumDistance: 6000 - spawnGamePreset: [ "NFAdventure", "NFPirate" ] + spawnGamePreset: [ NFAdventure, NFPirate ] spawnGroup: CargoDepot gridPath: /Maps/_NF/POI/cargodepot.yml addComponents: @@ -65,4 +65,4 @@ stationProto: MarketFrontierOutpost components: - type: StationNameSetup - mapNameTemplate: 'Cargo Depot' # Has a letter appended in NfAdventureSystem \ No newline at end of file + mapNameTemplate: 'Cargo Depot' # Has a letter appended in NfAdventureSystem diff --git a/Resources/Prototypes/_NF/PointsOfInterest/edison.yml b/Resources/Prototypes/_NF/PointsOfInterest/edison.yml index b681530f625..04bbf80b51d 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/edison.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/edison.yml @@ -1,5 +1,5 @@ # Author Info -# GitHub: +# GitHub: # Discord: Checkraze # Maintainer Info @@ -7,15 +7,15 @@ # Discord: ??? # Notes: -# +# # - type: pointOfInterest # id: Edison # name: 'Edison Power Plant' # minimumDistance: 3650 # maximumDistance: 6400 - # spawnGamePreset: [ "NFAdventure", "NFPirate" ] + # spawnGamePreset: [ NFAdventure, NFPirate ] # spawnGroup: Required - # gridPath: /Maps/_NF/POI/edison.yml + # gridPath: /Maps/_NF/POI/edison.yml # addComponents: # - type: IFF # color: "#3737C8" @@ -39,4 +39,4 @@ # availableJobs: # Pilot: [ 0, 0 ] # Mercenary: [ 0, 0 ] - # Contractor: [ 0, 0 ] \ No newline at end of file + # Contractor: [ 0, 0 ] diff --git a/Resources/Prototypes/_NF/PointsOfInterest/grifty.yml b/Resources/Prototypes/_NF/PointsOfInterest/grifty.yml index 180685cb041..cb5fce22f97 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/grifty.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/grifty.yml @@ -1,5 +1,5 @@ # Author Info -# GitHub: +# GitHub: # Discord: ??? # Maintainer Info @@ -13,7 +13,7 @@ name: "Grifty's Gas n Grub" minimumDistance: 3250 maximumDistance: 5600 - spawnGamePreset: [ "NFAdventure", "NFPirate" ] + spawnGamePreset: [ NFAdventure, NFPirate ] spawnGroup: Scrapyard gridPath: /Maps/_NF/POI/grifty.yml addComponents: diff --git a/Resources/Prototypes/_NF/PointsOfInterest/lodge.yml b/Resources/Prototypes/_NF/PointsOfInterest/lodge.yml index 457de645064..eb09273a2e4 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/lodge.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/lodge.yml @@ -13,7 +13,7 @@ name: 'Expeditionary Lodge' minimumDistance: 1650 maximumDistance: 3400 - spawnGamePreset: [ "NFAdventure", "NFPirate" ] + spawnGamePreset: [ NFAdventure, NFPirate ] spawnGroup: Required gridPath: /Maps/_NF/POI/lodge.yml addComponents: diff --git a/Resources/Prototypes/_NF/PointsOfInterest/lpbravo.yml b/Resources/Prototypes/_NF/PointsOfInterest/lpbravo.yml index db887fed650..7f135395d5b 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/lpbravo.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/lpbravo.yml @@ -1,5 +1,5 @@ # Author Info -# GitHub: +# GitHub: # Discord: Checkraze # Maintainer Info @@ -13,7 +13,7 @@ name: 'Listening Point Bravo' minimumDistance: 4000 maximumDistance: 6000 - spawnGamePreset: [ "NFAdventure", "NFPirate" ] + spawnGamePreset: [ NFAdventure, NFPirate ] spawnGroup: SyndicateFOB gridPath: /Maps/_NF/POI/lpbravo.yml hideWarp: true @@ -40,4 +40,4 @@ mapNameTemplate: 'Listening Point Bravo' - type: StationJobs availableJobs: {} - - type: StationDeadDropHintExempt \ No newline at end of file + - type: StationDeadDropHintExempt diff --git a/Resources/Prototypes/_NF/PointsOfInterest/mchobo.yml b/Resources/Prototypes/_NF/PointsOfInterest/mchobo.yml index e96f14f479a..aa6a3e70c2b 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/mchobo.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/mchobo.yml @@ -8,13 +8,13 @@ # Notes: # Dumping ground of broken dreams and broken ships. -# Based on the McCargo built by Dvir01 (https://github.com/dvir001) and ruined with drunken pride by Tych0. +# Based on the McCargo built by Dvir01 (https://github.com/dvir001) and ruined with drunken pride by Tych0. - type: pointOfInterest id: McHobo name: Derelict McCargo minimumDistance: 3250 maximumDistance: 5600 - spawnGamePreset: [ "NFAdventure", "NFPirate" ] + spawnGamePreset: [ NFAdventure, NFPirate ] spawnGroup: Scrapyard gridPath: /Maps/_NF/POI/mchobo.yml addComponents: diff --git a/Resources/Prototypes/_NF/PointsOfInterest/nfsd.yml b/Resources/Prototypes/_NF/PointsOfInterest/nfsd.yml index 191efb3995a..d993915f438 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/nfsd.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/nfsd.yml @@ -13,7 +13,7 @@ name: 'NFSD Outpost' minimumDistance: 750 maximumDistance: 1000 - spawnGamePreset: [ "NFAdventure", "NFPirate" ] + spawnGamePreset: [ NFAdventure, NFPirate ] spawnGroup: Required gridPath: /Maps/_NF/POI/nfsd.yml addComponents: diff --git a/Resources/Prototypes/_NF/PointsOfInterest/northpole.yml b/Resources/Prototypes/_NF/PointsOfInterest/northpole.yml index 4bc1fe15b56..47a9c84fc8b 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/northpole.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/northpole.yml @@ -1,5 +1,5 @@ # Author Info -# GitHub: +# GitHub: # Discord: Checkraze # Maintainer Info @@ -13,7 +13,7 @@ name: "The North Pole" minimumDistance: 2150 maximumDistance: 4850 - spawnGamePreset: [ "NFAdventure", "NFPirate" ] + spawnGamePreset: [ NFAdventure, NFPirate ] spawnGroup: Christmas spawnChance: 0 gridPath: /Maps/_NF/POI/northpole.yml @@ -24,4 +24,4 @@ flags: [HideLabel] - type: Shuttle angularDamping: 999999 - linearDamping: 999999 \ No newline at end of file + linearDamping: 999999 diff --git a/Resources/Prototypes/_NF/PointsOfInterest/omnichurch.yml b/Resources/Prototypes/_NF/PointsOfInterest/omnichurch.yml index 1369c5be8d5..8a0861058c2 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/omnichurch.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/omnichurch.yml @@ -7,13 +7,13 @@ # Discord: ??? # Notes: -# +# - type: pointOfInterest id: Omnichurch name: "Omnichurch Beacon" minimumDistance: 2200 maximumDistance: 4900 - spawnGamePreset: [ "NFAdventure", "NFPirate" ] + spawnGamePreset: [ NFAdventure, NFPirate ] gridPath: /Maps/_NF/POI/beacon.yml addComponents: - type: IFF @@ -21,4 +21,4 @@ readOnly: true - type: Shuttle angularDamping: 999999 - linearDamping: 999999 \ No newline at end of file + linearDamping: 999999 diff --git a/Resources/Prototypes/_NF/PointsOfInterest/thepit.yml b/Resources/Prototypes/_NF/PointsOfInterest/thepit.yml index 8671beb348f..8a13ec26b97 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/thepit.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/thepit.yml @@ -13,7 +13,7 @@ name: "The Pit" minimumDistance: 2200 maximumDistance: 4200 - spawnGamePreset: [ "NFAdventure", "NFPirate" ] + spawnGamePreset: [ NFAdventure, NFPirate ] spawnGroup: Arena gridPath: /Maps/_NF/POI/arena.yml addComponents: diff --git a/Resources/Prototypes/_NF/PointsOfInterest/tinniasrest.yml b/Resources/Prototypes/_NF/PointsOfInterest/tinniasrest.yml index 3da0e81dd26..c7f48701a94 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/tinniasrest.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/tinniasrest.yml @@ -13,7 +13,7 @@ name: "Tinnia's Rest" minimumDistance: 1200 maximumDistance: 2900 - spawnGamePreset: [ "NFAdventure", "NFPirate" ] + spawnGamePreset: [ NFAdventure, NFPirate ] spawnGroup: RestStop gridPath: /Maps/_NF/POI/tinnia.yml addComponents: diff --git a/Resources/Prototypes/_NF/PointsOfInterest/trade.yml b/Resources/Prototypes/_NF/PointsOfInterest/trade.yml index 8f2b9129c88..555f321139b 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/trade.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/trade.yml @@ -13,7 +13,7 @@ name: Trade Outpost minimumDistance: 1500 maximumDistance: 2500 - spawnGamePreset: [ "NFAdventure", "NFPirate" ] + spawnGamePreset: [ NFAdventure, NFPirate ] spawnGroup: MarketStation gridPath: /Maps/_NF/POI/trade.yml addComponents: diff --git a/Resources/Prototypes/_NF/PointsOfInterest/trademall.yml b/Resources/Prototypes/_NF/PointsOfInterest/trademall.yml index 6d80b3c1574..9b7e75158fb 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/trademall.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/trademall.yml @@ -13,7 +13,7 @@ name: Trade Mall minimumDistance: 1500 maximumDistance: 2500 - spawnGamePreset: [ "NFAdventure", "NFPirate" ] + spawnGamePreset: [ NFAdventure, NFPirate ] spawnGroup: MarketStation gridPath: /Maps/_NF/POI/trademall.yml addComponents: From 579235c673e1931760263db5cb7d7979750a316d Mon Sep 17 00:00:00 2001 From: Whatstone Date: Fri, 20 Dec 2024 14:10:41 -0500 Subject: [PATCH 08/13] showInVote, pirate vs. adventure names/description --- Resources/Locale/en-US/_NF/adventure/adventure.ftl | 8 ++++++-- Resources/Prototypes/_NF/game_presets.yml | 4 ++-- Resources/Prototypes/game_presets.yml | 10 +++++----- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Resources/Locale/en-US/_NF/adventure/adventure.ftl b/Resources/Locale/en-US/_NF/adventure/adventure.ftl index 3e1a1268163..9ee3991db5d 100644 --- a/Resources/Locale/en-US/_NF/adventure/adventure.ftl +++ b/Resources/Locale/en-US/_NF/adventure/adventure.ftl @@ -11,8 +11,12 @@ adventure-webhook-top-loss = lost a total of {$amount}. adventure-webhook-ledger-start = Ledger Summary -adventure-title = New Frontier Adventure Mode -adventure-description = Join a ship crew or buy your own and explore, research, salvage, or haul your way to riches! +nf-adventure-title = Adventure +nf-adventure-description = Join a ship crew or buy your own and explore, research, salvage, or haul your way to riches! + +nf-pirate-title = Pirates +nf-pirate-description = A gang of pirates is on the loose! Take care out in space and try not to get plundered! + currency = Spesos shipyard-rules-default1 = diff --git a/Resources/Prototypes/_NF/game_presets.yml b/Resources/Prototypes/_NF/game_presets.yml index 9fe3ee6783a..de04807683b 100644 --- a/Resources/Prototypes/_NF/game_presets.yml +++ b/Resources/Prototypes/_NF/game_presets.yml @@ -5,7 +5,7 @@ - adventure name: adventure-title description: adventure-description - showInVote: false + showInVote: true rules: - NFAdventure - BasicStationEventScheduler @@ -22,7 +22,7 @@ - pirate name: adventure-title description: adventure-description - showInVote: false + showInVote: true rules: - NFAdventure - BasicStationEventScheduler diff --git a/Resources/Prototypes/game_presets.yml b/Resources/Prototypes/game_presets.yml index 945b4a8c83b..ad66624f7f5 100644 --- a/Resources/Prototypes/game_presets.yml +++ b/Resources/Prototypes/game_presets.yml @@ -91,7 +91,7 @@ showInVote: false #4boring4vote description: greenshift-description rules: - - SpaceTrafficControlFriendlyEventScheduler + - SpaceTrafficControlFriendlyEventScheduler - BasicRoundstartVariation - type: gamePreset @@ -100,7 +100,7 @@ - secret - sekrit name: secret-title - showInVote: true + showInVote: false # Frontier: true < false description: secret-description rules: - Secret @@ -126,7 +126,7 @@ showInVote: false #Admin Use description: secret-description rules: - - SpaceTrafficControlFriendlyEventScheduler + - SpaceTrafficControlFriendlyEventScheduler - BasicRoundstartVariation - type: gamePreset @@ -164,7 +164,7 @@ name: death-match-title description: death-match-description maxPlayers: 15 - showInVote: true + showInVote: false # Frontier: true < false supportedMaps: DeathMatchMapPool rules: - DeathMatch31 @@ -233,4 +233,4 @@ - BasicStationEventScheduler - KesslerSyndromeScheduler - SpaceTrafficControlEventScheduler - - BasicRoundstartVariation \ No newline at end of file + - BasicRoundstartVariation From 58d066ae8a4f871c206680d07a906133a48ccafa Mon Sep 17 00:00:00 2001 From: Whatstone Date: Fri, 20 Dec 2024 14:13:37 -0500 Subject: [PATCH 09/13] uncommitted changes --- Resources/Prototypes/_NF/game_presets.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Resources/Prototypes/_NF/game_presets.yml b/Resources/Prototypes/_NF/game_presets.yml index de04807683b..6c39e92fdb9 100644 --- a/Resources/Prototypes/_NF/game_presets.yml +++ b/Resources/Prototypes/_NF/game_presets.yml @@ -3,8 +3,8 @@ alias: - nfadventure - adventure - name: adventure-title - description: adventure-description + name: nf-adventure-title + description: nf-adventure-description showInVote: true rules: - NFAdventure @@ -20,8 +20,8 @@ alias: - nfpirate - pirate - name: adventure-title - description: adventure-description + name: nf-pirate-title + description: nf-pirate-description showInVote: true rules: - NFAdventure From a7762a9215a84da4f5738cbca2915204310cde2c Mon Sep 17 00:00:00 2001 From: Whatstone Date: Fri, 20 Dec 2024 14:29:38 -0500 Subject: [PATCH 10/13] Fix cove linter issue --- Resources/Prototypes/_NF/PointsOfInterest/cove.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/Prototypes/_NF/PointsOfInterest/cove.yml b/Resources/Prototypes/_NF/PointsOfInterest/cove.yml index f41c3382e8a..57bb4d1c336 100644 --- a/Resources/Prototypes/_NF/PointsOfInterest/cove.yml +++ b/Resources/Prototypes/_NF/PointsOfInterest/cove.yml @@ -13,7 +13,7 @@ name: Pirate Cove minimumDistance: 10000 maximumDistance: 15000 - spawnGamePreset: NFPirate + spawnGamePreset: [ NFPirate ] spawnGroup: Required gridPath: /Maps/_NF/POI/cove.yml hideWarp: true From bddfdf1a9a41e50258e4bdebe960ba484ff8ea2f Mon Sep 17 00:00:00 2001 From: Whatstone Date: Fri, 20 Dec 2024 14:58:16 -0500 Subject: [PATCH 11/13] POISystem: handle null preset --- .../_NF/GameRule/PointOfInterestSystem.cs | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/Content.Server/_NF/GameRule/PointOfInterestSystem.cs b/Content.Server/_NF/GameRule/PointOfInterestSystem.cs index 4e3d1c069cd..16bad0ed8a0 100644 --- a/Content.Server/_NF/GameRule/PointOfInterestSystem.cs +++ b/Content.Server/_NF/GameRule/PointOfInterestSystem.cs @@ -59,10 +59,14 @@ public void GenerateDepots(MapId mapUid, List depotPro var rotation = 2 * Math.PI / depotCount; var rotationOffset = _random.NextAngle() / depotCount; + if (_ticker.CurrentPreset is null) + return; + + var currentPreset = _ticker.CurrentPreset.ID; + for (int i = 0; i < depotCount && depotPrototypes.Count > 0; i++) { var proto = _random.Pick(depotPrototypes); - var currentPreset = _ticker.CurrentPreset!.ID; if (!proto.SpawnGamePreset.Contains(currentPreset)) continue; @@ -95,10 +99,13 @@ public void GenerateMarkets(MapId mapUid, List marketP var marketCount = _configurationManager.GetCVar(NFCCVars.MarketStations); _random.Shuffle(marketPrototypes); int marketsAdded = 0; + + if (_ticker.CurrentPreset is null) + return; + var currentPreset = _ticker.CurrentPreset.ID; + foreach (var proto in marketPrototypes) { - var currentPreset = _ticker.CurrentPreset!.ID; - if (!proto.SpawnGamePreset.Contains(currentPreset)) continue; @@ -126,10 +133,13 @@ public void GenerateOptionals(MapId mapUid, List optio var optionalCount = _configurationManager.GetCVar(NFCCVars.OptionalStations); _random.Shuffle(optionalPrototypes); int optionalsAdded = 0; + + if (_ticker.CurrentPreset is null) + return; + var currentPreset = _ticker.CurrentPreset.ID; + foreach (var proto in optionalPrototypes) { - var currentPreset = _ticker.CurrentPreset!.ID; - if (!proto.SpawnGamePreset.Contains(currentPreset)) continue; @@ -152,12 +162,13 @@ public void GenerateRequireds(MapId mapUid, List requi //Traditionally these would be stations like Expedition Lodge, NFSD station, Prison/Courthouse POI, etc. //There are no limit to these, and any prototype marked alwaysSpawn = true will get pulled out of any list that isnt Markets/Depots //And will always appear every time, and also will not be included in other optional/dynamic lists + if (_ticker.CurrentPreset is null) + return; + var currentPreset = _ticker.CurrentPreset!.ID; requiredStations = new List(); foreach (var proto in requiredPrototypes) { - var currentPreset = _ticker.CurrentPreset!.ID; - if (!proto.SpawnGamePreset.Contains(currentPreset)) continue; @@ -179,6 +190,9 @@ public void GenerateUniques(MapId mapUid, Dictionary(); foreach (var prototypeList in uniquePrototypes.Values) @@ -187,8 +201,6 @@ public void GenerateUniques(MapId mapUid, Dictionary Date: Fri, 20 Dec 2024 14:59:18 -0500 Subject: [PATCH 12/13] Define output vars --- Content.Server/_NF/GameRule/PointOfInterestSystem.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Content.Server/_NF/GameRule/PointOfInterestSystem.cs b/Content.Server/_NF/GameRule/PointOfInterestSystem.cs index 16bad0ed8a0..d58a70b924a 100644 --- a/Content.Server/_NF/GameRule/PointOfInterestSystem.cs +++ b/Content.Server/_NF/GameRule/PointOfInterestSystem.cs @@ -162,11 +162,13 @@ public void GenerateRequireds(MapId mapUid, List requi //Traditionally these would be stations like Expedition Lodge, NFSD station, Prison/Courthouse POI, etc. //There are no limit to these, and any prototype marked alwaysSpawn = true will get pulled out of any list that isnt Markets/Depots //And will always appear every time, and also will not be included in other optional/dynamic lists + + requiredStations = new List(); + if (_ticker.CurrentPreset is null) return; var currentPreset = _ticker.CurrentPreset!.ID; - requiredStations = new List(); foreach (var proto in requiredPrototypes) { if (!proto.SpawnGamePreset.Contains(currentPreset)) @@ -190,11 +192,13 @@ public void GenerateUniques(MapId mapUid, Dictionary(); + if (_ticker.CurrentPreset is null) return; var currentPreset = _ticker.CurrentPreset!.ID; - uniqueStations = new List(); foreach (var prototypeList in uniquePrototypes.Values) { // Try to spawn From e6155c4d752a87cc9c1d707955e61ae20b9e7fbc Mon Sep 17 00:00:00 2001 From: Dvir <39403717+dvir001@users.noreply.github.com> Date: Sat, 21 Dec 2024 02:17:48 +0200 Subject: [PATCH 13/13] Update GamePresetPrototype.cs --- Content.Server/GameTicking/Presets/GamePresetPrototype.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Content.Server/GameTicking/Presets/GamePresetPrototype.cs b/Content.Server/GameTicking/Presets/GamePresetPrototype.cs index 1b5d66b1880..4731364ace2 100644 --- a/Content.Server/GameTicking/Presets/GamePresetPrototype.cs +++ b/Content.Server/GameTicking/Presets/GamePresetPrototype.cs @@ -37,8 +37,8 @@ public sealed partial class GamePresetPrototype : IPrototype public IReadOnlyList Rules { get; private set; } = Array.Empty(); /// - /// If specified, the gamemode will only be run with these maps. - /// If none are elligible, the global fallback will be used. + /// If specified, the gamemode will only be run with these maps. + /// If none are elligible, the global fallback will be used. /// [DataField("supportedMaps", customTypeSerializer: typeof(PrototypeIdSerializer))] public string? MapPool;