Factorio.com|Forums|Wiki|Mod Portal|API Docs Prototype|Runtime|Auxiliary

# Factorio Runtime Docs Version 2.0.7

## Events

Events are delivered to mods in response to certain actions happening in the game. A mod can register a callback for a given event using the LuaBootstrap::on_event function. Events receive a parameter that is a table containing fields `name` and `tick` specifying the event ID (see defines.events) and the tick the event happened. This table may also contain additional fields that depend on what event it is. Additionally, some events can use filters to provide improved performance when a mod doesn't need or want to react to everything a given event may be triggered by.

CustomInputEvent | Called when a CustomInputPrototype is activated.
on_achievement_gained new | Called when an achievement is gained.
on_ai_command_completed | Called when a unit/group completes a command.
on_area_cloned | Called when an area of the map is cloned.
on_biter_base_built | Called when a biter migration builds a base. [...]
on_brush_cloned | Called when a set of positions on the map is cloned.
on_build_base_arrived changed | Called when a defines.command.build_base command reaches its destination, and before building starts.
on_built_entity changed | Called when player builds something.
on_cancelled_deconstruction | Called when the deconstruction of an entity is canceled.
on_cancelled_upgrade changed | Called when the upgrade of an entity is canceled.
on_character_corpse_expired | Called when a character corpse expires due to timeout or all of the items being removed from it. [...]
on_chart_tag_added | Called when a chart tag is created.
on_chart_tag_modified changed | Called when a chart tag is modified by a player.
on_chart_tag_removed | Called just before a chart tag is deleted.
on_chunk_charted | Called when a chunk is charted or re-charted.
on_chunk_deleted | Called when one or more chunks are deleted using LuaSurface::delete_chunk.
on_chunk_generated | Called when a chunk is generated.
on_combat_robot_expired | Called when a combat robot expires through a lack of energy, or timeout.
on_console_chat | Called when a message is sent to the in-game console, either by a player or through the server interface. [...]
on_console_command | Called when someone enters a command-like message regardless of it being a valid command.
on_cutscene_cancelled | Called when a cutscene is cancelled by the player or by script.
on_cutscene_finished | Called when a cutscene finishes naturally (was not cancelled).
on_cutscene_started | Called when a cutscene starts.
on_cutscene_waypoint_reached | Called when a cutscene is playing, each time it reaches a waypoint in that cutscene. [...]
on_entity_cloned | Called when an entity is cloned. [...]
on_entity_color_changed | Called after an entity has been recolored either by the player or through script. [...]
on_entity_damaged changed | Called when an entity is damaged. [...]
on_entity_died | Called when an entity dies.
on_entity_logistic_slot_changed changed | Called when one of an entity's logistic slots changes.
on_entity_renamed | Called after an entity has been renamed either by the player or through script.
on_entity_settings_pasted | Called after entity copy-paste is done.
on_entity_spawned | Called when an entity is spawned by a EnemySpawner
on_equipment_inserted | Called after equipment is inserted into an equipment grid.
on_equipment_removed changed | Called after equipment is removed from an equipment grid.
on_force_cease_fire_changed | Called when the a forces cease fire values change.
on_force_created | Called when a new force is created using `game.create_force()` This is not called when the default forces (`'player'`, `'enemy'`, `'neutral'`) are created as they will always exist.
on_force_friends_changed | Called when the a forces friends change.
on_force_reset | Called when LuaForce::reset is finished.
on_forces_merged | Called after two forces have been merged using `game.merge_forces()`. [...]
on_forces_merging | Called when two forces are about to be merged using `game.merge_forces()`.
on_game_created_from_scenario | Called when a game is created from a scenario. [...]
on_gui_checked_state_changed | Called when LuaGuiElement checked state is changed (related to checkboxes and radio buttons).
on_gui_click | Called when LuaGuiElement is clicked.
on_gui_closed | Called when the player closes the GUI they have open. [...]
on_gui_confirmed | Called when a LuaGuiElement is confirmed, for example by pressing Enter in a textfield.
on_gui_elem_changed | Called when LuaGuiElement element value is changed (related to choose element buttons).
on_gui_hover | Called when LuaGuiElement is hovered by the mouse.
on_gui_leave | Called when the player's cursor leaves a LuaGuiElement that was previously hovered.
on_gui_location_changed | Called when LuaGuiElement element location is changed (related to frames in `player.gui.screen`).
on_gui_opened | Called when the player opens a GUI.
on_gui_selected_tab_changed | Called when LuaGuiElement selected tab is changed (related to tabbed-panes).
on_gui_selection_state_changed | Called when LuaGuiElement selection state is changed (related to drop-downs and listboxes).
on_gui_switch_state_changed | Called when LuaGuiElement switch state is changed (related to switches).
on_gui_text_changed | Called when LuaGuiElement text is changed by the player.
on_gui_value_changed | Called when LuaGuiElement slider value is changed (related to the slider element).
on_land_mine_armed | Called when a land mine is armed.
on_lua_shortcut | Called when a custom Lua shortcut is pressed.
on_marked_for_deconstruction | Called when an entity is marked for deconstruction with the Deconstruction planner or via script.
on_marked_for_upgrade changed | Called when an entity is marked for upgrade with the Upgrade planner or via script.
on_market_item_purchased | Called after a player purchases some offer from a `market` entity.
on_mod_item_opened changed | Called when the player uses the 'Open item GUI' control on an item defined with the 'mod-openable' flag
on_object_destroyed new | Called after an object is destroyed that has been registered with LuaBootstrap::register_on_object_destroyed. [...]
on_permission_group_added | Called directly after a permission group is added.
on_permission_group_deleted | Called directly after a permission group is deleted.
on_permission_group_edited | Called directly after a permission group is edited in some way.
on_permission_string_imported | Called directly after a permission string is imported.
on_picked_up_item | Called when a player picks up an item.
on_player_alt_reverse_selected_area | Called after a player alt-reverse-selects an area with a selection-tool item.
on_player_alt_selected_area changed | Called after a player alt-selects an area with a selection-tool item.
on_player_ammo_inventory_changed | Called after a players ammo inventory changed in some way.
on_player_armor_inventory_changed | Called after a players armor inventory changed in some way.
on_player_banned | Called when a player is banned.
on_player_built_tile changed | Called after a player builds tiles.
on_player_cancelled_crafting | Called when a player cancels crafting.
on_player_changed_force | Called after a player changes forces.
on_player_changed_position | Called when the tile position a player is located at changes.
on_player_changed_surface | Called after a player changes surfaces.
on_player_cheat_mode_disabled | Called when cheat mode is disabled on a player.
on_player_cheat_mode_enabled | Called when cheat mode is enabled on a player.
on_player_clicked_gps_tag | Called when a player clicks a gps tag
on_player_configured_blueprint | Called when a player clicks the "confirm" button in the configure Blueprint GUI.
on_player_controller_changed new | Called after a player changes controller types.
on_player_crafted_item | Called when the player finishes crafting an item. [...]
on_player_created | Called after the player was created.
on_player_cursor_stack_changed | Called after a player's cursor stack changed in some way. [...]
on_player_deconstructed_area changed | Called when a player selects an area with a deconstruction planner.
on_player_demoted | Called when a player is demoted.
on_player_died | Called after a player dies.
on_player_display_density_scale_changed new | Called when the display density scale changes for a given player. [...]
on_player_display_resolution_changed | Called when the display resolution changes for a given player.
on_player_display_scale_changed | Called when the display scale changes for a given player.
on_player_driving_changed_state | Called when the player's driving state has changed, meaning a player has either entered or left a vehicle. [...]
on_player_dropped_item | Called when a player drops an item on the ground.
on_player_fast_transferred | Called when a player fast-transfers something to or from an entity.
on_player_flipped_entity new | Called when the player flips an entity. [...]
on_player_flushed_fluid | Called after player flushed fluid
on_player_gun_inventory_changed | Called after a players gun inventory changed in some way.
on_player_input_method_changed | Called when a player's input method changes. [...]
on_player_joined_game | Called after a player joins the game. [...]
on_player_kicked | Called when a player is kicked.
on_player_left_game | Called after a player leaves the game. [...]
on_player_locale_changed new | Called when a player's active locale changes. [...]
on_player_main_inventory_changed | Called after a players main inventory changed in some way.
on_player_mined_entity | Called after the results of an entity being mined are collected just before the entity is destroyed. [...]
on_player_mined_item | Called when the player mines something.
on_player_mined_tile | Called after a player mines tiles.
on_player_muted | Called when a player is muted.
on_player_pipette changed | Called when a player invokes the "smart pipette" over an entity.
on_player_placed_equipment | Called after the player puts equipment in an equipment grid
on_player_promoted | Called when a player is promoted.
on_player_removed | Called when a player is removed (deleted) from the game. [...]
on_player_removed_equipment changed | Called after the player removes equipment from an equipment grid
on_player_repaired_entity | Called when a player repairs an entity.
on_player_respawned | Called after a player respawns.
on_player_reverse_selected_area | Called after a player reverse-selects an area with a selection-tool item.
on_player_rotated_entity | Called when the player rotates an entity. [...]
on_player_selected_area changed | Called after a player selects an area with a selection-tool item.
on_player_set_quick_bar_slot | Called when a player sets a quickbar slot to anything (new value, or set to empty).
on_player_setup_blueprint changed | Called when a player selects an area with a blueprint.
on_player_toggled_alt_mode | Called when a player toggles alt mode, also known as "show entity info".
on_player_toggled_map_editor | Called when a player toggles the map editor on or off.
on_player_trash_inventory_changed | Called after a players trash inventory changed in some way.
on_player_unbanned | Called when a player is un-banned.
on_player_unmuted | Called when a player is unmuted.
on_player_used_capsule changed | Called when a player uses a capsule that results in some game action.
on_player_used_spidertron_remote new | Called when a player uses spidertron remote to send all selected units to a given position
on_post_entity_died changed | Called after an entity dies.
on_pre_build changed | Called when players uses an item to build something. [...]
on_pre_chunk_deleted | Called before one or more chunks are deleted using LuaSurface::delete_chunk.
on_pre_entity_settings_pasted | Called before entity copy-paste is done.
on_pre_ghost_deconstructed | Called before a ghost entity is destroyed as a result of being marked for deconstruction. [...]
on_pre_ghost_upgraded changed | Called before a ghost entity is upgraded.
on_pre_permission_group_deleted | Called directly before a permission group is deleted.
on_pre_permission_string_imported | Called directly before a permission string is imported.
on_pre_player_crafted_item | Called when a player queues something to be crafted.
on_pre_player_died | Called before a players dies.
on_pre_player_left_game | Called before a player leaves the game.
on_pre_player_mined_item | Called when the player completes a mining action, but before the entity is potentially removed from the map. [...]
on_pre_player_removed | Called before a player is removed (deleted) from the game. [...]
on_pre_player_toggled_map_editor | Called before a player toggles the map editor on or off.
on_pre_robot_exploded_cliff changed | Called directly before a robot explodes cliffs.
on_pre_scenario_finished new | Called just before the scenario finishes.
on_pre_script_inventory_resized | Called just before a script inventory is resized.
on_pre_surface_cleared | Called just before a surface is cleared (all entities removed and all chunks deleted).
on_pre_surface_deleted | Called just before a surface is deleted.
on_redo_applied new | Called when the player triggers "redo".
on_research_cancelled | Called when research is cancelled.
on_research_finished | Called when a research finishes.
on_research_moved new | Called when research is moved forwards or backwards in the research queue.
on_research_reversed | Called when a research is reversed (unresearched).
on_research_started | Called when a technology research starts.
on_resource_depleted | Called when a resource entity reaches 0 or its minimum yield for infinite resources.
on_robot_built_entity changed | Called when a construction robot builds an entity.
on_robot_built_tile changed | Called after a robot builds tiles.
on_robot_exploded_cliff changed | Called directly after a robot explodes cliffs.
on_robot_mined | Called when a robot mines an entity.
on_robot_mined_entity | Called after the results of an entity being mined are collected just before the entity is destroyed. [...]
on_robot_mined_tile | Called after a robot mines tiles.
on_robot_pre_mined | Called before a robot mines an entity.
on_rocket_launch_ordered | Called when a rocket silo is ordered to be launched.
on_rocket_launched | Called when the rocket is launched.
on_runtime_mod_setting_changed | Called when a runtime mod setting is changed by a player.
on_script_inventory_resized | Called just after a script inventory is resized.
on_script_path_request_finished | Called when a LuaSurface::request_path call completes.
on_script_trigger_effect changed | Called when a script trigger effect is triggered.
on_sector_scanned | Called when an entity of type `radar` finishes scanning a sector.
on_segment_entity_created new | Called when an individual segment of a SegmentedUnit is created.
on_selected_entity_changed | Called after the selected entity changes for a given player.
on_space_platform_built_entity new | Called when a space platform builds an entity.
on_space_platform_built_tile new | Called after a space platform builds tiles.
on_space_platform_changed_state new | Called when a space platform changes state
on_space_platform_mined_entity new | Called after the results of an entity being mined are collected just before the entity is destroyed. [...]
on_space_platform_mined_item new | Called when a platform mines an entity.
on_space_platform_mined_tile new | Called after a platform mines tiles.
on_space_platform_pre_mined new | Called before a platform mines an entity.
on_spider_command_completed | Called when a spider finishes moving to its autopilot position.
on_string_translated | Called when a translation request generated through LuaPlayer::request_translation or LuaPlayer::request_translations has been completed.
on_surface_cleared | Called just after a surface is cleared (all entities removed and all chunks deleted).
on_surface_created | Called when a surface is created. [...]
on_surface_deleted | Called after a surface is deleted.
on_surface_imported | Called after a surface is imported via the map editor.
on_surface_renamed | Called when a surface is renamed.
on_technology_effects_reset | Called when LuaForce::reset_technology_effects is finished.
on_tick | It is fired once every tick. [...]
on_train_changed_state | Called when a train changes state (started to stopped and vice versa)
on_train_created | Called when a new train is created either through disconnecting/connecting an existing one or building a new one.
on_train_schedule_changed | Called when a trains schedule is changed either by the player or through script.
on_trigger_created_entity | Called when an entity with a trigger prototype (such as capsules) create an entity AND that trigger prototype defined `trigger_created_entity=true`.
on_trigger_fired_artillery | Called when an entity with a trigger prototype (such as capsules) fire an artillery projectile AND that trigger prototype defined `trigger_fired_artillery=true`.
on_undo_applied new | Called when the player triggers "undo".
on_unit_added_to_group changed | Called when a unit is added to a unit group.
on_unit_group_created changed | Called when a new unit group is created, before any members are added to it.
on_unit_group_finished_gathering changed | Called when a unit group finishes gathering and starts executing its command.
on_unit_removed_from_group changed | Called when a unit is removed from a unit group.
on_worker_robot_expired | Called when a worker (construction or logistic) robot expires through a lack of energy.
script_raised_built | A static event mods can use to tell other mods they built something by script. [...]
script_raised_destroy | A static event mods can use to tell other mods they destroyed something by script. [...]
script_raised_revive | A static event mods can use to tell other mods they revived something by script. [...]
script_raised_set_tiles | A static event mods can use to tell other mods they changed tiles on a surface by script. [...]
script_raised_teleported | A static event mods can use to tell other mods they teleported something by script. [...]

## Events

### CustomInputEvent

Called when a CustomInputPrototype is activated.

player_index | :: uint | The player that activated the custom input.
The player that activated the custom input.
input_name | :: string | The prototype name of the custom input that was activated.
The prototype name of the custom input that was activated.
cursor_position | :: MapPosition | The mouse cursor position when the custom input was activated.
The mouse cursor position when the custom input was activated.
cursor_display_location | :: GuiLocation | The mouse cursor display location when the custom input was activated.
The mouse cursor display location when the custom input was activated.
selected_prototype | :: SelectedPrototypeData? | Information about the prototype that is selected when the custom input is used. Needs to be enabled on the custom input's prototype. `nil` if none is selected.
Information about the prototype that is selected when the custom input is used. Needs to be enabled on the custom input's prototype. `nil` if none is selected.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

#### Example

    -- This will be raised when a custom input with the name "my-potato-control" and action "lua" is pressed
    script.on_event("my-potato-control", function(event)
      game.print("Keyboard shortcut pressed on tick: " ..tostring(event.tick))
    end)

### on_achievement_gained new

Called when an achievement is gained.

player_index | :: uint | The player who gained the achievement.
The player who gained the achievement.
achievement | :: LuaAchievementPrototype |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_ai_command_completed

Called when a unit/group completes a command.

unit_number | :: uint | unit_number/group_number of the unit/group which just completed a command.
unit_number/group_number of the unit/group which just completed a command.
result | :: defines.behavior_result |
was_distracted | :: boolean | Was this command generated by a distraction.
Was this command generated by a distraction.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_area_cloned

Called when an area of the map is cloned.

source_surface | :: LuaSurface |
source_area | :: BoundingBox |
destination_surface | :: LuaSurface |
destination_area | :: BoundingBox |
destination_force | :: LuaForce? |
clone_tiles | :: boolean |
clone_entities | :: boolean |
clone_decoratives | :: boolean |
clear_destination_entities | :: boolean |
clear_destination_decoratives | :: boolean |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_biter_base_built

Called when a biter migration builds a base.

This will be called multiple times for each migration, once for every biter that is sacrificed to build part of the new base.

entity | :: LuaEntity | The entity that was built.
The entity that was built.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_brush_cloned

Called when a set of positions on the map is cloned.

source_offset | :: TilePosition |
destination_offset | :: TilePosition |
source_surface | :: LuaSurface |
source_positions | :: array[TilePosition] |
destination_surface | :: LuaSurface |
destination_force | :: LuaForce? |
clone_tiles | :: boolean |
clone_entities | :: boolean |
clone_decoratives | :: boolean |
clear_destination_entities | :: boolean |
clear_destination_decoratives | :: boolean |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_build_base_arrived changed

Called when a defines.command.build_base command reaches its destination, and before building starts.

unit | :: LuaEntity? | The unit the command was assigned to.
The unit the command was assigned to.
group | :: LuaCommandable? | The unit group the command was assigned to.
The unit group the command was assigned to.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_built_entity changed

Called when player builds something.

Can be filtered using LuaPlayerBuiltEntityEventFilter.

entity | :: LuaEntity |
player_index | :: uint |
consumed_items | :: LuaInventory |
tags | :: Tags? | The tags associated with this entity if any.
The tags associated with this entity if any.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_cancelled_deconstruction

Called when the deconstruction of an entity is canceled.

Can be filtered using LuaEntityDeconstructionCancelledEventFilter.

entity | :: LuaEntity |
player_index | :: uint? |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_cancelled_upgrade changed

Called when the upgrade of an entity is canceled.

Can be filtered using LuaUpgradeCancelledEventFilter.

entity | :: LuaEntity |
player_index | :: uint? |
target | :: LuaEntityPrototype |
quality | :: LuaQualityPrototype |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_character_corpse_expired

Called when a character corpse expires due to timeout or all of the items being removed from it.

this is not called if the corpse is mined. See defines.events.on_pre_player_mined_item to detect that.

corpse | :: LuaEntity | The corpse.
The corpse.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_chart_tag_added

Called when a chart tag is created.

tag | :: LuaCustomChartTag |
force | :: LuaForce |
player_index | :: uint? |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_chart_tag_modified changed

Called when a chart tag is modified by a player.

tag | :: LuaCustomChartTag |
player_index | :: uint? |
force | :: LuaForce |
old_text | :: string |
old_icon | :: SignalID |
old_position | :: MapPosition |
old_surface | :: LuaSurface |
old_player_index | :: uint? |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_chart_tag_removed

Called just before a chart tag is deleted.

tag | :: LuaCustomChartTag |
force | :: LuaForce |
player_index | :: uint? |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_chunk_charted

Called when a chunk is charted or re-charted.

surface_index | :: uint |
position | :: ChunkPosition |
area | :: BoundingBox | Area of the chunk.
Area of the chunk.
force | :: LuaForce |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_chunk_deleted

Called when one or more chunks are deleted using LuaSurface::delete_chunk.

surface_index | :: uint |
positions | :: array[ChunkPosition] | The chunks deleted.
The chunks deleted.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_chunk_generated

Called when a chunk is generated.

area | :: BoundingBox | Area of the chunk.
Area of the chunk.
position | :: ChunkPosition | Position of the chunk.
Position of the chunk.
surface | :: LuaSurface | The surface the chunk is on.
The surface the chunk is on.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_combat_robot_expired

Called when a combat robot expires through a lack of energy, or timeout.

robot | :: LuaEntity |
owner | :: LuaEntity? | The entity that owns the robot if any.
The entity that owns the robot if any.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_console_chat

Called when a message is sent to the in-game console, either by a player or through the server interface.

This event only fires for plain messages, not for any commands (including `/shout` or `/whisper`).

player_index | :: uint? | The player doing the chatting, if any.
The player doing the chatting, if any.
message | :: string | The chat message that was sent.
The chat message that was sent.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_console_command

Called when someone enters a command-like message regardless of it being a valid command.

player_index | :: uint? | The player if any.
The player if any.
command | :: string | The command as typed without the preceding forward slash ('/').
The command as typed without the preceding forward slash ('/').
parameters | :: string | The parameters provided if any.
The parameters provided if any.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_cutscene_cancelled

Called when a cutscene is cancelled by the player or by script.

player_index | :: uint | The player the cutscene was shown to.
The player the cutscene was shown to.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_cutscene_finished

Called when a cutscene finishes naturally (was not cancelled).

player_index | :: uint | The player the cutscene was shown to.
The player the cutscene was shown to.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_cutscene_started

Called when a cutscene starts.

player_index | :: uint | The player the cutscene is being shown to.
The player the cutscene is being shown to.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_cutscene_waypoint_reached

Called when a cutscene is playing, each time it reaches a waypoint in that cutscene.

This refers to an index in the table previously passed to set_controller which started the cutscene.

player_index | :: uint | The player index of the player viewing the cutscene.
The player index of the player viewing the cutscene.
waypoint_index | :: uint | The index of the waypoint we just completed.
The index of the waypoint we just completed.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_entity_cloned

Called when an entity is cloned. The filter applies to the source entity.

Can be filtered using LuaEntityClonedEventFilter.

source | :: LuaEntity |
destination | :: LuaEntity |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_entity_color_changed

Called after an entity has been recolored either by the player or through script.

Automatic recoloring due to LuaPlayer::color will not raise events, as that is a separate mechanism.

entity | :: LuaEntity | The entity that was recolored.
The entity that was recolored.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_entity_damaged changed

Called when an entity is damaged. This is not called when an entities health is set directly by another mod.

Can be filtered using LuaEntityDamagedEventFilter.

entity | :: LuaEntity |
damage_type | :: LuaDamagePrototype |
original_damage_amount | :: float | The damage amount before resistances.
The damage amount before resistances.
final_damage_amount | :: float | The damage amount after resistances.
The damage amount after resistances.
final_health | :: float | The health of the entity after the damage was applied.
The health of the entity after the damage was applied.
cause | :: LuaEntity? | The entity that originally triggered the events that led to this damage, if available (e.g. the character, turret, etc. that pulled the trigger).
The entity that originally triggered the events that led to this damage, if available (e.g. the character, turret, etc. that pulled the trigger).
source | :: LuaEntity? | The entity that is directly dealing the damage, if available (e.g. the projectile, flame, sticker, grenade, laser beam, etc.).
The entity that is directly dealing the damage, if available (e.g. the projectile, flame, sticker, grenade, laser beam, etc.).
force | :: LuaForce? | The force that did the attacking if any.
The force that did the attacking if any.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_entity_died

Called when an entity dies.

Can be filtered using LuaEntityDiedEventFilter.

entity | :: LuaEntity | The entity that died.
The entity that died.
cause | :: LuaEntity? | The entity that did the killing if available.
The entity that did the killing if available.
loot | :: LuaInventory | The loot generated by this entity if any.
The loot generated by this entity if any.
force | :: LuaForce? | The force that did the killing if any.
The force that did the killing if any.
damage_type | :: LuaDamagePrototype? | The damage type if any.
The damage type if any.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_entity_logistic_slot_changed changed

Called when one of an entity's logistic slots changes.

player_index | :: uint? | The player who changed the slot, or `nil` if changed by script.
The player who changed the slot, or `nil` if changed by script.
entity | :: LuaEntity | The entity for whom a logistic slot was changed.
The entity for whom a logistic slot was changed.
section | :: LuaLogisticSection | The section changed.
The section changed.
slot_index | :: uint | The slot index that was changed.
The slot index that was changed.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_entity_renamed

Called after an entity has been renamed either by the player or through script.

player_index | :: uint? | If by_script is true this will not be included.
If by_script is true this will not be included.
by_script | :: boolean |
entity | :: LuaEntity |
old_name | :: string |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_entity_settings_pasted

Called after entity copy-paste is done.

player_index | :: uint |
source | :: LuaEntity | The source entity settings were copied from.
The source entity settings were copied from.
destination | :: LuaEntity | The destination entity settings were copied to.
The destination entity settings were copied to.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_entity_spawned

Called when an entity is spawned by a EnemySpawner

spawner | :: LuaEntity |
entity | :: LuaEntity |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_equipment_inserted

Called after equipment is inserted into an equipment grid.

grid | :: LuaEquipmentGrid | The equipment grid inserted into.
The equipment grid inserted into.
equipment | :: LuaEquipment | The equipment inserted.
The equipment inserted.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_equipment_removed changed

Called after equipment is removed from an equipment grid.

grid | :: LuaEquipmentGrid | The equipment grid removed from.
The equipment grid removed from.
equipment | :: string | The equipment removed.
The equipment removed.
quality | :: string | The equipment quality.
The equipment quality.
count | :: uint | The count of equipment removed.
The count of equipment removed.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_force_cease_fire_changed

Called when the a forces cease fire values change.

force | :: LuaForce | The force who's cease fire changed.
The force who's cease fire changed.
other_force | :: LuaForce | Which force was added or removed.
Which force was added or removed.
added | :: boolean | If the other force was added or removed.
If the other force was added or removed.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_force_created

Called when a new force is created using `game.create_force()`

This is not called when the default forces (`'player'`, `'enemy'`, `'neutral'`) are created as they will always exist.

force | :: LuaForce | The newly created force.
The newly created force.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_force_friends_changed

Called when the a forces friends change.

force | :: LuaForce | The force who's friends changed.
The force who's friends changed.
other_force | :: LuaForce | Which force was added or removed.
Which force was added or removed.
added | :: boolean | If the other force was added or removed.
If the other force was added or removed.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_force_reset

Called when LuaForce::reset is finished.

force | :: LuaForce |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_forces_merged

Called after two forces have been merged using `game.merge_forces()`.

The source force is invalidated before this event is called and the name can be re-used in this event if desired.

source_name | :: string | The force destroyed.
The force destroyed.
source_index | :: uint | The index of the destroyed force.
The index of the destroyed force.
destination | :: LuaForce | The force entities where reassigned to.
The force entities where reassigned to.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_forces_merging

Called when two forces are about to be merged using `game.merge_forces()`.

source | :: LuaForce | The force to be destroyed
The force to be destroyed
destination | :: LuaForce | The force to reassign entities to.
The force to reassign entities to.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_game_created_from_scenario

Called when a game is created from a scenario. This is fired for every mod, even when the scenario's save data already includes it. In those cases however, LuaBootstrap::on_init is not fired.

This event is not fired when the scenario is loaded via the map editor.

name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_gui_checked_state_changed

Called when LuaGuiElement checked state is changed (related to checkboxes and radio buttons).

element | :: LuaGuiElement | The element whose checked state changed.
The element whose checked state changed.
player_index | :: uint | The player who did the change.
The player who did the change.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_gui_click

Called when LuaGuiElement is clicked.

element | :: LuaGuiElement | The clicked element.
The clicked element.
player_index | :: uint | The player who did the clicking.
The player who did the clicking.
button | :: defines.mouse_button_type | The mouse button used if any.
The mouse button used if any.
cursor_display_location | :: GuiLocation | The display location of the player's cursor.
The display location of the player's cursor.
alt | :: boolean | If alt was pressed.
If alt was pressed.
control | :: boolean | If control was pressed.
If control was pressed.
shift | :: boolean | If shift was pressed.
If shift was pressed.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_gui_closed

Called when the player closes the GUI they have open.

This can only be raised when the GUI's player controller is still valid. If a GUI is thus closed due to the player disconnecting, dying, or becoming a spectator in other ways, it won't cause this event to be raised.

It's not advised to open any other GUI during this event because if this is run as a request to open a different GUI the game will force close the new opened GUI without notice to ensure the original requested GUI is opened.

player_index | :: uint | The player.
The player.
gui_type | :: defines.gui_type | The GUI type that was open.
The GUI type that was open.
entity | :: LuaEntity? | The entity that was open
The entity that was open
item | :: LuaItemStack? | The item that was open
The item that was open
equipment | :: LuaEquipment? | The equipment that was open
The equipment that was open
other_player | :: LuaPlayer? | The other player that was open
The other player that was open
element | :: LuaGuiElement? | The custom GUI element that was open
The custom GUI element that was open
technology | :: LuaTechnology? | The technology that was automatically selected when opening the research GUI
The technology that was automatically selected when opening the research GUI
tile_position | :: TilePosition? | The tile position that was open
The tile position that was open
inventory | :: LuaInventory? | The script inventory that was open
The script inventory that was open
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_gui_confirmed

Called when a LuaGuiElement is confirmed, for example by pressing Enter in a textfield.

element | :: LuaGuiElement | The confirmed element.
The confirmed element.
player_index | :: uint | The player who did the confirming.
The player who did the confirming.
alt | :: boolean | If alt was pressed.
If alt was pressed.
control | :: boolean | If control was pressed.
If control was pressed.
shift | :: boolean | If shift was pressed.
If shift was pressed.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_gui_elem_changed

Called when LuaGuiElement element value is changed (related to choose element buttons).

element | :: LuaGuiElement | The element whose element value changed.
The element whose element value changed.
player_index | :: uint | The player who did the change.
The player who did the change.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_gui_hover

Called when LuaGuiElement is hovered by the mouse.

element | :: LuaGuiElement | The element that is being hovered over.
The element that is being hovered over.
player_index | :: uint | The player whose cursor is hovering.
The player whose cursor is hovering.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_gui_leave

Called when the player's cursor leaves a LuaGuiElement that was previously hovered.

element | :: LuaGuiElement | The element that was being hovered.
The element that was being hovered.
player_index | :: uint | The player whose cursor was hovering.
The player whose cursor was hovering.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_gui_location_changed

Called when LuaGuiElement element location is changed (related to frames in `player.gui.screen`).

element | :: LuaGuiElement | The element whose location changed.
The element whose location changed.
player_index | :: uint | The player who did the change.
The player who did the change.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_gui_opened

Called when the player opens a GUI.

player_index | :: uint | The player.
The player.
gui_type | :: defines.gui_type | The GUI type that was opened.
The GUI type that was opened.
entity | :: LuaEntity? | The entity that was opened
The entity that was opened
item | :: LuaItemStack? | The item that was opened
The item that was opened
equipment | :: LuaEquipment? | The equipment that was opened
The equipment that was opened
other_player | :: LuaPlayer? | The other player that was opened
The other player that was opened
element | :: LuaGuiElement? | The custom GUI element that was opened
The custom GUI element that was opened
inventory | :: LuaInventory? | The script inventory that was opened
The script inventory that was opened
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_gui_selected_tab_changed

Called when LuaGuiElement selected tab is changed (related to tabbed-panes).

element | :: LuaGuiElement | The tabbed pane whose selected tab changed.
The tabbed pane whose selected tab changed.
player_index | :: uint | The player who did the change.
The player who did the change.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_gui_selection_state_changed

Called when LuaGuiElement selection state is changed (related to drop-downs and listboxes).

element | :: LuaGuiElement | The element whose selection state changed.
The element whose selection state changed.
player_index | :: uint | The player who did the change.
The player who did the change.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_gui_switch_state_changed

Called when LuaGuiElement switch state is changed (related to switches).

element | :: LuaGuiElement | The switch whose switch state changed.
The switch whose switch state changed.
player_index | :: uint | The player who did the change.
The player who did the change.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_gui_text_changed

Called when LuaGuiElement text is changed by the player.

element | :: LuaGuiElement | The edited element.
The edited element.
player_index | :: uint | The player who did the edit.
The player who did the edit.
text | :: string | The new text in the element.
The new text in the element.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_gui_value_changed

Called when LuaGuiElement slider value is changed (related to the slider element).

element | :: LuaGuiElement | The element whose value changed.
The element whose value changed.
player_index | :: uint | The player who did the change.
The player who did the change.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_land_mine_armed

Called when a land mine is armed.

mine | :: LuaEntity |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_lua_shortcut

Called when a custom Lua shortcut is pressed.

player_index | :: uint |
prototype_name | :: string | Shortcut prototype name of the shortcut that was clicked.
Shortcut prototype name of the shortcut that was clicked.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_marked_for_deconstruction

Called when an entity is marked for deconstruction with the Deconstruction planner or via script.

Can be filtered using LuaEntityMarkedForDeconstructionEventFilter.

entity | :: LuaEntity |
player_index | :: uint? |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_marked_for_upgrade changed

Called when an entity is marked for upgrade with the Upgrade planner or via script.

Can be filtered using LuaEntityMarkedForUpgradeEventFilter.

player_index | :: uint? |
entity | :: LuaEntity |
target | :: LuaEntityPrototype |
quality | :: LuaQualityPrototype |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_market_item_purchased

Called after a player purchases some offer from a `market` entity.

player_index | :: uint | The player who did the purchasing.
The player who did the purchasing.
market | :: LuaEntity | The market entity.
The market entity.
offer_index | :: uint | The index of the offer purchased.
The index of the offer purchased.
count | :: uint | The amount of offers purchased.
The amount of offers purchased.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_mod_item_opened changed

Called when the player uses the 'Open item GUI' control on an item defined with the 'mod-openable' flag

player_index | :: uint | The player.
The player.
item | :: LuaItemPrototype | The item clicked on.
The item clicked on.
quality | :: LuaQualityPrototype | The item quality clicked on.
The item quality clicked on.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_object_destroyed new

Called after an object is destroyed that has been registered with LuaBootstrap::register_on_object_destroyed.

Depending on when a given object is destroyed, this event will be fired at the end of the current tick or at the end of the next tick.

registration_number | :: uint64 | The number returned by register_on_object_destroyed to uniquely identify this object during this event.
The number returned by register_on_object_destroyed to uniquely identify this object during this event.
useful_id | :: uint64 | Useful identifier of the object. Same as second value returned by LuaBootstrap::register_on_object_destroyed
Useful identifier of the object. Same as second value returned by LuaBootstrap::register_on_object_destroyed
type | :: defines.target_type | Type of the object that was destroyed. Same as third value returned by LuaBootstrap::register_on_object_destroyed
Type of the object that was destroyed. Same as third value returned by LuaBootstrap::register_on_object_destroyed
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_permission_group_added

Called directly after a permission group is added.

player_index | :: uint? | The player that added the group or `nil` if by a mod.
The player that added the group or `nil` if by a mod.
group | :: LuaPermissionGroup | The group added.
The group added.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_permission_group_deleted

Called directly after a permission group is deleted.

player_index | :: uint? | The player doing the deletion or `nil` if by a mod.
The player doing the deletion or `nil` if by a mod.
group_name | :: string | The group that was deleted.
The group that was deleted.
id | :: uint | The group id that was deleted.
The group id that was deleted.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_permission_group_edited

Called directly after a permission group is edited in some way.

player_index | :: uint? | The player that did the editing or `nil` if by a mod.
The player that did the editing or `nil` if by a mod.
group | :: LuaPermissionGroup | The group being edited.
The group being edited.
type | :: `"add-permission"` or `"remove-permission"` or `"enable-all"` or `"disable-all"` or `"add-player"` or `"remove-player"` or `"rename"` | The edit type.
The edit type.
action | :: defines.input_action | The action when the `type` is `"add-permission"` or `"remove-permission"`.
The action when the `type` is `"add-permission"` or `"remove-permission"`.
other_player_index | :: uint | The other player when the `type` is `"add-player"` or `"remove-player"`.
The other player when the `type` is `"add-player"` or `"remove-player"`.
old_name | :: string | The old group name when the `type` is `"rename"`.
The old group name when the `type` is `"rename"`.
new_name | :: string | The new group name when the `type` is `"rename"`.
The new group name when the `type` is `"rename"`.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_permission_string_imported

Called directly after a permission string is imported.

player_index | :: uint | The player that imported the string.
The player that imported the string.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_picked_up_item

Called when a player picks up an item.

item_stack | :: SimpleItemStack |
player_index | :: uint |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_alt_reverse_selected_area

Called after a player alt-reverse-selects an area with a selection-tool item.

player_index | :: uint | The player doing the selection.
The player doing the selection.
surface | :: LuaSurface | The surface selected.
The surface selected.
area | :: BoundingBox | The area selected.
The area selected.
item | :: string | The item used to select the area.
The item used to select the area.
entities | :: array[LuaEntity] | The entities selected.
The entities selected.
tiles | :: array[LuaTile] | The tiles selected.
The tiles selected.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_alt_selected_area changed

Called after a player alt-selects an area with a selection-tool item.

player_index | :: uint | The player doing the selection.
The player doing the selection.
surface | :: LuaSurface | The surface selected.
The surface selected.
area | :: BoundingBox | The area selected.
The area selected.
item | :: string | The item used to select the area.
The item used to select the area.
quality | :: string | The item quality used to select the area.
The item quality used to select the area.
entities | :: array[LuaEntity] | The entities selected.
The entities selected.
tiles | :: array[LuaTile] | The tiles selected.
The tiles selected.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_ammo_inventory_changed

Called after a players ammo inventory changed in some way.

player_index | :: uint |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_armor_inventory_changed

Called after a players armor inventory changed in some way.

player_index | :: uint |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_banned

Called when a player is banned.

player_index | :: uint? | The player banned.
The player banned.
player_name | :: string | The banned player name.
The banned player name.
by_player | :: uint? | The player that did the banning if any.
The player that did the banning if any.
reason | :: string? | The reason given if any.
The reason given if any.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_built_tile changed

Called after a player builds tiles.

player_index | :: uint |
surface_index | :: uint | The surface the tile(s) were built on.
The surface the tile(s) were built on.
tiles | :: array[OldTileAndPosition] | The position data.
The position data.
tile | :: LuaTilePrototype | The tile prototype that was placed.
The tile prototype that was placed.
item | :: LuaItemPrototype? | The item type used to build the tiles
The item type used to build the tiles
quality | :: LuaQualityPrototype? | The quality of the item used to build the tiles
The quality of the item used to build the tiles
inventory | :: LuaInventory? | The inventory containing the items used to build the tiles.
The inventory containing the items used to build the tiles.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_cancelled_crafting

Called when a player cancels crafting.

player_index | :: uint | The player that did the crafting.
The player that did the crafting.
items | :: LuaInventory | The crafting items returned to the player's inventory.
The crafting items returned to the player's inventory.
recipe | :: LuaRecipe | The recipe that has been cancelled.
The recipe that has been cancelled.
cancel_count | :: uint | The number of crafts that have been cancelled.
The number of crafts that have been cancelled.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_changed_force

Called after a player changes forces.

player_index | :: uint | The player who changed forces.
The player who changed forces.
force | :: LuaForce | The old force.
The old force.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_changed_position

Called when the tile position a player is located at changes.

player_index | :: uint | The player.
The player.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_changed_surface

Called after a player changes surfaces.

player_index | :: uint | The player who changed surfaces.
The player who changed surfaces.
surface_index | :: uint? | The surface index the player was on - may be `nil` if the surface no longer exists.
The surface index the player was on - may be `nil` if the surface no longer exists.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_cheat_mode_disabled

Called when cheat mode is disabled on a player.

player_index | :: uint | The player.
The player.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_cheat_mode_enabled

Called when cheat mode is enabled on a player.

player_index | :: uint | The player.
The player.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_clicked_gps_tag

Called when a player clicks a gps tag

player_index | :: uint | Index of the player
Index of the player
position | :: MapPosition | Map position contained in gps tag
Map position contained in gps tag
surface | :: string | Surface name contained in gps tag, even when such surface does not exists
Surface name contained in gps tag, even when such surface does not exists
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_configured_blueprint

Called when a player clicks the "confirm" button in the configure Blueprint GUI.

player_index | :: uint | The player.
The player.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_controller_changed new

Called after a player changes controller types.

player_index | :: uint | The player who changed controllers.
The player who changed controllers.
old_type | :: defines.controllers | The old controller type.
The old controller type.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_crafted_item

Called when the player finishes crafting an item. This event fires just before the results are inserted into the player's inventory, not when the crafting is queued (see on_pre_player_crafted_item).

item_stack | :: LuaItemStack | The item that has been crafted.
The item that has been crafted.
player_index | :: uint | The player doing the crafting.
The player doing the crafting.
recipe | :: LuaRecipe | The recipe used to craft this item.
The recipe used to craft this item.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_created

Called after the player was created.

player_index | :: uint |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_cursor_stack_changed

Called after a player's cursor stack changed in some way.

This is fired in the same tick that the change happens, but not instantly.

player_index | :: uint |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_deconstructed_area changed

Called when a player selects an area with a deconstruction planner.

player_index | :: uint | The player doing the selection.
The player doing the selection.
surface | :: LuaSurface | The surface selected.
The surface selected.
area | :: BoundingBox | The area selected.
The area selected.
item | :: string | The item used to select the area.
The item used to select the area.
stack | :: LuaItemStack? | The item stack used to select the area.
The item stack used to select the area.
quality | :: string | The item quality used to select the area.
The item quality used to select the area.
alt | :: boolean | If normal selection or alt selection was used.
If normal selection or alt selection was used.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_demoted

Called when a player is demoted.

player_index | :: uint | The player.
The player.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_died

Called after a player dies.

player_index | :: uint |
cause | :: LuaEntity? |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_display_density_scale_changed new

Called when the display density scale changes for a given player. The display density scale is the scale value automatically applied based on the player's display DPI. This is only relevant on platforms that support high-density displays.

player_index | :: uint | The player
The player
old_scale | :: double | The old display scale
The old display scale
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_display_resolution_changed

Called when the display resolution changes for a given player.

player_index | :: uint | The player
The player
old_resolution | :: DisplayResolution | The old display resolution
The old display resolution
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_display_scale_changed

Called when the display scale changes for a given player.

player_index | :: uint | The player
The player
old_scale | :: double | The old display scale
The old display scale
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_driving_changed_state

Called when the player's driving state has changed, meaning a player has either entered or left a vehicle.

This event is not raised when the player is ejected from a vehicle due to it being destroyed.

player_index | :: uint |
entity | :: LuaEntity? | The vehicle if any.
The vehicle if any.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_dropped_item

Called when a player drops an item on the ground.

player_index | :: uint |
entity | :: LuaEntity | The item-on-ground entity.
The item-on-ground entity.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_fast_transferred

Called when a player fast-transfers something to or from an entity.

player_index | :: uint | The player transferred from or to.
The player transferred from or to.
entity | :: LuaEntity | The entity transferred from or to.
The entity transferred from or to.
from_player | :: boolean | Whether the transfer was from player to entity. If `false`, the transfer was from entity to player.
Whether the transfer was from player to entity. If `false`, the transfer was from entity to player.
is_split | :: boolean | Whether the transfer was a split action (half stack).
Whether the transfer was a split action (half stack).
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_flipped_entity new

Called when the player flips an entity. This event is only fired when the entity actually changes its orientation or mirroring -- pressing the flip keys on an entity that can't be flipped won't fire this event.

entity | :: LuaEntity | The flipped entity.
The flipped entity.
horizontal | :: boolean | The enacted flip. true = Horizontal, false = Vertical
The enacted flip. true = Horizontal, false = Vertical
player_index | :: uint |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_flushed_fluid

Called after player flushed fluid

player_index | :: uint | Index of the player
Index of the player
fluid | :: string | Name of a fluid that was flushed
Name of a fluid that was flushed
amount | :: double | Amount of fluid that was removed
Amount of fluid that was removed
entity | :: LuaEntity | Entity from which flush was performed
Entity from which flush was performed
only_this_entity | :: boolean | True if flush was requested only on this entity
True if flush was requested only on this entity
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_gun_inventory_changed

Called after a players gun inventory changed in some way.

player_index | :: uint |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_input_method_changed

Called when a player's input method changes. See LuaPlayer::input_method.

player_index | :: uint | The player whose input method changed.
The player whose input method changed.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_joined_game

Called after a player joins the game. This is not called when loading a save file in singleplayer, as the player doesn't actually leave the game, and the save is just on pause until they rejoin.

player_index | :: uint |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_kicked

Called when a player is kicked.

player_index | :: uint | The player kicked.
The player kicked.
by_player | :: uint? | The player that did the kicking if any.
The player that did the kicking if any.
reason | :: string? | The reason given if any.
The reason given if any.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_left_game

Called after a player leaves the game. This is not called when closing a save file in singleplayer, as the player doesn't actually leave the game, and the save is just on pause until they rejoin.

player_index | :: uint |
reason | :: defines.disconnect_reason |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_locale_changed new

Called when a player's active locale changes. See LuaPlayer::locale.

player_index | :: uint | The player whose locale was changed.
The player whose locale was changed.
old_locale | :: string | The previously active locale.
The previously active locale.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_main_inventory_changed

Called after a players main inventory changed in some way.

player_index | :: uint |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_mined_entity

Called after the results of an entity being mined are collected just before the entity is destroyed.

After this event any items in the buffer will be transferred into the player as if they came from mining the entity.

The buffer inventory is special in that it's only valid during this event and has a dynamic size expanding as more items are transferred into it.

Can be filtered using LuaPlayerMinedEntityEventFilter.

player_index | :: uint | The index of the player doing the mining.
The index of the player doing the mining.
entity | :: LuaEntity | The entity that has been mined.
The entity that has been mined.
buffer | :: LuaInventory | The temporary inventory that holds the result of mining the entity.
The temporary inventory that holds the result of mining the entity.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_mined_item

Called when the player mines something.

item_stack | :: SimpleItemStack | The item given to the player
The item given to the player
player_index | :: uint |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_mined_tile

Called after a player mines tiles.

player_index | :: uint |
surface_index | :: uint | The surface the tile(s) were mined from.
The surface the tile(s) were mined from.
tiles | :: array[OldTileAndPosition] | The position data.
The position data.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_muted

Called when a player is muted.

player_index | :: uint | The player.
The player.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_pipette changed

Called when a player invokes the "smart pipette" over an entity.

player_index | :: uint | The player
The player
item | :: LuaItemPrototype | The item put in the cursor
The item put in the cursor
quality | :: LuaQualityPrototype | The item quality put in the cursor
The item quality put in the cursor
used_cheat_mode | :: boolean | If cheat mode was used to give a free stack of the item.
If cheat mode was used to give a free stack of the item.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_placed_equipment

Called after the player puts equipment in an equipment grid

player_index | :: uint |
equipment | :: LuaEquipment | The equipment put in the equipment grid.
The equipment put in the equipment grid.
grid | :: LuaEquipmentGrid | The equipment grid the equipment was put in.
The equipment grid the equipment was put in.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_promoted

Called when a player is promoted.

player_index | :: uint | The player.
The player.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_removed

Called when a player is removed (deleted) from the game. This is markedly different from a player temporarily leaving the game, and instead behaves like the player never existed in the save file.

player_index | :: uint | The index of the removed player.
The index of the removed player.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_removed_equipment changed

Called after the player removes equipment from an equipment grid

player_index | :: uint |
grid | :: LuaEquipmentGrid | The equipment grid removed from.
The equipment grid removed from.
equipment | :: string | The equipment removed.
The equipment removed.
quality | :: string | The equipment quality.
The equipment quality.
count | :: uint | The count of equipment removed.
The count of equipment removed.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_repaired_entity

Called when a player repairs an entity.

Can be filtered using LuaPlayerRepairedEntityEventFilter.

player_index | :: uint |
entity | :: LuaEntity |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_respawned

Called after a player respawns.

player_index | :: uint |
player_port | :: LuaEntity? | The player port used to respawn if one was used.
The player port used to respawn if one was used.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_reverse_selected_area

Called after a player reverse-selects an area with a selection-tool item.

player_index | :: uint | The player doing the selection.
The player doing the selection.
surface | :: LuaSurface | The surface selected.
The surface selected.
area | :: BoundingBox | The area selected.
The area selected.
item | :: string | The item used to select the area.
The item used to select the area.
entities | :: array[LuaEntity] | The entities selected.
The entities selected.
tiles | :: array[LuaTile] | The tiles selected.
The tiles selected.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_rotated_entity

Called when the player rotates an entity. This event is only fired when the entity actually changes its orientation -- pressing the rotate key on an entity that can't be rotated won't fire this event.

Entities being flipped will not fire this event, even if the flip involves rotating. See on_player_flipped_entity.

entity | :: LuaEntity | The rotated entity.
The rotated entity.
previous_direction | :: defines.direction | The previous direction
The previous direction
player_index | :: uint |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_selected_area changed

Called after a player selects an area with a selection-tool item.

player_index | :: uint | The player doing the selection.
The player doing the selection.
surface | :: LuaSurface | The surface selected.
The surface selected.
area | :: BoundingBox | The area selected.
The area selected.
item | :: string | The item used to select the area.
The item used to select the area.
quality | :: string | The item quality used to select the area.
The item quality used to select the area.
entities | :: array[LuaEntity] | The entities selected.
The entities selected.
tiles | :: array[LuaTile] | The tiles selected.
The tiles selected.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_set_quick_bar_slot

Called when a player sets a quickbar slot to anything (new value, or set to empty).

player_index | :: uint |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_setup_blueprint changed

Called when a player selects an area with a blueprint.

player_index | :: uint | The player doing the selection.
The player doing the selection.
surface | :: LuaSurface | The surface selected.
The surface selected.
area | :: BoundingBox | The area selected.
The area selected.
item | :: string | The item used to select the area.
The item used to select the area.
stack | :: LuaItemStack? | The item stack used to select the area.
The item stack used to select the area.
quality | :: string | The item quality used to select the area.
The item quality used to select the area.
alt | :: boolean | If normal selection or alt selection was used.
If normal selection or alt selection was used.
mapping | :: LuaLazyLoadedValue(dictionary[uint → LuaEntity]) | The blueprint entity index to source entity mapping. Note: if any mod changes the blueprint this will be incorrect.
The blueprint entity index to source entity mapping. Note: if any mod changes the blueprint this will be incorrect.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_toggled_alt_mode

Called when a player toggles alt mode, also known as "show entity info".

player_index | :: uint |
alt_mode | :: boolean | The new alt mode value. This value is a shortcut for accessing GameViewSettings::show_entity_info on the player.
The new alt mode value. This value is a shortcut for accessing GameViewSettings::show_entity_info on the player.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_toggled_map_editor

Called when a player toggles the map editor on or off.

player_index | :: uint |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_trash_inventory_changed

Called after a players trash inventory changed in some way.

player_index | :: uint |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_unbanned

Called when a player is un-banned.

player_index | :: uint? | The player un-banned.
The player un-banned.
player_name | :: string | The player name un-banned.
The player name un-banned.
by_player | :: uint? | The player that did the un-banning if any.
The player that did the un-banning if any.
reason | :: string? | The reason the player was banned if any.
The reason the player was banned if any.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_unmuted

Called when a player is unmuted.

player_index | :: uint | The player.
The player.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_used_capsule changed

Called when a player uses a capsule that results in some game action.

player_index | :: uint | The player.
The player.
item | :: LuaItemPrototype | The capsule item used.
The capsule item used.
quality | :: LuaQualityPrototype | The quality of the capsule item used.
The quality of the capsule item used.
position | :: MapPosition | The position the capsule was used.
The position the capsule was used.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_player_used_spidertron_remote new

Called when a player uses spidertron remote to send all selected units to a given position

player_index | :: uint | The player that used the remote.
The player that used the remote.
position | :: MapPosition | Goal position to which spidertron was sent to.
Goal position to which spidertron was sent to.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_post_entity_died changed

Called after an entity dies.

Can be filtered using LuaPostEntityDiedEventFilter.

ghost | :: LuaEntity? | The ghost created by the entity dying if any.
The ghost created by the entity dying if any.
force | :: LuaForce? | The force that did the killing if any.
The force that did the killing if any.
position | :: MapPosition | Position where the entity died.
Position where the entity died.
prototype | :: LuaEntityPrototype | The entity prototype of the entity that died.
The entity prototype of the entity that died.
quality | :: LuaQualityPrototype | The quality of the entity that died.
The quality of the entity that died.
damage_type | :: LuaDamagePrototype? | The damage type if any.
The damage type if any.
corpses | :: array[LuaEntity] | The corpses created by the entity dying if any.
The corpses created by the entity dying if any.
surface_index | :: uint | The surface the entity was on.
The surface the entity was on.
unit_number | :: uint? | The unit number the entity had if any.
The unit number the entity had if any.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_pre_build changed

Called when players uses an item to build something. Called before on_built_entity.

player_index | :: uint | The player who did the placing.
The player who did the placing.
position | :: MapPosition | Where the item was placed.
Where the item was placed.
build_mode | :: defines.build_mode | Build mode the item was placed with.
Build mode the item was placed with.
direction | :: defines.direction | The direction the item was facing when placed.
The direction the item was facing when placed.
mirror | :: boolean | If the item is mirrored (only crafting machines support this)
If the item is mirrored (only crafting machines support this)
flip_horizontal | :: boolean | Whether the blueprint was flipped horizontally. `nil` if not built by a blueprint.
Whether the blueprint was flipped horizontally. `nil` if not built by a blueprint.
flip_vertical | :: boolean | Whether the blueprint was flipped vertically. `nil` if not built by a blueprint.
Whether the blueprint was flipped vertically. `nil` if not built by a blueprint.
created_by_moving | :: boolean | Whether the item was placed while moving.
Whether the item was placed while moving.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_pre_chunk_deleted

Called before one or more chunks are deleted using LuaSurface::delete_chunk.

surface_index | :: uint |
positions | :: array[ChunkPosition] | The chunks to be deleted.
The chunks to be deleted.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_pre_entity_settings_pasted

Called before entity copy-paste is done.

player_index | :: uint |
source | :: LuaEntity | The source entity settings will be copied from.
The source entity settings will be copied from.
destination | :: LuaEntity | The destination entity settings will be copied to.
The destination entity settings will be copied to.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_pre_ghost_deconstructed

Called before a ghost entity is destroyed as a result of being marked for deconstruction.

Also called for item request proxies before they are destroyed as a result of being marked for deconstruction.

Can be filtered using LuaPreGhostDeconstructedEventFilter.

player_index | :: uint? | The player that did the deconstruction if any.
The player that did the deconstruction if any.
ghost | :: LuaEntity |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_pre_ghost_upgraded changed

Called before a ghost entity is upgraded.

Can be filtered using LuaPreGhostUpgradedEventFilter.

player_index | :: uint? | The player that did the upgrade if any.
The player that did the upgrade if any.
ghost | :: LuaEntity |
target | :: LuaEntityPrototype |
quality | :: LuaQualityPrototype |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_pre_permission_group_deleted

Called directly before a permission group is deleted.

player_index | :: uint? | The player doing the deletion or `nil` if by a mod.
The player doing the deletion or `nil` if by a mod.
group | :: LuaPermissionGroup | The group to be deleted.
The group to be deleted.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_pre_permission_string_imported

Called directly before a permission string is imported.

player_index | :: uint | The player importing the string.
The player importing the string.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_pre_player_crafted_item

Called when a player queues something to be crafted.

player_index | :: uint | The player doing the crafting.
The player doing the crafting.
recipe | :: LuaRecipe | The recipe being queued.
The recipe being queued.
items | :: LuaInventory | The items removed from the players inventory to do the crafting.
The items removed from the players inventory to do the crafting.
queued_count | :: uint | The number of times the recipe is being queued.
The number of times the recipe is being queued.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_pre_player_died

Called before a players dies.

player_index | :: uint |
cause | :: LuaEntity? |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_pre_player_left_game

Called before a player leaves the game.

player_index | :: uint |
reason | :: defines.disconnect_reason |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_pre_player_mined_item

Called when the player completes a mining action, but before the entity is potentially removed from the map. This is called even if the entity does not end up being removed.

Can be filtered using LuaPrePlayerMinedEntityEventFilter.

entity | :: LuaEntity | The entity being mined
The entity being mined
player_index | :: uint |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_pre_player_removed

Called before a player is removed (deleted) from the game. This is markedly different from a player temporarily leaving the game, and instead behaves like the player never existed in the save file.

player_index | :: uint | The index of the removed player.
The index of the removed player.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_pre_player_toggled_map_editor

Called before a player toggles the map editor on or off.

player_index | :: uint |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_pre_robot_exploded_cliff changed

Called directly before a robot explodes cliffs.

robot | :: LuaEntity |
cliff | :: LuaEntity |
item | :: LuaItemPrototype | The cliff explosive used.
The cliff explosive used.
quality | :: LuaQualityPrototype | The quality of the cliff explosive used.
The quality of the cliff explosive used.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_pre_scenario_finished new

Called just before the scenario finishes.

name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_pre_script_inventory_resized

Called just before a script inventory is resized.

player_index | :: uint? | If done by console command; the player who ran the command.
If done by console command; the player who ran the command.
mod | :: string | The mod that did the resizing. This will be `"core"` if done by console command or scenario script.
The mod that did the resizing. This will be `"core"` if done by console command or scenario script.
inventory | :: LuaInventory |
old_size | :: uint | The old inventory size.
The old inventory size.
new_size | :: uint | The new inventory size.
The new inventory size.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_pre_surface_cleared

Called just before a surface is cleared (all entities removed and all chunks deleted).

surface_index | :: uint |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_pre_surface_deleted

Called just before a surface is deleted.

surface_index | :: uint |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_redo_applied new

Called when the player triggers "redo".

player_index | :: uint | The player who triggered the redo action.
The player who triggered the redo action.
actions | :: array[UndoRedoAction] | The context of the redo action.
The context of the redo action.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_research_cancelled

Called when research is cancelled.

research | :: dictionary[string → uint] | A mapping of technology name to how many times it was cancelled.
A mapping of technology name to how many times it was cancelled.
force | :: LuaForce | The force whose research was cancelled.
The force whose research was cancelled.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_research_finished

Called when a research finishes.

research | :: LuaTechnology | The researched technology
The researched technology
by_script | :: boolean | If the technology was researched by script.
If the technology was researched by script.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_research_moved new

Called when research is moved forwards or backwards in the research queue.

force | :: LuaForce | The force whose research was re-arranged.
The force whose research was re-arranged.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_research_reversed

Called when a research is reversed (unresearched).

research | :: LuaTechnology | The technology un-researched
The technology un-researched
by_script | :: boolean | If the technology was un-researched by script.
If the technology was un-researched by script.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_research_started

Called when a technology research starts.

research | :: LuaTechnology | The technology being researched
The technology being researched
last_research | :: LuaTechnology? |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_resource_depleted

Called when a resource entity reaches 0 or its minimum yield for infinite resources.

entity | :: LuaEntity |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_robot_built_entity changed

Called when a construction robot builds an entity.

Can be filtered using LuaRobotBuiltEntityEventFilter.

robot | :: LuaEntity | The robot that did the building.
The robot that did the building.
entity | :: LuaEntity | The entity built.
The entity built.
stack | :: LuaItemStack | The item used to do the building.
The item used to do the building.
tags | :: Tags? | The tags associated with this entity if any.
The tags associated with this entity if any.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_robot_built_tile changed

Called after a robot builds tiles.

robot | :: LuaEntity | The robot.
The robot.
tiles | :: array[OldTileAndPosition] | The position data.
The position data.
tile | :: LuaTilePrototype | The tile prototype that was placed.
The tile prototype that was placed.
item | :: LuaItemPrototype | The item type used to build the tiles.
The item type used to build the tiles.
quality | :: LuaQualityPrototype | The quality the item used to build the tiles.
The quality the item used to build the tiles.
inventory | :: LuaInventory | The inventory containing the stacks used to build the tiles.
The inventory containing the stacks used to build the tiles.
surface_index | :: uint | The surface the tile(s) are build on.
The surface the tile(s) are build on.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_robot_exploded_cliff changed

Called directly after a robot explodes cliffs.

robot | :: LuaEntity |
item | :: LuaItemPrototype | The cliff explosive used.
The cliff explosive used.
quality | :: LuaQualityPrototype | The quality of the cliff explosive used.
The quality of the cliff explosive used.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_robot_mined

Called when a robot mines an entity.

robot | :: LuaEntity | The robot that did the mining.
The robot that did the mining.
item_stack | :: SimpleItemStack | The entity the robot just picked up.
The entity the robot just picked up.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_robot_mined_entity

Called after the results of an entity being mined are collected just before the entity is destroyed.

After this event any items in the buffer will be transferred into the robot as if they came from mining the entity.

The buffer inventory is special in that it's only valid during this event and has a dynamic size expanding as more items are transferred into it.

Can be filtered using LuaRobotMinedEntityEventFilter.

robot | :: LuaEntity | The robot doing the mining.
The robot doing the mining.
entity | :: LuaEntity | The entity that has been mined.
The entity that has been mined.
buffer | :: LuaInventory | The temporary inventory that holds the result of mining the entity.
The temporary inventory that holds the result of mining the entity.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_robot_mined_tile

Called after a robot mines tiles.

robot | :: LuaEntity | The robot.
The robot.
tiles | :: array[OldTileAndPosition] | The position data.
The position data.
surface_index | :: uint | The surface the tile(s) were mined on.
The surface the tile(s) were mined on.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_robot_pre_mined

Called before a robot mines an entity.

Can be filtered using LuaPreRobotMinedEntityEventFilter.

robot | :: LuaEntity | The robot that's about to do the mining.
The robot that's about to do the mining.
entity | :: LuaEntity | The entity which is about to be mined.
The entity which is about to be mined.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_rocket_launch_ordered

Called when a rocket silo is ordered to be launched.

rocket | :: LuaEntity |
rocket_silo | :: LuaEntity |
player_index | :: uint? | The player that is riding the rocket, if any.
The player that is riding the rocket, if any.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_rocket_launched

Called when the rocket is launched.

rocket | :: LuaEntity |
rocket_silo | :: LuaEntity? |
player_index | :: uint? | The player that is riding the rocket, if any.
The player that is riding the rocket, if any.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_runtime_mod_setting_changed

Called when a runtime mod setting is changed by a player.

player_index | :: uint? | If the `setting_type` is `"global"` and it was changed through the mod settings GUI, this is the index of the player that changed the global setting. If the `setting_type` is `"runtime-per-user"` and it changed a current setting of the player, this is the index of the player whose setting was changed. In all other cases, this is `nil`.
If the `setting_type` is `"global"` and it was changed through the mod settings GUI, this is the index of the player that changed the global setting. If the `setting_type` is `"runtime-per-user"` and it changed a current setting of the player, this is the index of the player whose setting was changed. In all other cases, this is `nil`.
setting | :: string | The prototype name of the setting that was changed.
The prototype name of the setting that was changed.
setting_type | :: `"runtime-global"` or `"runtime-per-user"` |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_script_inventory_resized

Called just after a script inventory is resized.

player_index | :: uint? | If done by console command; the player who ran the command.
If done by console command; the player who ran the command.
mod | :: string | The mod that did the resizing. This will be `"core"` if done by console command or scenario script.
The mod that did the resizing. This will be `"core"` if done by console command or scenario script.
inventory | :: LuaInventory |
old_size | :: uint | The old inventory size.
The old inventory size.
new_size | :: uint | The new inventory size.
The new inventory size.
overflow_inventory | :: LuaInventory | Any items which didn't fit into the new inventory size.
Any items which didn't fit into the new inventory size.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_script_path_request_finished

Called when a LuaSurface::request_path call completes.

path | :: array[PathfinderWaypoint]? | The actual path that the pathfinder has determined. `nil` if pathfinding failed.
The actual path that the pathfinder has determined. `nil` if pathfinding failed.
id | :: uint | Handle to associate the callback with a particular call to LuaSurface::request_path.
Handle to associate the callback with a particular call to LuaSurface::request_path.
try_again_later | :: boolean | Indicates that the pathfinder failed because it is too busy, and that you can retry later.
Indicates that the pathfinder failed because it is too busy, and that you can retry later.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_script_trigger_effect changed

Called when a script trigger effect is triggered.

effect_id | :: string | The effect_id specified in the trigger effect.
The effect_id specified in the trigger effect.
surface_index | :: uint | The surface the effect happened on.
The surface the effect happened on.
source_position | :: MapPosition? |
source_entity | :: LuaEntity? |
target_position | :: MapPosition? |
target_entity | :: LuaEntity? |
cause_entity | :: LuaEntity? | The entity that originally caused the sequence of triggers
The entity that originally caused the sequence of triggers
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_sector_scanned

Called when an entity of type `radar` finishes scanning a sector.

Can be filtered using LuaSectorScannedEventFilter.

radar | :: LuaEntity | The radar that did the scanning.
The radar that did the scanning.
chunk_position | :: ChunkPosition | The chunk scanned.
The chunk scanned.
area | :: BoundingBox | Area of the scanned chunk.
Area of the scanned chunk.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_segment_entity_created new

Called when an individual segment of a SegmentedUnit is created.

entity | :: LuaEntity |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_selected_entity_changed

Called after the selected entity changes for a given player.

player_index | :: uint | The player whose selected entity changed.
The player whose selected entity changed.
last_entity | :: LuaEntity? | The last selected entity if it still exists and there was one.
The last selected entity if it still exists and there was one.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_space_platform_built_entity new

Called when a space platform builds an entity.

Can be filtered using LuaPlatformBuiltEntityEventFilter.

platform | :: LuaSpacePlatform | The platform that did the building.
The platform that did the building.
entity | :: LuaEntity | The entity built.
The entity built.
stack | :: LuaItemStack | The item used to do the building.
The item used to do the building.
tags | :: Tags? | The tags associated with this entity if any.
The tags associated with this entity if any.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_space_platform_built_tile new

Called after a space platform builds tiles.

platform | :: LuaSpacePlatform | The platform.
The platform.
tiles | :: array[OldTileAndPosition] | The position data.
The position data.
tile | :: LuaTilePrototype | The tile prototype that was placed.
The tile prototype that was placed.
item | :: LuaItemPrototype | The item type used to build the tiles.
The item type used to build the tiles.
quality | :: LuaQualityPrototype | The quality the item used to build the tiles.
The quality the item used to build the tiles.
inventory | :: LuaInventory | The inventory containing the stacks used to build the tiles.
The inventory containing the stacks used to build the tiles.
surface_index | :: uint | The surface the tile(s) are build on.
The surface the tile(s) are build on.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_space_platform_changed_state new

Called when a space platform changes state

platform | :: LuaSpacePlatform |
old_state | :: defines.space_platform_state |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_space_platform_mined_entity new

Called after the results of an entity being mined are collected just before the entity is destroyed.

After this event any items in the buffer will be transferred into the platform as if they came from mining the entity.

The buffer inventory is special in that it's only valid during this event and has a dynamic size expanding as more items are transferred into it.

Can be filtered using LuaPlatformMinedEntityEventFilter.

platform | :: LuaSpacePlatform | The platform doing the mining.
The platform doing the mining.
entity | :: LuaEntity | The entity that has been mined.
The entity that has been mined.
buffer | :: LuaInventory | The temporary inventory that holds the result of mining the entity.
The temporary inventory that holds the result of mining the entity.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_space_platform_mined_item new

Called when a platform mines an entity.

platform | :: LuaSpacePlatform | The platform that did the mining.
The platform that did the mining.
item_stack | :: SimpleItemStack | The entity the platform just picked up.
The entity the platform just picked up.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_space_platform_mined_tile new

Called after a platform mines tiles.

platform | :: LuaSpacePlatform | The platform.
The platform.
tiles | :: array[OldTileAndPosition] | The position data.
The position data.
surface_index | :: uint | The surface the tile(s) were mined on.
The surface the tile(s) were mined on.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_space_platform_pre_mined new

Called before a platform mines an entity.

Can be filtered using LuaPrePlatformMinedEntityEventFilter.

platform | :: LuaSpacePlatform | The platform that's about to do the mining.
The platform that's about to do the mining.
entity | :: LuaEntity | The entity which is about to be mined.
The entity which is about to be mined.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_spider_command_completed

Called when a spider finishes moving to its autopilot position.

vehicle | :: LuaEntity | Spider vehicle which was requested to move.
Spider vehicle which was requested to move.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_string_translated

Called when a translation request generated through LuaPlayer::request_translation or LuaPlayer::request_translations has been completed.

player_index | :: uint | The player whose locale was used for the translation.
The player whose locale was used for the translation.
localised_string | :: LocalisedString | The localised string being translated.
The localised string being translated.
result | :: string | The translated `localised_string`.
The translated `localised_string`.
id | :: uint | The unique id for this translation request.
The unique id for this translation request.
translated | :: boolean | Whether the requested localised string was valid and could be translated.
Whether the requested localised string was valid and could be translated.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_surface_cleared

Called just after a surface is cleared (all entities removed and all chunks deleted).

surface_index | :: uint |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_surface_created

Called when a surface is created.

This is not called when the default surface is created as it will always exist.

surface_index | :: uint |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_surface_deleted

Called after a surface is deleted.

surface_index | :: uint |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_surface_imported

Called after a surface is imported via the map editor.

surface_index | :: uint |
original_name | :: string | The original surface name.
The original surface name.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_surface_renamed

Called when a surface is renamed.

surface_index | :: uint |
old_name | :: string |
new_name | :: string |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_technology_effects_reset

Called when LuaForce::reset_technology_effects is finished.

force | :: LuaForce |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_tick

It is fired once every tick. Since this event is fired every tick, its handler shouldn't include performance heavy code.

name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_train_changed_state

Called when a train changes state (started to stopped and vice versa)

train | :: LuaTrain |
old_state | :: defines.train_state |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_train_created

Called when a new train is created either through disconnecting/connecting an existing one or building a new one.

train | :: LuaTrain |
old_train_id_1 | :: uint? | The first old train id when splitting/merging trains.
The first old train id when splitting/merging trains.
old_train_id_2 | :: uint? | The second old train id when splitting/merging trains.
The second old train id when splitting/merging trains.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_train_schedule_changed

Called when a trains schedule is changed either by the player or through script.

train | :: LuaTrain |
player_index | :: uint? | The player who made the change if any.
The player who made the change if any.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_trigger_created_entity

Called when an entity with a trigger prototype (such as capsules) create an entity AND that trigger prototype defined `trigger_created_entity=true`.

entity | :: LuaEntity |
source | :: LuaEntity? |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_trigger_fired_artillery

Called when an entity with a trigger prototype (such as capsules) fire an artillery projectile AND that trigger prototype defined `trigger_fired_artillery=true`.

entity | :: LuaEntity |
source | :: LuaEntity? |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_undo_applied new

Called when the player triggers "undo".

player_index | :: uint | The player who triggered the undo action.
The player who triggered the undo action.
actions | :: array[UndoRedoAction] | The context of the undo action.
The context of the undo action.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_unit_added_to_group changed

Called when a unit is added to a unit group.

unit | :: LuaEntity |
group | :: LuaCommandable |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_unit_group_created changed

Called when a new unit group is created, before any members are added to it.

group | :: LuaCommandable |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_unit_group_finished_gathering changed

Called when a unit group finishes gathering and starts executing its command.

group | :: LuaCommandable |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_unit_removed_from_group changed

Called when a unit is removed from a unit group.

unit | :: LuaEntity |
group | :: LuaCommandable |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### on_worker_robot_expired

Called when a worker (construction or logistic) robot expires through a lack of energy.

robot | :: LuaEntity |
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### script_raised_built

A static event mods can use to tell other mods they built something by script. This event is only raised if a mod does so with LuaBootstrap::raise_event or LuaBootstrap::raise_script_built, or when `raise_built` is passed to LuaSurface::create_entity.

Can be filtered using LuaScriptRaisedBuiltEventFilter.

entity | :: LuaEntity | The entity that has been built.
The entity that has been built.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### script_raised_destroy

A static event mods can use to tell other mods they destroyed something by script. This event is only raised if a mod does so with LuaBootstrap::raise_event or LuaBootstrap::raise_script_destroy, or when `raise_destroy` is passed to LuaEntity::destroy.

Can be filtered using LuaScriptRaisedDestroyEventFilter.

entity | :: LuaEntity | The entity that was destroyed.
The entity that was destroyed.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### script_raised_revive

A static event mods can use to tell other mods they revived something by script. This event is only raised if a mod does so with LuaBootstrap::raise_event or LuaBootstrap::raise_script_revive, or when `raise_revive` is passed to LuaEntity::revive.

Can be filtered using LuaScriptRaisedReviveEventFilter.

entity | :: LuaEntity | The entity that was revived.
The entity that was revived.
tags | :: Tags? | The tags associated with this entity, if any.
The tags associated with this entity, if any.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### script_raised_set_tiles

A static event mods can use to tell other mods they changed tiles on a surface by script. This event is only raised if a mod does so with LuaBootstrap::raise_event or LuaBootstrap::raise_script_set_tiles, or when `raise_event` is passed to LuaSurface::set_tiles.

surface_index | :: uint | The surface whose tiles were changed.
The surface whose tiles were changed.
tiles | :: array[Tile] | The tiles that were changed.
The tiles that were changed.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.

### script_raised_teleported

A static event mods can use to tell other mods they teleported something by script. This event is only raised if a mod does so with LuaBootstrap::raise_event or LuaBootstrap::raise_script_teleported, or when `raise_teleported` is passed to LuaControl::teleport.

Can be filtered using LuaScriptRaisedTeleportedEventFilter.

entity | :: LuaEntity | The entity that was teleported.
The entity that was teleported.
old_surface_index | :: uint8 | The entity's surface before the teleportation.
The entity's surface before the teleportation.
old_position | :: MapPosition | The entity's position before the teleportation.
The entity's position before the teleportation.
name | :: defines.events | Identifier of the event
Identifier of the event
tick | :: uint | Tick the event was generated.
Tick the event was generated.