public NoiseGeoProvince(long seed, ICoreServerAPI api) : base(seed) { IAsset asset = api.Assets.Get("worldgen/geologicprovinces.json"); provinces = asset.ToObject <GeologicProvinces>(); for (int i = 0; i < provinces.Variants.Length; i++) { provinces.Variants[i].Index = i; provinces.Variants[i].ColorInt = int.Parse(provinces.Variants[i].Hexcolor.TrimStart('#'), System.Globalization.NumberStyles.HexNumber); weightSum += provinces.Variants[i].Weight; } }
public void preLoad(IServerChunk[] chunks, int chunkX, int chunkZ) { mapChunk = chunks[0].MapChunk; heightMap = mapChunk.WorldGenTerrainHeightMap; rdx = chunkX % regionChunkSize; rdz = chunkZ % regionChunkSize; stratum = null; step = 0; strataThickness = 0; map = GetOrLoadLerpedProvinceMap(chunks[0].MapChunk, chunkX, chunkZ); lerpMapInv = 1f / TerraGenConfig.geoProvMapScale; chunkInRegionX = (chunkX % regionChunkSize) * lerpMapInv * chunksize; chunkInRegionZ = (chunkZ % regionChunkSize) * lerpMapInv * chunksize; provinces = NoiseGeoProvince.provinces; grp = 0; }
public override void StartServerSide(ICoreServerAPI api) { IAsset asset = api.Assets.Get("worldgen/rockstrata.json"); rockstrata = asset.ToObject <RockstrataWorldProperty>(); asset = api.Assets.Get("worldgen/geologicprovinces.json"); provinces = asset.ToObject <GeologicProvinces>(); this.api = api; // Call our loaded method manually if the server is already running (happens when mods are reloaded at runtime) if (api.Server.CurrentRunPhase == EnumServerRunPhase.RunGame) { OnGameWorldLoaded(); } api.Event.ChunkColumnGeneration(GenChunkColumn, EnumWorldGenPass.Terrain); api.Event.SaveGameLoaded += OnGameWorldLoaded; }