using Content.Shared.Procedural;
using Content.Shared.Procedural.DungeonGenerators;
using Content.Shared.Procedural.PostGeneration;
+using Robust.Server.Physics;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Prototypes;
{
Dungeon dungeon;
_sawmill.Info($"Generating dungeon {_gen.ID} with seed {_seed} on {_entManager.ToPrettyString(_gridUid)}");
+ _grid.CanSplit = false;
switch (_gen.Generator)
{
ValidateResume();
}
+ _grid.CanSplit = true;
+ _entManager.System<GridFixtureSystem>().CheckSplits(_gridUid);
return dungeon;
}
}
var mapId = new MapId(mapInt);
- var mapUid = _mapManager.GetMapEntityId(mapId);
-
- if (!TryComp<MapGridComponent>(mapUid, out var mapGrid))
- {
- shell.WriteError(Loc.GetString("cmd-dungen-mapgrid"));
- return;
- }
if (!_prototype.TryIndex<DungeonConfigPrototype>(args[1], out var dungeon))
{
}
var position = new Vector2(posX, posY);
+ var dungeonUid = _mapManager.GetMapEntityId(mapId);
+
+ if (!TryComp<MapGridComponent>(dungeonUid, out var dungeonGrid))
+ {
+ dungeonUid = EntityManager.CreateEntityUninitialized(null, new EntityCoordinates(dungeonUid, position));
+ dungeonGrid = EntityManager.AddComponent<MapGridComponent>(dungeonUid);
+ EntityManager.InitializeAndStartEntity(dungeonUid, mapId);
+ }
+
int seed;
if (args.Length >= 5)
}
shell.WriteLine(Loc.GetString("cmd-dungen-start", ("seed", seed)));
- GenerateDungeon(dungeon, mapUid, mapGrid, position, seed);
+ GenerateDungeon(dungeon, dungeonUid, dungeonGrid, position, seed);
}
private CompletionResult CompletionCallback(IConsoleShell shell, string[] args)
-cmd-dungen-desc = Generates a procedural dungeon with the specified preset, position, and seed.
+cmd-dungen-desc = Generates a procedural dungeon with the specified preset, position, and seed. Will spawn in space if the MapId doesn't have MapGridComponent.
cmd-dungen-help = dungen <MapId> <DungeonPreset> <PosX> <PosY> [seed]
cmd-dungen-arg-count = Require 4 args.
cmd-dungen-map-parse = Unable to parse MapId.