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;