Fix planet command being ran on existing maps (#21775)

This commit is contained in:
metalgearsloth
2023-12-11 19:51:02 +11:00
committed by GitHub
parent 5cf38a6eb3
commit 342b08418e
6 changed files with 148 additions and 68 deletions

View File

@@ -29,14 +29,15 @@ public sealed partial class BiomeSystem
int.TryParse(args[0], out var mapInt);
var mapId = new MapId(mapInt);
var mapUid = _mapManager.GetMapEntityId(mapId);
if (_mapManager.MapExists(mapId) ||
!TryComp<BiomeComponent>(_mapManager.GetMapEntityId(mapId), out var biome))
!TryComp<BiomeComponent>(mapUid, out var biome))
{
return;
}
ClearTemplate(biome);
ClearTemplate(mapUid, biome);
}
private CompletionResult BiomeClearCallbackHelper(IConsoleShell shell, string[] args)
@@ -63,8 +64,9 @@ public sealed partial class BiomeSystem
}
var mapId = new MapId(mapInt);
var mapUid = _mapManager.GetMapEntityId(mapId);
if (!_mapManager.MapExists(mapId) || !TryComp<BiomeComponent>(_mapManager.GetMapEntityId(mapId), out var biome))
if (!_mapManager.MapExists(mapId) || !TryComp<BiomeComponent>(mapUid, out var biome))
{
return;
}
@@ -81,7 +83,7 @@ public sealed partial class BiomeSystem
int.TryParse(args[3], out offset);
}
AddTemplate(biome, args[2], template, offset);
AddTemplate(mapUid, biome, args[2], template, offset);
}
private CompletionResult AddLayerCallbackHelp(IConsoleShell shell, string[] args)