NoiseFunction parameter defaults

Place to get help with not working mods / modding interface.
Roang
Inserter
Inserter
Posts: 28
Joined: Tue Aug 22, 2017 12:38 pm
Contact:

NoiseFunction parameter defaults

Post by Roang »

I am currently trying to implement a new MapGen Setting and have re-implemented some old 1.0 mod code.

One question that popped up for me is how can one set a default value for NoiseFunction parameters.
The parameters attribute is a string only array, so there is no possibility of param=default.

When looking at multioctave_noise (which I would like to wrap, then some of the parameters have default values. How do I need to define my noise function to achieve the same result?

Here is a sample definition to show off what I want to achieve

Code: Select all

data:extend{
  {
    type = "noise-function",
    name = "multi_octave_wrapper",
    parameters = {
      "x",
       "y",
       "persistence",
       "octaves",
       "seed0",
       "seed1",
       "input_scale_base" = 1, -- should be optional
        "output_scale _base" = 1}, -- should be optional
    expression = "multioctave_noise{\z
        x=x,\z
        y=y,\z
        persistence=persistence,\z
        seed0=seed0,\z
        seed1=seed1,\z
        octaves=octaves,\z
        input_scale=input_scale,\z
        output_scale=output_scale}",
    local_expressions = {
      largest_octave_scale = "(2 ^ (octaves))",
      input_scale = "input_scale_base / largest_octave_scale",
      output_scale = "input_scale_base * largest_octave_scale"
    }
  },
Natha
Filter Inserter
Filter Inserter
Posts: 304
Joined: Sun Mar 15, 2015 1:48 pm
Contact:

Re: NoiseFunction parameter defaults

Post by Natha »

I don't think thats possible, as multioctave_noise is a built-in function that is not defined anywhere in Lua code
Post Reply

Return to “Modding help”