Files
tbd-station-14/Content.Server/Procedural/BiomeSystem.Commands.cs
metalgearsloth fe7b96147c Biome rework (#37735)
* DungeonData rework

Back to fields, serializes better, just make new layers dumby.

* wawawewa

* Fix this

* Fixes

* Port the work over

* wawawewa

* zoom

* Kinda workin

* Adjust wawa

* Unloading work

* Ore + entitytable fixes

Iterate every dungeon not just last.

* Big shot

* wawawewa

* Fixes

* true

* Fixes

# Conflicts:
#	Content.Server/Procedural/DungeonJob/DungeonJob.cs

* wawawewa

* Fixes

* Fix

* Lot of work

* wawawewa

* Fixing

* eh?

* a

* Fix a heap of stuff

* Better ignored check

* Reserve tile changes

* biome

* changes

* wawawewa

* Fixes & snow

* Shadow fixes

* wawawewa

* smol

* Add layer API

* More work

* wawawewa

* Preloads and running again

* wawawewa

* Modified

* Replacements and command

* Runtime support

* werk

* Fix expeds + dungeon alltiles

* reh

---------

Co-authored-by: Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
2025-07-03 00:36:06 -04:00

106 lines
3.2 KiB
C#

using Content.Server.Administration;
using Content.Shared.Administration;
using Content.Shared.Procedural;
using Content.Shared.Procedural.Components;
using Robust.Shared.Console;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
namespace Content.Server.Procedural;
public sealed partial class BiomeSystem
{
[AdminCommand(AdminFlags.Mapping)]
public sealed class BiomeAddLayerCommand : LocalizedEntityCommands
{
[Dependency] private readonly IPrototypeManager _protoManager = default!;
public override string Command => "biome_addlayer";
public override void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (args.Length != 3)
{
shell.WriteError(Help);
return;
}
if (!int.TryParse(args[0], out var entInt))
{
return;
}
var entId = new EntityUid(entInt);
if (!EntityManager.TryGetComponent(entId, out BiomeComponent? biome))
{
return;
}
if (!_protoManager.TryIndex(args[2], out DungeonConfigPrototype? config))
{
return;
}
var system = EntityManager.System<BiomeSystem>();
system.AddLayer((entId, biome), args[1], config);
}
public override CompletionResult GetCompletion(IConsoleShell shell, string[] args)
{
switch (args.Length)
{
case 1:
return CompletionResult.FromOptions(CompletionHelper.Components<BiomeComponent>(args[0]));
case 2:
return CompletionResult.FromHint("layerId");
case 3:
return CompletionResult.FromOptions(CompletionHelper.PrototypeIDs<DungeonConfigPrototype>());
}
return CompletionResult.Empty;
}
}
[AdminCommand(AdminFlags.Mapping)]
public sealed class BiomeRemoveLayerCommand : LocalizedEntityCommands
{
public override string Command => "biome_removelayer";
public override void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (args.Length != 2)
{
shell.WriteError(Help);
return;
}
if (!int.TryParse(args[0], out var entInt))
{
return;
}
var entId = new EntityUid(entInt);
if (!EntityManager.TryGetComponent(entId, out BiomeComponent? biome))
{
return;
}
var system = EntityManager.System<BiomeSystem>();
system.RemoveLayer((entId, biome), args[1]);
}
public override CompletionResult GetCompletion(IConsoleShell shell, string[] args)
{
switch (args.Length)
{
case 0:
return CompletionResult.FromOptions(CompletionHelper.Components<BiomeComponent>(args[0]));
case 1:
return CompletionResult.FromHint("layerId");
}
return CompletionResult.Empty;
}
}
}