Factorio.com|Forums|Wiki|Mod Portal|API Docs

# Factorio Prototype Docs Version 2.0.77

# NamedNoiseExpression - Prototype Docs

## NamedNoiseExpression 'noise-expression' Example code

A NoiseExpression with a name. The base game uses named noise expressions to specify functions for many map properties to be used in map generation; e.g. the "elevation" expression is used to calculate elevation for every point on a map. For a list of the built-in named noise expressions, see data.raw.

Named noise expressions can be used by MapGenSettings and MapGenPreset to override which named expression is used to calculate a given property by having an entry in `property_expression_names`, e.g. `elevation = "elevation_island"`.

Alternate expressions can be made available in the map generator GUI by setting their `intended_property` to the name of the property they should override.

Named noise expressions can also be used as noise variables e.g. `var("my-noise-expression")`.

Inherits from Prototype « PrototypeBase

## Properties

- default
- sorted

expression | :: NoiseExpression | The noise expression itself. [...]
The noise expression itself. [...]
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. [...]
intended_property optional | :: string | Names the property that this expression is intended to provide a value for, if any. [...]
Names the property that this expression is intended to provide a value for, if any. [...]

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. [...]
custom_tooltip_fields optional | :: array[CustomTooltipField] | Allows to add extra description items to the tooltip and Factoriopedia.
Allows to add extra description items to the tooltip and Factoriopedia.

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[overridden] optional | :: Order | Used to order alternative expressions in the map generator GUI. [...]
Used to order alternative expressions in the map generator GUI. [...]
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_description optional | :: LocalisedString | Provides additional description used in factoriopedia.
Provides additional description used in factoriopedia.
subgroup optional | :: ItemSubGroupID | The name of an ItemSubGroup.
The name of an ItemSubGroup.
hidden optional | :: boolean |
hidden_in_factoriopedia optional | :: boolean |
parameter optional | :: boolean | 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_simulation 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.

expression | :: NoiseExpression | The noise expression itself. [...]
The noise expression itself. [...]
intended_property optional | :: string | Names the property that this expression is intended to provide a value for, if any. [...]
Names the property that this expression is intended to provide a value for, if any. [...]
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

custom_tooltip_fields optional | :: array[CustomTooltipField] | Allows to add extra description items to the tooltip and Factoriopedia.
Allows to add extra description items to the tooltip and Factoriopedia.
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

name | :: string | Unique textual identification of the prototype. [...]
Unique textual identification of the prototype. [...]
type | :: string | Specifies the kind of prototype this is. [...]
Specifies the kind of prototype this is. [...]
factoriopedia_description optional | :: LocalisedString | Provides additional description used in factoriopedia.
Provides additional description used in factoriopedia.
factoriopedia_simulation 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.
hidden optional | :: boolean |
hidden_in_factoriopedia optional | :: boolean |
localised_description optional | :: LocalisedString | Overwrites the description set in the locale file. [...]
Overwrites the description set in the locale file. [...]
localised_name optional | :: LocalisedString | Overwrites the name set in the locale file. [...]
Overwrites the name set in the locale file. [...]
order[overridden] optional | :: Order | Used to order alternative expressions in the map generator GUI. [...]
Used to order alternative expressions in the map generator GUI. [...]
parameter optional | :: boolean | 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.
subgroup optional | :: ItemSubGroupID | The name of an ItemSubGroup.
The name of an ItemSubGroup.

## Properties

### expression :: NoiseExpression

The noise expression itself. This is where most of the noise magic happens.

### 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, 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.

### intended_property :: string optional

Names the property that this expression is intended to provide a value for, if any. This will make the expression show up as an option in the map generator GUI, unless it is the only expression with that intended property, in which case it will be hidden and selected by default.

For example if a noise expression is intended to be used as an alternative temperature generator, `intended_property` should be "temperature".

## Overridden Properties

### order :: Order optional

Used to order alternative expressions in the map generator GUI. For a given property (e.g. 'temperature'), the NamedNoiseExpression with that property's name as its `intended_property` with the lowest order will be chosen as the default in the GUI.

If no order is specified, it defaults to "2000" if the property name matches the expression name (making it the 'technical default' generator for the property if none is specified in MapGenSettings), or "3000" otherwise. A generator defined with an order less than "2000" but with a unique name can thereby override the default generator used when creating a new map through the GUI without automatically overriding the 'technical default' generator, which is probably used by existing maps.

## Example

    {
      type = "noise-expression",
      name = "distance",
      expression = "distance_from_nearest_point{x = x, y = y, points = starting_positions}"
    }