Page 1 of 1

mapgeneration override

Posted: Thu Nov 12, 2015 10:44 am
by safan
I want a planet with only desert biome, no water and not a single tree. Can i force this? Where should i start?

i don't find https://forums.factorio.com/wiki/inde ... cification helpful.

thanks.

Re: mapgeneration override

Posted: Thu Nov 12, 2015 3:44 pm
by prg
safan wrote:I want a planet with only desert biome, no water and not a single tree. Can i force this? Where should i start?

i don't find https://forums.factorio.com/wiki/inde ... cification helpful.

thanks.
Don't think it's possible to tell the map generator to do this for you, but you can kludge something together yourself like this:

Code: Select all

require "defines"

script.on_event(defines.events.on_chunk_generated, function(event)
    local tiles = {}
    for x = event.area.left_top.x, event.area.right_bottom.x do
        for y = event.area.left_top.y, event.area.right_bottom.y do
            table.insert(tiles, {name="sand", position={x, y}})
        end
    end
    event.surface.set_tiles(tiles)
    for _, tree in pairs(event.surface.find_entities_filtered{area=event.area, type="tree"}) do
        tree.destroy()
    end
end)