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] |
Main toplevel type, provides access to most of the API though its members. An instance
of LuaGameScript is available as the global object named game
.
Find the event handler for an event.
Raise an event.
Show an in-game message dialog.
point_to={type="nowhere"}
to remove the arrow entirely.) The dialog itself will be placed near the arrow's target.Disable showing tips and tricks.
Freeze or unfreeze time of day at the current value.
Is this the demo version of Factorio?
Save scenario progress.
Load scenario progress.
Forces a reload of the scenario script when the save game without the migration is loaded.
Saves the current configuration of Atlas to a file. This will result in huge file containing all of the game graphics moved to as small space as possible.
Run internal consistency checks. Allegedly prints any errors it finds.
Regenerate all tiles. This will correct tile transitions and variations on all chunks of the map.
Take a screenshot and save it to a file.
Remove file or directory. Given path is taken relative to the script output directory. Can be used to remove files created by LuaGameScript::write_file.
Force a CRC check. Tells all peers to calculate their current map CRC; these CRC are then compared against each other. If a mismatch is detected, the game is desynced and some peers are forced to reconnect.
Create a new force.
Merge two forces together. All entities in the source force will be reassigned to the target force. The source force will then be destroyed.
Create a new surface
Instruct the server to save the map.
Get the prototype of an item.
When set to true, the sun will always shine.
The player playing the game.
The player typing at the console.
Evolution factor of enemies.
Current scenario difficulty.
Current map tick.
Is the scenario finished?
Speed to update the map at. 1.0 is normal speed -- 60 UPS.
Current time of day, as a number in range [0, 1).
Amount of darkness at the current time.
Is peaceful mode enabled?
Current wind speed.
Current wind direction.
Change in wind orientation per tick.