Rooms demiplane generation improvement (#1583)

* Add CP14RoomsDunGen for procedural room placement

Introduces the CP14RoomsDunGen layer for generating rooms across the grid based on tags and tile masks. Updates DungeonJob and DungeonSystem to support the new layer, and modifies relevant YAML prototypes to use CP14RoomsDunGen instead of OreDunGen for room spawning in demiplane modifiers.

* some fixes

* its done done done

* exit room

* additional entry points

* fix

* Update migration.yml
This commit is contained in:
Red
2025-07-27 16:45:16 +03:00
committed by GitHub
parent 5020be8ec6
commit fcbe2cce6b
22 changed files with 2606 additions and 291 deletions

View File

@@ -78,7 +78,7 @@ public sealed partial class DungeonSystem
Vector2i origin,
DungeonRoomPrototype room,
Random random,
HashSet<Vector2i>? reservedTiles,
HashSet<Vector2i>? reservedTiles = null, //CP14 default null
bool clearExisting = false,
bool rotation = false)
{
@@ -129,29 +129,6 @@ public sealed partial class DungeonSystem
var finalRoomRotation = roomTransform.Rotation();
// 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);
}
}
}
var roomCenter = (room.Offset + room.Size / 2f) * grid.TileSize;
var tileOffset = -roomCenter + grid.TileSizeHalfVector;
_tiles.Clear();