From 7f840afdb7378c049d8f92f9bc987e49675d0f15 Mon Sep 17 00:00:00 2001 From: Whatstone <166147148+whatston3@users.noreply.github.com> Date: Tue, 22 Oct 2024 12:47:11 -0400 Subject: [PATCH] Push space dungeons into gameset, name dungeons (#2301) --- .../_NF/GameRule/Components/AdventureRuleComponent.cs | 6 ++++++ Content.Server/_NF/GameRule/NfAdventureRuleSystem.cs | 9 +++++---- Content.Shared/Procedural/DungeonConfig.cs | 5 ----- Resources/Locale/en-US/_NF/adventure/adventure.ftl | 4 +++- Resources/Prototypes/Procedural/dungeon_configs.yml | 1 - Resources/Prototypes/_NF/GameRules/roundstart.yml | 11 +++++++++++ .../Prototypes/_NF/Procedural/dungeon_configs.yml | 1 - 7 files changed, 25 insertions(+), 12 deletions(-) diff --git a/Content.Server/_NF/GameRule/Components/AdventureRuleComponent.cs b/Content.Server/_NF/GameRule/Components/AdventureRuleComponent.cs index e0e47ce0c2b..401228dae80 100644 --- a/Content.Server/_NF/GameRule/Components/AdventureRuleComponent.cs +++ b/Content.Server/_NF/GameRule/Components/AdventureRuleComponent.cs @@ -1,3 +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))] @@ -9,4 +12,7 @@ public sealed partial class AdventureRuleComponent : Component public List RequiredPois = new(); public List OptionalPois = new(); public List UniquePois = new(); + + [DataField(customTypeSerializer: typeof(PrototypeIdListSerializer))] + public List SpaceDungeons = new(); } diff --git a/Content.Server/_NF/GameRule/NfAdventureRuleSystem.cs b/Content.Server/_NF/GameRule/NfAdventureRuleSystem.cs index 475fe794447..38b95c90759 100644 --- a/Content.Server/_NF/GameRule/NfAdventureRuleSystem.cs +++ b/Content.Server/_NF/GameRule/NfAdventureRuleSystem.cs @@ -257,11 +257,9 @@ protected override void Started(EntityUid uid, AdventureRuleComponent component, // Using invalid entity, we don't have a relevant entity to reference here. RaiseLocalEvent(EntityUid.Invalid, new StationsGeneratedEvent(), broadcast: true); // TODO: attach this to a meaningful entity. - var dungenTypes = _prototypeManager.EnumeratePrototypes(); - - foreach (var dunGen in dungenTypes) + foreach (var dungeonProto in component.SpaceDungeons) { - if (dunGen.SkipDungeonGen) + if (!_prototypeManager.TryIndex(dungeonProto, out var dunGen)) continue; var seed = _random.Next(); @@ -279,6 +277,9 @@ protected override void Started(EntityUid uid, AdventureRuleComponent component, _shuttle.AddIFFFlag(grids[0], IFFFlags.HideLabel); _console.WriteLine(null, $"dungeon spawned at {offset}"); + string dungeonName = Loc.GetString("adventure-space-dungeon-name", ("dungeonPrototype", dungeonProto)); + _meta.SetEntityName(grids[0], dungeonName); + //pls fit the grid I beg, this is so hacky //its better now but i think i need to do a normalization pass on the dungeon configs //because they are all offset. confirmed good size grid, just need to fix all the offsets. diff --git a/Content.Shared/Procedural/DungeonConfig.cs b/Content.Shared/Procedural/DungeonConfig.cs index 2b2ced9685d..c4093741ec0 100644 --- a/Content.Shared/Procedural/DungeonConfig.cs +++ b/Content.Shared/Procedural/DungeonConfig.cs @@ -53,9 +53,4 @@ public sealed class DungeonConfigPrototype : DungeonConfig, IPrototype { [IdDataField] public string ID { get; private set; } = default!; - - // Frontier: skip dungeon generation - [DataField] - public bool SkipDungeonGen = false; - // End Frontier } diff --git a/Resources/Locale/en-US/_NF/adventure/adventure.ftl b/Resources/Locale/en-US/_NF/adventure/adventure.ftl index 4930e8675b3..c227bb1c12d 100644 --- a/Resources/Locale/en-US/_NF/adventure/adventure.ftl +++ b/Resources/Locale/en-US/_NF/adventure/adventure.ftl @@ -27,4 +27,6 @@ changelog-tab-title-Upstream = Upstream Changelog multiauth-already-connected = Already connected to Frontier Official servers. public-transit-departure = Now departing for {$destination}. Estimated travel time: {$flytime} seconds. -public-transit-arrival = Thank you for choosing NT Public Transit. Next transfer to {$destination} departs in {$waittime} seconds. \ No newline at end of file +public-transit-arrival = Thank you for choosing NT Public Transit. Next transfer to {$destination} departs in {$waittime} seconds. + +adventure-space-dungeon-name = Space Dungeon: {$dungeonPrototype} \ No newline at end of file diff --git a/Resources/Prototypes/Procedural/dungeon_configs.yml b/Resources/Prototypes/Procedural/dungeon_configs.yml index c87c86f9b97..413b23a79db 100644 --- a/Resources/Prototypes/Procedural/dungeon_configs.yml +++ b/Resources/Prototypes/Procedural/dungeon_configs.yml @@ -1,7 +1,6 @@ # Base configs - type: dungeonConfig id: PlanetBase - skipDungeonGen: true # Frontier layers: - !type:PrefabDunGen presets: diff --git a/Resources/Prototypes/_NF/GameRules/roundstart.yml b/Resources/Prototypes/_NF/GameRules/roundstart.yml index c04dc6b73f6..efdd77ccbe8 100644 --- a/Resources/Prototypes/_NF/GameRules/roundstart.yml +++ b/Resources/Prototypes/_NF/GameRules/roundstart.yml @@ -4,6 +4,17 @@ categories: [ HideSpawnMenu ] components: - type: AdventureRule + spaceDungeons: + - CaveFactory + - MedSci + - FactoryDorms + - LavaMercenary + - VirologyLab + - SalvageOutpost + # Upstream definitions + - Experiment + - SnowyLabs + - LavaBrig # Skipping Mineshaft, Haunted; they're in caves - type: entity id: BluespaceEventScheduler diff --git a/Resources/Prototypes/_NF/Procedural/dungeon_configs.yml b/Resources/Prototypes/_NF/Procedural/dungeon_configs.yml index 9331eb4d844..eea8ff7d747 100644 --- a/Resources/Prototypes/_NF/Procedural/dungeon_configs.yml +++ b/Resources/Prototypes/_NF/Procedural/dungeon_configs.yml @@ -1,7 +1,6 @@ # Base dungeon prototypes - type: dungeonConfig id: Everything - skipDungeonGen: true # Frontier layers: - !type:PrefabDunGen presets: