Change map_gen_settings based on position
Posted: Fri Feb 07, 2025 9:45 am
				
				Hej everybody,
Im quite new to modding factorio, but Im trying. It would be great to have some input from the experts 
 
The mod idea: I would like to generate different biomes on nauvis, each corresponding to the different planets in space age. I love spaceship logistic and the space age mod in general, but I thought it would be cool to do it all on nauvis with long distance trains connecting the different biomes.
I have found mods which allow something similar, but they mostly mix all resources so they are available everywhere on nauvis. I would like to have distinct biomes representing the different planets.
For the first version of the mod the easiest solution would be to simply check the y position of a chunk and use the map_gen_settings of different planets. It is not really biomes, but the results would be a planet with bands, not too different from earth: you go south to the equator and find a gleba belt (tropical zone) and after a vulcanus belt (desert/warm area) at the quator. Same going north, first a fulgora belts and then artic region of aquilo.
I tried coding control.lua something like this (just to see if it works):
script.on_event(defines.events.on_chunk_generated, function(event)
if event.position.y > 100 then
data.raw.planet.nauvis.map_gen_settings = data.raw.planet.fulgora.map_gen_settings
end
end)
Well, it didn't work I have the feeling that the event on_chunk_generated is activated after the chunk is generated, which is not ideal.
 I have the feeling that the event on_chunk_generated is activated after the chunk is generated, which is not ideal.
Anyone with some experience on map generation can give me advice? Do you think the general idea would work?
Cheers
			Im quite new to modding factorio, but Im trying. It would be great to have some input from the experts
 
 The mod idea: I would like to generate different biomes on nauvis, each corresponding to the different planets in space age. I love spaceship logistic and the space age mod in general, but I thought it would be cool to do it all on nauvis with long distance trains connecting the different biomes.
I have found mods which allow something similar, but they mostly mix all resources so they are available everywhere on nauvis. I would like to have distinct biomes representing the different planets.
For the first version of the mod the easiest solution would be to simply check the y position of a chunk and use the map_gen_settings of different planets. It is not really biomes, but the results would be a planet with bands, not too different from earth: you go south to the equator and find a gleba belt (tropical zone) and after a vulcanus belt (desert/warm area) at the quator. Same going north, first a fulgora belts and then artic region of aquilo.
I tried coding control.lua something like this (just to see if it works):
script.on_event(defines.events.on_chunk_generated, function(event)
if event.position.y > 100 then
data.raw.planet.nauvis.map_gen_settings = data.raw.planet.fulgora.map_gen_settings
end
end)
Well, it didn't work
 I have the feeling that the event on_chunk_generated is activated after the chunk is generated, which is not ideal.
 I have the feeling that the event on_chunk_generated is activated after the chunk is generated, which is not ideal.Anyone with some experience on map generation can give me advice? Do you think the general idea would work?
Cheers