All events

Every event contains at least the name and tick attributes. Other events may include some additional attributes, specific to the event.

Contains
name :: defines.events: Identifier of the event
tick :: uint: 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.

on_built_entity

Called when player builds something.

Contains
created_entity :: LuaEntity
player_index :: uint
on_canceled_deconstruction

Called when the deconstruction of an entity is canceled.

Contains
entity :: LuaEntity
on_chunk_generated

Called when a chunk is generated.

Contains
area :: BoundingBox: Area of the chunk
surface :: LuaSurface: The surface the chunk is on
on_entity_died

Called when an entity dies.

Contains
entity :: LuaEntity
on_force_created

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

Contains
force :: LuaForce: The newly created force.
on_forces_merging

Called when two forces are merged using game.merge_forces().

Contains
source :: LuaForce: The force to be destroyed
destination :: LuaForce: The force to reassign entities to.
on_gui_click

Called when LuaGuiElement is clicked.

Contains
element :: LuaGuiElement: The clicked element.
player_index :: uint: The player who did the clicking.
on_marked_for_deconstruction

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

Contains
entity :: LuaEntity
on_picked_up_item

Called when a player picks up an item.

Contains
item_stack :: LuaItemStack
player_index :: uint
on_player_crafted_item

Called when the player crafts an item (upon inserting into player's inventory, not clicking the button to craft). As of 0.11.0, is called for each item crafted as well as what was clicked ("iron-axe" triggers both "iron-stick" with a count of 2 and "iron-axe" with a count of 1, assuming no "iron-sticks" are in the player's inventory)

Contains
item_stack :: LuaItemStack: The crafted item
on_player_created

Called after the player was created.

Contains
player_index :: uint
on_player_driving_changed_state

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

Contains
player_index :: uint
on_player_mined_item

Called when the player mines something.

Contains
item_stack :: LuaItemStack: The item given to the player
player_index :: uint
on_player_rotated_entity

Called when the player rotates an entity (including some non-obvious rotations such as with the stone furnace, but not the solar-panel).

Contains
entity :: LuaEntity: The rotated entity.
player_index :: uint
on_preplayer_mined_item

Called when the player starts mining something.

Contains
entity :: LuaEntity: The entity being mined
player_index :: uint
on_put_item

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

Contains
position :: Position: Where the item was placed.
player_index :: uint: The player who did the placing.
on_research_finished

Called when a research finishes.

Contains
research :: LuaTechnology: The researched technology
on_research_started

Called when a technology research starts.

Contains
research :: LuaTechnology: The technology being researched
on_resource_depleted

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

Contains
entity :: LuaEntity
on_robot_built_entity

Called when a construction robot builds an entity.

Contains
created_entity :: LuaEntity
on_robot_mined

Called when a robot mines an entity.

Contains
item_stack :: LuaItemStack: The entity the robot just picked up.
on_robot_pre_mined

Called before a robot mines an entity.

Contains
entity :: LuaEntity: The entity which is about to be mined.
on_rocket_launched

Called when the rocket is launched.

Contains
rocket :: LuaEntity
on_sector_scanned

Called when the radar finishes scanning a sector.

Contains
radar :: LuaEntity: The radar that did the scanning.
on_train_changed_state

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

Contains
train :: LuaTrain
on_trigger_created_entity

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

Contains
entity :: LuaEntity