public void GenerateAsync(Game game, int width, int height, int length, int seed) { Width = width; Height = height; Length = length; Thread thread = new Thread( () => { SinglePlayerServer server = (SinglePlayerServer)game.Network; try { server.generatedMap = Generate(width, height, length, seed); } catch (Exception ex) { ErrorHandler.LogError("IMapGenerator.RunAsync", ex); } Done = true; } ); thread.IsBackground = true; thread.Name = "IMapGenerator.RunAsync"; thread.Start(); }
void GenerateMap(IMapGenerator gen) { SinglePlayerServer server = (SinglePlayerServer)game.Network; int width = GetInt(0), height = GetInt(1); int length = GetInt(2), seed = GetSeedInt(3); long volume = (long)width * height * length; if (volume > 800 * 800 * 800) { game.Chat.Add("&cThe generated map's volume is too big."); } else if (width == 0 || height == 0 || length == 0) { game.Chat.Add("&cOne of the map dimensions is invalid."); } else { server.GenMap(width, height, length, seed, gen); } }