public void LoadGrid(string NameOrSteamID, int ID, bool FromSavePos = true) { if (!AdminTryGetPlayerSteamID(NameOrSteamID, out ulong PlayerSteamID)) { return; } PlayerHangar PlayersHanger = new PlayerHangar(PlayerSteamID, Chat, true); if (!PlayersHanger.LoadGrid(ID, out IEnumerable <MyObjectBuilder_CubeGrid> Grids, out GridStamp Stamp)) { return; } if (FromSavePos == false && InConsole == true) { FromSavePos = true; } ParallelSpawner Spawner = new ParallelSpawner(Grids, Chat, !FromSavePos); if (Spawner.Start(FromSavePos, AdminPlayerPosition)) { Chat?.Respond("Spawning Complete!"); PlayersHanger.RemoveGridStamp(Stamp); } else { Chat?.Respond("An error occured while spawning the grid!"); } }
public void LoadGrid(string NameOrSteamID, int ID, bool FromSavePos = true) { if (!AdminTryGetPlayerSteamID(NameOrSteamID, out ulong PlayerSteamID)) { return; } PlayerHangar PlayersHanger = new PlayerHangar(PlayerSteamID, Chat, true); if (!PlayersHanger.TryGetGridStamp(ID, out GridStamp Stamp)) { return; } if (!PlayersHanger.LoadGrid(Stamp, out IEnumerable <MyObjectBuilder_CubeGrid> Grids)) { Log.Error($"Loading grid {ID} failed for {NameOrSteamID}!"); Chat.Respond("Loading grid failed! Report this to staff and check logs for more info!"); return; } Vector3D LoadPos = Stamp.GridSavePosition; if (FromSavePos == false && InConsole == true) { FromSavePos = true; } if (!FromSavePos) { LoadPos = AdminPlayerPosition; } ParallelSpawner Spawner = new ParallelSpawner(Grids, Chat); if (Spawner.Start(LoadPos, FromSavePos)) { Chat?.Respond($"Spawning Completed! \n Location: {LoadPos}"); PlayersHanger.RemoveGridStamp(ID); } else { Chat?.Respond("An error occured while spawning the grid!"); } }