Creating an empty map?

Place to share custom user maps, scenarios and campaigns.

Creating an empty map?

Postby Slackie » Mon Mar 20, 2017 10:39 am

Hey all. Wondering if it's possible to create an entirely empty map? I want to create a custom map with pre-defined resource locations, removing everything else on the map. To be clear I want to start with the entire world being empty, no trees, resources, water, etc.

I've so far accomplished this in the map editor by creating massive water areas (so that everything where the water is placed will be deleted) and then filling in the water with land to create an empty square of land, but this seems sub-optimal.

Anyone done this before?
Slackie
Burner Inserter
Burner Inserter
 
Posts: 8
Joined: Mon Mar 20, 2017 10:29 am

Re: Creating an empty map?

Postby darkfrei » Mon Mar 20, 2017 3:12 pm

Here was custom map generation.

[MOD 0.14.x] Water maze
viewtopic.php?f=94&t=21568
https://m.imgur.com/a/wptLh
User avatar
darkfrei
Filter Inserter
Filter Inserter
 
Posts: 657
Joined: Thu Nov 20, 2014 11:11 pm

Re: Creating an empty map?

Postby Slackie » Tue Mar 21, 2017 2:21 am

darkfrei wrote:Here was custom map generation.

[MOD 0.14.x] Water maze
viewtopic.php?f=94&t=21568
https://m.imgur.com/a/wptLh


Thanks for the link, that looks similar to what I am trying to do.

I found some modified code in that thread on the last page which illustrates how to make the chunk generator generate only water chunks, but when I follow the instructions for making it generate only land chunks, it generates land with resources on it!

So, somehow I need to either figure out how to generate land and then wipe it as part of chunk generation, or I need to do a second pass after generating water and convert it to land.

Anyone have an idea how I could modify the water maze mod to do that?
Slackie
Burner Inserter
Burner Inserter
 
Posts: 8
Joined: Mon Mar 20, 2017 10:29 am

Re: Creating an empty map?

Postby abregado » Sun May 14, 2017 12:09 pm

You can override the autoplace controls when you create a new surface.

Have a read in the documentation here http://lua-api.factorio.com/latest/LuaGameScript.html#LuaGameScript.create_surface

When providing a MapSettings table, provide an empty autoplace controls object. It should generate nothing at all.
abregado
Inserter
Inserter
 
Posts: 47
Joined: Sat Aug 30, 2014 9:43 am

Re: Creating an empty map?

Postby Slackie » Sun May 14, 2017 12:27 pm

Surfaces sound promising... I ended up making a little mod to do it:

Code: Select all
local function make_chunk(event)
    local x1 = event.area.left_top.x
    local y1 = event.area.left_top.y
    local x2 = event.area.right_bottom.x
    local y2 = event.area.right_bottom.y
    local surface = event.surface
    local replace_type = "dirt-dark"

    tiles = {}

    for x = x1, x2 do
        for y = y1, y2 do
            local existing_type = surface.get_tile(x, y).name

            if existing_type ~= replace_type then
                table.insert(tiles, {name = replace_type, position = {x, y}})
            end
        end
    end

    surface.set_tiles(tiles)

    for key, entity in pairs(event.surface.find_entities(event.area)) do
        if entity.type ~= "player" then
            entity.destroy()
        end
    end

    surface.destroy_decoratives(event.area)
end

local function on_load(event)
    script.on_event(defines.events.on_chunk_generated, make_chunk)
end

local function on_init(event)
    on_load(nil)
end

script.on_init(on_init)
script.on_load(on_load)
Slackie
Burner Inserter
Burner Inserter
 
Posts: 8
Joined: Mon Mar 20, 2017 10:29 am


Return to Maps and Scenarios

Who is online

Users browsing this forum: No registered users and 2 guests