Salvage expeditions (#12745)

This commit is contained in:
metalgearsloth
2023-04-20 10:43:13 +10:00
committed by GitHub
parent 486d7c179e
commit 122350f19c
79 changed files with 2764 additions and 662 deletions

View File

@@ -110,13 +110,11 @@ public sealed partial class DungeonJob
var rooms = new List<DungeonRoom>(dungeon.Rooms);
var roomTiles = new List<Vector2i>();
var tileData = new Tile(_tileDefManager[gen.Tile].TileId);
var count = gen.Count;
while (count > 0 && rooms.Count > 0)
for (var i = 0; i < gen.Count; i++)
{
var roomIndex = random.Next(rooms.Count);
var room = rooms[roomIndex];
rooms.RemoveAt(roomIndex);
// Move out 3 tiles in a direction away from center of the room
// If none of those intersect another tile it's probably external
@@ -126,12 +124,6 @@ public sealed partial class DungeonJob
foreach (var tile in roomTiles)
{
// Check the interior node is at least accessible?
// Can't do anchored because it might be a locker or something.
// TODO: Better collision mask check
if (_lookup.GetEntitiesIntersecting(gridUid, tile, LookupFlags.Dynamic | LookupFlags.Static).Any())
continue;
var direction = (tile - room.Center).ToAngle().GetCardinalDir().ToAngle().ToVec();
var isValid = true;
@@ -163,8 +155,6 @@ public sealed partial class DungeonJob
_entManager.SpawnEntity(ent, gridCoords);
}
count--;
// Clear out any biome tiles nearby to avoid blocking it
foreach (var nearTile in grid.GetTilesIntersecting(new Circle(gridCoords.Position, 1.5f), false))
{