local math_random = math.random script.on_init(function() local nauvis = game.surfaces[1] local mgs = nauvis.map_gen_settings mgs.autoplace_controls.water = { frequency = 6, richness = 1, size = 6 } mgs.property_expression_names = { elevation = 'elevation_lakes' } nauvis.map_gen_settings = mgs nauvis.clear(true) end) script.on_event(defines.events.on_chunk_generated, function(event) local surface = event.surface local create_entity = surface.create_entity local set_hidden_tile = surface.set_hidden_tile local can_place_entity = surface.can_place_entity local entities = {} local tiles = {} for _, tile in pairs(surface.find_tiles_filtered{ area = event.area }) do local position = tile.position if tile.collides_with('water_tile') then tiles[#tiles + 1] = { name = 'landfill', position = position } set_hidden_tile(position, 'water') entities[#entities + 1] = { name = 'coal', position = position, enable_tree_removal = false, amount = math_random(10, 100) } else entities[#entities + 1] = { name = 'iron-ore', position = position, enable_tree_removal = false, amount = math_random(1000, 2000) } end if math_random() > 0.90 then entities[#entities + 1] = { name = 'tree-0'..math_random(1, 9), position = position, enable_tree_removal = false } elseif math_random() > 0.95 then entities[#entities + 1] = { name = 'big-rock', position = position, enable_tree_removal = false } end end surface.set_tiles(tiles, true) for _, entity in pairs(entities) do if can_place_entity(entity) then create_entity(entity) end end end)