on_init(f) | Register a callback to be run on module init. |
on_load(f) | Register a function to be run on module load. |
on_configuration_changed(f) | Register a function to be run when the 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. |
get_output_inventory() → LuaInventory | Gets the entities output inventory if it has one. |
get_module_inventory() → LuaInventory | |
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) | Sets the entity to be deconstructed by construction robots. |
cancel_deconstruction(force) | Cancels deconstruction if it is scheduled, does nothing otherwise. |
to_be_deconstructed() → boolean | Is this entity marked for deconstruction? |
get_filter(slot) → string | Get the filter for a slot. |
set_filter(filter, slot) | Set the filter for a slot. |
clear_filter(slot) | Clear the filter for a slot. |
get_request_slot(slot) → LuaItemStack | Get a logistic requester slot. |
set_request_slot(request, slot) | Set a logistic requester slot. |
clear_request_slot(slot) | Clear a logistic requester slot. |
get_circuit_condition(connector) → CircuitCondition | |
set_circuit_condition(connector, condition) | |
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_inventory(inventory) → LuaInventory | Get an inventory belonging to this entity. |
can_insert(items) → boolean | Can at least some items be inserted? |
insert(items) → uint | Insert items into this entity. |
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? |
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. |
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 :: string [R] | Localised name of the entity. |
ghost_localised_name :: string [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 [R] | Position where the entity puts its stuff. |
drop_target :: LuaEntity [R] | The entity this entity is putting its stuff to or nil if there is no such entity. |
selected_gun_index :: uint [RW] | Index of the currently selected weapon slot of this character. |
energy :: float [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. |
train :: LuaTrain [R] | The train this rolling stock belongs to. |
neighbours :: dictionary string → array 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's color. |
signal_state :: 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 [R] | The current crafting progress, as a number in range [0, 1]. |
bonus_progress :: float [R] | 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. |
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. |
force :: string or LuaForce [RW] | The force of this entity. |
surface :: LuaSurface [R] | The surface this entity is currently on. |
position :: Position [R] | Current position of the entity. |
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 :: string [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 string → LuaItemPrototype [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 :: uint [R] | Amount of pollution emissions per tick this entity will create. |
corpses :: dictionary string → LuaEntityPrototype [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. |
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. |
take{position=…, equipment=…} → SimpleItemStack | Remove an equipment from the grid. |
take_all() → dictionary string → uint | 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. |
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. |
operator [] [RW] | Access, set or clear a fluid box. |
operator # :: uint [R] | Number of fluid boxes. |
name :: string [R] | Name of this prototype. |
localised_name :: string [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. |
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_kill_count(entity, count) | |
get_kill_count(entity) → uint | How many entities of a given type were killed by this force. |
set_spawn_position(position, surface) | |
get_spawn_position(surface) → Position | |
name :: string [R] | Name of the force. |
technologies :: dictionary string → LuaTechnology [R] | Technologies owned by this force, indexed by their name. |
recipes :: dictionary string → LuaRecipe [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] | |
logistic_robot_speed_modifier :: double [RW] | |
logistic_robot_storage_modifier :: 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 :: uint [RW] | Number of extra items that can be transferred (so 1 + inserter_stack_size_bonus is transfer
stack size)
|
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 string → array of LuaLogisticNetwork [R] | List of logistic networks, grouped by surface. |
kill_counts :: dictionary string → uint [R] | For each entity, the number of kills of that entity achieved by this force. |
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. |
freeze_daytime(freeze) | Freeze or unfreeze time of day at the current value. |
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_tiles() | Regenerate all tiles. |
regenerate_entity(entitites) | Regenerate autoplacement of some entities. |
take_screenshot{player=…, position=…, resolution=…, zoom=…, path=…, show_gui=…, show_entity_info=…} | Take a screenshot and save it to a file. |
write_file(filename, data) | Write a string to a file. |
remove_path(path) | Remove file or directory. |
get_player(player) → LuaPlayer | Get the LuaPlayer for a player. |
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. |
get_surface(surface) | |
create_surface(name, settings) | Create a new surface |
server_save(name) | Instruct the server to save the map. |
get_item_prototype(item) → LuaItemPrototype | Get the prototype of an item. |
always_day :: boolean [RW] | When set to true, the sun will always shine. |
player :: LuaPlayer [R] | The player playing the game. |
local_player :: LuaPlayer [R] | The player typing at the console. |
players :: array of LuaPlayer [R] | |
evolution_factor :: float [RW] | Evolution factor of enemies. |
map_settings :: MapSettings [R] | |
difficulty :: difficulty [R] | Current scenario difficulty. |
forces :: dictionary string → LuaForce [R] | |
entity_prototypes :: dictionary string → LuaEntityPrototype [R] | |
item_prototypes :: dictionary string → LuaItemPrototype [R] | |
fluid_prototypes :: dictionary string → LuaFluidPrototype [R] | |
tick :: uint [R] | Current map tick. |
finished :: boolean [R] | Is the scenario finished? |
speed :: float [RW] | Speed to update the map at. |
daytime :: float [RW] | Current time of day, as a number in range [0, 1). |
darkness :: float [R] | Amount of darkness at the current time. |
peaceful_mode :: boolean [RW] | Is peaceful mode enabled? |
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. |
surfaces :: dictionary string → LuaSurface [R] |
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. |
add{type=…, name=…, style=…} | 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 :: string [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. |
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 string → uint | 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. |
operator [] [RW] | The indexing operator. |
operator # [R] | Get the number of slots in this inventory. |
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 :: string [R] | |
stack_size :: uint [R] | Maximum stack size of the item specified by this prototype. |
fuel_value :: float [R] | Fuel value when burned. |
order :: string [R] | Order string. |
group :: LuaGroup [R] | The group this prototype belongs to. |
subgroup :: LuaGroup [R] | The subgroup this prototype belongs to. |
place_result :: LuaEntityPrototype [R] | Prototype of the entity that will be created by placing this item, or nil if there is no such
entity. |
speed :: float [R] | Mining or repairing speed if this is a mining or repairing tool; otherwise nil . |
magazine_size :: float [R] | Size of full magazine; nil if this is not an ammo item. |
default_request_amount :: uint [R] | The default request value. |
resistances :: Resistances [R] | Resistances of this armour item; nil if not an armour. |
item_to_clear :: LuaItemPrototype [R] | Item required to clear this blueprint; nil if this is not a blueprint. |
stackable :: boolean [R] | Is this item allowed to stack at all? |
module_effects [R] | Effects of this module; nil if this is not a module. |
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. |
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 |
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. |
has_grid :: boolean [R] | true if this item has an equipment grid. |
grid :: LuaEquipmentGrid [R] | The equipment grid of this item. |
health :: float [RW] | How much health the item has, as a number in range [0, 1]. |
durability :: uint [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. |
cost_to_build :: dictionary string → uint [R] | Raw materials required to build this blueprint. |
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. |
get_item_count(item, member) → uint | Count given or all items in the network or given members. |
get_contents() → dictionary string → uint | 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). |
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() → string | 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. |
has_game_view() | Does the player have a game view? |
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. |
get_inventory(inventory) → LuaInventory | Get an inventory belonging to this entity. |
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. |
character :: LuaEntity [RW] | The character attached to this player, or nil if no character. |
index :: uint [R] | This player's index in LuaGameScript::players. |
force :: string or LuaForce [RW] | The force of this player. |
gui :: LuaGui [R] | |
opened_self :: boolean [R] | true if the player opened itself. |
controller_type :: 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. |
connected :: boolean [R] | true if the player is currently connected to the game. |
cursor_position :: Position [W] | Position of the player's mouse cursor. |
zoom :: double [W] | The player's zoom-level. |
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. |
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 [RW] | Current walking state. |
riding_state [RW] | Current riding state of the vehicle the player is currently in. |
mining_state [RW] | Current mining state. |
cursor_stack :: LuaItemStack [R] | The player's cursor stack. |
driving :: boolean [RW] | true if the player is in a vehicle. |
reload() | Reload the recipe from the prototype. |
enabled :: boolean [RW] | Can the recipe be used? |
name :: string [R] | 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. |
add_interface(name, functions) | Add a remote interface. |
call(interface, function, ...) | Call a function of an interface. |
interfaces :: dictionary string → dictionary string → boolean [R] | List of all registered interfaces. |
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] |
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=…, name=…, type=…, force=…} → array of LuaEntity | Find entities of given type or name in a given area. |
count_entities_filtered{area=…, name=…, type=…, force=…} → 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) | 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=…, count=…, force=…} → uint | Give a command to multiple units. |
create_entity{name=…, position=…, direction=…, force=…, target=…, source=…} → 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) | 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. |
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. |
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 :: string [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 string → LuaTechnology [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. |
collides_with(layer) | What type of things can collide with this tile? |
name :: string [R] | Prototype name of this tile. |
get_item_count(item) → uint | Get the amount of a particular item stored in the train. |
get_contents() → dictionary string → uint | 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 string → array of LuaEntity [R] | Arrays of locomotives. |
cargo_wagons :: array of LuaEntity [R] | The cargo carriages the train contains. |
schedule :: TrainSchedule [RW] | |
state :: defines.trainstate [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] |
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 string → uint | Get counts of all items on this line. |
owner :: LuaEntity [R] | The entity this transport line belongs to. |
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.groupstate [R] | Whether this group is gathering, moving or attacking. |