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
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