Page 1 of 1

autoplace_controls for new surface doesn't work

Posted: Tue Mar 05, 2019 12:40 pm
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.

Re: autoplace_controls for new surface doesn't work

Posted: Wed Mar 06, 2019 2:36 am
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
        },