public static void Stop(Player player, bool Won) { if (Failed != null && Mines != null) { Failed.Clear(); foreach (Vector3I m in Mines.Values) { Vector3I removed; Mines.TryRemove(m.ToString(), out removed); } } World world = WorldManager.FindWorldOrPrintMatches(player, "Minefield"); WorldManager.RemoveWorld(world); WorldManager.SaveWorldList(); Server.RequestGC(); instance = null; if (Won) { Server.Players.Message("{0}&S Won the game of MineField!", player.ClassyName); } else { Server.Players.Message("{0}&S aborted the game of MineField", player.ClassyName); } }
public static void Start(Player player) { Map map = MapGeneratorOld.GenerateEmpty(64, 128, 16); map.Save("maps/minefield.fcm"); if (_world != null) { WorldManager.RemoveWorld(_world); } WorldManager.AddWorld(Player.Console, "Minefield", map, true); _map = map; _world = WorldManager.FindWorldExact("Minefield"); SetUpRed(); SetUpMiddleWater(); SetUpGreen(); SetUpMines(); _map.Spawn = new Position(_map.Width / 2, 5, _ground + 3).ToVector3I().ToPlayerCoords(); _world.LoadMap(); _world.gameMode = GameMode.MineField; _world.EnableTNTPhysics(Player.Console, false); Server.Message("{0}&S started a game of MineField on world Minefield!", player.ClassyName); WorldManager.SaveWorldList(); Server.RequestGC(); }