From 8e1f5317676f624d0b4401f25e87d2a72cdf17e4 Mon Sep 17 00:00:00 2001 From: Ed <96445749+TheShuEd@users.noreply.github.com> Date: Tue, 18 Mar 2025 00:41:43 +0300 Subject: [PATCH] Trying to fix check fails (#1036) * Update unique_loot.yml * test * slarti help * test omega --- .../CP14DemiplaneSystem.Generation.cs | 61 ++++---- .../Entities/Markers/Spawners/unique_loot.yml | 13 +- .../Entities/Objects/Tools/demiplane_keys.yml | 27 ++++ .../Demiplane/Locations/t10_omega_test.yml | 139 ++++++++++++++++++ 4 files changed, 209 insertions(+), 31 deletions(-) create mode 100644 Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/t10_omega_test.yml diff --git a/Content.Server/_CP14/Demiplane/CP14DemiplaneSystem.Generation.cs b/Content.Server/_CP14/Demiplane/CP14DemiplaneSystem.Generation.cs index 6eb11bb04e..26b9ba5a62 100644 --- a/Content.Server/_CP14/Demiplane/CP14DemiplaneSystem.Generation.cs +++ b/Content.Server/_CP14/Demiplane/CP14DemiplaneSystem.Generation.cs @@ -204,45 +204,52 @@ public sealed partial class CP14DemiplaneSystem private void GeneratorMapInit(Entity generator, ref MapInitEvent args) { - //Location generation - HashSet suitableConfigs = new(); - foreach (var locationConfig in _proto.EnumeratePrototypes()) - { - suitableConfigs.Add(locationConfig); - } - CP14DemiplaneLocationPrototype? selectedConfig = null; - while (suitableConfigs.Count > 0) + //Location generation + if (generator.Comp.Location is null) { - var randomConfig = _random.Pick(suitableConfigs); - - if (!generator.Comp.TiersContent.ContainsKey(randomConfig.Tier)) + HashSet suitableConfigs = new(); + foreach (var locationConfig in _proto.EnumeratePrototypes()) { - suitableConfigs.Remove(randomConfig); - continue; + suitableConfigs.Add(locationConfig); } - if (!_random.Prob(generator.Comp.TiersContent[randomConfig.Tier])) + while (suitableConfigs.Count > 0) { - suitableConfigs.Remove(randomConfig); - continue; + var randomConfig = _random.Pick(suitableConfigs); + + if (!generator.Comp.TiersContent.ContainsKey(randomConfig.Tier)) + { + suitableConfigs.Remove(randomConfig); + continue; + } + + if (!_random.Prob(generator.Comp.TiersContent[randomConfig.Tier])) + { + suitableConfigs.Remove(randomConfig); + continue; + } + + selectedConfig = randomConfig; + break; } - selectedConfig = randomConfig; - break; - } + if (selectedConfig is null) + { + // We dont should be here - if (selectedConfig is null) + Log.Warning("Expedition mission generation failed: No suitable location configs."); + QueueDel(generator); + return; + } + generator.Comp.Location = selectedConfig; + } + else { - // We dont should be here - - Log.Warning("Expedition mission generation failed: No suitable location configs."); - QueueDel(generator); - return; + if (!_proto.TryIndex(generator.Comp.Location, out selectedConfig)) + return; } - generator.Comp.Location = selectedConfig; - //Modifier generation Dictionary suitableModifiersWeights = new(); foreach (var modifier in _proto.EnumeratePrototypes()) diff --git a/Resources/Prototypes/_CP14/Entities/Markers/Spawners/unique_loot.yml b/Resources/Prototypes/_CP14/Entities/Markers/Spawners/unique_loot.yml index e083e188f7..7e7a803dce 100644 --- a/Resources/Prototypes/_CP14/Entities/Markers/Spawners/unique_loot.yml +++ b/Resources/Prototypes/_CP14/Entities/Markers/Spawners/unique_loot.yml @@ -1,8 +1,14 @@ +- type: entity + id: CP14SpawnUniqueBase + abstract: true + parent: MarkerBase + categories: [ ForkFiltered, Spawner ] + - type: entity name: random artifact spawner id: CP14SpawnUniqueArtifact - parent: MarkerBase - categories: [ ForkFiltered, DoNotMap ] + parent: CP14SpawnUniqueBase + categories: [ DoNotMap ] components: - type: CP14UniqueLootSpawner tag: CP14UniqueSpawnDemiplanetLoot @@ -16,8 +22,7 @@ - type: entity name: random tradepost spawner id: CP14SpawnUniqueTradepost - parent: MarkerBase - categories: [ ForkFiltered ] + parent: CP14SpawnUniqueBase components: - type: CP14UniqueLootSpawner tag: CP14UniqueSpawnTradepost diff --git a/Resources/Prototypes/_CP14/Entities/Objects/Tools/demiplane_keys.yml b/Resources/Prototypes/_CP14/Entities/Objects/Tools/demiplane_keys.yml index 7411996204..81ea27749e 100644 --- a/Resources/Prototypes/_CP14/Entities/Objects/Tools/demiplane_keys.yml +++ b/Resources/Prototypes/_CP14/Entities/Objects/Tools/demiplane_keys.yml @@ -57,4 +57,31 @@ MapLight: 1 selectedModifiers: - EntryRoom + - Exit + +- type: entity + id: CP14DemiplaneKeyOmega + parent: CP14BaseSubdimensionalKey + suffix: Omega + components: + - type: Sprite + scale: 2, 2 + layers: + - state: core + color: red + - type: CP14DemiplaneGeneratorData + tiersContent: + 1: 0.6 # We dont have lot t2 content now. In future, decrease to 0.33 + 2: 1 + limits: + Reward: 5 + Danger: 5 + Fun: 1 + Weather: 1 + MapLight: 1 + location: T1OmegaTest + autoRifts: + - CP14DemiplanePassway + selectedModifiers: + - EntryRoom - Exit \ No newline at end of file diff --git a/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/t10_omega_test.yml b/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/t10_omega_test.yml new file mode 100644 index 0000000000..187dd012fa --- /dev/null +++ b/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/t10_omega_test.yml @@ -0,0 +1,139 @@ +- type: cp14DemiplaneLocation + id: T1OmegaTest + tier: 1 + locationConfig: CP14OmegaTest + name: cp14-demiplane-location-cave + tags: + - CP14DemiplaneOres + - CP14DemiplaneUnderground + - CP14DemiplaneHerbals + - CP14DemiplaneWater + - CP14DemiplaneAnimalsSwamp + +- type: dungeonConfig + id: CP14OmegaTest + layers: + #Masks + - !type:PrototypeDunGen + proto: CP14DemiplaneOmegaPlatingMaskBorder + - !type:PrototypeDunGen + proto: CP14DemiplaneOmegaCavesFloorMaskStone + - !type:PrototypeDunGen + proto: CP14DemiplaneOmegaCavesFloorMaskAir + - !type:PrototypeDunGen + proto: CP14DemiplaneOmegaCavesFloorMaskAir2 + - !type:PrototypeDunGen + proto: CP14DemiplaneOmegaCavesFloorMaskAir3 + # Biomes + - !type:BiomeDunGen + biomeTemplate: CP14CavesIndestructibleFill + tileMask: + - Plating + - !type:BiomeDunGen + biomeTemplate: CP14CavesGeneric + tileMask: + - CP14FloorSand + - !type:BiomeDunGen + biomeTemplate: CP14Grassland + tileMask: + - CP14FloorGrass + - !type:BiomeDunGen + biomeTemplate: CP14LeafMaze + tileMask: + - CP14FloorSnow + - !type:BiomeDunGen + biomeTemplate: CP14SwampFill + tileMask: + - CP14FloorGrassTall + + + +- type: dungeonConfig + id: CP14DemiplaneOmegaPlatingMaskBorder + layers: + - !type:NoiseDistanceDunGen + size: 260, 260 + distanceConfig: !type:DunGenEuclideanSquaredDistance + blendWeight: 1 + layers: + - tile: Plating + threshold: 0.50 + noise: + frequency: 0.010 + noiseType: OpenSimplex2 + fractalType: FBm + octaves: 5 + lacunarity: 2 + gain: 0.5 + +- type: dungeonConfig + id: CP14DemiplaneOmegaCavesFloorMaskStone + layers: + - !type:NoiseDistanceDunGen + size: 200, 200 + distanceConfig: !type:DunGenEuclideanSquaredDistance + blendWeight: 0.9 + layers: + - tile: CP14FloorSand + threshold: 0.50 + noise: + frequency: 0.010 + noiseType: OpenSimplex2 + fractalType: FBm + octaves: 5 + lacunarity: 2 + gain: 0.5 + +- type: dungeonConfig + id: CP14DemiplaneOmegaCavesFloorMaskAir + layers: + - !type:NoiseDistanceDunGen + size: 100, 100 + distanceConfig: !type:DunGenEuclideanSquaredDistance + blendWeight: 0.7 + layers: + - tile: CP14FloorGrass + threshold: 0.60 + noise: + frequency: 0.020 + noiseType: OpenSimplex2 + fractalType: FBm + octaves: 5 + lacunarity: 2 + gain: 0.5 + +- type: dungeonConfig + id: CP14DemiplaneOmegaCavesFloorMaskAir2 + layers: + - !type:NoiseDistanceDunGen + size: 80, 80 + distanceConfig: !type:DunGenEuclideanSquaredDistance + blendWeight: 0.5 + layers: + - tile: CP14FloorSnow + threshold: 0.50 + noise: + frequency: 0.030 + noiseType: OpenSimplex2 + fractalType: FBm + octaves: 5 + lacunarity: 2 + gain: 0.5 + +- type: dungeonConfig + id: CP14DemiplaneOmegaCavesFloorMaskAir3 + layers: + - !type:NoiseDistanceDunGen + size: 100, 100 + distanceConfig: !type:DunGenEuclideanSquaredDistance + blendWeight: 0.4 + layers: + - tile: CP14FloorGrassTall + threshold: 0.50 + noise: + frequency: 0.045 + noiseType: OpenSimplex2 + fractalType: FBm + octaves: 5 + lacunarity: 2 + gain: 0.5 \ No newline at end of file