signals

raw

An OrderedDict of all signals extracted from data.raw, sorted by the signal processing order. The signal processing order is the sorted virtual signals, followed by the sorted fluid signals, followed by all the sorted item signals. The order of signals in signals.raw can be considered equivalent to signals.virtual + signals.fluid + signals.item. The exact format of the data depends on what type of item/fluid/signal is being queried. Allows the user to iterate over all signals in order, and query specific properties about them, such as their order string for custom sorting orders. Order and content are dependent on loaded mods.

Example:

import json
from draftsman.data import signals

print(json.dumps(signals.raw["iron-ore"], indent=4))
{
    "order": "e[iron-ore]",
    "pictures": [ ... ],
    "stack_size": 50,
    "type": "item",
    "icon_mipmaps": 4,
    "name": "iron-ore",
    "icon": "__base__/graphics/icons/iron-ore.png",
    "subgroup": "raw-resource",
    "icon_size": 64
}
type_of

A dict of all signals where the key is the name of the signal and the value is the signal type of the signal. Note that this value may differ from the value of signals.raw[signal_name]["type"]; this value is used specifically during the construction of SIGNAL_ID. The returned value can be one of "item", "fluid", or "virtual". Order is dependent on loaded mods.

Note

This structure is unsorted. If you want to iterate over signals in order, consider using signals.raw instead:

from draftsman.data import signals

for signal_name in signals.raw:
    print(signals.type_of[signal_name])
item

A list of all item signal names, sorted by their Factorio order. Order and content are dependent on mods.

# Possible contents
[
    "wooden-chest",
    "iron-chest",
    "steel-chest",
    "storage-tank",
    "transport-belt",
    "fast-transport-belt",
    "express-transport-belt",
    "underground-belt",
    "fast-underground-belt",
    "express-underground-belt",
    ...
]
fluid

A list of all fluid signal names, sorted by their Factorio order. Order and content are dependent on loaded mods.

# Possible contents
[
    "water",
    "crude-oil",
    "steam",
    "heavy-oil",
    "light-oil",
    "petroleum-gas",
    "sulfuric-acid",
    "lubricant"
]
virtual

A list of all virtual signal names, sorted by their Factorio order. Order and content are dependent on loaded mods.

# Possible contents
[
    "signal-everything",
    "signal-anything",
    "signal-each",
    "signal-0",
    "signal-1",
    "signal-2",
    "signal-3",
    "signal-4",
    "signal-5",
    "signal-6",
    ...
]

Note

signals.virtual contains the signals in signals.pure_virtual, as illustrated above.

pure_virtual

A list of all pure virtual signal names, sorted by their Factorio order. This list is constant, independent of mods, and is always equivalent to:

["signal-everything", "signal-anything", "signal-each"]
get_signal_type(signal_name: str) str

Returns the type of the signal based on its ID string.

SignalID objects in blueprints require a "type" field when specifying them. However, this information is redundant most of the time, as the type for any signal is always the same, making writing it out arduous. This function conveniently gets the signal type from the signal’s name.

Parameters:

signal_name – The name of the signal.

Returns:

"item", "fluid", or "virtual"

Raises:

InvalidSignalError – If the signal name is not contained within draftsman.data.signals.

signal_dict(signal_name: str) dict

Creates a SignalID dict from the given signal name.

Uses get_signal_type() to get the type for the dictionary.

Parameters:

signal_name – The name of the signal.

Returns:

A dict with the "name" and "type" keys set.