Exemple #1
0
 internal void GenMap( int width, int height, int length, int seed, IMapGenerator generator )
 {
     game.World.Reset();
     GC.Collect();
     this.generator = generator;
     game.SetNewScreen( new LoadingMapScreen( game, "Generating level", "Generating.." ) );
     generator.GenerateAsync( game, width, height, length, seed );
 }
Exemple #2
0
        void EndGeneration()
        {
            game.SetNewScreen( null );
            if( generatedMap == null ) {
                game.Chat.Add( "&cFailed to generate the map." );
            } else {
                IMapGenerator gen = generator;
                game.World.SetNewMap( generatedMap, gen.Width, gen.Height, gen.Length );
                generatedMap = null;
                ResetPlayerPosition();
                game.WorldEvents.RaiseOnNewMapLoaded();
            }

            generator = null;
            game.Chat.Add( "&ePlaying single player", MessageType.Status1 );
            GC.Collect();
        }
        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 );
            }
        }