Demiplan polishing v4 (#530)

* Wizden PR copy

* sync

* Update DungeonJob.PostGenBiome.cs

* Update DungeonJob.PostGenBiome.cs

* some rebalance

* required exits and enters!

* room fill fix

* snakes nerf

* enable En-US localization for playtest

* guidebook update

* hotfix!!!

* anchoring deletion

* trying fix caves

* Update RoomFillSystem.cs

* disable locations for test

* Update CP14SpawnRandomDemiplaneJob.cs

* Update required_layers.yml

* Revert "Update required_layers.yml"

This reverts commit 2dd33db282.

* finally

* Update ContentLocalizationManager.cs

* Update spawners.yml

* Update test.yml

* fix
This commit is contained in:
Ed
2024-11-03 14:40:21 +03:00
committed by GitHub
parent 51f4ec84d5
commit 53df2848c4
13 changed files with 196 additions and 148 deletions

View File

@@ -13,7 +13,6 @@ namespace Content.Server.Procedural;
public sealed partial class DungeonSystem
{
// Temporary caches.
private readonly HashSet<EntityUid> _entitySet = new();
private readonly List<DungeonRoomPrototype> _availableRooms = new();
/// <summary>
@@ -99,6 +98,20 @@ public sealed partial class DungeonSystem
return roomRotation;
}
private static Box2 GetRotatedBox(Vector2 point1, Vector2 point2, double angle)
{
if (angle == 0)
return new Box2(point1, point2);
if (Math.Abs(angle - Math.PI / 2) < 1E-5)
return new Box2(point2.X, point1.Y, point1.X, point2.Y);
if (Math.Abs(angle - Math.PI) < 1E-5)
return new Box2(point2, point1);
if (Math.Abs(angle + Math.PI / 2) < 1E-5)
return new Box2(point1.X, point2.Y, point2.X, point1.Y);
throw new NotImplementedException();
}
public void SpawnRoom(
EntityUid gridUid,
MapGridComponent grid,
@@ -113,32 +126,37 @@ public sealed partial class DungeonSystem
var templateGrid = Comp<MapGridComponent>(templateMapUid);
var roomDimensions = room.Size;
var entitySet = new HashSet<EntityUid>();
var finalRoomRotation = roomTransform.Rotation();
//CP14 bandage it - int dont work
// go BRRNNTTT on existing stuff
//if (clearExisting)
//{
// var gridBounds = new Box2(Vector2.Transform(-room.Size/2, roomTransform), Vector2.Transform(room.Size/2, roomTransform));
// _entitySet.Clear();
// // Polygon skin moment
// gridBounds = gridBounds.Enlarged(-0.05f);
// _lookup.GetLocalEntitiesIntersecting(gridUid, gridBounds, _entitySet, LookupFlags.Uncontained);
//
// foreach (var templateEnt in _entitySet)
// {
// Del(templateEnt);
// }
//
// if (TryComp(gridUid, out DecalGridComponent? decalGrid))
// {
// foreach (var decal in _decals.GetDecalsIntersecting(gridUid, gridBounds, decalGrid))
// {
// _decals.RemoveDecal(gridUid, decal.Index, decalGrid);
// }
// }
//}
//CP14 end
/*
if (clearExisting)
{
var point1 = Vector2.Transform(-room.Size / 2, roomTransform);
var point2 = Vector2.Transform(room.Size / 2, roomTransform);
var gridBounds = GetRotatedBox(point1, point2, finalRoomRotation);
entitySet.Clear();
// Polygon skin moment
gridBounds = gridBounds.Enlarged(-0.05f);
_lookup.GetLocalEntitiesIntersecting(gridUid, gridBounds, entitySet, LookupFlags.Uncontained);
foreach (var templateEnt in entitySet)
{
Del(templateEnt);
}
if (TryComp(gridUid, out DecalGridComponent? decalGrid))
{
foreach (var decal in _decals.GetDecalsIntersecting(gridUid, gridBounds, decalGrid))
{
_decals.RemoveDecal(gridUid, decal.Index, decalGrid);
}
}
}
*/
var roomCenter = (room.Offset + room.Size / 2f) * grid.TileSize;
var tileOffset = -roomCenter + grid.TileSizeHalfVector;

View File

@@ -32,7 +32,7 @@ public sealed class RoomFillSystem : EntitySystem
_dungeon.SpawnRoom(
xform.GridUid.Value,
mapGrid,
_maps.LocalToTile(xform.GridUid.Value, mapGrid, xform.Coordinates),
_maps.LocalToTile(xform.GridUid.Value, mapGrid, xform.Coordinates) - new Vector2i(room.Size.X/2,room.Size.Y/2), //CP14 Offset for halfroom
room,
random,
null,

View File

@@ -6,7 +6,6 @@ using Content.Shared._CP14.Demiplane.Prototypes;
using Content.Shared.Atmos;
using Content.Shared.Gravity;
using Content.Shared.Procedural;
using Content.Shared.Procedural.DungeonGenerators;
using Robust.Shared.CPUJob.JobQueues;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
@@ -62,14 +61,17 @@ public sealed class CP14SpawnRandomDemiplaneJob : Job<bool>
_modifiers = modifiers;
_seed = seed;
_sawmill = logManager.GetSawmill("cp14_expedition_job");
_sawmill = logManager.GetSawmill("cp14_demiplane_job");
}
protected override async Task<bool> Process()
{
_sawmill.Debug("cp14_expedition", $"Spawning expedition mission with seed {0}");
_sawmill.Debug($"Spawning demiplane `{_config.Id}` with seed {_seed}");
var grid = _mapManager.CreateGridEntity(DemiplaneMapUid);
_mapManager.DoMapInitialize(_demiplaneMapId);
_mapManager.SetMapPaused(_demiplaneMapId, false);
MetaDataComponent? metadata = null;
DungeonConfigPrototype dungeonConfig = new();
@@ -87,7 +89,6 @@ public sealed class CP14SpawnRandomDemiplaneJob : Job<bool>
//Add map components
_entManager.AddComponents(DemiplaneMapUid, expeditionConfig.Components);
//Apply modifiers
foreach (var modifier in _modifiers)
{
@@ -96,6 +97,8 @@ public sealed class CP14SpawnRandomDemiplaneJob : Job<bool>
dungeonConfig.Layers.AddRange(indexedModifier.Layers);
_entManager.AddComponents(DemiplaneMapUid, indexedModifier.Components);
_sawmill.Debug($"Added modifier: {_seed} - {modifier.Id}");
}
//Enter and exits
@@ -104,13 +107,6 @@ public sealed class CP14SpawnRandomDemiplaneJob : Job<bool>
dungeonConfig.Layers.AddRange(indexedConnections.Layers);
}
//Spawn modified config
_dungeon.GenerateDungeon(dungeonConfig,
grid,
grid,
Vector2i.Zero,
_seed);
//Setup gravity
var gravity = _entManager.EnsureComponent<GravityComponent>(DemiplaneMapUid);
gravity.Enabled = true;
@@ -123,8 +119,12 @@ public sealed class CP14SpawnRandomDemiplaneJob : Job<bool>
var mixture = new GasMixture(moles, Atmospherics.T20C);
_entManager.System<AtmosphereSystem>().SetMapAtmosphere(DemiplaneMapUid, false, mixture);
_mapManager.DoMapInitialize(_demiplaneMapId);
_mapManager.SetMapPaused(_demiplaneMapId, false);
//Spawn modified config
_dungeon.GenerateDungeon(dungeonConfig,
grid,
grid,
Vector2i.Zero,
_seed); //TODO: Transform to Async
return true;
}

View File

@@ -10,7 +10,7 @@ namespace Content.Shared.Localizations
[Dependency] private readonly ILocalizationManager _loc = default!;
// If you want to change your codebase's language, do it here.
public const string Culture = "en-US"; // CrystallPunk-Localization. "ru-RU" or "en-US"
public const string Culture = "ru-RU"; // CrystallPunk-Localization. "ru-RU" or "en-US"
/// <summary>
/// Custom format strings used for parsing and displaying minutes:seconds timespans.
@@ -28,9 +28,9 @@ namespace Content.Shared.Localizations
var culture = new CultureInfo(Culture);
_loc.LoadCulture(culture);
// Uncomment for Ru localization
//var fallbackCulture = new CultureInfo("en-US");
//_loc.LoadCulture(fallbackCulture);
//_loc.SetFallbackCluture(fallbackCulture);
var fallbackCulture = new CultureInfo("en-US");
_loc.LoadCulture(fallbackCulture);
_loc.SetFallbackCluture(fallbackCulture);
//
_loc.AddFunction(culture, "PRESSURE", FormatPressure);

View File

@@ -4,7 +4,7 @@
description: You touch the creature, healing its body from physical damage
components:
- type: CP14MagicEffect
manaCost: 15
manaCost: 20
telegraphyEffects:
- !type:CP14SpellSpawnEntityOnTarget
spawns:
@@ -21,8 +21,16 @@
Slash: -10
Blunt: -10
Piercing: -10
Poison: -10
Caustic: -10
Cold: -10
Heat: -10
Shock: -10
Asphyxiation: -50
Bloodloss: -10
- !type:Jitter
- !type:ModifyBleedAmount
- !type:ModifyBloodLevel
- type: CP14MagicEffectVerbalAspect
startSpeech: "Et curabuntur..."
endSpeech: "vulnera tua"

View File

@@ -22,7 +22,6 @@
- !type:GroupSelector
weight: 75
children:
- id: CP14Wallet
- !type:GroupSelector
children:
- id: CP14SilverCoin1
@@ -33,7 +32,6 @@
weight: 0.5
- id: CP14CopperCoin1
weight: 1
- id: CP14Wheat
- !type:GroupSelector
children:
- id: CP14DyeRed
@@ -42,23 +40,6 @@
- id: CP14DyeGreen
- id: CP14DyePurple
- id: CP14DyeBlack
- !type:GroupSelector
children:
- id: CP14SeedWheat
- id: CP14SeedPumpkin
- id: CP14SeedCabbage
- id: CP14SeedCucumber
- id: CP14SeedTomato
- !type:GroupSelector
children:
- id: CP14BloodFlower
- id: CP14AgaricMushroom
- id: CP14WildSage
- id: CP14QuartzShard
- id: CP14BlueAmanita
- id: CP14Dayflin
- id: CP14CopperBar1
- id: CP14IronBar1
- id: CP14EnergyCrystalSmall
- id: CP14Bucket
- id: CP14OldLantern
@@ -84,9 +65,45 @@
- id: CP14ChromiumSlime
- id: CP14LumiMushroom
- id: CP14SilverCoin5
- id: CP14GoldBar1
- id: CP14EnergyCrystalMedium
- id: CP14DemiplanKey
# remove this when players can create their own magic items
- !type:GroupSelector
children:
- id: CP14ClothingRingIceDagger
- id: CP14ClothingRingIceShards
- id: CP14ClothingRingFlameCreation
- id: CP14ClothingRingFireball
- id: CP14ClothingRingCureWounds
- id: CP14ClothingRingShadowStep
- id: CP14ClothingRingShadowGrab
- id: CP14ClothingRingEarthWall
- id: CP14ClothingRingIceFloor
- id: CP14ClothingRingSphereOfLight
- id: CP14ClothingRingFlashLight
- !type:GroupSelector
children:
- id: CP14ClothingCloakArmoredRed
- id: CP14ClothingCloakBlacksmithArpon
- id: CP14ClothingCloakMaidArpon
- id: CP14ClothingCloakBrassArmor
- id: CP14ClothingCloakCuirass
- id: CP14ClothingCloakInfantryCuirass
- id: CP14ClothingCloakCuirassLoincloth
- id: CP14ClothingCloakCuirassLeg
- id: CP14ClothingHeadCapellina
- !type:GroupSelector
children:
- id: CP14ClothingCloakFurcapeBlack
- id: CP14ClothingCloakFurcapeBlue
- id: CP14ClothingCloakSimpleWhite
- id: CP14ClothingCloakSimpleDarkBlue
- id: CP14ClothingCloakRitualAttireLeather
- id: CP14ClothingHeadBeretMercenary
- id: CP14ClothingPantsMercenaryTrousers
- id: CP14ClothingPantsSouthernMagician
- id: CP14ClothingShirtMercenary
- id: CP14ClothingShirtYellowWizard
- type: entityTable
id: CP14TableBureaucracy

View File

@@ -0,0 +1,17 @@
- type: dungeonConfig
id: CP14DemiplanePlatingMaskBorder
layers:
- !type:NoiseDistanceDunGen
size: 140, 140
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

View File

@@ -1,27 +1,29 @@
- type: cp14DemiplaneLocation
id: T1Caves
locationConfig: CP14ExpeditionCaves
locationConfig: CP14DemiplaneCaves
tags:
- CP14DemiplanOre
- CP14DemiplanUnderground
- CP14DemiplaneCave
- CP14DemiplaneUnderground
components:
- type: CP14WeatherController
entries:
- visuals: CP14Mist
- type: dungeonConfig
id: CP14ExpeditionCaves
id: CP14DemiplaneCaves
layers:
# Masks
- !type:PrototypeDunGen
proto: CP14ExpeditionCavesFloorMaskBorder
proto: CP14DemiplanePlatingMaskBorder
- !type:PrototypeDunGen
proto: CP14ExpeditionCavesFloorMaskStone
proto: CP14DemiplaneCavesFloorMaskStone
- !type:PrototypeDunGen
proto: CP14ExpeditionCavesFloorMaskAir
proto: CP14DemiplaneCavesFloorMaskAir
# Biomes
- !type:PrototypeDunGen
proto: CP14ExpeditionCavesFillBorder
- !type:BiomeDunGen
biomeTemplate: CP14CavesIndestructibleFill
tileMask:
- Plating
- !type:BiomeDunGen
biomeTemplate: CP14CavesGeneric
tileMask:
@@ -32,25 +34,7 @@
- CP14FloorGrass
- type: dungeonConfig
id: CP14ExpeditionCavesFloorMaskAir
layers:
- !type:NoiseDistanceDunGen
size: 80, 80
distanceConfig: !type:DunGenEuclideanSquaredDistance
blendWeight: 0.5
layers:
- tile: CP14FloorGrass
threshold: 0.50
noise:
frequency: 0.030
noiseType: OpenSimplex2
fractalType: FBm
octaves: 5
lacunarity: 2
gain: 0.5
- type: dungeonConfig
id: CP14ExpeditionCavesFloorMaskStone
id: CP14DemiplaneCavesFloorMaskStone
layers:
- !type:NoiseDistanceDunGen
size: 120, 120
@@ -68,30 +52,19 @@
gain: 0.5
- type: dungeonConfig
id: CP14ExpeditionCavesFloorMaskBorder
id: CP14DemiplaneCavesFloorMaskAir
layers:
- !type:NoiseDistanceDunGen
size: 130, 130
size: 80, 80
distanceConfig: !type:DunGenEuclideanSquaredDistance
blendWeight: 1
blendWeight: 0.5
layers:
- tile: CP14FloorBase
- tile: CP14FloorGrass
threshold: 0.50
noise:
frequency: 0.010
frequency: 0.030
noiseType: OpenSimplex2
fractalType: FBm
octaves: 5
lacunarity: 2
gain: 0.5
- type: dungeonConfig
id: CP14ExpeditionCavesFillBorder
reserveTiles: true
data:
entities:
Fill: CP14WallStoneIndestructable
layers:
- !type:FillGridDunGen
allowedTiles:
- CP14FloorBase
gain: 0.5

View File

@@ -2,9 +2,9 @@
id: T1GrassGeode
locationConfig: CP14DemiplaneGrassGeode
tags:
- CP14DemiplanOre
- CP14DemiplanGrass
- CP14DemiplanUnderground
- CP14DemiplaneCave
- CP14DemiplaneGrass
- CP14DemiplaneUnderground
components:
- type: CP14WeatherController
entries:
@@ -17,7 +17,7 @@
layers:
# Masks
- !type:PrototypeDunGen
proto: CP14DemiplaneGrassGeodeFloorMaskBorder
proto: CP14DemiplanePlatingMaskBorder
- !type:PrototypeDunGen
proto: CP14DemiplaneGrassGeodeFloorMaskStone
- !type:PrototypeDunGen
@@ -25,8 +25,10 @@
- !type:PrototypeDunGen
proto: CP14DemiplaneGrassGeodeFloorMaskWater
# Biomes
- !type:PrototypeDunGen
proto: CP14ExpeditionCavesFillBorder
- !type:BiomeDunGen
biomeTemplate: CP14CavesIndestructibleFill
tileMask:
- Plating
- !type:BiomeDunGen
biomeTemplate: CP14GrasslandTestResult
tileMask:

View File

@@ -2,9 +2,9 @@
id: T1GrasslandIsland
locationConfig: CP14ExpeditionGrasslandIsland
tags:
- CP14DemiplanOre
- CP14DemiplanOpenSky
- CP14DemiplanGrass
- CP14DemiplaneCave
- CP14DemiplaneOpenSky
- CP14DemiplaneGrass
components:
- type: MapLight
ambientLightColor: "#BFEEFFFF"

View File

@@ -3,7 +3,7 @@
unique: false
reward: 0.5
requiredTags:
- CP14DemiplanOre
- CP14DemiplaneCave
layers:
- !type:OreDunGen
entityMask:
@@ -18,7 +18,7 @@
unique: false
reward: 0.4
requiredTags:
- CP14DemiplanOre
- CP14DemiplaneCave
layers:
- !type:OreDunGen
entityMask:
@@ -32,7 +32,7 @@
id: QuartzCrystal
reward: 0.1
requiredTags:
- CP14DemiplanOre
- CP14DemiplaneCave
layers:
- !type:OreDunGen
tileMask:
@@ -47,8 +47,8 @@
reward: 0.2
generationWeight: 0.1
requiredTags:
- CP14DemiplanOre
- CP14DemiplanUnderground
- CP14DemiplaneCave
- CP14DemiplaneUnderground
layers:
- !type:OreDunGen
tileMask:
@@ -63,7 +63,7 @@
reward: 0.2
generationWeight: 0.1
requiredTags:
- CP14DemiplanOre
- CP14DemiplaneCave
layers:
- !type:OreDunGen
tileMask:
@@ -79,7 +79,7 @@
reward: 0.2
generationWeight: 0.1
requiredTags:
- CP14DemiplanOre
- CP14DemiplaneCave
layers:
- !type:OreDunGen
tileMask:
@@ -97,7 +97,7 @@
reward: 0.2
generationWeight: 0.1
requiredTags:
- CP14DemiplanOre
- CP14DemiplaneCave
layers:
- !type:OreDunGen
tileMask:
@@ -115,8 +115,8 @@
reward: 0.2
generationWeight: 0.1
requiredTags:
- CP14DemiplanOre
- CP14DemiplanUnderground
- CP14DemiplaneCave
- CP14DemiplaneUnderground
layers:
- !type:OreDunGen
tileMask:
@@ -131,8 +131,8 @@
reward: 0.2
generationWeight: 0.1
requiredTags:
- CP14DemiplanOre
- CP14DemiplanUnderground
- CP14DemiplaneCave
- CP14DemiplaneUnderground
layers:
- !type:OreDunGen
tileMask:
@@ -147,8 +147,8 @@
id: Dayflin
reward: 0.2
requiredTags:
- CP14DemiplanGrass
- CP14DemiplanOpenSky
- CP14DemiplaneGrass
- CP14DemiplaneOpenSky
layers:
- !type:OreDunGen
tileMask:
@@ -164,7 +164,7 @@
id: BlueAmanita
reward: 0.2
requiredTags:
- CP14DemiplanGrass
- CP14DemiplaneGrass
layers:
- !type:OreDunGen
tileMask:
@@ -180,7 +180,7 @@
id: BloodFlower
reward: 0.2
requiredTags:
- CP14DemiplanGrass
- CP14DemiplaneGrass
layers:
- !type:OreDunGen
tileMask:
@@ -196,8 +196,8 @@
id: WildSage
reward: 0.2
requiredTags:
- CP14DemiplanGrass
- CP14DemiplanOpenSky
- CP14DemiplaneGrass
- CP14DemiplaneOpenSky
layers:
- !type:OreDunGen
tileMask:
@@ -213,7 +213,7 @@
id: LumiShroom
reward: 0.2
requiredTags:
- CP14DemiplanUnderground
- CP14DemiplaneUnderground
layers:
- !type:OreDunGen
tileMask:
@@ -231,7 +231,7 @@
unique: false
reward: 0.3
requiredTags:
- CP14DemiplanOre
- CP14DemiplaneCave
layers:
- !type:OreDunGen
entityMask:
@@ -268,11 +268,11 @@
id: EnemyXeno
difficulty: 0.5
requiredTags:
- CP14DemiplanUnderground
- CP14DemiplaneUnderground
layers:
- !type:MobsDunGen
minCount: 5
maxCount: 8
minCount: 2
maxCount: 3
groups:
- id: CP14MobXenoDrone
amount: 1
@@ -294,7 +294,7 @@
id: EnemyDyno
difficulty: 0.5
requiredTags:
- CP14DemiplanOpenSky
- CP14DemiplaneOpenSky
layers:
- !type:MobsDunGen
minCount: 3
@@ -308,8 +308,8 @@
difficulty: 0.7
layers:
- !type:MobsDunGen
minCount: 3
maxCount: 6
minCount: 1
maxCount: 2
groups:
- id: CP14MobPurpleSnake
amount: 1

View File

@@ -1,11 +1,11 @@
- type: Tag
id: CP14DemiplanOre
id: CP14DemiplaneCave
- type: Tag
id: CP14DemiplanGrass
id: CP14DemiplaneGrass
- type: Tag
id: CP14DemiplanOpenSky
id: CP14DemiplaneOpenSky
- type: Tag
id: CP14DemiplanUnderground
id: CP14DemiplaneUnderground

View File

@@ -5,6 +5,19 @@
threshold: -1.0
tile: CP14FloorBase
- type: biomeTemplate
id: CP14CavesIndestructibleFill
layers:
- !type:BiomeTileLayer
threshold: -1.0
tile: CP14FloorBase
- !type:BiomeEntityLayer
threshold: -1
allowedTiles:
- CP14FloorBase
entities:
- CP14WallStoneIndestructable
- type: biomeTemplate
id: CP14CavesFloor
layers: