autoplace_controls for new surface doesn't work

Place to get help with not working mods / modding interface.
Raelf
Burner Inserter
Burner Inserter
Posts: 12
Joined: Sun Dec 23, 2018 4:01 pm
Contact:

autoplace_controls for new surface doesn't work

Post by Raelf »

Hello,

I'm trying to change the MapGenSettings for a new surface. But I don't get it working with 0.17. With 0.16 I didn't had any problem. So I think I need to change something, but I can't find what.
Here is how I create my new surface:

Code: Select all

	local settings = game.surfaces[1].map_gen_settings

	settings.autoplace_controls = {
		["moon-sand"] = { size = "normal", frequency="normal" },
		["iron-ore"] = { size = 3, frequency = 0.125, richness = 2 },
		["copper-ore"] = { size = 3, frequency = 0.125, richness = 2 },
		["stone"] = { size = 3, frequency = 0.125, richness = 2 },
		["uranium-ore"] = { size = 3, frequency = 0.125, richness = 2 },
		["helium3"] = { size = 3, frequency = 0.25, richness = 2 },
		["ice"] = { size = 3, frequency = 0.125, richness = 2 },
	}
	settings.autoplace_settings = {
		entity =
		{
			treat_missing_as_default = false,
			settings =
			{
				frequency = "none",
				size = "none",
				richness = "none"
			}
		},
		decorative =
		{
			treat_missing_as_default = false,
			settings =
			{
				frequency = "none",
				size = "none",
				richness="none"
			}
		}
	}
	settings.terrain_segmentation = "none"
	settings.default_enable_all_autoplace_controls = false
	settings.water = "none"
	settings.starting_area = "none"
	settings.height = 100000
	settings.width = 100000

  	global.planets['moon'] = game.create_surface('moon', settings)
The surface is then created and I also have only my moon-sand terrain. But no resources are getting generated. When I change the default_enable_all_autoplace_controls to true it works, but then also the vanilla terrain is available.
Anyone knows what I'm doing wrong?

Thank you for helping and best wishes.
EnigmaticAussie
Fast Inserter
Fast Inserter
Posts: 129
Joined: Mon Dec 18, 2017 7:53 am
Contact:

Re: autoplace_controls for new surface doesn't work

Post by EnigmaticAussie »

I believe it's because they are numerical now, not strings.

Code: Select all

local rail_world_basic_settings = {
    autoplace_controls = {
        coal = {
            frequency = 0.33333333332999997,
            size = 3
        },
        ["copper-ore"] = {
            frequency = 0.33333333332999997,
            size = 3
        },
        ["crude-oil"] = {
            frequency = 0.33333333332999997,
            size = 3
        },
        ["enemy-base"] = {
            size = 0.5
        },
Post Reply

Return to “Modding help”