Page 1 of 1

[Done] Map Pre-sets

Posted: Tue Jun 11, 2019 5:43 pm
by TheSAguy
I'm not finding where I can set the Bias for Moisture and Terrain type.
I want to force a -0.5 for both

Image

Thanks.

Re: Map Pre-sets

Posted: Tue Jun 11, 2019 6:25 pm
by Qon
I can't find them in map-gen-presets or map-settings but moisture and aux are noise-layers

data.raw['noise-expression']["control-setting:aux:bias"]

Code: Select all

["control-setting:aux:bias"] = {
      expression = {
        expression_id = "literal-number:0",
        literal_value = 0,
        type = "literal-number"
      },
      name = "control-setting:aux:bias",
      type = "noise-expression"
    },
data.raw['noise-expression']["control-setting:moisture:bias"]

Code: Select all

    ["control-setting:moisture:bias"] = {
      expression = {
        expression_id = "literal-number:0",
        literal_value = 0,
        type = "literal-number"
      },
      name = "control-setting:moisture:bias",
      type = "noise-expression"
    },
So not sure how you would change them just for some presets and not all. I tried

Code: Select all

data.raw['noise-expression']["control-setting:aux:bias"].expression.literal_value = -0.5
data.raw['noise-expression']["control-setting:moisture:bias"].expression.literal_value = -0.5
but that didn't change the settings. (I haven't modded any noise-layers before so I just shotgun tested it)
So I don't know how to do it. Where did you look?

Re: Map Pre-sets

Posted: Tue Jun 11, 2019 6:38 pm
by Bilka
See https://github.com/Bilka2/ChangeMapSett ... i.lua#L514

Changing map gen settings runtime is obviously not the same thing as the presets, but they are close enough. Simply set the property_expression_names to "-0.5" in the map gen preset for the moisture/aux, the same way I am doing it there for the map gen settings. The location of the property_expression_names inside the map gen preset should be documented on the wiki: https://wiki.factorio.com/Types/MapGenPreset

Re: Map Pre-sets

Posted: Tue Jun 11, 2019 7:41 pm
by TheSAguy
I tried, but got lost in all that code. (I know I'm going to be yelled at..)

All I'd like to do is hard-code the two bias.
Why does the below not work?

Code: Select all

data.raw['noise-expression']["control-setting:aux:bias"].expression.literal_value = -0.5
data.raw['noise-expression']["control-setting:moisture:bias"].expression.literal_value = -0.5
Thanks.

Re: Map Pre-sets

Posted: Wed Jun 12, 2019 9:00 am
by Bilka
My code:

Code: Select all

local property_expression_names_mine = {}

property_expression_names_mine["control-setting:moisture:frequency:multiplier"] = 1 / util.textfield_to_number_with_error(climate_table[ENTIRE_PREFIX .. "moisture-freq"]) -- inverse
property_expression_names_mine["control-setting:moisture:bias"] = util.textfield_to_number_with_error(climate_table[ENTIRE_PREFIX .. "moisture-size"])
property_expression_names_mine["control-setting:aux:frequency:multiplier"] = 1 / util.textfield_to_number_with_error(climate_table[ENTIRE_PREFIX .. "aux-freq"]) -- inverse
property_expression_names_mine["control-setting:aux:bias"] = util.textfield_to_number_with_error(climate_table[ENTIRE_PREFIX .. "aux-size"])

map_gen_settings.property_expression_names = property_expression_names_mine
Your code:

Code: Select all

local property_expression_names_mine = {}

property_expression_names_mine["control-setting:moisture:frequency:multiplier"] = 1 / <number you want to have show up in the map generator screen> -- inverse
property_expression_names_mine["control-setting:moisture:bias"] = <number you want to have show up in the map generator screen>
property_expression_names_mine["control-setting:aux:frequency:multiplier"] = 1 / <number you want to have show up in the map generator screen> -- inverse
property_expression_names_mine["control-setting:aux:bias"] = <number you want to have show up in the map generator screen>

data.raw["map-gen-presets"]["default"].your_preset.basic_settings.property_expression_names = property_expression_names_mine

Re: Map Pre-sets

Posted: Wed Jun 12, 2019 2:22 pm
by TheSAguy
Thanks Bilka,
I do appreciate it!