UNPKG

typed-factorio

Version:

Featureful typescript definitions for the Factorio modding api.

1,291 lines (1,287 loc) 450 kB
// This is an auto-generated file. Do not edit directly! /** @noSelfInFile */ import type { EntityType } from "factorio:prototype" import type { VersionString } from "factorio:common" /** * @noResolution */ declare module "factorio:runtime" { /** * Identifies a statistics prototype, depending on the statistics type. * * ## Union members * - {@link ItemWithQualityID}: Used with item production statistics. * - {@link FluidID}: Used with fluid production statistics. * - {@link EntityWithQualityID}: Used with electric network, entity build count, and kill count statistics. * - {@link EntityID}: Used with pollution statistics. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/FlowStatisticsID.html Online documentation} */ export type FlowStatisticsID = ItemWithQualityID | FluidID | EntityWithQualityID | EntityID export type ItemStackIndex = uint16 export type LogisticFilterIndex = uint16 export type ItemCountType = uint export type InventoryIndex = uint8 /** * A string that specifies how the inputs should be compared. * * While the API accepts both versions for `"less/greater than or equal to"` and `"not equal"`, it'll always return `"≥"`, `"≤"` or `"≠"` respectively when reading them back. * * ## Union members * - `"="`: "equal to" * - `">"`: "greater than" * - `"<"`: "lesser than" * - `"≥"`: "greater than or equal to" * - `">="`: "greater than or equal to" * - `"≤"`: "lesser than or equal to" * - `"<="`: "lesser than or equal to" * - `"≠"`: "not equal to" * - `"!="`: "not equal to" * @see {@link https://lua-api.factorio.com/2.0.47/concepts/ComparatorString.html Online documentation} */ export type ComparatorString = "=" | ">" | "<" | "≥" | ">=" | "≤" | "<=" | "≠" | "!=" export type ComparatorStringRead = "=" | ">" | "<" | "≥" | "≤" | "≠" export type SpriteType = | "item" | "entity" | "technology" | "recipe" | "fluid" | "tile" | "item-group" | "virtual-signal" | "shortcut" | "achievement" | "equipment" | "ammo-category" | "decorative" | "space-connection" | "space-location" | "surface" | "airborne-pollutant" | "asteroid-chunk" | "quality" | "file" | "utility" /** * It can be either the name of a {@link import("factorio:prototype").SpritePrototype SpritePrototype} defined in the data stage, or a path in form "type/name" or "type.name". * * The validity of a SpritePath can be verified at runtime using {@link LuaHelpers#is_valid_sprite_path LuaHelpers::is_valid_sprite_path}. * * {@link https://lua-api.factorio.com/2.0.47/concepts/SpritePath.html > The supported types are:} * @see {@link https://lua-api.factorio.com/2.0.47/concepts/SpritePath.html Online documentation} */ export type SpritePath = (string & { _?: never }) | `${SpriteType}${"/" | "."}${string}` /** * @example * -- Most common collision mask of buildings: * collision_mask = {layers = {item = true, meltable = true, object = true, player = true, water_tile = true, is_object = true, is_lower_object = true}} * @see {@link https://lua-api.factorio.com/2.0.47/concepts/CollisionMask.html Online documentation} */ export interface CollisionMask { /** * Every key in the dictionary is the name of one {@link LuaCollisionLayerPrototype layer} the object collides with. The value is meaningless and always `true`. An empty table means that no layers are set. */ readonly layers: Record<string, true> /** * Any two entities that both have this option enabled on their prototype and have an identical collision mask layers list will not collide. Other collision mask options are not included in the identical layer list check. This does mean that two different prototypes with the same collision mask layers and this option enabled will not collide. Defaults to `false`. */ readonly not_colliding_with_itself?: boolean /** * Uses the prototypes position rather than its collision box when doing collision checks with tile prototypes. Allows the prototype to overlap colliding tiles up until its center point. This is only respected for character movement and cars driven by players. Defaults to `false`. */ readonly consider_tile_transitions?: boolean /** * Any prototype with this collision option will only be checked for collision with other prototype's collision masks if they are a tile. Defaults to `false`. */ readonly colliding_with_tiles_only?: boolean } /** * The percentual increase of the attribute. A value of `0.6` means a 60% increase. * * Quality values are divided by 10 internally, allowing for one more decimal of precision. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/ModuleEffectValue.html Online documentation} */ export type ModuleEffectValue = float /** * @example * -- These are the effects of the vanilla Speed Module 3 * {speed = 0.5, consumption = 0.7, quality = -0.25} * @see {@link https://lua-api.factorio.com/2.0.47/concepts/ModuleEffects.html Online documentation} */ export interface ModuleEffects { readonly consumption?: ModuleEffectValue readonly speed?: ModuleEffectValue readonly productivity?: ModuleEffectValue readonly pollution?: ModuleEffectValue readonly quality?: ModuleEffectValue } /** * `math.huge` represents the maximum possible tick. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/MapTick.html Online documentation} */ export type MapTick = uint64 /** * A number between 0 and 255 inclusive, represented by one of the following named strings or the string version of the number. For example `"10"` and `"decals"` are both valid. Higher values are rendered above lower values. * * ## Union members * - `string`: A string of a number * - `"zero"`: 0 * - `"background-transitions"`: 1 * - `"under-tiles"`: 2 * - `"decals"`: 10 * - `"above-tiles"`: 11 * - `"ground-layer-1"`: 12 * - `"ground-layer-2"`: 13 * - `"ground-layer-3"`: 14 * - `"ground-layer-4"`: 15 * - `"ground-layer-5"`: 16 * - `"lower-radius-visualization"`: 29 * - `"radius-visualization"`: 30 * - `"transport-belt-integration"`: 65 * - `"resource"`: 66 * - `"building-smoke"`: 67 * - `"rail-stone-path-lower"`: 68 * - `"rail-stone-path"`: 76 * - `"rail-tie"`: 84 * - `"decorative"`: 92 * - `"ground-patch"`: 93 * - `"ground-patch-higher"`: 94 * - `"ground-patch-higher2"`: 95 * - `"rail-chain-signal-metal"`: 96 * - `"rail-screw"`: 97 * - `"rail-metal"`: 100 * - `"remnants"`: 102 * - `"floor"`: 103 * - `"transport-belt"`: 104 * - `"transport-belt-endings"`: 105 * - `"floor-mechanics-under-corpse"`: 106 * - `"corpse"`: 107 * - `"floor-mechanics"`: 108 * - `"item"`: 109 * - `"transport-belt-reader"`: 117 * - `"lower-object"`: 118 * - `"transport-belt-circuit-connector"`: 120 * - `"lower-object-above-shadow"`: 121 * - `"lower-object-overlay"`: 122 * - `"object-under"`: 123 * - `"object"`: 124 * - `"cargo-hatch"`: 125 * - `"higher-object-under"`: 126 * - `"higher-object-above"`: 127 * - `"train-stop-top"`: 128 * - `"item-in-inserter-hand"`: 129 * - `"above-inserters"`: 130 * - `"wires"`: 131 * - `"under-elevated"`: 132 * - `"elevated-rail-stone-path-lower"`: 133 * - `"elevated-rail-stone-path"`: 134 * - `"elevated-rail-tie"`: 135 * - `"elevated-rail-screw"`: 136 * - `"elevated-rail-metal"`: 137 * - `"elevated-lower-object"`: 141 * - `"elevated-object"`: 142 * - `"elevated-higher-object"`: 143 * - `"fluid-visualization"`: 149 * - `"wires-above"`: 150 * - `"entity-info-icon"`: 153 * - `"entity-info-icon-above"`: 154 * - `"explosion"`: 157 * - `"projectile"`: 158 * - `"smoke"`: 159 * - `"air-object"`: 160 * - `"air-entity-info-icon"`: 161 * - `"light-effect"`: 162 * - `"selection-box"`: 187 * - `"higher-selection-box"`: 188 * - `"collision-selection-box"`: 189 * - `"arrow"`: 190 * - `"cursor"`: 226 * @see {@link https://lua-api.factorio.com/2.0.47/concepts/RenderLayer.html Online documentation} */ export type RenderLayer = | `${bigint}` | "zero" | "background-transitions" | "under-tiles" | "decals" | "above-tiles" | "ground-layer-1" | "ground-layer-2" | "ground-layer-3" | "ground-layer-4" | "ground-layer-5" | "lower-radius-visualization" | "radius-visualization" | "transport-belt-integration" | "resource" | "building-smoke" | "rail-stone-path-lower" | "rail-stone-path" | "rail-tie" | "decorative" | "ground-patch" | "ground-patch-higher" | "ground-patch-higher2" | "rail-chain-signal-metal" | "rail-screw" | "rail-metal" | "remnants" | "floor" | "transport-belt" | "transport-belt-endings" | "floor-mechanics-under-corpse" | "corpse" | "floor-mechanics" | "item" | "transport-belt-reader" | "lower-object" | "transport-belt-circuit-connector" | "lower-object-above-shadow" | "lower-object-overlay" | "object-under" | "object" | "cargo-hatch" | "higher-object-under" | "higher-object-above" | "train-stop-top" | "item-in-inserter-hand" | "above-inserters" | "wires" | "under-elevated" | "elevated-rail-stone-path-lower" | "elevated-rail-stone-path" | "elevated-rail-tie" | "elevated-rail-screw" | "elevated-rail-metal" | "elevated-lower-object" | "elevated-object" | "elevated-higher-object" | "fluid-visualization" | "wires-above" | "entity-info-icon" | "entity-info-icon-above" | "explosion" | "projectile" | "smoke" | "air-object" | "air-entity-info-icon" | "light-effect" | "selection-box" | "higher-selection-box" | "collision-selection-box" | "arrow" | "cursor" /** * What is shown in the map view. If a field is not given, that setting will not be changed. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/MapViewSettings.html Online documentation} */ export interface MapViewSettings { readonly "show-logistic-network"?: boolean readonly "show-electric-network"?: boolean readonly "show-turret-range"?: boolean readonly "show-pollution"?: boolean readonly "show-networkless-logistic-members"?: boolean readonly "show-train-station-names"?: boolean readonly "show-player-names"?: boolean readonly "show-tags"?: boolean readonly "show-worker-robots"?: boolean readonly "show-rail-signal-states"?: boolean readonly "show-recipe-icons"?: boolean readonly "show-pipelines"?: boolean readonly "show-non-standard-map-info"?: boolean } /** * ## Union members * - `"entity"`: The normal entity selection box. Yellow by default. * - `"multiplayer-entity"`: The multiplayer entity selection box which gets tinted using {@link LuaPlayer#chat_color LuaPlayer::chat_color}. White by default. * - `"electricity"`: The selection box used to specify electric poles an entity is connected to. Light blue by default. * - `"copy"`: The selection box used when doing entity copy-paste. Green by default. * - `"not-allowed"`: The selection box used when specifying colliding entities. Red by default. * - `"pair"`: Light blue by default. * - `"logistics"`: Light blue by default. * - `"train-visualization"`: White by default. * - `"blueprint-snap-rectangle"`: Green by default. * - `"spidertron-remote-selected"` * - `"spidertron-remote-to-be-selected"` * @see {@link https://lua-api.factorio.com/2.0.47/concepts/CursorBoxRenderType.html Online documentation} */ export type CursorBoxRenderType = | "entity" | "multiplayer-entity" | "electricity" | "copy" | "not-allowed" | "pair" | "logistics" | "train-visualization" | "blueprint-snap-rectangle" | "spidertron-remote-selected" | "spidertron-remote-to-be-selected" /** * The name of a {@link LuaCollisionLayerPrototype}. * @example * "is_lower_object" * @see {@link https://lua-api.factorio.com/2.0.47/concepts/CollisionLayerID.html Online documentation} */ export type CollisionLayerID = string /** * State of a GUI {@link LuaGuiElement#switch_state switch}. * * ## Union members * - `"left"` * - `"right"` * - `"none"` * @see {@link https://lua-api.factorio.com/2.0.47/concepts/SwitchState.html Online documentation} */ export type SwitchState = "left" | "right" | "none" export interface PrototypeWithQuality { /** * Name of a prototype. */ readonly name: string /** * Name of a quality prototype. Always defined when reading, defaults to "normal" when writing. */ readonly quality?: string } export interface PrototypeWithQualityRead { readonly name: string readonly quality: string } /** * A `string` specifying a type for {@link LuaGuiElement#elem_type choose elem buttons}. It's also used by {@link ElemID} for {@link LuaGuiElement#elem_tooltip LuaGuiElement::elem_tooltip}. * * ## Union members * - `"achievement"` * - `"decorative"` * - `"entity"` * - `"equipment"` * - `"fluid"` * - `"item"` * - `"item-group"` * - `"recipe"` * - `"signal"` * - `"technology"` * - `"tile"` * - `"asteroid-chunk"` * - `"space-location"` * - `"item-with-quality"` * - `"entity-with-quality"` * - `"recipe-with-quality"` * - `"equipment-with-quality"` * @see {@link https://lua-api.factorio.com/2.0.47/concepts/ElemType.html Online documentation} */ export type ElemType = | "achievement" | "decorative" | "entity" | "equipment" | "fluid" | "item" | "item-group" | "recipe" | "signal" | "technology" | "tile" | "asteroid-chunk" | "space-location" | "item-with-quality" | "entity-with-quality" | "recipe-with-quality" | "equipment-with-quality" export interface ElemID { readonly type: ElemType /** * Name of a prototype as defined by `type`. */ readonly name: string /** * Name of a quality prototype if `type` use quality. */ readonly quality?: string } /** * An item filter may be specified in two ways, either as a string which is an item prototype name or as a table. * @see ItemFilterWrite * @see {@link https://lua-api.factorio.com/2.0.47/concepts/ItemFilter.html Online documentation} */ export type ItemFilter = | { /** * The item. */ readonly name?: LuaItemPrototype /** * The quality. */ readonly quality?: LuaQualityPrototype /** * The quality comparison type. */ readonly comparator?: ComparatorStringRead } | string /** * Write form of {@link ItemFilter}, where some properties allow additional values as input compared to the read form. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/ItemFilter.html Online documentation} */ export type ItemFilterWrite = | { /** * The item. */ readonly name?: ItemID /** * The quality. */ readonly quality?: QualityID /** * The quality comparison type. */ readonly comparator?: ComparatorString } | string /** * Common attributes to all variants of {@link GuiArrowSpecification}. */ export interface BaseGuiArrowSpecification { readonly margin: uint /** * This determines which of the following fields will be required. */ readonly type: GuiArrowType } /** * `"entity"` variant of {@link GuiArrowSpecification}. */ export interface EntityGuiArrowSpecification extends BaseGuiArrowSpecification { readonly type: "entity" readonly entity: LuaEntity } /** * `"position"` variant of {@link GuiArrowSpecification}. */ export interface PositionGuiArrowSpecification extends BaseGuiArrowSpecification { readonly type: "position" readonly position: MapPosition | MapPositionArray } /** * `"crafting_queue"` variant of {@link GuiArrowSpecification}. */ export interface CraftingQueueGuiArrowSpecification extends BaseGuiArrowSpecification { readonly type: "crafting_queue" /** * Index in the crafting queue to point to. */ readonly crafting_queueindex: uint } /** * `"item_stack"` variant of {@link GuiArrowSpecification}. */ export interface ItemStackGuiArrowSpecification extends BaseGuiArrowSpecification { readonly type: "item_stack" /** * Which inventory the stack is in. */ readonly inventory_index: defines.inventory /** * Which stack to point to. */ readonly item_stack_index: uint readonly source: "player" | "target" | "player-quickbar" } /** * Variants of {@link GuiArrowSpecification} with no additional attributes. */ export interface OtherGuiArrowSpecification extends BaseGuiArrowSpecification { readonly type: "nowhere" | "goal" | "entity_info" | "active_window" } /** * Used for specifying where a GUI arrow should point to. * * Base attributes: {@link BaseGuiArrowSpecification} * * Other attributes may be specified depending on `type`: * - `"entity"`: {@link EntityGuiArrowSpecification} * - `"position"`: {@link PositionGuiArrowSpecification} * - `"crafting_queue"`: {@link CraftingQueueGuiArrowSpecification} * - `"item_stack"`: {@link ItemStackGuiArrowSpecification} * @see {@link https://lua-api.factorio.com/2.0.47/concepts/GuiArrowSpecification.html Online documentation} */ export type GuiArrowSpecification = | EntityGuiArrowSpecification | PositionGuiArrowSpecification | CraftingQueueGuiArrowSpecification | ItemStackGuiArrowSpecification | OtherGuiArrowSpecification /** * Reading this always returns the table with the named keys. * * If this is specified as a three-element array then the array items are x, y and z, in that order. * @see Vector3DArray * @see {@link https://lua-api.factorio.com/2.0.47/concepts/Vector3D.html Online documentation} */ export interface Vector3D { readonly x: float readonly y: float readonly z: float } /** * Array form of {@link Vector3D}. * @see Vector3D * @see {@link https://lua-api.factorio.com/2.0.47/concepts/Vector3D.html Online documentation} */ export type Vector3DArray = readonly [float, float, float] export interface ItemWithQualityCounts { /** * Name of the item prototype. */ readonly name: string /** * The number of items. */ readonly count: uint /** * Name of the item's quality prototype. */ readonly quality: string } export interface EquipmentWithQualityCounts { /** * Name of the equipment prototype. */ readonly name: string /** * The number of equipment items. */ readonly count: uint /** * Name of the equipment's quality prototype. */ readonly quality: string } /** * @see TrainScheduleWrite * @see {@link https://lua-api.factorio.com/2.0.47/concepts/TrainSchedule.html Online documentation} */ export interface TrainSchedule { /** * Index of the currently active record */ readonly current: uint readonly records: ScheduleRecord[] } /** * Write form of {@link TrainSchedule}, where some properties allow additional values as input compared to the read form. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/TrainSchedule.html Online documentation} */ export interface TrainScheduleWrite { /** * Index of the currently active record */ readonly current: uint readonly records: readonly ScheduleRecordWrite[] } /** * @see PlatformScheduleWrite * @see {@link https://lua-api.factorio.com/2.0.47/concepts/PlatformSchedule.html Online documentation} */ export interface PlatformSchedule { /** * Index of the currently active record */ readonly current: uint readonly records: ScheduleRecord[] } /** * Write form of {@link PlatformSchedule}, where some properties allow additional values as input compared to the read form. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/PlatformSchedule.html Online documentation} */ export interface PlatformScheduleWrite { /** * Index of the currently active record */ readonly current: uint readonly records: readonly ScheduleRecordWrite[] } export interface EffectReceiver { readonly base_effect: ModuleEffects readonly uses_module_effects: boolean readonly uses_beacon_effects: boolean readonly uses_surface_effects: boolean } /** * A recipe prototype with optional quality specification. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/RecipeIDAndQualityIDPair.html Online documentation} */ export interface RecipeIDAndQualityIDPair { /** * Recipe prototype. */ readonly name: LuaRecipePrototype /** * Quality prototype. */ readonly quality: LuaQualityPrototype } export interface WorkerRobotOrder { /** * The type of the order. */ readonly type: defines.robot_order_type /** * The target of the order. */ readonly target?: LuaEntity /** * The item to place if relevant. */ readonly item_to_place?: SimpleItemStack /** * The secondary target of the upgrade order. */ readonly secondary_target?: LuaEntity /** * The cliff explosive for the cliff explode job. */ readonly cliff_explosive_id?: LuaItemPrototype /** * The target item of the pickup or deliver order. */ readonly target_item?: ItemIDAndQualityIDPair /** * The target count of the pickup or deliver order. */ readonly target_count?: ItemCountType } /** * A force may be specified in one of three ways. * * ## Union members * - `string`: Name of the force, same as {@link LuaForce#name LuaForce::name}. * - {@link uint8}: Index of the force, same as {@link LuaForce#index LuaForce::index}. * - {@link LuaForce}: A reference to {@link LuaForce} may be passed directly. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/ForceID.html Online documentation} */ export type ForceID = string | uint8 | LuaForce /** * A fluid may be specified in one of three ways. * * ## Union members * - `string`: The fluid name. * - {@link LuaFluidPrototype}: The fluid prototype. * - {@link Fluid}: The fluid. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/FluidID.html Online documentation} */ export type FluidID = string | LuaFluidPrototype | Fluid /** * An entity prototype with optional quality specification. Can be specified in one of four ways. * * ## Union members * - {@link LuaEntity}: The entity. Both prototype and quality of the entity will be used. * - {@link LuaEntityPrototype}: The entity prototype. Normal quality will be used. * - `string`: The prototype name. Normal quality will be used. * - {@link EntityIDAndQualityIDPair}: A table of entity prototype and quality. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/EntityWithQualityID.html Online documentation} */ export type EntityWithQualityID = LuaEntity | LuaEntityPrototype | string | EntityIDAndQualityIDPair /** * An entity prototype with optional quality specification. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/EntityIDAndQualityIDPair.html Online documentation} */ export interface EntityIDAndQualityIDPair { /** * Entity prototype. */ readonly name: EntityID /** * Quality prototype. Normal quality will be used if not specified. */ readonly quality?: QualityID } /** * An item prototype with optional quality specification. Can be specified in one of four ways. * * ## Union members * - {@link LuaItemStack}: The item stack. Both prototype and quality of the item stack will be used. * - {@link LuaItemPrototype}: The item prototype. Normal quality will be used. * - `string`: The prototype name. Normal quality will be used. * - {@link ItemIDAndQualityIDPair}: A table of entity prototype and quality. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/ItemWithQualityID.html Online documentation} */ export type ItemWithQualityID = LuaItemStack | LuaItemPrototype | string | ItemIDAndQualityIDPairWrite /** * An item prototype with optional quality specification. * @see ItemIDAndQualityIDPairWrite * @see {@link https://lua-api.factorio.com/2.0.47/concepts/ItemIDAndQualityIDPair.html Online documentation} */ export interface ItemIDAndQualityIDPair { /** * Item prototype. Returns `LuaItemPrototype` when read. */ readonly name: LuaItemPrototype /** * Quality prototype. Normal quality will be used if not specified. Returns `LuaQualityPrototype` when read. */ readonly quality?: LuaQualityPrototype } /** * Write form of {@link ItemIDAndQualityIDPair}, where some properties allow additional values as input compared to the read form. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/ItemIDAndQualityIDPair.html Online documentation} */ export interface ItemIDAndQualityIDPairWrite { /** * Item prototype. Returns `LuaItemPrototype` when read. */ readonly name: ItemID /** * Quality prototype. Normal quality will be used if not specified. Returns `LuaQualityPrototype` when read. */ readonly quality?: QualityID } /** * An item prototype may be specified in one of four ways. * * ## Union members * - {@link LuaItemPrototype}: Item prototype. * - {@link LuaItemStack}: Non empty item stack. * - {@link LuaItem}: The item. * - `string`: The prototype name. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/ItemID.html Online documentation} */ export type ItemID = LuaItemPrototype | LuaItemStack | LuaItem | string /** * An entity prototype may be specified in one of three ways. * * ## Union members * - {@link LuaEntityPrototype}: The entity prototype. * - {@link LuaEntity}: The entity. * - `string`: The prototype name. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/EntityID.html Online documentation} */ export type EntityID = LuaEntityPrototype | LuaEntity | string /** * An technology prototype may be specified in one of three ways. * * ## Union members * - {@link LuaTechnologyPrototype}: The technology prototype. * - {@link LuaTechnology}: Instance of the technology. * - `string`: The prototype name. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/TechnologyID.html Online documentation} */ export type TechnologyID = LuaTechnologyPrototype | LuaTechnology | string /** * A particle prototype may be specified in one of two ways. * * ## Union members * - {@link LuaParticlePrototype}: The particle prototype. * - `string`: The prototype name. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/ParticleID.html Online documentation} */ export type ParticleID = LuaParticlePrototype | string /** * A damage type prototype may be specified in one of two ways. * * ## Union members * - {@link LuaDamagePrototype}: The damage type prototype. * - `string`: The prototype name. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/DamageTypeID.html Online documentation} */ export type DamageTypeID = LuaDamagePrototype | string /** * A trivial smoke prototype may be specified in one of two ways. * * ## Union members * - {@link LuaTrivialSmokePrototype}: The trivial smoke prototype. * - `string`: The prototype name. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/TrivialSmokeID.html Online documentation} */ export type TrivialSmokeID = LuaTrivialSmokePrototype | string /** * The text is aligned so that the target position is at the given side of the text. * * For example, `"right"` aligned text means the right side of the text is at the target position. Or in other words, the target is on the right of the text. * * ## Union members * - `"left"` * - `"right"` * - `"center"` * @see {@link https://lua-api.factorio.com/2.0.47/concepts/TextAlign.html Online documentation} */ export type TextAlign = "left" | "right" | "center" /** * The text is aligned so that the target position is at the given side of the text. * * For example, `"top"` aligned text means the top of the text is at the target position. Or in other words, the target is at the top of the text. * * ## Union members * - `"top"` * - `"middle"` * - `"baseline"` * - `"bottom"` * @see {@link https://lua-api.factorio.com/2.0.47/concepts/VerticalTextAlign.html Online documentation} */ export type VerticalTextAlign = "top" | "middle" | "baseline" | "bottom" /** * A quality prototype may be specified in one of two ways. * * ## Union members * - {@link LuaQualityPrototype}: The quality prototype. * - `string`: The prototype name. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/QualityID.html Online documentation} */ export type QualityID = LuaQualityPrototype | string /** * A recipe may be specified in one of three ways. * * ## Union members * - {@link LuaRecipePrototype}: By recipe prototype. * - {@link LuaRecipe}: By instance of recipe. * - `string`: By name of the recipe prototype. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/RecipeID.html Online documentation} */ export type RecipeID = LuaRecipePrototype | LuaRecipe | string /** * A tile may be specified in one of three ways. * * ## Union members * - {@link LuaTilePrototype}: By tile prototype. * - {@link LuaTile}: By instance of tile. * - `string`: By name of the tile prototype. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/TileID.html Online documentation} */ export type TileID = LuaTilePrototype | LuaTile | string export interface Fluid { /** * Fluid prototype name of the fluid. */ readonly name: string /** * Amount of the fluid. */ readonly amount: double /** * The temperature. When reading from {@link LuaFluidBox}, this field will always be present. It is not necessary to specify it when writing, however. When not specified, the fluid will be set to the fluid's default temperature as specified in the fluid's prototype. */ readonly temperature?: float } /** * An equipment prototype may be specified in one of three ways. * * ## Union members * - {@link LuaEquipmentPrototype}: The equipment prototype. * - {@link LuaEquipment}: The equipment. * - `string`: The prototype name. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/EquipmentID.html Online documentation} */ export type EquipmentID = LuaEquipmentPrototype | LuaEquipment | string /** * An equipment prototype with optional quality specification. * * ## Union members * - {@link LuaEquipmentPrototype}: The equipment prototype. Normal quality will be used. * - {@link LuaEquipment}: The equipment. Both prototype and quality of the provided equipment will be used. * - `string`: The prototype name. Normal quality will be used. * - {@link EquipmentIDAndQualityIDPair}: A table of equipment prototype and quality. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/EquipmentWithQualityID.html Online documentation} */ export type EquipmentWithQualityID = LuaEquipmentPrototype | LuaEquipment | string | EquipmentIDAndQualityIDPair /** * An equipment prototype with optional quality specification. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/EquipmentIDAndQualityIDPair.html Online documentation} */ export interface EquipmentIDAndQualityIDPair { /** * Equipment prototype. */ readonly name: EquipmentID /** * Quality prototype. Normal quality will be used if not specified. */ readonly quality?: QualityID } /** * Two positions, specifying the top-left and bottom-right corner of the box respectively. Like with {@link MapPosition}, the names of the members may be omitted. When read from the game, the third member `orientation` is present if it is non-zero. * @see BoundingBoxArray * @example * -- Explicit definition * {left_top = {x = -2, y = -3}, right_bottom = {x = 5, y = 8}} * @example * -- Shorthand * {{-2, -3}, {5, 8}} * @see {@link https://lua-api.factorio.com/2.0.47/concepts/BoundingBox.html Online documentation} */ export interface BoundingBox { readonly left_top: MapPosition readonly right_bottom: MapPosition readonly orientation?: RealOrientation } /** * Array form of {@link BoundingBox}. * @see BoundingBox * @see {@link https://lua-api.factorio.com/2.0.47/concepts/BoundingBox.html Online documentation} */ export type BoundingBoxArray = readonly [MapPosition | MapPositionArray, MapPosition | MapPositionArray] export interface BoundingBoxWrite { readonly left_top: (MapPosition | MapPositionArray) | MapPositionArray readonly right_bottom: (MapPosition | MapPositionArray) | MapPositionArray readonly orientation?: RealOrientation } /** * Space platform may be specified in one of one ways. * * ## Union members * - {@link LuaSpacePlatform} * @see {@link https://lua-api.factorio.com/2.0.47/concepts/SpacePlatformIdentification.html Online documentation} */ export type SpacePlatformIdentification = LuaSpacePlatform /** * Set of forces. Can be specified in one of two ways. * * ## Union members * - {@link LuaForce}[]: Array of many forces. * - {@link LuaForce}: A single force. * @see ForceSetWrite * @see {@link https://lua-api.factorio.com/2.0.47/concepts/ForceSet.html Online documentation} */ export type ForceSet = LuaForce[] | LuaForce /** * Write form of {@link ForceSet}, where some properties allow additional values as input compared to the read form. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/ForceSet.html Online documentation} */ export type ForceSetWrite = readonly ForceID[] | ForceID /** * A decorative prototype may be specified in one of two ways. * * ## Union members * - {@link LuaDecorativePrototype}: The decorative prototype. * - `string`: The prototype name. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/DecorativeID.html Online documentation} */ export type DecorativeID = LuaDecorativePrototype | string /** * An asteroid chunk prototype may be specified in one of two ways. * * ## Union members * - {@link LuaAsteroidChunkPrototype}: The asteroid chunk prototype. * - `string`: The prototype name. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/AsteroidChunkID.html Online documentation} */ export type AsteroidChunkID = LuaAsteroidChunkPrototype | string /** * A space location prototype may be specified in one of two ways. * * ## Union members * - {@link LuaSpaceLocationPrototype}: The space location prototype. * - `string`: The prototype name. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/SpaceLocationID.html Online documentation} */ export type SpaceLocationID = LuaSpaceLocationPrototype | string /** * A signal filter may be specified in two ways, either as a string which is a virtual signal name or item prototype name or as a table. * @see SignalFilterWrite * @see {@link https://lua-api.factorio.com/2.0.47/concepts/SignalFilter.html Online documentation} */ export type SignalFilter = | { /** * The type of the signal filter. */ readonly type?: SignalIDType /** * Name of the signal. */ readonly name: string /** * The prototype name of the signal's quality. `nil` for any quality. */ readonly quality?: LuaQualityPrototype /** * The comparator for quality. `nil` if any quality. */ readonly comparator?: ComparatorStringRead } | string /** * Write form of {@link SignalFilter}, where some properties allow additional values as input compared to the read form. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/SignalFilter.html Online documentation} */ export type SignalFilterWrite = | { /** * The type of the signal filter. */ readonly type?: SignalIDType /** * Name of the signal. */ readonly name: string /** * The prototype name of the signal's quality. `nil` for any quality. */ readonly quality?: QualityID /** * The comparator for quality. `nil` if any quality. */ readonly comparator?: ComparatorString } | string /** * @see LogisticFilterWrite * @see {@link https://lua-api.factorio.com/2.0.47/concepts/LogisticFilter.html Online documentation} */ export interface LogisticFilter { /** * The item filter to put into the slot. */ readonly value?: SignalFilter /** * The minimum amount to satisfy. */ readonly min?: int /** * The maximum amount to keep in inventory. `nil` for infinite. */ readonly max?: ItemCountType /** * The minimum count that will be delivered to a space platform. `nil` if unchanged from the default. */ readonly minimum_delivery_count?: ItemCountType /** * The space location to import from. */ readonly import_from?: LuaSpaceLocationPrototype } /** * Write form of {@link LogisticFilter}, where some properties allow additional values as input compared to the read form. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/LogisticFilter.html Online documentation} */ export interface LogisticFilterWrite { /** * The item filter to put into the slot. */ readonly value?: SignalFilterWrite /** * The minimum amount to satisfy. */ readonly min?: int /** * The maximum amount to keep in inventory. `nil` for infinite. */ readonly max?: ItemCountType /** * The minimum count that will be delivered to a space platform. `nil` if unchanged from the default. */ readonly minimum_delivery_count?: ItemCountType /** * The space location to import from. */ readonly import_from?: SpaceLocationID } export interface PrintSettings { /** * Color of the message to print. Defaults to white. */ readonly color?: Color | ColorArray /** * If a sound should be emitted for this message. Defaults to `defines.print_sound.use_player_settings`. */ readonly sound?: defines.print_sound /** * Condition when to skip adding message. Defaults to `defines.print_skip.if_redundant`. */ readonly skip?: defines.print_skip /** * The sound to play. If not given, {@link import("factorio:prototype").UtilitySounds#console_message UtilitySounds::console_message} will be used instead. */ readonly sound_path?: SoundPath /** * The volume of the sound to play. Must be between 0 and 1 inclusive. Defaults to 1. */ readonly volume_modifier?: float /** * If set to false, message will not be part of game state and will disappear from output console after save-load. Defaults to `true`. */ readonly game_state?: boolean } /** * Surface property prototype may be specified in one of two ways. * * ## Union members * - {@link LuaSurfacePropertyPrototype}: The surface property prototype. * - `string`: The prototype name. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/SurfacePropertyID.html Online documentation} */ export type SurfacePropertyID = LuaSurfacePropertyPrototype | string /** * When writing it is possible to give LuaEntity or MapPosition directly. However, reading always returns the full ScriptRenderTargetTable. * @see ScriptRenderTargetWrite * @see {@link https://lua-api.factorio.com/2.0.47/concepts/ScriptRenderTarget.html Online documentation} */ export type ScriptRenderTarget = LuaEntity | MapPosition | ScriptRenderTargetTable /** * Write form of {@link ScriptRenderTarget}, where some properties allow additional values as input compared to the read form. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/ScriptRenderTarget.html Online documentation} */ export type ScriptRenderTargetWrite = LuaEntity | (MapPosition | MapPositionArray) | ScriptRenderTargetTableWrite /** * @see ScriptRenderTargetTableWrite * @see {@link https://lua-api.factorio.com/2.0.47/concepts/ScriptRenderTargetTable.html Online documentation} */ export interface ScriptRenderTargetTable { readonly entity?: LuaEntity /** * Only used if `entity` was given. */ readonly offset?: Vector /** * Only used, and mandatory if `entity` is not given. */ readonly position?: MapPosition } /** * Write form of {@link ScriptRenderTargetTable}, where some properties allow additional values as input compared to the read form. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/ScriptRenderTargetTable.html Online documentation} */ export interface ScriptRenderTargetTableWrite { readonly entity?: LuaEntity /** * Only used if `entity` was given. */ readonly offset?: Vector /** * Only used, and mandatory if `entity` is not given. */ readonly position?: MapPosition | MapPositionArray } /** * An item filter may be specified in two ways, either as a string which is a quality prototype name or as a table. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/QualityCondition.html Online documentation} */ export type QualityCondition = | { /** * The prototype name of the quality. */ readonly quality?: string /** * The comparator for quality. */ readonly comparator?: ComparatorString } | string /** * The destination of a cargo pod. * @see CargoDestinationWrite * @see {@link https://lua-api.factorio.com/2.0.47/concepts/CargoDestination.html Online documentation} */ export interface CargoDestination { /** * The type of destination. */ readonly type: defines.cargo_destination /** * Only used if `type` is {@link defines.cargo_destination.station station}. Must be entity of type `cargo-landing-pad` or `space-platform-hub`. */ readonly station?: LuaEntity /** * Only used if `type` is {@link defines.cargo_destination.station station}. Must be connected to the station and not reserved. */ readonly hatch?: LuaCargoHatch /** * Only used if `type` is {@link defines.cargo_destination.station station} or {@link defines.cargo_destination.surface surface}. If true, items with {@link import("factorio:prototype").ItemPrototype#rocket_launch_products rocket_launch_products} defined will be transformed into their products before starting descent. Defaults to `false`. */ readonly transform_launch_products?: boolean /** * Only used if `type` is {@link defines.cargo_destination.surface surface}. */ readonly surface?: SurfaceIdentification /** * Only used if `type` is {@link defines.cargo_destination.surface surface}. Determines the position on the surface to land near. If not provided, cargo pod will switch destination type from {@link defines.cargo_destination.surface surface} to {@link defines.cargo_destination.station station} before starting descent if there is a station available, and will land at {0, 0} if there is no station available. */ readonly position?: MapPosition /** * Only used if `type` is {@link defines.cargo_destination.surface surface} and `position` is specified. Determines whether to land at `position` exactly or at a random location nearby. Defaults to `false`. */ readonly land_at_exact_position?: boolean /** * Only used if `type` is {@link defines.cargo_destination.space_platform space_platform}. Only used for sending space platform starter packs to a platform that is waiting for a starter pack. */ readonly space_platform?: SpacePlatformIdentification } /** * Write form of {@link CargoDestination}, where some properties allow additional values as input compared to the read form. * @see {@link https://lua-api.factorio.com/2.0.47/concepts/CargoDestination.html Online documentation} */ export interface CargoDestinationWrite { /** * The type of destination. */ readonly type: defines.cargo_destination /** * Only used if `type` is {@link defines.cargo_destination.station station}. Must be entity of type `cargo-landing-pad` or `space-platform-hub`. */ readonly station?: LuaEntity /** * Only used if `type` is {@link defines.cargo_destination.station station}. Must be connected to the station and not reserved. */ readonly hatch?: LuaCargoHatch /** * Only used if `type` is {@link defines.cargo_destination.station station} or {@link defines.cargo_destination.surface surface}. If true, items with {@link import("factorio:prototype").ItemPrototype#rocket_launch_products rocket_launch_products} defined will be transformed into their products before starting descent. Defaults to `false`. */ readonly transform_launch_products?: boolean /** * Only used if `type` is {@link defines.cargo_destination.surface surface}. */ readonly surface?: SurfaceIdentification /** * Only used if `type` is {@link defines.cargo_destination.surface surface}. Determines the position on the surface to land near. If not provided, cargo pod will switch destination type from {@link defines.cargo_destination.surface surface} to {@link defines.cargo_destination.station station} before starting descent if there is a station available, and will land at {0, 0} if there is no station available. */ readonly position?: MapPosition | MapPositionArray /** * Only used if `type` is {@link defines.cargo_destination.surface surface} and `position` is specified. Determines whether to land at `position` exactly or at a random location nearby. Defaults to `false`. */ readonly land_at_exact_position?: boolean /** * Only used if `type` is {@link defines.cargo_destination.space_platform space_platform}. Only used for sending space platform starter packs to a platform that is waiting for a starter pack. */ readonly space_platform?: SpacePlatformIdentification } export interface ScheduleRecordPosition { /** * The schedule index */ readonly schedule_index?: uint /** * The interrupt index */ readonly interrupt_index?: uint } /** * A set of limitations for the player zoom level. * @example * { * closest = { zoom = 4 }, * furthest = { zoom = 1 / 16 }, * furthest_game_view = { distance = 200, max_distance = 400 } * } * @see {@link https://lua-api.factorio.com/2.0.47/concepts/ZoomLimits.html Online documentation} */ export interface ZoomLimits { /** * The closest zoom level that the player's current controller can have. If not defined when overwriting {@link LuaPlayer#zoom_limits LuaPlayer::zoom_limits}, then the default value for the current controller as defined by the engine will be used instead. When reading from {@link LuaPlayer#zoom_limits LuaPlayer::zoom_limits}, this field will contain the value previously set by a script or the default value defined by the engine. */ readonly closest?: ZoomSpecification /** * The furthest zoom level that the player's current controller can have. If for any reason the `furthest` limit is closer than `closest`, then the player's zoom will be locked to the closer of the two values. If not defined when overwriting {@link LuaPlayer#zoom_limits LuaPlayer::zoom_limits}, then the default value for the current controller as defined by the engine will be used instead. When reading from {@link LuaPlayer#zoom_limits LuaPlayer::zoom_limits}, this field will contain the value previously set by a script or the default value defined by the engine. */ readonly furthest?: ZoomSpecification /** * The furthest zoom level at which the engine will render the game view. Zoom levels further than this limit will render using chart (map) view. Set this to the same value as `furthest` to force the game view at all zoom levels. Set this to some value closer than `closest` to force chart view at all zoom levels. If not defined when overwriting {@link LuaPlayer#zoom_limits LuaPlayer::zoom_limits}, then the default value for the current controller as defined by the engine will be used instead. When reading from {@link LuaPlayer#zoom_limits LuaPlayer::zoom_limits}, this field will contain the value previously set by a script or the default value defined by the engine. */ readonly furthest_game_view?: ZoomSpecification } /** * A table specifying a fixed or dynamically-computed zoom level using one of the supported methods. Used by {@link ZoomLimits}. * * Method 1 only uses the `zoom` fie