Classes

This is a list of all Lua classes defined by Factorio.
class LuaBootstrap
on_init(f) Register a callback to be run on mod init.
on_load(f) Register a function to be run on module load.
on_configuration_changed(f) Register a function to be run when mod configuration changes.
on_event(event, f) Register a handler to run on event or events.
generate_event_name() → uint Generate a new, unique event ID.
class LuaChunkIterator
valid :: boolean [R] Is this object valid?
class LuaCircuitNetwork
get_signal(SignalID) The current value of the signal.
entity :: LuaEntity [R] The entity this circuit network reference is associated with
wire_type :: defines.wire_type [R] The wire type this network is associated with.
circuit_connector_id :: defines.circuit_connector_id [R] The circuit connector ID on the associated entity this network was gotten from.
signals :: array of Signal [R] The circuit network signals last tick.
valid :: boolean [R] Is this object valid?
class LuaControl
get_inventory(inventory) → LuaInventory Get an inventory belonging to this entity.
get_quickbar() → LuaInventory Get the quickbar belonging to this entity if any.
can_insert(items) → boolean Can at least some items be inserted?
insert(items) → uint Insert items into this entity.
set_gui_arrow{type=…} Create an arrow which points at this entity.
clear_gui_arrow() Removes the arrow created by set_gui_arrow.
get_item_count(item) → uint Get the number of all or some items in this entity.
has_items_inside() → boolean Does this entity have any item inside it?
can_reach_entity(entity) → boolean Can a given entity be opened or accessed?
clear_items_inside() Remove all items from this entity.
remove_item(items) → uint Remove items from this entity.
teleport(position, surface) → boolean Teleport the entity to a given position, possibly on another surface.
update_selected_entity(position) Select an entity, as if by hovering the mouse above it.
clear_selected_entity() Unselect any selected entity.
disable_flashlight() Disable the flashlight.
enable_flashlight() Enable the flashlight.
get_craftable_count(recipe) → uint Gets the count of the given recipe that can be crafted.
begin_crafting{count=…, recipe=…, silent=…} → uint Begins crafting the given count of the given recipe
cancel_crafting(options) Cancels crafting the given count of the given crafting queue index
surface :: LuaSurface [R] The surface this entity is currently on.
position :: Position [R] Current position of the entity.
vehicle :: LuaEntity [R] The vehicle the player is currently sitting in; nil if none.
force :: LuaForce [R] The force of this entity.
selected :: LuaEntity [R] The currently selected entity; nil if none.
opened :: LuaEntity [R] The entity whose GUI the player currently has open; nil if none.
crafting_queue_size :: uint [R] Size of the crafting queue.
walking_state [R] Current walking state.
riding_state [R] Current riding state of this car or the vehicle this player is riding in.
mining_state [R] Current mining state.
cursor_stack :: LuaItemStack [R] The player's cursor stack.
driving :: boolean [R] true if the player is in a vehicle.
crafting_queue :: array of CraftingQueueItem [R] Gets the current crafting queue items.
cheat_mode :: boolean [R] When true hand crafting is free and instant
character_crafting_speed_modifier :: double [R]
character_mining_speed_modifier :: double [R]
character_running_speed_modifier :: double [R]
character_build_distance_bonus :: uint [R]
character_item_drop_distance_bonus :: uint [R]
character_reach_distance_bonus :: uint [R]
character_resource_reach_distance_bonus :: uint [R]
character_item_pickup_distance_bonus :: uint [R]
character_loot_pickup_distance_bonus :: uint [R]
quickbar_count_bonus :: uint [R]
character_inventory_slots_bonus :: uint [R]
character_logistic_slot_count_bonus :: uint [R]
character_trash_slot_count_bonus :: uint [R]
character_maximum_following_robot_count_bonus :: uint [R]
character_health_bonus :: float [R]
auto_trash_filters :: dictionary stringuint [R] The auto-trash filters.
class LuaControlBehavior
get_circuit_network(wire, circuit_connector) → LuaCircuitNetwork
type :: defines.control_behavior.type [R] The concrete type of this control behavior.
entity :: LuaEntity [R] The entity this control behavior belongs to.
class LuaAccumulatorControlBehavior extends LuaControlBehavior
valid :: boolean [R] Is this object valid?
Inherited from LuaControlBehavior: get_circuit_network, type, entity
class LuaCombinatorControlBehavior extends LuaControlBehavior
get_signal_last_tick(signal) Gets the value of a specific signal sent by this combinator behavior last tick or nil if the signal didn't exist.
signals_last_tick :: array of Signal [R] The circuit network signals sent by this combinator last tick.
class LuaConstantCombinatorControlBehavior extends LuaControlBehavior
parameters :: ConstantCombinatorParameters [RW] The constant combinator parameters
enabled :: boolean [RW] Turns this constant combinator on and off.
valid :: boolean [R] Is this object valid?
Inherited from LuaControlBehavior: get_circuit_network, type, entity
class LuaContainerControlBehavior extends LuaControlBehavior
valid :: boolean [R] Is this object valid?
Inherited from LuaControlBehavior: get_circuit_network, type, entity
class LuaGenericOnOffControlBehavior extends LuaControlBehavior
disabled :: boolean [R] If the entity is currently disabled because of the control behavior.
circuit_condition :: CircuitConditionSpecification [RW] The circuit condition.
logistic_condition :: CircuitConditionSpecification [RW] The logistic condition.
connect_to_logistic_network :: boolean [RW] true if this should connect to the logitic network.
valid :: boolean [R] Is this object valid?
Inherited from LuaControlBehavior: get_circuit_network, type, entity
class LuaLogisticContainerControlBehavior extends LuaControlBehavior
circuit_mode_of_operation :: defines.control_behavior.logistic_container.circuit_mode_of_operation [RW] The circuit mode of operations for the logistic container.
valid :: boolean [R] Is this object valid?
Inherited from LuaControlBehavior: get_circuit_network, type, entity
class LuaRailSignalControlBehavior extends LuaControlBehavior
valid :: boolean [R] Is this object valid?
Inherited from LuaControlBehavior: get_circuit_network, type, entity
class LuaRoboportControlBehavior extends LuaControlBehavior
mode_of_operations :: defines.control_behavior.roboport.circuit_mode_of_operation [RW]
available_logistic_output_signal :: SignalID [RW]
total_logistic_output_signal :: SignalID [RW]
available_construction_output_signal :: SignalID [RW]
total_construction_output_signal :: SignalID [RW]
valid :: boolean [R] Is this object valid?
Inherited from LuaControlBehavior: get_circuit_network, type, entity
class LuaStorageTankControlBehavior extends LuaControlBehavior
valid :: boolean [R] Is this object valid?
Inherited from LuaControlBehavior: get_circuit_network, type, entity
class LuaTrainStopControlBehavior extends LuaControlBehavior
send_to_train :: boolean [RW] true if the train stop should send the circuit network contents to the train to use.
valid :: boolean [R] Is this object valid?
Inherited from LuaControlBehavior: get_circuit_network, type, entity
class LuaWallControlBehavior extends LuaControlBehavior
circuit_condition :: CircuitConditionSpecification [RW] The circuit condition.
valid :: boolean [R] Is this object valid?
Inherited from LuaControlBehavior: get_circuit_network, type, entity
class LuaArithmeticCombinatorControlBehavior extends LuaCombinatorControlBehavior
parameters :: ArithmeticCombinatorParameters [RW] The arithmetic combinator parameters.
valid :: boolean [R] Is this object valid?
Inherited from LuaControlBehavior: get_circuit_network, type, entity
Inherited from LuaCombinatorControlBehavior: get_signal_last_tick, signals_last_tick
class LuaDeciderCombinatorControlBehavior extends LuaCombinatorControlBehavior
parameters :: DeciderCombinatorParameters [RW] The decider combinator parameters
valid :: boolean [R] Is this object valid?
Inherited from LuaControlBehavior: get_circuit_network, type, entity
Inherited from LuaCombinatorControlBehavior: get_signal_last_tick, signals_last_tick
class LuaInserterControlBehavior extends LuaGenericOnOffControlBehavior
circuit_read_hand_contents :: boolean [RW] true if the contents of the inserter hand should be sent to the circuit network
circuit_mode_of_operation :: defines.control_behavior.inserter.circuit_mode_of_operation [RW] The circuit mode of operations for the inserter.
circuit_hand_read_mode :: defines.control_behavior.inserter.hand_read_mode [RW] The hand read mode for the inserter.
valid :: boolean [R] Is this object valid?
Inherited from LuaControlBehavior: get_circuit_network, type, entity
Inherited from LuaGenericOnOffControlBehavior: disabled, circuit_condition, logistic_condition, connect_to_logistic_network
class LuaLampControlBehavior extends LuaGenericOnOffControlBehavior
use_colors :: boolean [RW] true if the lamp should set the color from the circuit network signals.
valid :: boolean [R] Is this object valid?
Inherited from LuaControlBehavior: get_circuit_network, type, entity
Inherited from LuaGenericOnOffControlBehavior: disabled, circuit_condition, logistic_condition, connect_to_logistic_network
class LuaTransportBeltControlBehavior extends LuaGenericOnOffControlBehavior
valid :: boolean [R] Is this object valid?
Inherited from LuaControlBehavior: get_circuit_network, type, entity
Inherited from LuaGenericOnOffControlBehavior: disabled, circuit_condition, logistic_condition, connect_to_logistic_network
class LuaCustomTable
operator [] [RW] Access an element of this custom table.
operator # :: uint [R] Number of elements in this table.
valid :: boolean [R] Is this object valid?
class LuaDamagePrototype
name :: string [R] Name of this prototype.
order :: string [R] Order string of this prototype.
localised_name :: LocalisedString [R]
valid :: boolean [R] Is this object valid?
class LuaEntity extends LuaControl
get_output_inventory() → LuaInventory Gets the entities output inventory if it has one.
get_module_inventory() → LuaInventory
get_fuel_inventory() → LuaInventory The fuel inventory for this entity or nil if this entity doesn't have a fuel inventory.
damage(damage, force, type) → float Damages the entity.
destroy() → boolean Destroys the entity.
set_command(command) Give the entity a command.
has_command() → boolean Has this unit been assigned a command?
die() Immediately kills the entity.
has_flag(flag) → boolean Test whether this entity's prototype has a flag set.
add_market_item{price=…, offer=…} Offer a thing on the market.
remove_market_item(offer) → boolean Remove an offer from a market.
get_market_items() → array of Offer Get all offers in a market as an array.
connect_neighbour(target) Connect two devices with wire or cable.
disconnect_neighbour(target) Disconnect wires or cables.
order_deconstruction(force) → boolean Sets the entity to be deconstructed by construction robots.
cancel_deconstruction(force) Cancels deconstruction if it is scheduled, does nothing otherwise.
to_be_deconstructed(force) → boolean Is this entity marked for deconstruction?
get_request_slot(slot) → SimpleItemStack Get a logistic requester slot.
set_request_slot(request, slot) Set a logistic requester slot.
clear_request_slot(slot) Clear a logistic requester slot.
is_crafting() → boolean
is_opened() → boolean
is_opening() → boolean
is_closed() → boolean
is_closing() → boolean
request_to_open(force, extra_time)
request_to_close(force)
get_transport_line(index) → LuaTransportLine Get a transport line of a belt.
launch_rocket() → boolean
revive() → uint Revive a ghost.
get_connected_rail{rail_direction=…, rail_connection_direction=…} → LuaEntity
get_filter(uint) → string Get the filter for a slot in an inserter or a loader.
set_filter(uint, string) Set the filter for a slot in an inserter or a loader
get_control_behavior() → LuaControlBehavior Gets the control behavior of the entity (if any).
get_or_create_control_behavior() → LuaControlBehavior Gets (and or creates if needed) the control behavior of the entity.
get_circuit_network(wire, circuit_connector) → LuaCircuitNetwork
supports_backer_name() → boolean
copy_settings(entity) → dictionary stringuint Copies settings from the given entity onto this entity.
passenger :: LuaEntity [RW] Setting to nil forces the character out of the vehicle, setting to a new character forces any existing passenger out and the given character becomes the new passenger.
name :: string [R] Name of the entity prototype.
ghost_name :: string [R] Name of the entity contained in this ghost
localised_name :: LocalisedString [R] Localised name of the entity.
ghost_localised_name :: LocalisedString [R] Localised name of the entity contained in this ghost.
type :: string [R] The entity prototype type of this entity.
ghost_type :: string [R] The prototype type of the entity contained in this ghost.
active :: boolean [RW] Deactivating an entity will stop all its operations (car will stop moving, inserters will stop working, fish will stop moving etc).
destructible :: boolean [RW] When the entity is not destructible it can't be damaged.
minable :: boolean [RW]
rotatable :: boolean [RW] When entity is not to be rotatable (inserter, transport belt etc), it can't be rotated by player using the R key.
operable :: boolean [RW] Player can't open gui of this entity and he can't quick insert/input stuff in to the entity when it is not operable.
health :: float [RW] Health of the entity.
direction :: defines.direction [RW] The current direction this entity is facing.
orientation :: float [RW] The smooth orientation.
amount :: uint [RW] Count of resource units contained.
effectivity_modifier :: float [RW] Multiplies the acceleration the vehicle can create for one unit of energy.
consumption_modifier :: float [RW] Multiplies the the energy consumption.
friction_modifier :: float [RW] Multiplies the car friction rate.
speed :: float [RW] The current speed of the car.
stack :: LuaItemStack [R]
prototype :: LuaEntityPrototype [R] The entity prototype of this entity.
ghost_prototype :: LuaEntityPrototype [R] The entity prototype of the entity contained in this ghost.
drop_position :: Position [RW] Position where the entity puts its stuff.
pickup_position :: Position [RW] Where the inserter will pick up items from.
drop_target :: LuaEntity [R] The entity this entity is putting its stuff to or nil if there is no such entity.
pickup_target :: LuaEntity [R] The entity the inserter will attempt to pick up from.
selected_gun_index :: uint [RW] Index of the currently selected weapon slot of this character.
energy :: double [RW] Energy stored in the entity (heat in furnace, energy stored in electrical devices etc.
recipe :: LuaRecipe [RW] Current recipe being assembled by this machine.
held_stack :: LuaItemStack [R] The item stack currently held in an inserter's hand.
held_stack_position :: Position [R] Current position of the inserter's "hand".
train :: LuaTrain [R] The train this rolling stock belongs to.
neighbours :: dictionary stringarray of LuaEntity or array of LuaEntity or LuaEntity [R]
fluidbox :: LuaFluidBox [RW]
backer_name :: string [RW] The name of a backer (of Factorio) assigned to a lab or train station / stop.
time_to_live :: uint [RW] The ticks left for a ghost entity before it's destroyed.
color :: Color [RW] The character or rolling stock color.
signal_state :: defines.signal_state [R] The state of this rail signal.
chain_signal_state :: uint [R] The state of this chain signal.
to_be_looted :: boolean [RW] Will this entity be picked up automatically when the player walks over it?
crafting_progress :: float [RW] The current crafting progress, as a number in range [0, 1].
bonus_progress :: float [RW] The current productivity bonus progress, as a number in range [0, 1].
belt_to_ground_type :: string [R] "input" or "output", depending on whether this underground belt goes down or up.
loader_type :: string [R] "input" or "output", depending on whether this loader puts to or gets from a container.
rocket_parts :: uint [RW] Number of rocket parts in the silo.
logistic_network :: LuaLogisticNetwork [R] The logistic network this entity is a part of.
logistic_cell :: LuaLogisticCell [R] The logistic cell this entity is a part of.
item_requests :: dictionary stringuint [RW] Items this ghost will request when revived.
player :: LuaPlayer [R] The player connected to this character.
unit_group :: LuaUnitGroup [R] The unit group this unit is a member of, or nil if none.
damage_dealt :: double [RW] The damage dealt by this turret.
kills :: uint [RW] The number of units killed by this turret.
built_by :: LuaPlayer [RW] The player who built the entity
electric_buffer_size :: double [RW] The buffer size for the electric energy source or nil if the entity doesn't have an electric energy source.
electric_input_flow_limit :: double [RW] The input flow limit for the electric energy source or nil if the entity doesn't have an electric energy source.
electric_output_flow_limit :: double [RW] The output flow limit for the electric energy source or nil if the entity doesn't have an electric energy source.
electric_drain :: double [RW] The electric drain for the electric energy source or nil if the entity doesn't have an electric energy source.
electric_emissions :: double [RW] The emissions size for the electric energy source or nil if the entity doesn't have an electric energy source.
unit_number :: uint [R] The unit number or nil if the entity doesn't have one.
mining_progress :: double [RW] The mining progress for this mining drill or nil if this isn't a mining drill.
bonus_mining_progress :: double [RW] The bonus mining progress for this mining drill or nil if this isn't a mining drill.
power_production :: double [RW] The power production specific to the ElectricEnergyInterface entity type.
power_usage :: double [RW] The power usage specific to the ElectricEnergyInterface entity type.
bounding_box :: BoundingBox [R]
mining_target :: LuaEntity [R] The mining target or nil if none
circuit_connected_entities [R] Entities connected to this entity via the circuit network.
circuit_connection_definitions :: array of CircuitConnectionDefinition [R] The connection definition for entities connected to this entity via the circuit network.
request_slot_count :: uint [R] The number of request slots this entity has.
filter_slot_count :: uint [R] The number of filter slots this inserter or loader has.
grid :: LuaEquipmentGrid [R] The equipment grid or nil if this entity doesn't have an equipment grid.
supports_direction [R] If this entity supports directions.
valid :: boolean [R] Is this object valid?
Inherited from LuaControl: get_inventory, get_quickbar, can_insert, insert, set_gui_arrow, clear_gui_arrow, get_item_count, has_items_inside, can_reach_entity, clear_items_inside, remove_item, teleport, update_selected_entity, clear_selected_entity, disable_flashlight, enable_flashlight, get_craftable_count, begin_crafting, cancel_crafting, surface, position, vehicle, force, selected, opened, crafting_queue_size, walking_state, riding_state, mining_state, cursor_stack, driving, crafting_queue, cheat_mode, character_crafting_speed_modifier, character_mining_speed_modifier, character_running_speed_modifier, character_build_distance_bonus, character_item_drop_distance_bonus, character_reach_distance_bonus, character_resource_reach_distance_bonus, character_item_pickup_distance_bonus, character_loot_pickup_distance_bonus, quickbar_count_bonus, character_inventory_slots_bonus, character_logistic_slot_count_bonus, character_trash_slot_count_bonus, character_maximum_following_robot_count_bonus, character_health_bonus, auto_trash_filters
class LuaEntityPrototype
has_flag(flag) → boolean Does this prototype have a flag enabled?
type :: string [R] Type of this prototype.
name :: string [R] Name of this prototype.
localised_name :: LocalisedString [R]
max_health :: float [R] Max health of this entity.
infinite_resource :: boolean [R] Is this resource infinite?
minimum_resource_amount :: uint [R] Minimum amount of this resource.
resource_category :: string [R] Category of this resource.
mineable_properties [R]
items_to_place_this :: dictionary stringLuaItemPrototype [R] Items that when placed will produce this entity.
collision_box :: BoundingBox [R] The bounding box used for collision checking.
selection_box :: BoundingBox [R] The bounding box used for drawing selection.
order :: string [R] Order string of this prototype.
group :: LuaGroup [R] Group of this entity.
subgroup :: LuaGroup [R] Subgroup of this entity.
healing_per_tick :: uint [R] Amount this entity can heal per tick.
emissions_per_tick :: double [R] Amount of pollution emissions per tick this entity will create.
corpses :: dictionary stringLuaEntityPrototype [R] Corpses used when this entity is destroyed.
selectable_in_game :: boolean [R] Is this entity selectable?
weight :: uint [R]
resistances :: Resistances [R]
fast_replaceable_group :: string [R] The group of mutually fast-replaceable entities.
loot :: Loot [R] Loot that will be dropped when this entity is killed.
repair_speed_modifier :: uint [R] Repair-speed modifier for this entity.
turret_range :: uint [R]
autoplace_specification :: AutoplaceSpecification [R] Autoplace specification for this entity prototype.
collision_mask :: array of string [R] The collison masks this entity uses
belt_speed :: double [R] The speed of this transport belt or nil if this isn't a transport belt related prototype.
underground_belt_distance :: uint [R] The max connection distance this underground belt prototype can connect at or nil if this isn't an underground belt prototype.
result_units :: array of UnitSpawnDefinition [R] The result units and spawn points with weight and evolution factor for a biter spawner entity.
attack_result [R] The attack result of this entity if the entity has one else nil.
final_attack_result [R] The final attack result for projectiles nil if not a projectile
spawn_cooldown [R] The spawning cooldown for this enemy spawner prototype or nil.
mining_drill_radius :: double [R] The mining radius of this mining drill prototype or nil if this isn't a mining drill prototype.
logistic_mode :: string [R] The logistic mode of this logistic container or nil if this isn't a logistic container prototype.
valid :: boolean [R] Is this object valid?
class LuaEquipment
name :: string [R] Name of this equipment.
type :: string [R] Type of this equipment.
position :: Position [R] Position of this equipment in the equipment grid.
shape [R] Shape of this equipment.
shield :: double [RW] Current shield value of the equipment.
max_shield :: double [R] Maximum shield value.
max_solar_power :: double [R] Maximum solar power generated.
movement_bonus :: double [R] Movement speed bonus.
generator_power :: double [R] Energy generated per tick.
energy :: double [RW] Current available energy.
max_energy :: double [R] Maximum amount of energy that can be stored in this equipment.
prototype :: LuaEquipmentPrototype [R]
valid :: boolean [R] Is this object valid?
class LuaEquipmentGrid
take{position=…, equipment=…} → SimpleItemStack Remove an equipment from the grid.
take_all() → dictionary stringuint Remove all equipment from the grid.
clear() Clear all equipment from the grid.
put{name=…, position=…} → LuaEquipment Insert an equipment into the grid.
can_move{equipment=…, position=…} → boolean Check whether moving an equipment would succeed.
move{equipment=…, position=…} → boolean Move an equipment within this grid.
get(position) → LuaEquipment Find equipment in the Equipment Grid based off a position.
prototype :: LuaEquipmentGridPrototype [R]
width :: uint [R] Width of the equipment grid.
height :: uint [R] Height of the equipment grid.
equipment :: array of LuaEquipment [R] All the equipment in this grid.
generator_energy :: double [R] Total energy per tick generated by the equipment inside this grid.
max_solar_energy :: double [R] Maximum energy per tick that can be created by any solar panels in the equipment grid.
available_in_batteries :: double [R] The total energy stored in all batteries in the equipment grid.
battery_capacity :: double [R] Total energy storage capacity of all batteries in the equipment grid.
valid :: boolean [R] Is this object valid?
class LuaEquipmentGridPrototype
name :: string [R] Name of this prototype.
order :: string [R] Order string of this prototype.
localised_name :: LocalisedString [R]
equipment_categories :: array of string [R] Equipment category names for the categories that may be inserted into this equipment grid.
width :: uint [R]
height :: uint [R]
valid :: boolean [R] Is this object valid?
class LuaEquipmentPrototype
name :: string [R] Name of this prototype.
type :: string [R] Type of this equipment prototype.
order :: string [R] Order string of this prototype.
localised_name :: LocalisedString [R]
shape [R] Shape of this equipment prototype.
take_result :: LuaItemPrototype [R] The result item when taking this equipment out of an equipment grid.
energy_production :: double [R] The max power generated by this equipment.
shield :: float [R] The shield value of this equipment.
energy_per_shield :: double [R] The energy per shield point restored.
logistic_parameters [R] The logistic parameters for roboport equipment
energy_consumption :: double [R]
movement_bonus :: float [R]
night_vision_tint :: Color [R]
energy_source [R] The energy source prototype for the equipment.
equipment_categories :: array of string [R] Category names for this equipment.
valid :: boolean [R] Is this object valid?
class LuaFlowStatistics
get_input_count(string) Gets the total input count for a given prototype.
set_input_count(string, count) Sets the total input count for a given prototype.
get_output_count(string) Gets the total output count for a given prototype.
set_output_count(string, count) Sets the total output count for a given prototype.
input_counts :: dictionary stringarray of uint64 or double [R] List of input counts indexed by name <> value.
output_counts :: dictionary stringarray of uint64 or double [R] List of output counts indexed by name <> value.
force :: LuaForce [R] The force these statistics belong to.
valid :: boolean [R] Is this object valid?
class LuaFluidBox
operator # :: uint [R] Number of fluid boxes.
operator [] [R] Access, set or clear a fluid box.
valid :: boolean [R] Is this object valid?
class LuaFluidPrototype
name :: string [R] Name of this prototype.
localised_name :: LocalisedString [R]
default_temperature :: double [R] Default temperature of the fluid.
max_temperature :: double [R] Maximum temperature the fluid can reach.
heat_capacity :: double [R] How much energy the fluid will generate at max temperature assuming 100% efficiency steam engine.
pressure_to_speed_ratio :: double [R] How much pressure -- difference in fluid levels -- will be converted to speed.
flow_to_energy_ratio :: double [R] How much will a volume of fluid transferred be converted to energy.
max_push_amount :: double [R]
ratio_to_push :: double [R]
order :: string [R] Order string for this prototype.
group :: LuaGroup [R] Group of this prototype.
subgroup :: LuaGroup [R] Subgroup of this prototype.
base_color :: Color [R]
flow_color :: Color [R]
valid :: boolean [R] Is this object valid?
class LuaForce
get_entity_count(name) → uint Count entities of given type.
disable_research() Disable research for this force.
enable_research() Enable research for this force.
disable_all_prototypes() Disable all recipes and technologies.
reset_recipes() Load the original version of all recipes from the prototypes.
enable_all_recipes() Unlock all recipes.
enable_all_technologies() Unlock all technologies.
research_all_technologies() Research all technologies.
reset_technologies() Load the original versions of technologies from prototypes.
reset() Reset everything.
chart(surface, area) Chart a portion of the map.
clear_chart() Remove all charted area from the chart.
rechart() Force a rechart of the whole chart.
chart_all() Chart all generated chunks.
is_chunk_charted(surface, position) → boolean Has a chunk been charted?
get_ammo_damage_modifier(ammo) → double
set_ammo_damage_modifier(ammo, modifier)
get_gun_speed_modifier(ammo) → double
set_gun_speed_modifier(ammo, modifier)
get_turret_attack_modifier(turret) → double
set_turret_attack_modifier(turret, modifier)
set_cease_fire(other, cease_fire) Stop attacking members of a given force.
get_cease_fire(other) → boolean Will this force attack members of another force?
is_pathfinder_busy() → boolean Is pathfinder busy?
kill_all_units() Kill all units and flush the pathfinder.
find_logistic_network_by_position(position, surface) → LuaLogisticNetwork
set_spawn_position(position, surface)
get_spawn_position(surface) → Position
unchart_chunk(position, surface)
name :: string [R] Name of the force.
technologies :: custom dictionary stringLuaTechnology [R] Technologies owned by this force, indexed by their name.
recipes :: custom dictionary stringLuaRecipe [R] Recipes available to this force, indexed by their name.
manual_mining_speed_modifier :: double [RW] Multiplier of the manual mining speed.
manual_crafting_speed_modifier :: double [RW] Multiplier of the manual crafting speed.
laboratory_speed_modifier :: double [RW]
worker_robots_speed_modifier :: double [RW]
worker_robots_storage_bonus :: double [RW]
current_research :: LuaTechnology or string [RW] The current research in progress.
research_progress :: double [RW] Progress of current research, as a number in range [0, 1].
inserter_stack_size_bonus :: double [RW] The inserter stack size bonus for non stack inserters
stack_inserter_capacity_bonus :: uint [RW] Number of items that can be transferred by stack inserters
character_logistic_slot_count :: double [RW] Number of character logistic slots.
character_trash_slot_count :: double [RW] Number of character trash slots.
quickbar_count :: uint [RW] Number of character quick bars.
maximum_following_robot_count :: uint [RW] Maximum number of follower robots.
ghost_time_to_live :: uint [RW] The time, in ticks, before a placed ghost disappears.
players :: array of LuaPlayer [R] Players belonging to this force.
ai_controllable :: boolean [RW] Enables some higher-level AI behaviour for this force.
logistic_networks :: dictionary stringarray of LuaLogisticNetwork [R] List of logistic networks, grouped by surface.
item_production_statistics :: LuaFlowStatistics [R] The item production statistics for this force.
fluid_production_statistics :: LuaFlowStatistics [R] The fluid production statistics for this force.
kill_count_statistics :: LuaFlowStatistics [R] The kill counter statistics for this force.
item_resource_statistics :: LuaFlowStatistics [R] The item resource statistics for this force (item resources collected).
fluid_resource_statistics :: LuaFlowStatistics [R] The fluid resource statistics for this force (fluid resources collected).
entity_build_count_statistics :: LuaFlowStatistics [R] The entity build statistics for this force (built and mined)
character_running_speed_modifier :: uint [RW]
character_build_distance_bonus :: uint [RW]
character_item_drop_distance_bonus :: uint [RW]
character_reach_distance_bonus :: uint [RW]
character_resource_reach_distance_bonus :: double [RW]
character_item_pickup_distance_bonus :: double [RW]
character_loot_pickup_distance_bonus :: double [RW]
character_inventory_slots_bonus :: uint [RW] the number of additional inventory slots the character main inventory has.
deconstruction_time_to_live :: uint [RW] The time, in ticks, before a deconstruction order is removed.
character_health_bonus :: float [RW]
auto_character_trash_slots :: boolean [RW] true if auto character trash slots are enabled.
valid :: boolean [R] Is this object valid?
class LuaGameScript
get_event_handler(event) Find the event handler for an event.
raise_event(event, table) Raise an event.
set_game_state{game_finished=…, player_won=…, next_level=…, can_continue=…} Set scenario state.
get_entity_by_tag(tag) → LuaEntity
show_message_dialog{text=…, image=…, point_to=…} Show an in-game message dialog.
disable_tips_and_tricks() Disable showing tips and tricks.
is_demo() → boolean Is this the demo version of Factorio?
save(name) Save scenario progress.
load(name) Load scenario progress.
reload_script() Forces a reload of the scenario script when the save game without the migration is loaded.
save_atlas() Saves the current configuration of Atlas to a file.
check_consistency() Run internal consistency checks.
regenerate_entity(entitites) Regenerate autoplacement of some entities on all surfaces.
take_screenshot{player=…, by_player=…, position=…, resolution=…, zoom=…, path=…, show_gui=…, show_entity_info=…, anti_alias=…} Take a screenshot and save it to a file.
write_file(filename, data, append, for_player) Write a string to a file.
remove_path(path) Remove file or directory.
remove_offline_players(players) Remove players who are currently not connected from the map.
force_crc() Force a CRC check.
create_force(force) → LuaForce Create a new force.
merge_forces(source, destination) Merge two forces together.
create_surface(name, settings) Create a new surface
server_save(name) Instruct the server to save the map.
delete_surface(surface) Deletes the given surface and all entities on it.
disable_replay() Disables replay saving for the current save file.
direction_to_string(direction) Converts the given direction into the string version of the direction.
player :: LuaPlayer [R] The player typing at the console - nil in all other instances.
players :: custom dictionary uint or stringLuaPlayer [R]
evolution_factor :: float [RW] Evolution factor of enemies.
map_settings :: MapSettings [R]
difficulty :: defines.difficulty [R] Current scenario difficulty.
forces :: custom dictionary stringLuaForce [R]
entity_prototypes :: custom dictionary stringLuaEntityPrototype [R]
item_prototypes :: custom dictionary stringLuaItemPrototype [R]
fluid_prototypes :: custom dictionary stringLuaFluidPrototype [R]
tile_prototypes :: custom dictionary stringLuaTilePrototype [R]
equipment_prototypes :: custom dictionary stringLuaEquipmentPrototype [R]
damage_prototypes :: custom dictionary stringLuaDamagePrototype [R]
virtual_signal_prototypes :: custom dictionary stringLuaVirtualSignalPrototype [R]
equipment_grid_prototypes :: custom dictionary stringLuaEquipmentGridPrototype [R]
tick :: uint [R] Current map tick.
finished :: boolean [R] Is the scenario finished?
speed :: float [RW] Speed to update the map at.
surfaces :: custom dictionary stringLuaSurface [R]
active_mods :: dictionary stringstring [R] The active mods versions.
class LuaGroup
name :: string [R]
type :: string [R]
group :: LuaGroup [R] The parent group if any; nil if none.
subgroups :: array of LuaGroup [R] Subgroups of this group.
order :: string [R]
valid :: boolean [R] Is this object valid?
class LuaGui
is_valid_sprite_path(sprite_path) → boolean Returns true if sprite_path is valid and contains loaded sprite, otherwise false.
player :: LuaPlayer [R] The player who owns this gui.
top :: LuaGuiElement [R] The top part of the GUI.
left :: LuaGuiElement [R] The left part of the GUI.
center :: LuaGuiElement [R] The center part of the GUI.
valid :: boolean [R] Is this object valid?
class LuaGuiElement
add{type=…, name=…, style=…} → LuaGuiElement Add a child element.
destroy() Remove this element, along with its children.
gui :: LuaGui [R] The GUI this element is a part of.
parent :: LuaGuiElement [R] The direct parent of this element; nil if this is a top-level element.
name :: string [R] The name of this element.
caption :: LocalisedString [RW] The text displayed on the element.
value :: double [RW] How much this progress bar is filled.
direction :: string [RW] Direction of the layout.
style :: LuaStyle or string [RW] The style of this element.
text :: string [RW] The text contained in a textfield.
children_names :: array of string [R] Names of all the children of this element.
state :: boolean [RW] Is this checkbox checked?
player_index :: uint [R] Index into LuaGameScript::players specifying the player who owns this element.
sprite :: SpritePath [RW] Path the the image to display on this sprite-button.
tooltip :: LocalisedString [RW]
vertical_scroll_policy :: string [RW] Allowed values are: "always", "never", or "auto"
horizontal_scroll_policy :: string [RW] Allowed values are: "always", "never", or "auto"
type :: string [R] The type of this GUI element.
valid :: boolean [R] Is this object valid?
class LuaInventory
clear() Make this inventory empty.
can_insert(items) → boolean Can at least some items be inserted?
insert(items) → uint Insert items into this inventory.
remove(items) → uint Remove items from this inventory.
get_item_count(item) → uint Get the number of all or some items in this inventory.
is_empty() → boolean Does this inventory contain nothing?
get_contents() → dictionary stringuint Get counts of all items in this inventory.
hasbar() → boolean Does this inventory have a bar?
getbar() → uint Get the current bar.
setbar(bar) Set the current bar.
has_filters() → boolean If this inventory has filters
can_set_filter(index, filter) → boolean If the given inventory slot filter can be set to the given filter.
get_filter(index) → string Gets the filter for the given item stack index.
set_filter(index, filter) → boolean Sets the filter for the given item stack index.
find_item_stack(item) → LuaItemStack Gets the first LuaItemStack in the inventory that matches the given item name.
operator # [R] Get the number of slots in this inventory.
index :: uint [R] The inventory index this inventory uses.
operator [] [R] The indexing operator.
valid :: boolean [R] Is this object valid?
class LuaItemPrototype
has_flag(flag) → boolean Does this prototype have a flag enabled?
type :: string [R] Type of this prototype.
name :: string [R] Name of this prototype.
localised_name :: LocalisedString [R]
localised_description :: LocalisedString [R]
order :: string [R] Order string.
place_result :: LuaEntityPrototype [R] Prototype of the entity that will be created by placing this item, or nil if there is no such entity.
place_as_equipment_result :: LuaEquipmentPrototype [R] Prototype of the equipment that will be created by placing this item in an equipment grid or nil if there is no equipment defined.
place_as_tile_result [R] The place as tile result if one is defined else nil.
stackable :: boolean [R] Is this item allowed to stack at all?
default_request_amount :: uint [R] The default request value.
stack_size :: uint [R] Maximum stack size of the item specified by this prototype.
fuel_value :: float [R] Fuel value when burned.
subgroup :: LuaGroup [R] The subgroup this prototype belongs to.
group :: LuaGroup [R] The group this prototype belongs to.
flags :: dictionary stringboolean [R] The item prototype flags for this item prototype.
ammo_type :: AmmoType [R] Type of this ammo prototype or nil if this is not an ammo prototype.
magazine_size :: float [R] Size of full magazine; nil if this is not an ammo item.
equipment_grid :: LuaEquipmentGridPrototype [R] The prototype of this armor equipment grid or nil if none or this is not an armor item.
resistances :: Resistances [R] Resistances of this armour item; nil if not an armor or or the armor has no resistances.
inventory_size_bonus :: uint [R] The invntory size bonus for this armor prototype.
capsule_action :: CapsuleAction [R] The capsule action for this capsule item prototype or nil if this isn't a capsule item prototype.
attack_parameters :: AttackParameters [R] The gun attack parameters or nil if not a gun item prototype.
inventory_size :: uint [R] The main inventory size for item-with-inventory-prototype.
item_filters :: dictionary stringLuaItemPrototype [R]
group_filters :: dictionary stringLuaGroup [R]
sub_group_filters :: dictionary stringLuaGroup [R]
filter_mode :: string [R] The filter mode used by this item with inventory.
insertion_priority_mode :: string [R] The insertion priority mode used by this item with inventory.
localised_filter_message :: LocalisedString [R] The localised string used when the player attempts to put items into this item with inventory that aren't allowed.
extend_inventory_by_default :: boolean [R] If this item with inventory extends the inventory it resides in by default.
default_label_color :: Color [R] The default label color used for this item with label.
draw_label_for_cursor_render :: boolean [R] If true, and this item with label has a label it is drawn in place of the normal number when held in the cursor.
speed :: float [R] Mining or repairing speed if this is a mining or repairing tool; otherwise nil.
attack_result :: array of TriggerItem [R] The attack result of this mining tool prototype.
attack_range :: float [R] The attack range of this mining tool or nil if not a mining tool.
module_effects :: dictionary stringEffectValue [R] Effects of this module; nil if this is not a module.
category :: string [R] The module category name
tier :: float [R] The module tier
limitations :: array of string [R] An array of recipe names this module is allowed to work with.
limitation_message_key :: string [R] The limitation message key used when the player attempts to use this modules in some place it's not allowed.
straight_rail :: LuaEntityPrototype [R] The straight rail prototype used for this rail planner prototype.
curved_rail :: LuaEntityPrototype [R] The curved rail prototype used for this rail planner prototype.
repair_result :: array of TriggerItem [R] The repair result of this repair tool prototype or nil if this isn't a repair tool prototype.
selection_border_color :: Color [R] The color used when doing normal selection with this selection tool prototype.
alt_selection_border_color :: Color [R] The color used when doing alt selection with this selection tool prototype.
selection_mode_flags :: SelectionModeFlags [R] Flags that affect which entities will be selected.
alt_selection_mode_flags :: SelectionModeFlags [R] Flags that affect which entities will be selected during alternate selection.
selection_cursor_box_type :: string [R]
alt_selection_cursor_box_type :: string [R]
always_include_tiles :: boolean [R] If tiles area always included when doing selection with this selection tool prototype.
durability_description_key :: string [R] The durability message key used when displaying the durability of this tool.
durability :: double [R] The durability of this tool item or nil if not a tool item.
valid :: boolean [R] Is this object valid?
class LuaItemStack
is_blueprint_setup() → boolean Is this blueprint item setup?
get_blueprint_entities() → array of blueprint entity Entities in this blueprint.
set_blueprint_entities(entities) Set new entities to be a part of this blueprint.
add_ammo(amount) Add ammo to this ammo item.
drain_ammo(amount) Remove ammo from this ammo item.
add_durability(amount) Add durability to this tool item.
drain_durability(amount) Remove durability from this tool item.
can_set_stack(stack) → boolean Would a call to LuaItemStack::set_stack succeed?
set_stack(stack) → boolean Set this item stack to another item stack.
clear() Clear this item stack.
get_blueprint_tiles() → array of blueprint tile Tiles in this blueprint
set_blueprint_tiles(tiles) Set tiles in this blueprint
get_inventory(inventory) → LuaInventory Access the inner inventory of an item.
build_blueprint{surface=…, force=…, position=…, force_build=…, direction=…} → array of LuaEntity Build this blueprint
create_blueprint{surface=…, force=…, area=…, always_include_tiles=…} Sets up this blueprint using the found blueprintable entities/tiles on the surface.
valid_for_read :: boolean [R] Is this valid for reading?
prototype :: LuaItemPrototype [R] Prototype of the item held in this stack.
name :: string [R] Prototype name of the item held in this stack.
type :: string [R] Type of the item prototype.
count :: uint [RW] Number of items in this stack.
grid :: LuaEquipmentGrid [R] The equipment grid of this item or nil if this item doesn't have a grid.
health :: float [RW] How much health the item has, as a number in range [0, 1].
durability :: double [RW] Durability of the contained item.
ammo :: uint [RW] Number of bullets left in the magazine.
blueprint_icons :: array of Icon [RW] Icons of a blueprint item.
label :: string [RW] The current label for this item.
label_color :: Color [RW] The current label color for this item.
allow_manual_label_change :: boolean [RW] If the label for this item can be manually changed.
cost_to_build :: dictionary stringuint [R] Raw materials required to build this blueprint.
extends_inventory :: boolean [RW] If this item extends the inventory it resides in (provides its contents for counts, crafting, insertion).
prioritize_insertion_mode :: string [RW] The insertion mode priority this ItemWithInventory uses when items are inserted into an inventory it resides in.
default_icons :: array of Icon [R] The default icons for a blueprint item.
valid :: boolean [R] Is this object valid?
class LuaLogisticCell
is_in_logistic_range(position) → boolean Is a given position within the logistic range of this cell?
is_in_construction_range(position) → boolean Is a given position within the construction range of this cell?
is_neighbour_with(other) → boolean Are two cells neighbours?
logistic_radius :: float [R] Logistic radius of this cell.
construction_radius :: float [R] Construction radius of this cell.
stationed_logistic_robot_count :: uint [R] Number of stationed logistic robots in this cell.
stationed_construction_robot_count :: uint [R] Number of stationed construction robots in this cell.
mobile :: boolean [R] true if this is a mobile cell.
transmitting :: boolean [R] true if this cell is active.
charge_approach_distance :: float [R] Radius at which the robots hover when waiting to be charged.
charging_robot_count :: uint [R] Number of robots currently charging.
to_charge_robot_count :: uint [R] Number of robots waiting to charge.
owner :: LuaEntity [R] This cell's owner.
logistic_network :: LuaLogisticNetwork [R] The network that owns this cell or nil.
neighbours :: array of LuaLogisticCell [R] Neighbouring cells.
charging_robots :: array of LuaEntity [R] Robots currently being charged.
to_charge_robots :: array of LuaEntity [R] Robots waiting to charge.
valid :: boolean [R] Is this object valid?
class LuaLogisticNetwork
get_item_count(item, member) → uint Count given or all items in the network or given members.
get_contents() → dictionary stringuint Get item counts for the entire network.
remove_item(item, members) → uint Remove items from the logistic network.
insert(item, members) → uint Insert items into the logistic network.
find_cell_closest_to(position) → LuaLogisticCell Find logistic cell closest to a given position.
available_logistic_robots :: uint [R] Number of logistic robots available for a job.
all_logistic_robots :: uint [R] The total number of logistic robots in the network (idle and active + in roboports).
available_construction_robots :: uint [R] Number of construction robots available for a job.
all_construction_robots :: uint [R] The total number of construction robots in the network (idle and active + in roboports).
robot_limit :: uint [R] Maximum number of robots the network can work with.
cells :: array of LuaLogisticCell [R] All cells in this network.
providers :: array of LuaEntity [R] All entities that have logistic provider points in this network.
empty_providers :: array of LuaEntity [R] All entities that have empty logistic provider points in this network.
requesters :: array of LuaEntity [R] All entities that have logistic requester points in this network.
full_or_satisfied_requesters :: array of LuaEntity [R] All entities that have full or satisfied logistic requester points in this network.
storages :: array of LuaEntity [R] All entities that have logistic storage points in this network.
logistic_members :: array of LuaEntity [R] All other entities that have logistic points in this network (inserters mostly).
valid :: boolean [R] Is this object valid?
class LuaPlayer extends LuaControl
set_ending_screen_data(message, file) Setup the screen to be shown when the game is finished.
print(message) Print text to the chat console.
clear_console() Clear the chat console.
get_goal_description() → LocalisedString Get the current goal description, as a localised string.
set_goal_description(text, only_update) Set the text in the goal window (top left).
set_controller{type=…, character=…} Set the controller type of the player.
build_from_cursor() → boolean Build the entity in the player's cursor (hand).
rotate_for_build() → boolean Rotate the entity in cursor before building.
disable_recipe_groups() Disable recipe groups.
print_entity_statistics(entities) Print entity statistics to the player's console.
unlock_achievement(name) Unlock the achievements of the given player.
clean_cursor() Invokes the "clean cursor" action on the player as if the user pressed it.
create_character(character) Creates and attaches a character entity to this player.
character :: LuaEntity [RW] The character attached to this player, or nil if no character.
index :: uint [R] This player's index in LuaGameScript::players.
gui :: LuaGui [R]
opened_self :: boolean [R] true if the player opened itself.
controller_type :: defines.controllers [R]
game_view_settings :: GameViewSettings [RW] The player's game view settings.
minimap_enabled :: boolean [RW] true if the minimap is visible.
color :: Color [RW] The colour associated with the player.
name :: string [RW] The player's username.
tag :: string [RW] The tag that is shown after the player in chat and on the map.
connected :: boolean [R] true if the player is currently connected to the game.
admin :: boolean [R] true if the player is an admin.
entity_copy_source :: LuaEntity [R] The source entity used during entity settings copy-paste if any.
afk_time :: uint [R] How many ticks since the last action of this player
online_time :: uint [R] How many ticks did this player spend playing this save (all sessions combined)
cursor_position :: Position [W] Position of the player's mouse cursor.
zoom :: double [W] The player's zoom-level.
valid :: boolean [R] Is this object valid?
Inherited from LuaControl: get_inventory, get_quickbar, can_insert, insert, set_gui_arrow, clear_gui_arrow, get_item_count, has_items_inside, can_reach_entity, clear_items_inside, remove_item, teleport, update_selected_entity, clear_selected_entity, disable_flashlight, enable_flashlight, get_craftable_count, begin_crafting, cancel_crafting, surface, position, vehicle, force, selected, opened, crafting_queue_size, walking_state, riding_state, mining_state, cursor_stack, driving, crafting_queue, cheat_mode, character_crafting_speed_modifier, character_mining_speed_modifier, character_running_speed_modifier, character_build_distance_bonus, character_item_drop_distance_bonus, character_reach_distance_bonus, character_resource_reach_distance_bonus, character_item_pickup_distance_bonus, character_loot_pickup_distance_bonus, quickbar_count_bonus, character_inventory_slots_bonus, character_logistic_slot_count_bonus, character_trash_slot_count_bonus, character_maximum_following_robot_count_bonus, character_health_bonus, auto_trash_filters
class LuaRecipe
reload() Reload the recipe from the prototype.
enabled :: boolean [RW] Can the recipe be used?
name :: string [R] Name of the recipe.
localised_name :: LocalisedString [R] Localised name of the recipe.
category :: string [R] Category of the recipe.
ingredients :: array of Ingredient [R] Ingredients for this recipe.
products :: array of Product [R] The results of this recipe.
hidden :: boolean [R] Is the recipe hidden?
energy :: double [R] Energy required to execute this recipe.
order :: string [R] Order string.
group :: LuaGroup [R] Group of this recipe.
subgroup :: LuaGroup [R] Subgroup of this recipe.
force :: LuaForce [R] The force that owns this recipe.
valid :: boolean [R] Is this object valid?
class LuaRemote
add_interface(name, functions) Add a remote interface.
remove_interface(name) → boolean Removes an interface with the given name.
call(interface, function, ...) Call a function of an interface.
interfaces :: dictionary stringdictionary stringboolean [R] List of all registered interfaces.
class LuaStyle
gui :: LuaGui [R] Gui of the LuaGuiElement of this style.
name :: string [R] Name of this style.
minimal_width :: int [RW]
maximal_width :: int [RW]
minimal_height :: int [RW]
maximal_height :: int [RW]
top_padding :: int [RW]
right_padding :: int [RW]
bottom_padding :: int [RW]
left_padding :: int [RW]
font_color :: Color [RW]
font :: string [RW]
resize_row_to_width :: boolean [RW]
cell_spacing :: int [RW] Space between the table cell contents and border.
horizontal_spacing :: int [RW] Horizontal space between individual cells.
vertical_spacing :: int [RW] Vertical space between individual cells.
visible :: boolean [RW] When not visible the GUI element is hidden completely and takes no space in the layout.
valid :: boolean [R] Is this object valid?
class LuaSurface
get_pollution(position) → double Get the pollution for a given position.
can_place_entity{name=…, position=…, direction=…, force=…} → boolean Check for collisions with terrain or other entities.
find_entity(entity, position) → LuaEntity Find a specific entity at a specific position.
find_entities(area) → array of LuaEntity Find entities in a given area.
find_entities_filtered{area=…, position=…, name=…, type=…, force=…, limit=…} → array of LuaEntity Find entities of given type or name in a given area.
count_entities_filtered{area=…, position=…, name=…, type=…, force=…, limit=…} → uint Count entities of given type or name in a given area.
find_non_colliding_position(name, center, radius, precision) → Position Find a non-colliding possition within a given rectangle.
spill_item_stack(position, items, enable_looted) Spill items on the ground centered at a given location.
find_enemy_units(center, radius, force) → array of LuaEntity Find units enemy of a given force within an area.
find_nearest_enemy{position=…, max_distance=…, force=…} → LuaEntity Find the enemy closest to the given position.
set_multi_command{command=…, unit_count=…, force=…, unit_search_distance=…} → uint Give a command to multiple units.
create_entity{name=…, position=…, direction=…, force=…, target=…, source=…, fast_replace=…, player=…, spill=…} → LuaEntity Create an entity on this surface.
create_unit_group{position=…, force=…} → LuaUnitGroup Create a new unit group at a given position.
build_enemy_base(position, unit_count, force) Send a group to build a new base.
get_tile(x, y) → LuaTile Get the tile at a given position.
get_tileproperties(x, y) → TileProperties Get tile properties.
set_tiles(tiles, correct_tiles) Set tiles at specified locations.
pollute(source, amount) Spawn pollution at the given position.
get_chunks() → LuaChunkIterator Get an iterator going over every chunk on this surface.
is_chunk_generated(position) → boolean Is a given chunk generated?
request_to_generate_chunks(position, radius) Request that the game's map generator generate chunks at the given position for the given radius on this surface.
find_logistic_network_by_position(position, force) → LuaLogisticNetwork Find the logistic network that covers a given position.
freeze_daytime(freeze) Freeze or unfreeze time of day at the current value.
deconstruct_area{area=…, force=…} Place a deconstruction request.
cancel_deconstruct_area{area=…, force=…} Cancel a deconstruction order.
get_hidden_tile(position) The hidden tile name or nil if there isn't one for the given position.
get_connected_tiles(position, tiles) → array of Position Gets all tiles of the given types that are connected horizontally or vertically to the given tile position including the given tile position.
regenerate_entity(entitites) Regenerate autoplacement of some entities on this surface.
name :: string [R] The name of this surface.
index :: uint [R] Unique ID associated with this surface.
map_gen_settings :: MapGenSettings [R] Gets the generation settings for the surface.
always_day :: boolean [RW] When set to true, the sun will always shine.
daytime :: float [RW] Current time of day, as a number in range [0, 1).
darkness :: float [R] Amount of darkness at the current time.
wind_speed :: float [RW] Current wind speed.
wind_orientation :: float [RW] Current wind direction.
wind_orientation_change :: float [RW] Change in wind orientation per tick.
peaceful_mode :: boolean [RW] Is peaceful mode enabled on this surface?
valid :: boolean [R] Is this object valid?
class LuaTechnology
reload() Reload this technology from its prototype.
force :: LuaForce [R] The force this technology blongs to.
name :: string [R] Name of this technology.
localised_name :: LocalisedString [R] Localised name of this technology.
enabled :: boolean [RW] Can this technology be researched?
upgrade :: boolean [R] Is this an upgrade-type research?
researched :: boolean [RW] Has this technology been researched?
prerequisites :: dictionary stringLuaTechnology [R] Prerequisites of this technology.
research_unit_ingredients :: array of Ingredient [R] Ingredients labs will require to research this technology.
effects :: array of Modifier [R] Effects applied when this technology is researched.
research_unit_count :: uint [R] Number of research units required for this technology.
research_unit_energy :: double [R] Amount of energy required to finish a unit of research.
order :: string [R] Order string for this prototype.
valid :: boolean [R] Is this object valid?
class LuaTile
collides_with(layer) What type of things can collide with this tile?
name :: string [R] Prototype name of this tile.
prototype :: LuaTilePrototype [R]
position :: Position [R] The position this tile references.
valid :: boolean [R] Is this object valid?
class LuaTilePrototype
name :: string [R] Name of this prototype.
order :: string [R] Order string of this prototype.
localised_name :: LocalisedString [R]
collision_mask :: array of string [R] The collison mask this tile uses
layer :: uint [R]
walking_speed_modifier :: float [R]
vehicle_friction_modifier :: float [R]
map_color :: Color [R]
decorative_removal_probability :: float [R] The probability that decorative entities will be removed from on top of this tile when this tile is generated.
allowed_neighbors :: dictionary stringLuaTilePrototype [R]
mineable_properties [R]
items_to_place_this :: dictionary stringLuaItemPrototype [R] Items that when placed will produce this tile.
can_be_part_of_blueprint :: boolean [R] False if this tile is not allowed in blueprints regardless of the ability to build it.
emissions_per_tick :: double [R] Amount of pollution emissions per tick this tile will absorb.
autoplace_specification :: AutoplaceSpecification [R] Autoplace specification for this prototype.
valid :: boolean [R] Is this object valid?
class LuaTrain
get_item_count(item) → uint Get the amount of a particular item stored in the train.
get_contents() → dictionary stringuint Get a summary of the train's inventory.
remove_item(stack) → uint Remove some items from the train.
insert(stack) Insert a stack into the train.
clear_items_inside() Clear all items in this train.
manual_mode :: boolean [RW] When true, the train is explicitly controlled by the player or script.
speed :: double [RW] Current speed.
carriages :: array of LuaEntity [R] Rolling stocks the train is composed of.
locomotives :: dictionary stringarray of LuaEntity [R] Arrays of locomotives.
cargo_wagons :: array of LuaEntity [R] The cargo carriages the train contains.
schedule :: TrainSchedule [RW]
state :: defines.train_state [R] This train's current state.
front_rail :: LuaEntity [R] The rail at the front end of the train, possibly nil.
back_rail :: LuaEntity [R] The rail at the back end of the train, possibly nil.
rail_direction_from_front_rail :: defines.rail_direction [R]
rail_direction_from_back_rail :: defines.rail_direction [R]
front_stock :: LuaEntity [R] The front stock of this train or nil.
back_stock :: LuaEntity [R] The back stock of this train or nil.
station :: LuaEntity [R] The train stop this train is stopped at or nil.
valid :: boolean [R] Is this object valid?
class LuaTransportLine
clear() Remove all items from this transport line.
get_item_count(item) → uint Count some or all items on this line.
remove_item(items) → uint Remove some items from this line.
can_insert_at(position) → boolean Can an item be inserted at a given position?
can_insert_at_back() → boolean Can an item be inserted at the back of this line?
insert_at(position, items) → boolean Insert items at a given position.
insert_at_back(items) → boolean Insert items at the back of this line.
get_contents() → dictionary stringuint Get counts of all items on this line.
owner :: LuaEntity [R] The entity this transport line belongs to.
valid :: boolean [R] Is this object valid?
class LuaUnitGroup
add_member(unit) Make a unit a member of this group.
set_command(command) Give this group a command.
set_autonomous() Make this group autonomous.
start_moving() Make the group start moving even if some of its members haven't yet arrived.
destroy() Dissolve this group.
members :: array of LuaEntity [R] Members of this group.
position :: Position [R] Group position.
state :: defines.group_state [R] Whether this group is gathering, moving or attacking.
force :: LuaForce [R] The force of this unit group.
surface :: LuaSurface [R] The surface of this unit group.
valid :: boolean [R] Is this object valid?
class LuaVirtualSignalPrototype
name :: string [R] Name of this prototype.
order :: string [R] Order string of this prototype.
localised_name :: LocalisedString [R]
special :: boolean [R] If this is a special signal
subgroup :: LuaGroup [R]
valid :: boolean [R] Is this object valid?