From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Fri, 31 Mar 2023 05:54:17 +0000 (+1100) Subject: Add more dungeon layouts (#14924) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=b6a735774b71191e0d54aa45acf418abf75d7681;p=space-station-14.git Add more dungeon layouts (#14924) --- diff --git a/Content.Server/Procedural/DungeonSystem.Commands.cs b/Content.Server/Procedural/DungeonSystem.Commands.cs index aa8a92fa57..3b0058ca9a 100644 --- a/Content.Server/Procedural/DungeonSystem.Commands.cs +++ b/Content.Server/Procedural/DungeonSystem.Commands.cs @@ -101,4 +101,131 @@ public sealed partial class DungeonSystem 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(args[1], out var pack)) + { + return; + } + + var grid = EnsureComp(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(args[1], out var preset)) + { + return; + } + + var grid = EnsureComp(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(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(proto: _prototype)); + } + + return CompletionResult.Empty; + } } diff --git a/Content.Server/Procedural/DungeonSystem.cs b/Content.Server/Procedural/DungeonSystem.cs index 7f2a5f33a3..eca622cc44 100644 --- a/Content.Server/Procedural/DungeonSystem.cs +++ b/Content.Server/Procedural/DungeonSystem.cs @@ -40,6 +40,8 @@ public sealed partial class DungeonSystem : EntitySystem base.Initialize(); _sawmill = Logger.GetSawmill("dungen"); _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; SubscribeLocalEvent(OnRoundStart); } diff --git a/Resources/Locale/en-US/procedural/command.ftl b/Resources/Locale/en-US/procedural/command.ftl index 77b6476c9c..26887f77f2 100644 --- a/Resources/Locale/en-US/procedural/command.ftl +++ b/Resources/Locale/en-US/procedural/command.ftl @@ -13,3 +13,10 @@ cmd-dungen-hint-config = Dungeon config cmd-dungen-hint-posx = Position X cmd-dungen-hint-posy = Position Y 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 + +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 diff --git a/Resources/Prototypes/Procedural/dungeon_configs.yml b/Resources/Prototypes/Procedural/dungeon_configs.yml index 9a63ce9825..ddb84815d2 100644 --- a/Resources/Prototypes/Procedural/dungeon_configs.yml +++ b/Resources/Prototypes/Procedural/dungeon_configs.yml @@ -5,6 +5,8 @@ - SalvageExperiment presets: - Cross + - SpaceMan + - FourSquare postGeneration: - !type:MiddleConnectionPostGen overlapCount: 3 @@ -64,6 +66,8 @@ - LavaBrig presets: - Cross + - SpaceMan + - FourSquare postGeneration: - !type:MiddleConnectionPostGen overlapCount: 3 diff --git a/Resources/Prototypes/Procedural/dungeon_presets.yml b/Resources/Prototypes/Procedural/dungeon_presets.yml index 4fbe4af7ce..aed6fbf92c 100644 --- a/Resources/Prototypes/Procedural/dungeon_presets.yml +++ b/Resources/Prototypes/Procedural/dungeon_presets.yml @@ -10,3 +10,28 @@ - -2,36,3,53 - -20,18,-3,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 diff --git a/Resources/Prototypes/Procedural/dungeon_room_packs.yml b/Resources/Prototypes/Procedural/dungeon_room_packs.yml index 3f04cc235b..63766a0693 100644 --- a/Resources/Prototypes/Procedural/dungeon_room_packs.yml +++ b/Resources/Prototypes/Procedural/dungeon_room_packs.yml @@ -40,18 +40,38 @@ - 7,9,12,16 - 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 # Whole area room -#- type: dungeonRoomPack -# id: MediumArea1 -# size: 5,17 -# rooms: -# - 0,6,15,9 -# - 11,12,16,17 -# - 11,0,16,5 -# roomConnections: -# - 13,5 -# - 13,9 +- type: dungeonRoomPack + id: MediumArea1 + size: 5,17 + rooms: + - 0,0,5,17 # Three 5x5 rooms - type: dungeonRoomPack @@ -80,6 +100,30 @@ - 0,6,5,11 - 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 - type: dungeonRoomPack id: SmallArea1