[Done] Map Pre-sets

Place to get help with not working mods / modding interface.
Post Reply
TheSAguy
Smart Inserter
Smart Inserter
Posts: 1449
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

[Done] Map Pre-sets

Post 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.
Last edited by TheSAguy on Wed Jun 12, 2019 2:22 pm, edited 1 time in total.

Qon
Smart Inserter
Smart Inserter
Posts: 2118
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: Map Pre-sets

Post 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?

Bilka
Factorio Staff
Factorio Staff
Posts: 3135
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Map Pre-sets

Post 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
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

TheSAguy
Smart Inserter
Smart Inserter
Posts: 1449
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

Re: Map Pre-sets

Post 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.

Bilka
Factorio Staff
Factorio Staff
Posts: 3135
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Map Pre-sets

Post 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
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

TheSAguy
Smart Inserter
Smart Inserter
Posts: 1449
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

Re: Map Pre-sets

Post by TheSAguy »

Thanks Bilka,
I do appreciate it!

Post Reply

Return to “Modding help”