fCraft.FlatMapGen.MakeFlatgrass C# (CSharp) Method

MakeFlatgrass() private method

private MakeFlatgrass ( int width, int length, int height ) : MapGeneratorState
width int
length int
height int
return MapGeneratorState
        public static MapGeneratorState MakeFlatgrass( int width, int length, int height ) {
            MapGeneratorParameters preset = Instance.CreateDefaultParameters();
            preset.MapWidth = width;
            preset.MapLength = length;
            preset.MapHeight = height;
            return preset.CreateGenerator();
        }
    }

Usage Example

Example #1
0
        public Map LoadMap()
        {
            var tempMap = Map;

            if (tempMap != null)
            {
                return(tempMap);
            }

            lock (SyncRoot) {
                if (Map != null)
                {
                    return(Map);
                }

                if (File.Exists(MapFileName))
                {
                    try {
                        Map = MapUtility.Load(MapFileName, true);
                    } catch (Exception ex) {
                        Logger.Log(LogType.Error,
                                   "World.LoadMap: Failed to load map ({0}): {1}",
                                   MapFileName,
                                   ex);
                    }
                }

                // or generate a default one
                if (Map == null)
                {
                    Server.Message("&WMap file is missing for world {0}&W. A new map has been created.", ClassyName);
                    Logger.Log(LogType.Warning,
                               "World.LoadMap: Map file missing for world {0}. Generating default flatgrass map.",
                               Name);
                    Map = FlatMapGen.MakeFlatgrass(128, 128, 64).Generate();
                }

                if (Map == null)
                {
                    // should never happen, theoretically, unless FlatMapGen messes up
                    throw new NullReferenceException("World.LoadMap failed to produce a map file!");
                }

                return(Map);
            }
        }
All Usage Examples Of fCraft.FlatMapGen::MakeFlatgrass