Factorio Prototype DocsVersion 2.0.28

NamedNoiseFunction 'noise-function' newExample code

Named noise functions are defined in the same way as NamedNoiseExpression except that they also have parameters.

Named noise functions are available to be used in NoiseExpressions.

Inherits from Prototype « PrototypeBase

Properties

parameters :: array[string]

The order of the parameters matters because functions can also be called with positional arguments. [...]

The order of the parameters matters because functions can also be called with positional arguments. [...]

expression :: NoiseExpression
local_expressions optional :: dictionary[string → NoiseExpression]

A map of expression name to expression. [...]

A map of expression name to expression. [...]

local_functions optional :: dictionary[string → NoiseFunction]

A map of function name to function. [...]

A map of function name to function. [...]

Inherited from Prototype
factoriopedia_alternative optional :: string

The ID type corresponding to the prototype that inherits from this. [...]

The ID type corresponding to the prototype that inherits from this. [...]

Inherited from PrototypeBase
type :: string

Specifies the kind of prototype this is. [...]

Specifies the kind of prototype this is. [...]

name :: string

Unique textual identification of the prototype. [...]

Unique textual identification of the prototype. [...]

order optional :: Order

Used to order prototypes in inventory, recipes and GUIs. [...]

Used to order prototypes in inventory, recipes and GUIs. [...]

localised_name optional :: LocalisedString

Overwrites the name set in the locale file. [...]

Overwrites the name set in the locale file. [...]

localised_description optional :: LocalisedString

Overwrites the description set in the locale file. [...]

Overwrites the description set in the locale file. [...]

factoriopedia_descriptionnew optional :: LocalisedString

Provides additional description used in factoriopedia.

Provides additional description used in factoriopedia.

subgroupnew optional :: ItemSubGroupID

The name of an ItemSubGroup.

The name of an ItemSubGroup.

hiddennew optional :: bool
hidden_in_factoriopedianew optional :: bool
parameternew optional :: bool

Whether the prototype is a special type which can be used to parametrize blueprints and doesn't have other function.

Whether the prototype is a special type which can be used to parametrize blueprints and doesn't have other function.

factoriopedia_simulationnew optional :: SimulationDefinition

The simulation shown when looking at this prototype in the Factoriopedia GUI.

The simulation shown when looking at this prototype in the Factoriopedia GUI.

Properties

parameters :: array[string]

The order of the parameters matters because functions can also be called with positional arguments.

A function can't have more than 255 parameters.

expression :: NoiseExpression

local_expressions :: dictionary[string → NoiseExpression] optional

A map of expression name to expression.

Local expressions are meant to store data locally similar to local variables in Lua. Their purpose is to hold noise expressions used multiple times in the named noise expression, or just to tell the reader that the local expression has a specific purpose. Local expressions can access other local definitions and also function parameters, but recursive definitions aren't supported.

local_functions :: dictionary[string → NoiseFunction] optional

A map of function name to function.

Local functions serve the same purpose as local expressions - they aren't visible outside of the specific prototype and they have access to other local definitions.

Examples

{
  type = "noise-function",
  name = "random_between",
  parameters = {"from", "to"},
  expression = "random_penalty{x = x, y = y, source = to, amplitude = to - from}"
}
{
  type = "noise-function",
  name = "finish_elevation",
  parameters = {"elevation", "segmentation_multiplier"},
  expression = "min((elevation - water_level) / segmentation_multiplier, <more stuff>, starting_lake_distance / 16 + starting_lake_noise / 2)",
  local_expressions =
  {
    starting_lake_distance = "distance_from_nearest_point{x = x, y = y, points = starting_lake_positions, maximum_distance = 1024}",
    starting_lake_noise = "quick_multioctave_noise_persistence{<more stuff>}"
  }
}

Prototypes

Types

Defines