map_gen_settings ignores water

Place to get help with not working mods / modding interface.
Post Reply
staviq
Fast Inserter
Fast Inserter
Posts: 129
Joined: Wed Jun 29, 2016 1:22 pm
Contact:

map_gen_settings ignores water

Post by staviq »

Hi.

I'm tryingto create a copy of the game surface except with no water ( ignoring the starting area )

so i get current map_gen_settings, set water to "none" and create a new surface.

The problem is, there is still water in the same exact places.

Surface creation:

Code: Select all

if game.surfaces["NiceFill"] == nil
			then
				player.force.print( serpent.dump( game.surfaces ) )
				log( serpent.dump( game.surfaces ) )
				-- make a copy of the world, without water.
				
				local map_gen_settings = game.surfaces[1].map_gen_settings
				map_gen_settings.autoplace_controls["enemy-base"] = {frequency="none",size="none",richness="none"}
				map_gen_settings.autoplace_controls["trees"] = {frequency="none",size="none",richness="none"}
				map_gen_settings.autoplace_controls["water"] = {frequency="none",size="none",richness="none"}
				player.force.print( serpent.dump( map_gen_settings.autoplace_controls["enemy-base"] ) )
				map_gen_settings.water = "none"
				map_gen_settings.peaceful_mode = true
				game.create_surface( "NiceFill" )
				NiceFillSurface = game.surfaces["NiceFill"]
				player.force.print( serpent.dump( NiceFillSurface ) )
			end
But there, even if i wait for the chunk to be generated, i still get water in both sufraces:

Code: Select all

for k,v in pairs(event.positions) do
				local lc = 0;
				
				if not NiceFillSurface.is_chunk_generated( {x=(v.x/32),y=(v.y/32)} ) then
					NiceFillSurface.request_to_generate_chunks( {x=v.x,y=v.y}, 1 )
				end
				
				while not NiceFillSurface.is_chunk_generated( {x=(v.x/32),y=(v.y/32)} )
				do
					lc = lc + 1
					if lc >= 100000 then
						-- oops
						player.force.print("oops")
						break
					end
					
				end
				
				local NFSTile = NiceFillSurface.get_tile( {x=v.x,y=v.y} )
				local GameTile = game.surfaces[event.surface_index].get_tile( {x=v.x,y=v.y} )
				
				player.force.print( serpent.dump( NFSTile.name ) .. " " .. serpent.dump( GameTile.name ) )
				
				--if NFSTile.name ~= GameTile.name
				--then
				--	table.insert( tilelist, {name=NFSTile.name, position = {x=v.x,y=v.y} } )
				--else
					table.insert( tilelist, {name='tdebug', position = {x=v.x,y=v.y} } )
				--end
			end

staviq
Fast Inserter
Fast Inserter
Posts: 129
Joined: Wed Jun 29, 2016 1:22 pm
Contact:

Re: map_gen_settings ignores water

Post by staviq »

Excuse me for being retarded, i forgot to use the new mapgen settings, i should get some sleep :)

Post Reply

Return to “Modding help”