Add more dungeon layouts (#14924)
This commit is contained in:
@@ -101,4 +101,131 @@ public sealed partial class DungeonSystem
|
|||||||
|
|
||||||
return CompletionResult.Empty;
|
return CompletionResult.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[AdminCommand(AdminFlags.Mapping)]
|
||||||
|
private void DungeonPackVis(IConsoleShell shell, string argstr, string[] args)
|
||||||
|
{
|
||||||
|
if (args.Length != 2)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!int.TryParse(args[0], out var mapInt))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var mapId = new MapId(mapInt);
|
||||||
|
var mapUid = _mapManager.GetMapEntityId(mapId);
|
||||||
|
|
||||||
|
if (!_prototype.TryIndex<DungeonRoomPackPrototype>(args[1], out var pack))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var grid = EnsureComp<MapGridComponent>(mapUid);
|
||||||
|
var tile = new Tile(_tileDefManager["FloorSteel"].TileId);
|
||||||
|
var tiles = new List<(Vector2i, Tile)>();
|
||||||
|
|
||||||
|
foreach (var room in pack.Rooms)
|
||||||
|
{
|
||||||
|
for (var x = room.Left; x < room.Right; x++)
|
||||||
|
{
|
||||||
|
for (var y = room.Bottom; y < room.Top; y++)
|
||||||
|
{
|
||||||
|
var index = new Vector2i(x, y);
|
||||||
|
tiles.Add((index, tile));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fill the rest out with a blank tile to make it easier to see
|
||||||
|
var dummyTile = new Tile(_tileDefManager["FloorAsteroidIronsand1"].TileId);
|
||||||
|
|
||||||
|
for (var x = 0; x < pack.Size.X; x++)
|
||||||
|
{
|
||||||
|
for (var y = 0; y < pack.Size.Y; y++)
|
||||||
|
{
|
||||||
|
var index = new Vector2i(x, y);
|
||||||
|
if (tiles.Contains((index, tile)))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
tiles.Add((index, dummyTile));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
grid.SetTiles(tiles);
|
||||||
|
shell.WriteLine(Loc.GetString("cmd-dungen_pack_vis"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[AdminCommand(AdminFlags.Mapping)]
|
||||||
|
private void DungeonPresetVis(IConsoleShell shell, string argstr, string[] args)
|
||||||
|
{
|
||||||
|
if (args.Length != 2)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!int.TryParse(args[0], out var mapInt))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var mapId = new MapId(mapInt);
|
||||||
|
var mapUid = _mapManager.GetMapEntityId(mapId);
|
||||||
|
|
||||||
|
if (!_prototype.TryIndex<DungeonPresetPrototype>(args[1], out var preset))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var grid = EnsureComp<MapGridComponent>(mapUid);
|
||||||
|
var tile = new Tile(_tileDefManager["FloorSteel"].TileId);
|
||||||
|
var tiles = new List<(Vector2i, Tile)>();
|
||||||
|
|
||||||
|
foreach (var room in preset.RoomPacks)
|
||||||
|
{
|
||||||
|
for (var x = room.Left; x < room.Right; x++)
|
||||||
|
{
|
||||||
|
for (var y = room.Bottom; y < room.Top; y++)
|
||||||
|
{
|
||||||
|
var index = new Vector2i(x, y);
|
||||||
|
tiles.Add((index, tile));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
grid.SetTiles(tiles);
|
||||||
|
shell.WriteLine(Loc.GetString("cmd-dungen_pack_vis"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private CompletionResult PresetCallback(IConsoleShell shell, string[] args)
|
||||||
|
{
|
||||||
|
if (args.Length == 1)
|
||||||
|
{
|
||||||
|
return CompletionResult.FromHintOptions(CompletionHelper.MapIds(EntityManager), Loc.GetString("cmd-dungen-hint-map"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.Length == 2)
|
||||||
|
{
|
||||||
|
return CompletionResult.FromOptions(CompletionHelper.PrototypeIDs<DungeonPresetPrototype>(proto: _prototype));
|
||||||
|
}
|
||||||
|
|
||||||
|
return CompletionResult.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
private CompletionResult PackCallback(IConsoleShell shell, string[] args)
|
||||||
|
{
|
||||||
|
if (args.Length == 1)
|
||||||
|
{
|
||||||
|
return CompletionResult.FromHintOptions(CompletionHelper.MapIds(EntityManager), Loc.GetString("cmd-dungen-hint-map"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.Length == 2)
|
||||||
|
{
|
||||||
|
return CompletionResult.FromOptions(CompletionHelper.PrototypeIDs<DungeonRoomPackPrototype>(proto: _prototype));
|
||||||
|
}
|
||||||
|
|
||||||
|
return CompletionResult.Empty;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ public sealed partial class DungeonSystem : EntitySystem
|
|||||||
base.Initialize();
|
base.Initialize();
|
||||||
_sawmill = Logger.GetSawmill("dungen");
|
_sawmill = Logger.GetSawmill("dungen");
|
||||||
_console.RegisterCommand("dungen", Loc.GetString("cmd-dungen-desc"), Loc.GetString("cmd-dungen-help"), GenerateDungeon, CompletionCallback);
|
_console.RegisterCommand("dungen", Loc.GetString("cmd-dungen-desc"), Loc.GetString("cmd-dungen-help"), GenerateDungeon, CompletionCallback);
|
||||||
|
_console.RegisterCommand("dungen_preset_vis", Loc.GetString("cmd-dungen_preset_vis-desc"), Loc.GetString("cmd-dungen_preset_vis-help"), DungeonPresetVis, PresetCallback);
|
||||||
|
_console.RegisterCommand("dungen_pack_vis", Loc.GetString("cmd-dungen_pack_vis-desc"), Loc.GetString("cmd-dungen_pack_vis-help"), DungeonPackVis, PackCallback);
|
||||||
_prototype.PrototypesReloaded += PrototypeReload;
|
_prototype.PrototypesReloaded += PrototypeReload;
|
||||||
SubscribeLocalEvent<RoundStartingEvent>(OnRoundStart);
|
SubscribeLocalEvent<RoundStartingEvent>(OnRoundStart);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,3 +13,10 @@ cmd-dungen-hint-config = Dungeon config
|
|||||||
cmd-dungen-hint-posx = Position X
|
cmd-dungen-hint-posx = Position X
|
||||||
cmd-dungen-hint-posy = Position Y
|
cmd-dungen-hint-posy = Position Y
|
||||||
cmd-dungen-hint-seed = [Seed]
|
cmd-dungen-hint-seed = [Seed]
|
||||||
|
|
||||||
|
cmd-dungen_preset_vis-desc = Generates a tile-based preview of a dungeon preset.
|
||||||
|
cmd-dungen_preset_vis-help = dungen_preset_vis <mapid> <preset>
|
||||||
|
|
||||||
|
cmd-dungen_pack_vis-success = Success
|
||||||
|
cmd-dungen_pack_vis-desc = Generates a tile-based preview of a dungeon pack.
|
||||||
|
cmd-dungen_pack_vis-help = dungen_pack_vis <mapid> <pack>
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
- SalvageExperiment
|
- SalvageExperiment
|
||||||
presets:
|
presets:
|
||||||
- Cross
|
- Cross
|
||||||
|
- SpaceMan
|
||||||
|
- FourSquare
|
||||||
postGeneration:
|
postGeneration:
|
||||||
- !type:MiddleConnectionPostGen
|
- !type:MiddleConnectionPostGen
|
||||||
overlapCount: 3
|
overlapCount: 3
|
||||||
@@ -64,6 +66,8 @@
|
|||||||
- LavaBrig
|
- LavaBrig
|
||||||
presets:
|
presets:
|
||||||
- Cross
|
- Cross
|
||||||
|
- SpaceMan
|
||||||
|
- FourSquare
|
||||||
postGeneration:
|
postGeneration:
|
||||||
- !type:MiddleConnectionPostGen
|
- !type:MiddleConnectionPostGen
|
||||||
overlapCount: 3
|
overlapCount: 3
|
||||||
|
|||||||
@@ -10,3 +10,28 @@
|
|||||||
- -2,36,3,53
|
- -2,36,3,53
|
||||||
- -20,18,-3,35
|
- -20,18,-3,35
|
||||||
- 4,18,21,35
|
- 4,18,21,35
|
||||||
|
|
||||||
|
# Two stumpy legs at the bottom, middle torso, then fat top
|
||||||
|
- type: dungeonPreset
|
||||||
|
id: SpaceMan
|
||||||
|
roomPacks:
|
||||||
|
- -14,0,-9,17
|
||||||
|
- -8,12,9,17
|
||||||
|
- 10,0,15,17
|
||||||
|
- -8,18,-3,23
|
||||||
|
- 4,18,9,23
|
||||||
|
- -2,18,3,35
|
||||||
|
- -8,36,9,53
|
||||||
|
- -14,36,-9,53
|
||||||
|
- 10,36,15,53
|
||||||
|
|
||||||
|
- type: dungeonPreset
|
||||||
|
id: FourSquare
|
||||||
|
roomPacks:
|
||||||
|
- -26,-5,-9,12
|
||||||
|
- 4,13,21,30
|
||||||
|
- 34,-5,51,12
|
||||||
|
- 4,-23,21,-6
|
||||||
|
- 10,-5,15,12
|
||||||
|
- -8,1,9,6
|
||||||
|
- 16,1,33,6
|
||||||
|
|||||||
@@ -40,18 +40,38 @@
|
|||||||
- 7,9,12,16
|
- 7,9,12,16
|
||||||
- 1,5,6,12
|
- 1,5,6,12
|
||||||
|
|
||||||
|
# 17x5 corridor through middle with 2 7x5 rooms off to the side.
|
||||||
|
- type: dungeonRoomPack
|
||||||
|
id: LargeArea6
|
||||||
|
size: 17,17
|
||||||
|
rooms:
|
||||||
|
- 0,6,17,11
|
||||||
|
- 0,0,7,5
|
||||||
|
- 10,0,17,5
|
||||||
|
|
||||||
|
# 3x7 corridor leading to 7x7 room.
|
||||||
|
- type: dungeonRoomPack
|
||||||
|
id: LargeArea7
|
||||||
|
size: 17,17
|
||||||
|
rooms:
|
||||||
|
- 0,7,7,10
|
||||||
|
- 8,5,15,12
|
||||||
|
|
||||||
|
# 17x5 corridor to 7x7
|
||||||
|
- type: dungeonRoomPack
|
||||||
|
id: LargeArea8
|
||||||
|
size: 17,17
|
||||||
|
rooms:
|
||||||
|
- 0,1,17,6
|
||||||
|
- 5,7,12,14
|
||||||
|
|
||||||
# Medium
|
# Medium
|
||||||
# Whole area room
|
# Whole area room
|
||||||
#- type: dungeonRoomPack
|
- type: dungeonRoomPack
|
||||||
# id: MediumArea1
|
id: MediumArea1
|
||||||
# size: 5,17
|
size: 5,17
|
||||||
# rooms:
|
rooms:
|
||||||
# - 0,6,15,9
|
- 0,0,5,17
|
||||||
# - 11,12,16,17
|
|
||||||
# - 11,0,16,5
|
|
||||||
# roomConnections:
|
|
||||||
# - 13,5
|
|
||||||
# - 13,9
|
|
||||||
|
|
||||||
# Three 5x5 rooms
|
# Three 5x5 rooms
|
||||||
- type: dungeonRoomPack
|
- type: dungeonRoomPack
|
||||||
@@ -80,6 +100,30 @@
|
|||||||
- 0,6,5,11
|
- 0,6,5,11
|
||||||
- 1,12,4,17
|
- 1,12,4,17
|
||||||
|
|
||||||
|
# 3x5 then a 13x3
|
||||||
|
- type: dungeonRoomPack
|
||||||
|
id: MediumArea5
|
||||||
|
size: 5,17
|
||||||
|
rooms:
|
||||||
|
- 0,0,5,3
|
||||||
|
- 1,4,4,17
|
||||||
|
|
||||||
|
# 5x5 then a 11x3
|
||||||
|
- type: dungeonRoomPack
|
||||||
|
id: MediumArea6
|
||||||
|
size: 5,17
|
||||||
|
rooms:
|
||||||
|
- 0,0,5,5
|
||||||
|
- 1,6,4,17
|
||||||
|
|
||||||
|
# 5x5 then a 11x5
|
||||||
|
- type: dungeonRoomPack
|
||||||
|
id: MediumArea7
|
||||||
|
size: 5,17
|
||||||
|
rooms:
|
||||||
|
- 0,0,5,5
|
||||||
|
- 0,6,5,17
|
||||||
|
|
||||||
# Small
|
# Small
|
||||||
- type: dungeonRoomPack
|
- type: dungeonRoomPack
|
||||||
id: SmallArea1
|
id: SmallArea1
|
||||||
|
|||||||
Reference in New Issue
Block a user