I'm trying to generate custom surfaces related to planets, to be able to randomize ore/enemy presence, etc, of the surface.
To do this, I basically create a surface using the planet mapgen with changes, then associate the surface with the planet (previous surface is deleted).
The goal is to keep the lightning, pressure, magnetism, pollution type, etc depending on the planet, while being able to randomize the map-gen for ore and ennemies
Code: Select all
--- example
local mapgen = game.planets['vulcanus'].prototype.map_gen_settings
mapgen.seed=12345
local surface = game.create_surface('[img=space-location.vulcanus] vulcanus-XX', mapgen)
game.planets['vulcanus'].associate_surface(surface)
I tried to generate the surface using LuaPlanet.generate_surface(), then changing the mapgen and deleting chunk to have something changed, but i didn't seem to work...
Code: Select all
--- this doesn't work ?
local surface = game.planets['aquilo'].create_surface()
surface.map_gen_settings.autoplace_controls.aquilo_crude_oil.frequency=10
surface.map_gen_settings.autoplace_controls.lithium_brine.frequency=10
surface.map_gen_settings.autoplace_controls.fluorine_vent.frequency=10
surface.map_gen_settings.seed=66666
for chunk in surface.get_chunks() do
surface.delete_chunk({x = chunk.x, y = chunk.y})
end
Maybe i'm not doing it the right way ?