Page 1 of 1

autoplace_settings does not work with landfill prototype?

Posted: Thu Aug 20, 2020 8:50 pm
by Godmave
This works as expected, the whole surface filled with dirt-6

Code: Select all

    
    local newSurface = game.create_surface(surfaceName, {
        starting_area = "none",
        water = "none",
        cliff_settings = { cliff_elevation_0 = 1024 },
        default_enable_all_autoplace_controls = false,
        autoplace_controls = autoplace_controls,
        autoplace_settings = {
            decorative = { treat_missing_as_default = false },
            entity = { treat_missing_as_default = false },
            tile = {
                treat_missing_as_default = false,
                settings = {
                    ["dirt-6"] = {
                        frequency = "normal",
                        size = "normal",
                    }
                }
            },
        }
    })
This does NOT work, the whole surface is filled with default grass tiles :(

Code: Select all

    
    local newSurface = game.create_surface(surfaceName, {
        starting_area = "none",
        water = "none",
        cliff_settings = { cliff_elevation_0 = 1024 },
        default_enable_all_autoplace_controls = false,
        autoplace_controls = autoplace_controls,
        autoplace_settings = {
            decorative = { treat_missing_as_default = false },
            entity = { treat_missing_as_default = false },
            tile = {
                treat_missing_as_default = false,
                settings = {
                    ["landfill"] = {
                        frequency = "normal",
                        size = "normal",
                    }
                }
            },
        }
    })

Re: autoplace_settings does not work with landfill prototype?

Posted: Thu Aug 20, 2020 10:40 pm
by Rseding91
Landfill doesn't have an autoplace defined in the prototype and so you can't generate a surface with it. Just like how you can't generate a surface with concrete.

You would need to define 'autoplace' in the prototype before it can be used for map generation.

Re: autoplace_settings does not work with landfill prototype?

Posted: Fri Aug 21, 2020 5:17 am
by Godmave
Just in case someone stumbles over this.
The solution is to add the following to the data.lua of your mod.

Code: Select all

data.raw['tile']['landfill']["autoplace"] = {}