mask tile filtering
This commit is contained in:
@@ -66,7 +66,8 @@ public sealed partial class DungeonSystem
|
||||
Random random,
|
||||
HashSet<Vector2i>? reservedTiles,
|
||||
bool clearExisting = false,
|
||||
bool rotation = false)
|
||||
bool rotation = false,
|
||||
List<string>? ignoreTiles = null) //CP14 ignoring atlas mask tiles
|
||||
{
|
||||
var originTransform = Matrix3Helpers.CreateTranslation(origin.X, origin.Y);
|
||||
var roomRotation = Angle.Zero;
|
||||
@@ -79,7 +80,7 @@ public sealed partial class DungeonSystem
|
||||
var roomTransform = Matrix3Helpers.CreateTransform((Vector2) room.Size / 2f, roomRotation);
|
||||
var finalTransform = Matrix3x2.Multiply(roomTransform, originTransform);
|
||||
|
||||
SpawnRoom(gridUid, grid, finalTransform, room, reservedTiles, clearExisting);
|
||||
SpawnRoom(gridUid, grid, finalTransform, room, reservedTiles, clearExisting, ignoreTiles); //CP14 ignoring atlas mask tiles
|
||||
}
|
||||
|
||||
public Angle GetRoomRotation(DungeonRoomPrototype room, Random random)
|
||||
@@ -105,7 +106,8 @@ public sealed partial class DungeonSystem
|
||||
Matrix3x2 roomTransform,
|
||||
DungeonRoomPrototype room,
|
||||
HashSet<Vector2i>? reservedTiles = null,
|
||||
bool clearExisting = false)
|
||||
bool clearExisting = false,
|
||||
List<string>? ignoreTiles = null) //CP14 ignoring atlas mask tiles
|
||||
{
|
||||
// Ensure the underlying template exists.
|
||||
var roomMap = GetOrCreateTemplate(room);
|
||||
@@ -155,7 +157,14 @@ public sealed partial class DungeonSystem
|
||||
|
||||
if (!clearExisting && reservedTiles?.Contains(rounded) == true)
|
||||
continue;
|
||||
|
||||
//CP14 ignoring atlas mask tiles
|
||||
if (ignoreTiles is not null)
|
||||
{
|
||||
var tileDef = _tileDefManager[tileRef.Tile.TypeId];
|
||||
if (ignoreTiles.Contains(tileDef.ID))
|
||||
continue;
|
||||
}
|
||||
//CP14 ignoring atlas mask tiles end
|
||||
_tiles.Add((rounded, tileRef.Tile));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
using Content.Shared.Procedural;
|
||||
using Content.Shared.Random;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server._CP14.Procedural.RoomSpawner;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// allows you to spawn one of the rooms during initialization
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(CP14RoomSpawnerSystem))]
|
||||
public sealed partial class CP14RoomSpawnerComponent : Component
|
||||
@@ -18,4 +17,11 @@ public sealed partial class CP14RoomSpawnerComponent : Component
|
||||
|
||||
[DataField]
|
||||
public bool ClearExisting = true;
|
||||
|
||||
[DataField]
|
||||
public List<string> IgnoreTiles = new()
|
||||
{
|
||||
"CP14FloorAtlasMask",
|
||||
"CP14FloorAtlasMask2",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using Content.Server.Procedural;
|
||||
using Content.Shared.Procedural;
|
||||
using Content.Shared.Random.Helpers;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
@@ -51,6 +50,7 @@ public sealed class CP14RoomSpawnerSystem : EntitySystem
|
||||
random,
|
||||
null,
|
||||
spawner.Comp.ClearExisting,
|
||||
spawner.Comp.Rotation);
|
||||
spawner.Comp.Rotation,
|
||||
ignoreTiles: spawner.Comp.IgnoreTiles);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user