typed-factorio
Version:
Featureful typescript definitions for the Factorio modding api.
4,273 lines • 130 kB
TypeScript
// This is an auto-generated file. Do not edit directly!
/** @noSelfInFile */
/**
* @noResolution
*/
declare module "factorio:runtime" {
/**
* Called when a {@link import("factorio:prototype").CustomInputPrototype CustomInputPrototype} is activated.
* @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)
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#CustomInputEvent Online documentation}
*/
interface CustomInputEvent extends EventData {
/**
* The player that activated the custom input.
*/
readonly player_index: PlayerIndex
/**
* The prototype name of the custom input that was activated.
*/
readonly input_name: string
/**
* The mouse cursor position when the custom input was activated.
*/
readonly cursor_position: MapPosition
/**
* The mouse cursor display location when the custom input was activated.
*/
readonly cursor_display_location: GuiLocation
/**
* 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.
*/
readonly selected_prototype?: SelectedPrototypeData
/**
* Identifier of the event
*/
readonly name: defines.events
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a unit/group completes a command.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_ai_command_completed Online documentation}
*/
interface OnAiCommandCompletedEvent extends EventData {
/**
* unit_number/group_number of the unit/group which just completed a command.
*/
readonly unit_number: UnitNumber
readonly result: defines.behavior_result
/**
* Was this command generated by a distraction.
*/
readonly was_distracted: boolean
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_ai_command_completed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when an area of the map is cloned.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_area_cloned Online documentation}
*/
interface OnAreaClonedEvent extends EventData {
readonly source_surface: LuaSurface
readonly source_area: BoundingBox
readonly destination_surface: LuaSurface
readonly destination_area: BoundingBox
readonly destination_force?: LuaForce
readonly clone_tiles: boolean
readonly clone_entities: boolean
readonly clone_decoratives: boolean
readonly clear_destination_entities: boolean
readonly clear_destination_decoratives: boolean
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_area_cloned
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* 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.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_biter_base_built Online documentation}
*/
interface OnBiterBaseBuiltEvent extends EventData {
/**
* The entity that was built.
*/
readonly entity: LuaEntity
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_biter_base_built
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a set of positions on the map is cloned.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_brush_cloned Online documentation}
*/
interface OnBrushClonedEvent extends EventData {
readonly source_offset: TilePosition
readonly destination_offset: TilePosition
readonly source_surface: LuaSurface
readonly source_positions: TilePosition[]
readonly destination_surface: LuaSurface
readonly destination_force?: LuaForce
readonly clone_tiles: boolean
readonly clone_entities: boolean
readonly clone_decoratives: boolean
readonly clear_destination_entities: boolean
readonly clear_destination_decoratives: boolean
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_brush_cloned
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a {@link defines.command.build_base} command reaches its destination, and before building starts.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_build_base_arrived Online documentation}
*/
interface OnBuildBaseArrivedEvent extends EventData {
/**
* The unit the command was assigned to.
*/
readonly unit?: LuaEntity
/**
* The unit group the command was assigned to.
*/
readonly group?: LuaUnitGroup
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_build_base_arrived
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when player builds something.
*
* Event filter: [LuaPlayerBuiltEntityEventFilter](LuaPlayerBuiltEntityEventFilter]
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_built_entity Online documentation}
*/
interface OnBuiltEntityEvent extends EventData {
readonly created_entity: LuaEntity
readonly player_index: PlayerIndex
readonly stack: LuaItemStack
/**
* The item prototype used to build the entity. Note this won't exist in some situations (built from blueprint, undo, etc).
*/
readonly item?: LuaItemPrototype
/**
* The tags associated with this entity if any.
*/
readonly tags?: Tags
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_built_entity
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when the deconstruction of an entity is canceled.
*
* Event filter: [LuaEntityDeconstructionCancelledEventFilter](LuaEntityDeconstructionCancelledEventFilter]
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_cancelled_deconstruction Online documentation}
*/
interface OnCancelledDeconstructionEvent extends EventData {
readonly entity: LuaEntity
readonly player_index?: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_cancelled_deconstruction
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when the upgrade of an entity is canceled.
*
* Event filter: [LuaUpgradeCancelledEventFilter](LuaUpgradeCancelledEventFilter]
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_cancelled_upgrade Online documentation}
*/
interface OnCancelledUpgradeEvent extends EventData {
readonly entity: LuaEntity
readonly player_index?: PlayerIndex
readonly target: LuaEntityPrototype
readonly direction?: defines.direction
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_cancelled_upgrade
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* 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 {@link defines.events.on_pre_player_mined_item} to detect that.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_character_corpse_expired Online documentation}
*/
interface OnCharacterCorpseExpiredEvent extends EventData {
/**
* The corpse.
*/
readonly corpse: LuaEntity
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_character_corpse_expired
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a chart tag is created.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_chart_tag_added Online documentation}
*/
interface OnChartTagAddedEvent extends EventData {
readonly tag: LuaCustomChartTag
readonly force: LuaForce
readonly player_index?: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_chart_tag_added
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a chart tag is modified by a player.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_chart_tag_modified Online documentation}
*/
interface OnChartTagModifiedEvent extends EventData {
readonly tag: LuaCustomChartTag
readonly player_index?: PlayerIndex
readonly force: LuaForce
readonly old_text: string
readonly old_icon?: SignalID
readonly old_player?: uint
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_chart_tag_modified
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called just before a chart tag is deleted.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_chart_tag_removed Online documentation}
*/
interface OnChartTagRemovedEvent extends EventData {
readonly tag: LuaCustomChartTag
readonly force: LuaForce
readonly player_index?: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_chart_tag_removed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a chunk is charted or re-charted.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_chunk_charted Online documentation}
*/
interface OnChunkChartedEvent extends EventData {
readonly surface_index: SurfaceIndex
readonly position: ChunkPosition
/**
* Area of the chunk.
*/
readonly area: BoundingBox
readonly force: LuaForce
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_chunk_charted
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when one or more chunks are deleted using {@link LuaSurface#delete_chunk LuaSurface::delete_chunk}.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_chunk_deleted Online documentation}
*/
interface OnChunkDeletedEvent extends EventData {
readonly surface_index: SurfaceIndex
/**
* The chunks deleted.
*/
readonly positions: ChunkPosition[]
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_chunk_deleted
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a chunk is generated.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_chunk_generated Online documentation}
*/
interface OnChunkGeneratedEvent extends EventData {
/**
* Area of the chunk.
*/
readonly area: BoundingBox
/**
* Position of the chunk.
*/
readonly position: ChunkPosition
/**
* The surface the chunk is on.
*/
readonly surface: LuaSurface
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_chunk_generated
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a combat robot expires through a lack of energy, or timeout.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_combat_robot_expired Online documentation}
*/
interface OnCombatRobotExpiredEvent extends EventData {
readonly robot: LuaEntity
/**
* The entity that owns the robot if any.
*/
readonly owner?: LuaEntity
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_combat_robot_expired
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* 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`).
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_console_chat Online documentation}
*/
interface OnConsoleChatEvent extends EventData {
/**
* The player doing the chatting, if any.
*/
readonly player_index?: PlayerIndex
/**
* The chat message that was sent.
*/
readonly message: string
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_console_chat
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when someone enters a command-like message regardless of it being a valid command.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_console_command Online documentation}
*/
interface OnConsoleCommandEvent extends EventData {
/**
* The player if any.
*/
readonly player_index?: PlayerIndex
/**
* The command as typed without the preceding forward slash ('/').
*/
readonly command: string
/**
* The parameters provided if any.
*/
readonly parameters: string
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_console_command
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a cutscene is cancelled by the player or by script.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_cutscene_cancelled Online documentation}
*/
interface OnCutsceneCancelledEvent extends EventData {
/**
* The player the cutscene was shown to.
*/
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_cutscene_cancelled
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a cutscene finishes naturally (was not cancelled).
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_cutscene_finished Online documentation}
*/
interface OnCutsceneFinishedEvent extends EventData {
/**
* The player the cutscene was shown to.
*/
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_cutscene_finished
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a cutscene starts.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_cutscene_started Online documentation}
*/
interface OnCutsceneStartedEvent extends EventData {
/**
* The player the cutscene is being shown to.
*/
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_cutscene_started
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* 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.
*
* Due to implementation omission, `waypoint_index` is 0-based.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_cutscene_waypoint_reached Online documentation}
*/
interface OnCutsceneWaypointReachedEvent extends EventData {
/**
* The player index of the player viewing the cutscene.
*/
readonly player_index: PlayerIndex
/**
* The index of the waypoint we just completed.
*/
readonly waypoint_index: uint
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_cutscene_waypoint_reached
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when the map difficulty settings are changed.
*
* It's not guaranteed that both settings are changed - just that at least one has been changed.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_difficulty_settings_changed Online documentation}
*/
interface OnDifficultySettingsChangedEvent extends EventData {
readonly old_recipe_difficulty: uint
readonly old_technology_difficulty: uint
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_difficulty_settings_changed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when an entity is cloned. The filter applies to the source entity.
*
* Event filter: [LuaEntityClonedEventFilter](LuaEntityClonedEventFilter]
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_entity_cloned Online documentation}
*/
interface OnEntityClonedEvent extends EventData {
readonly source: LuaEntity
readonly destination: LuaEntity
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_entity_cloned
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called after an entity has been recolored either by the player or through script.
*
* Automatic recoloring due to {@link LuaPlayer#color LuaPlayer::color} will not raise events, as that is a separate mechanism.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_entity_color_changed Online documentation}
*/
interface OnEntityColorChangedEvent extends EventData {
/**
* The entity that was recolored.
*/
readonly entity: LuaEntity
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_entity_color_changed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when an entity is damaged. This is not called when an entities health is set directly by another mod.
*
* Event filter: [LuaEntityDamagedEventFilter](LuaEntityDamagedEventFilter]
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_entity_damaged Online documentation}
*/
interface OnEntityDamagedEvent extends EventData {
readonly entity: LuaEntity
readonly damage_type: LuaDamagePrototype
/**
* The damage amount before resistances.
*/
readonly original_damage_amount: float
/**
* The damage amount after resistances.
*/
readonly final_damage_amount: float
/**
* The health of the entity after the damage was applied.
*/
readonly final_health: float
/**
* The entity that did the attacking if available.
*/
readonly cause?: LuaEntity
/**
* The force that did the attacking if any.
*/
readonly force?: LuaForce
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_entity_damaged
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called after an entity is destroyed that has been registered with {@link LuaBootstrap#register_on_entity_destroyed LuaBootstrap::register_on_entity_destroyed}.
*
* Depending on when a given entity is destroyed, this event will be fired at the end of the current tick or at the end of the next tick.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_entity_destroyed Online documentation}
*/
interface OnEntityDestroyedEvent extends EventData {
/**
* The number returned by {@link LuaBootstrap#register_on_entity_destroyed register_on_entity_destroyed} to uniquely identify this entity during this event.
*/
readonly registration_number: RegistrationNumber
/**
* The {@link LuaEntity#unit_number LuaEntity::unit_number} of the destroyed entity, if it had one.
*/
readonly unit_number?: UnitNumber
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_entity_destroyed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when an entity dies.
*
* Event filter: [LuaEntityDiedEventFilter](LuaEntityDiedEventFilter]
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_entity_died Online documentation}
*/
interface OnEntityDiedEvent extends EventData {
/**
* The entity that died.
*/
readonly entity: LuaEntity
/**
* The entity that did the killing if available.
*/
readonly cause?: LuaEntity
/**
* The loot generated by this entity if any.
*/
readonly loot: LuaInventory
/**
* The force that did the killing if any.
*/
readonly force?: LuaForce
/**
* The damage type if any.
*/
readonly damage_type?: LuaDamagePrototype
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_entity_died
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when one of an entity's personal logistic slots changes.
*
* "Personal logistic slot" refers to a character or vehicle's personal request / auto-trash slots, not the request slots on logistic chests.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_entity_logistic_slot_changed Online documentation}
*/
interface OnEntityLogisticSlotChangedEvent extends EventData {
/**
* The player who changed the slot, or `nil` if changed by script.
*/
readonly player_index?: PlayerIndex
/**
* The entity for whom a logistic slot was changed.
*/
readonly entity: LuaEntity
/**
* The slot index that was changed.
*/
readonly slot_index: uint
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_entity_logistic_slot_changed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called after an entity has been renamed either by the player or through script.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_entity_renamed Online documentation}
*/
interface OnEntityRenamedEvent extends EventData {
/**
* If by_script is true this will not be included.
*/
readonly player_index?: PlayerIndex
readonly by_script: boolean
readonly entity: LuaEntity
readonly old_name: string
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_entity_renamed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called after entity copy-paste is done.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_entity_settings_pasted Online documentation}
*/
interface OnEntitySettingsPastedEvent extends EventData {
readonly player_index: PlayerIndex
/**
* The source entity settings were copied from.
*/
readonly source: LuaEntity
/**
* The destination entity settings were copied to.
*/
readonly destination: LuaEntity
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_entity_settings_pasted
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when an entity is spawned by a EnemySpawner
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_entity_spawned Online documentation}
*/
interface OnEntitySpawnedEvent extends EventData {
readonly spawner: LuaEntity
readonly entity: LuaEntity
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_entity_spawned
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called after equipment is inserted into an equipment grid.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_equipment_inserted Online documentation}
*/
interface OnEquipmentInsertedEvent extends EventData {
/**
* The equipment grid inserted into.
*/
readonly grid: LuaEquipmentGrid
/**
* The equipment inserted.
*/
readonly equipment: LuaEquipment
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_equipment_inserted
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called after equipment is removed from an equipment grid.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_equipment_removed Online documentation}
*/
interface OnEquipmentRemovedEvent extends EventData {
/**
* The equipment grid removed from.
*/
readonly grid: LuaEquipmentGrid
/**
* The equipment removed.
*/
readonly equipment: string
/**
* The count of equipment removed.
*/
readonly count: uint
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_equipment_removed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when the a forces cease fire values change.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_force_cease_fire_changed Online documentation}
*/
interface OnForceCeaseFireChangedEvent extends EventData {
/**
* The force who's cease fire changed.
*/
readonly force: LuaForce
/**
* Which force was added or removed.
*/
readonly other_force: LuaForce
/**
* If the other force was added or removed.
*/
readonly added: boolean
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_force_cease_fire_changed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* 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.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_force_created Online documentation}
*/
interface OnForceCreatedEvent extends EventData {
/**
* The newly created force.
*/
readonly force: LuaForce
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_force_created
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when the a forces friends change.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_force_friends_changed Online documentation}
*/
interface OnForceFriendsChangedEvent extends EventData {
/**
* The force who's friends changed.
*/
readonly force: LuaForce
/**
* Which force was added or removed.
*/
readonly other_force: LuaForce
/**
* If the other force was added or removed.
*/
readonly added: boolean
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_force_friends_changed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when {@link LuaForce#reset LuaForce::reset} is finished.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_force_reset Online documentation}
*/
interface OnForceResetEvent extends EventData {
readonly force: LuaForce
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_force_reset
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* 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.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_forces_merged Online documentation}
*/
interface OnForcesMergedEvent extends EventData {
/**
* The force destroyed.
*/
readonly source_name: string
/**
* The index of the destroyed force.
*/
readonly source_index: uint
/**
* The force entities where reassigned to.
*/
readonly destination: LuaForce
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_forces_merged
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when two forces are about to be merged using `game.merge_forces()`.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_forces_merging Online documentation}
*/
interface OnForcesMergingEvent extends EventData {
/**
* The force to be destroyed
*/
readonly source: LuaForce
/**
* The force to reassign entities to.
*/
readonly destination: LuaForce
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_forces_merging
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* 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, {@link LuaBootstrap#on_init LuaBootstrap::on_init} is not fired.
*
* This event is not fired when the scenario is loaded via the map editor.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_game_created_from_scenario Online documentation}
*/
interface OnGameCreatedFromScenarioEvent extends EventData {
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_game_created_from_scenario
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when {@link LuaGuiElement} checked state is changed (related to checkboxes and radio buttons).
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_gui_checked_state_changed Online documentation}
*/
interface OnGuiCheckedStateChangedEvent extends EventData {
/**
* The element whose checked state changed.
*/
readonly element: LuaGuiElement
/**
* The player who did the change.
*/
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_gui_checked_state_changed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when {@link LuaGuiElement} is clicked.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_gui_click Online documentation}
*/
interface OnGuiClickEvent extends EventData {
/**
* The clicked element.
*/
readonly element: LuaGuiElement
/**
* The player who did the clicking.
*/
readonly player_index: PlayerIndex
/**
* The mouse button used if any.
*/
readonly button: defines.mouse_button_type
/**
* The display location of the player's cursor.
*/
readonly cursor_display_location: GuiLocation
/**
* If alt was pressed.
*/
readonly alt: boolean
/**
* If control was pressed.
*/
readonly control: boolean
/**
* If shift was pressed.
*/
readonly shift: boolean
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_gui_click
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* 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.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_gui_closed Online documentation}
*/
interface OnGuiClosedEvent extends EventData {
/**
* The player.
*/
readonly player_index: PlayerIndex
/**
* The GUI type that was open.
*/
readonly gui_type: defines.gui_type
/**
* The entity that was open
*/
readonly entity?: LuaEntity
/**
* The item that was open
*/
readonly item?: LuaItemStack
/**
* The equipment that was open
*/
readonly equipment?: LuaEquipment
/**
* The other player that was open
*/
readonly other_player?: LuaPlayer
/**
* The custom GUI element that was open
*/
readonly element?: LuaGuiElement
/**
* The technology that was automatically selected when opening the research GUI
*/
readonly technology?: LuaTechnology
/**
* The tile position that was open
*/
readonly tile_position?: TilePosition
/**
* The script inventory that was open
*/
readonly inventory?: LuaInventory
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_gui_closed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a {@link LuaGuiElement} is confirmed, for example by pressing Enter in a textfield.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_gui_confirmed Online documentation}
*/
interface OnGuiConfirmedEvent extends EventData {
/**
* The confirmed element.
*/
readonly element: LuaGuiElement
/**
* The player who did the confirming.
*/
readonly player_index: PlayerIndex
/**
* If alt was pressed.
*/
readonly alt: boolean
/**
* If control was pressed.
*/
readonly control: boolean
/**
* If shift was pressed.
*/
readonly shift: boolean
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_gui_confirmed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when {@link LuaGuiElement} element value is changed (related to choose element buttons).
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_gui_elem_changed Online documentation}
*/
interface OnGuiElemChangedEvent extends EventData {
/**
* The element whose element value changed.
*/
readonly element: LuaGuiElement
/**
* The player who did the change.
*/
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_gui_elem_changed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when {@link LuaGuiElement} is hovered by the mouse.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_gui_hover Online documentation}
*/
interface OnGuiHoverEvent extends EventData {
/**
* The element that is being hovered over.
*/
readonly element: LuaGuiElement
/**
* The player whose cursor is hovering.
*/
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_gui_hover
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when the player's cursor leaves a {@link LuaGuiElement} that was previously hovered.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_gui_leave Online documentation}
*/
interface OnGuiLeaveEvent extends EventData {
/**
* The element that was being hovered.
*/
readonly element: LuaGuiElement
/**
* The player whose cursor was hovering.
*/
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_gui_leave
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when {@link LuaGuiElement} element location is changed (related to frames in `player.gui.screen`).
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_gui_location_changed Online documentation}
*/
interface OnGuiLocationChangedEvent extends EventData {
/**
* The element whose location changed.
*/
readonly element: LuaGuiElement
/**
* The player who did the change.
*/
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_gui_location_changed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when the player opens a GUI.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_gui_opened Online documentation}
*/
interface OnGuiOpenedEvent extends EventData {
/**
* The player.
*/
readonly player_index: PlayerIndex
/**
* The GUI type that was opened.
*/
readonly gui_type: defines.gui_type
/**
* The entity that was opened
*/
readonly entity?: LuaEntity
/**
* The item that was opened
*/
readonly item?: LuaItemStack
/**
* The equipment that was opened
*/
readonly equipment?: LuaEquipment
/**
* The other player that was opened
*/
readonly other_player?: LuaPlayer
/**
* The custom GUI element that was opened
*/
readonly element?: LuaGuiElement
/**
* The script inventory that was opened
*/
readonly inventory?: LuaInventory
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_gui_opened
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when {@link LuaGuiElement} selected tab is changed (related to tabbed-panes).
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_gui_selected_tab_changed Online documentation}
*/
interface OnGuiSelectedTabChangedEvent extends EventData {
/**
* The tabbed pane whose selected tab changed.
*/
readonly element: LuaGuiElement
/**
* The player who did the change.
*/
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_gui_selected_tab_changed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when {@link LuaGuiElement} selection state is changed (related to drop-downs and listboxes).
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_gui_selection_state_changed Online documentation}
*/
interface OnGuiSelectionStateChangedEvent extends EventData {
/**
* The element whose selection state changed.
*/
readonly element: LuaGuiElement
/**
* The player who did the change.
*/
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_gui_selection_state_changed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when {@link LuaGuiElement} switch state is changed (related to switches).
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_gui_switch_state_changed Online documentation}
*/
interface OnGuiSwitchStateChangedEvent extends EventData {
/**
* The switch whose switch state changed.
*/
readonly element: LuaGuiElement
/**
* The player who did the change.
*/
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_gui_switch_state_changed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when {@link LuaGuiElement} text is changed by the player.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_gui_text_changed Online documentation}
*/
interface OnGuiTextChangedEvent extends EventData {
/**
* The edited element.
*/
readonly element: LuaGuiElement
/**
* The player who did the edit.
*/
readonly player_index: PlayerIndex
/**
* The new text in the element.
*/
readonly text: string
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_gui_text_changed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when {@link LuaGuiElement} slider value is changed (related to the slider element).
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_gui_value_changed Online documentation}
*/
interface OnGuiValueChangedEvent extends EventData {
/**
* The element whose value changed.
*/
readonly element: LuaGuiElement
/**
* The player who did the change.
*/
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_gui_value_changed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a land mine is armed.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_land_mine_armed Online documentation}
*/
interface OnLandMineArmedEvent extends EventData {
readonly mine: LuaEntity
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_land_mine_armed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a custom {@link import("factorio:prototype").ShortcutPrototype Lua shortcut} is pressed.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_lua_shortcut Online documentation}
*/
interface OnLuaShortcutEvent extends EventData {
readonly player_index: PlayerIndex
/**
* Shortcut prototype name of the shortcut that was clicked.
*/
readonly prototype_name: string
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_lua_shortcut
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when an entity is marked for deconstruction with the Deconstruction planner or via script.
*
* Event filter: [LuaEntityMarkedForDeconstructionEventFilter](LuaEntityMarkedForDeconstructionEventFilter]
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_marked_for_deconstruction Online documentation}
*/
interface OnMarkedForDeconstructionEvent extends EventData {
readonly entity: LuaEntity
readonly player_index?: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_marked_for_deconstruction
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when an entity is marked for upgrade with the Upgrade planner or via script.
*
* Event filter: [LuaEntityMarkedForUpgradeEventFilter](LuaEntityMarkedForUpgradeEventFilter]
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_marked_for_upgrade Online documentation}
*/
interface OnMarkedForUpgradeEvent extends EventData {
readonly entity: LuaEntity
readonly target: LuaEntityPrototype
readonly player_index?: PlayerIndex
/**
* The new direction (if any)
*/
readonly direction?: defines.direction
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_marked_for_upgrade
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called after a player purchases some offer from a `market` entity.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_market_item_purchased Online documentation}
*/
interface OnMarketItemPurchasedEvent extends EventData {
/**
* The player who did the purchasing.
*/
readonly player_index: PlayerIndex
/**
* The market entity.
*/
readonly market: LuaEntity
/**
* The index of the offer purchased.
*/
readonly offer_index: uint
/**
* The amount of offers purchased.
*/
readonly count: uint
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_market_item_purchased
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when the player uses the 'Open item GUI' control on an item defined with the 'mod-openable' flag
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_mod_item_opened Online documentation}
*/
interface OnModItemOpenedEvent extends EventData {
/**
* The player.
*/
readonly player_index: PlayerIndex
/**
* The item clicked on.
*/
readonly item: LuaItemPrototype
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_mod_item_opened
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called directly after a permission group is added.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_permission_group_added Online documentation}
*/
interface OnPermissionGroupAddedEvent extends EventData {
/**
* The player that added the group.
*/
readonly player_index: PlayerIndex
/**
* The group added.
*/
readonly group: LuaPermissionGroup
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_permission_group_added
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called directly after a permission group is deleted.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_permission_group_deleted Online documentation}
*/
interface OnPermissionGroupDeletedEvent extends EventData {
/**
* The player doing the deletion.
*/
readonly player_index: PlayerIndex
/**
* The group that was deleted.
*/
readonly group_name: string
/**
* The group id that was deleted.
*/
readonly id: uint
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_permission_group_deleted
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called directly after a permission group is edited in some way.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_permission_group_edited Online documentation}
*/
interface OnPermissionGroupEditedEvent extends EventData {
/**
* The player that did the editing.
*/
readonly player_index: PlayerIndex
/**
* The group being edited.
*/
readonly group: LuaPermissionGroup
/**
* The edit type.
*/
readonly type:
| "add-permission"
| "remove-permission"
| "enable-all"
| "disable-all"
| "add-player"
| "remove-player"
| "rename"
/**
* The action when the `type` is `"add-permission"` or `"remove-permission"`.
*/
readonly action: defines.input_action
/**
* The other player when the `type` is `"add-player"` or `"remove-player"`.
*/
readonly other_player_index: uint
/**
* The old group name when the `type` is `"rename"`.
*/
readonly old_name: string
/**
* The new group name when the `type` is `"rename"`.
*/
readonly new_name: string
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_permission_group_edited
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called directly after a permission string is imported.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_permission_string_imported Online documentation}
*/
interface OnPermissionStringImportedEvent extends EventData {
/**
* The player that imported the string.
*/
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_permission_string_imported
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a player picks up an item.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_picked_up_item Online documentation}
*/
interface OnPickedUpItemEvent extends EventData {
readonly item_stack: SimpleItemStack
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_picked_up_item
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called after a player alt-reverse-selects an area with a selection-tool item.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_alt_reverse_selected_area Online documentation}
*/
interface OnPlayerAltReverseSelectedAreaEvent extends EventData {
/**
* The player doing the selection.
*/
readonly player_index: PlayerIndex
/**
* The surface selected.
*/
readonly surface: LuaSurface
/**
* The area selected.
*/
readonly area: BoundingBox
/**
* The item used to select the area.
*/
readonly item: string
/**
* The entities selected.
*/
readonly entities: LuaEntity[]
/**
* The tiles selected.
*/
readonly tiles: LuaTile[]
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_alt_reverse_selected_area
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called after a player alt-selects an area with a selection-tool item.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_alt_selected_area Online documentation}
*/
interface OnPlayerAltSelectedAreaEvent extends EventData {
/**
* The player doing the selection.
*/
readonly player_index: PlayerIndex
/**
* The surface selected.
*/
readonly surface: LuaSurface
/**
* The area selected.
*/
readonly area: BoundingBox
/**
* The item used to select the area.
*/
readonly item: string
/**
* The entities selected.
*/
readonly entities: LuaEntity[]
/**
* The tiles selected.
*/
readonly tiles: LuaTile[]
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_alt_selected_area
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called after a players ammo inventory changed in some way.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_ammo_inventory_changed Online documentation}
*/
interface OnPlayerAmmoInventoryChangedEvent extends EventData {
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_ammo_inventory_changed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called after a players armor inventory changed in some way.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_armor_inventory_changed Online documentation}
*/
interface OnPlayerArmorInventoryChangedEvent extends EventData {
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_armor_inventory_changed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a player is banned.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_banned Online documentation}
*/
interface OnPlayerBannedEvent extends EventData {
/**
* The player banned.
*/
readonly player_index?: PlayerIndex
/**
* The banned player name.
*/
readonly player_name: string
/**
* The player that did the banning if any.
*/
readonly by_player?: PlayerIndex
/**
* The reason given if any.
*/
readonly reason?: string
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_banned
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called after a player builds tiles.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_built_tile Online documentation}
*/
interface OnPlayerBuiltTileEvent extends EventData {
readonly player_index: PlayerIndex
/**
* The surface the tile(s) were built on.
*/
readonly surface_index: SurfaceIndex
/**
* The position data.
*/
readonly tiles: OldTileAndPosition[]
/**
* The tile prototype that was placed.
*/
readonly tile: LuaTilePrototype
/**
* The item type used to build the tiles
*/
readonly item?: LuaItemPrototype
/**
* The stack used to build the tiles (may be empty if all of the items were used to build the tiles).
*/
readonly stack?: LuaItemStack
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_built_tile
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a player cancels crafting.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_cancelled_crafting Online documentation}
*/
interface OnPlayerCancelledCraftingEvent extends EventData {
/**
* The player that did the crafting.
*/
readonly player_index: PlayerIndex
/**
* The crafting items returned to the player's inventory.
*/
readonly items: LuaInventory
/**
* The recipe that has been cancelled.
*/
readonly recipe: LuaRecipe
/**
* The number of crafts that have been cancelled.
*/
readonly cancel_count: uint
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_cancelled_crafting
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called after a player changes forces.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_changed_force Online documentation}
*/
interface OnPlayerChangedForceEvent extends EventData {
/**
* The player who changed forces.
*/
readonly player_index: PlayerIndex
/**
* The old force.
*/
readonly force: LuaForce
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_changed_force
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when the tile position a player is located at changes.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_changed_position Online documentation}
*/
interface OnPlayerChangedPositionEvent extends EventData {
/**
* The player.
*/
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_changed_position
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called after a player changes surfaces.
*
* In the instance a player is moved off a surface due to it being deleted this is not called.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_changed_surface Online documentation}
*/
interface OnPlayerChangedSurfaceEvent extends EventData {
/**
* The player who changed surfaces.
*/
readonly player_index: PlayerIndex
/**
* The surface index the player was on.
*/
readonly surface_index: SurfaceIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_changed_surface
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when cheat mode is disabled on a player.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_cheat_mode_disabled Online documentation}
*/
interface OnPlayerCheatModeDisabledEvent extends EventData {
/**
* The player.
*/
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_cheat_mode_disabled
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when cheat mode is enabled on a player.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_cheat_mode_enabled Online documentation}
*/
interface OnPlayerCheatModeEnabledEvent extends EventData {
/**
* The player.
*/
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_cheat_mode_enabled
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a player clicks a gps tag
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_clicked_gps_tag Online documentation}
*/
interface OnPlayerClickedGpsTagEvent extends EventData {
/**
* Index of the player
*/
readonly player_index: PlayerIndex
/**
* Map position contained in gps tag
*/
readonly position: MapPosition
/**
* Surface name contained in gps tag, even when such surface does not exists
*/
readonly surface: string
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_clicked_gps_tag
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a player clicks the "confirm" button in the configure Blueprint GUI.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_configured_blueprint Online documentation}
*/
interface OnPlayerConfiguredBlueprintEvent extends EventData {
/**
* The player.
*/
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_configured_blueprint
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a player configures spidertron remote to be connected with a given spidertron
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_configured_spider_remote Online documentation}
*/
interface OnPlayerConfiguredSpiderRemoteEvent extends EventData {
/**
* The player that configured the remote.
*/
readonly player_index: PlayerIndex
/**
* Spider vehicle to which remote was connected to.
*/
readonly vehicle: LuaEntity
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_configured_spider_remote
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* 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 {@link OnPrePlayerCraftedItemEvent on_pre_player_crafted_item}).
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_crafted_item Online documentation}
*/
interface OnPlayerCraftedItemEvent extends EventData {
/**
* The item that has been crafted.
*/
readonly item_stack: LuaItemStack
/**
* The player doing the crafting.
*/
readonly player_index: PlayerIndex
/**
* The recipe used to craft this item.
*/
readonly recipe: LuaRecipe
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_crafted_item
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called after the player was created.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_created Online documentation}
*/
interface OnPlayerCreatedEvent extends EventData {
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_created
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called after a player's {@link LuaControl#cursor_stack cursor stack} changed in some way.
*
* This is fired in the same tick that the change happens, but not instantly.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_cursor_stack_changed Online documentation}
*/
interface OnPlayerCursorStackChangedEvent extends EventData {
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_cursor_stack_changed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a player selects an area with a deconstruction planner.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_deconstructed_area Online documentation}
*/
interface OnPlayerDeconstructedAreaEvent extends EventData {
/**
* The player doing the selection.
*/
readonly player_index: PlayerIndex
/**
* The surface selected.
*/
readonly surface: LuaSurface
/**
* The area selected.
*/
readonly area: BoundingBox
/**
* The item used to select the area.
*/
readonly item: string
/**
* If normal selection or alt selection was used.
*/
readonly alt: boolean
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_deconstructed_area
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a player is demoted.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_demoted Online documentation}
*/
interface OnPlayerDemotedEvent extends EventData {
/**
* The player.
*/
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_demoted
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called after a player dies.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_died Online documentation}
*/
interface OnPlayerDiedEvent extends EventData {
readonly player_index: PlayerIndex
readonly cause?: LuaEntity
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_died
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when the display resolution changes for a given player.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_display_resolution_changed Online documentation}
*/
interface OnPlayerDisplayResolutionChangedEvent extends EventData {
/**
* The player
*/
readonly player_index: PlayerIndex
/**
* The old display resolution
*/
readonly old_resolution: DisplayResolution
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_display_resolution_changed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when the display scale changes for a given player.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_display_scale_changed Online documentation}
*/
interface OnPlayerDisplayScaleChangedEvent extends EventData {
/**
* The player
*/
readonly player_index: PlayerIndex
/**
* The old display scale
*/
readonly old_scale: double
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_display_scale_changed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* 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.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_driving_changed_state Online documentation}
*/
interface OnPlayerDrivingChangedStateEvent extends EventData {
readonly player_index: PlayerIndex
/**
* The vehicle if any.
*/
readonly entity?: LuaEntity
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_driving_changed_state
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a player drops an item on the ground.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_dropped_item Online documentation}
*/
interface OnPlayerDroppedItemEvent extends EventData {
readonly player_index: PlayerIndex
/**
* The item-on-ground entity.
*/
readonly entity: LuaEntity
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_dropped_item
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a player fast-transfers something to or from an entity.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_fast_transferred Online documentation}
*/
interface OnPlayerFastTransferredEvent extends EventData {
/**
* The player transferred from or to.
*/
readonly player_index: PlayerIndex
/**
* The entity transferred from or to.
*/
readonly entity: LuaEntity
/**
* Whether the transfer was from player to entity. If `false`, the transfer was from entity to player.
*/
readonly from_player: boolean
/**
* Whether the transfer was a split action (half stack).
*/
readonly is_split: boolean
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_fast_transferred
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called after player flushed fluid
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_flushed_fluid Online documentation}
*/
interface OnPlayerFlushedFluidEvent extends EventData {
/**
* Index of the player
*/
readonly player_index: PlayerIndex
/**
* Name of a fluid that was flushed
*/
readonly fluid: string
/**
* Amount of fluid that was removed
*/
readonly amount: double
/**
* Entity from which flush was performed
*/
readonly entity: LuaEntity
/**
* True if flush was requested only on this entity
*/
readonly only_this_entity: boolean
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_flushed_fluid
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called after a players gun inventory changed in some way.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_gun_inventory_changed Online documentation}
*/
interface OnPlayerGunInventoryChangedEvent extends EventData {
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_gun_inventory_changed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a player's input method changes. See {@link LuaPlayer#input_method LuaPlayer::input_method}.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_input_method_changed Online documentation}
*/
interface OnPlayerInputMethodChangedEvent extends EventData {
/**
* The player whose input method changed.
*/
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_input_method_changed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* 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.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_joined_game Online documentation}
*/
interface OnPlayerJoinedGameEvent extends EventData {
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_joined_game
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a player is kicked.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_kicked Online documentation}
*/
interface OnPlayerKickedEvent extends EventData {
/**
* The player kicked.
*/
readonly player_index: PlayerIndex
/**
* The player that did the kicking if any.
*/
readonly by_player?: PlayerIndex
/**
* The reason given if any.
*/
readonly reason?: string
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_kicked
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* 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.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_left_game Online documentation}
*/
interface OnPlayerLeftGameEvent extends EventData {
readonly player_index: PlayerIndex
readonly reason: defines.disconnect_reason
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_left_game
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called after a players main inventory changed in some way.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_main_inventory_changed Online documentation}
*/
interface OnPlayerMainInventoryChangedEvent extends EventData {
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_main_inventory_changed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* 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.
*
* Event filter: [LuaPlayerMinedEntityEventFilter](LuaPlayerMinedEntityEventFilter]
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_mined_entity Online documentation}
*/
interface OnPlayerMinedEntityEvent extends EventData {
/**
* The index of the player doing the mining.
*/
readonly player_index: PlayerIndex
/**
* The entity that has been mined.
*/
readonly entity: LuaEntity
/**
* The temporary inventory that holds the result of mining the entity.
*/
readonly buffer: LuaInventory
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_mined_entity
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when the player mines something.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_mined_item Online documentation}
*/
interface OnPlayerMinedItemEvent extends EventData {
/**
* The item given to the player
*/
readonly item_stack: SimpleItemStack
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_mined_item
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called after a player mines tiles.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_mined_tile Online documentation}
*/
interface OnPlayerMinedTileEvent extends EventData {
readonly player_index: PlayerIndex
/**
* The surface the tile(s) were mined from.
*/
readonly surface_index: SurfaceIndex
/**
* The position data.
*/
readonly tiles: OldTileAndPosition[]
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_mined_tile
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a player is muted.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_muted Online documentation}
*/
interface OnPlayerMutedEvent extends EventData {
/**
* The player.
*/
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_muted
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a player invokes the "smart pipette" over an entity.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_pipette Online documentation}
*/
interface OnPlayerPipetteEvent extends EventData {
/**
* The player
*/
readonly player_index: PlayerIndex
/**
* The item put in the cursor
*/
readonly item: LuaItemPrototype
/**
* If cheat mode was used to give a free stack of the item.
*/
readonly used_cheat_mode: boolean
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_pipette
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called after the player puts equipment in an equipment grid
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_placed_equipment Online documentation}
*/
interface OnPlayerPlacedEquipmentEvent extends EventData {
readonly player_index: PlayerIndex
/**
* The equipment put in the equipment grid.
*/
readonly equipment: LuaEquipment
/**
* The equipment grid the equipment was put in.
*/
readonly grid: LuaEquipmentGrid
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_placed_equipment
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a player is promoted.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_promoted Online documentation}
*/
interface OnPlayerPromotedEvent extends EventData {
/**
* The player.
*/
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_promoted
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a player is removed (deleted) from the game. This is markedly different from a player temporarily {@link OnPlayerLeftGameEvent leaving} the game, and instead behaves like the player never existed in the save file.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_removed Online documentation}
*/
interface OnPlayerRemovedEvent extends EventData {
/**
* The index of the removed player.
*/
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_removed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called after the player removes equipment from an equipment grid
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_removed_equipment Online documentation}
*/
interface OnPlayerRemovedEquipmentEvent extends EventData {
readonly player_index: PlayerIndex
/**
* The equipment grid removed from.
*/
readonly grid: LuaEquipmentGrid
/**
* The equipment removed.
*/
readonly equipment: string
/**
* The count of equipment removed.
*/
readonly count: uint
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_removed_equipment
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a player repairs an entity.
*
* Event filter: [LuaPlayerRepairedEntityEventFilter](LuaPlayerRepairedEntityEventFilter]
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_repaired_entity Online documentation}
*/
interface OnPlayerRepairedEntityEvent extends EventData {
readonly player_index: PlayerIndex
readonly entity: LuaEntity
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_repaired_entity
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called after a player respawns.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_respawned Online documentation}
*/
interface OnPlayerRespawnedEvent extends EventData {
readonly player_index: PlayerIndex
/**
* The player port used to respawn if one was used.
*/
readonly player_port?: LuaEntity
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_respawned
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called after a player reverse-selects an area with a selection-tool item.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_reverse_selected_area Online documentation}
*/
interface OnPlayerReverseSelectedAreaEvent extends EventData {
/**
* The player doing the selection.
*/
readonly player_index: PlayerIndex
/**
* The surface selected.
*/
readonly surface: LuaSurface
/**
* The area selected.
*/
readonly area: BoundingBox
/**
* The item used to select the area.
*/
readonly item: string
/**
* The entities selected.
*/
readonly entities: LuaEntity[]
/**
* The tiles selected.
*/
readonly tiles: LuaTile[]
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_reverse_selected_area
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* 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.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_rotated_entity Online documentation}
*/
interface OnPlayerRotatedEntityEvent extends EventData {
/**
* The rotated entity.
*/
readonly entity: LuaEntity
/**
* The previous direction
*/
readonly previous_direction: defines.direction
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_rotated_entity
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called after a player selects an area with a selection-tool item.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_selected_area Online documentation}
*/
interface OnPlayerSelectedAreaEvent extends EventData {
/**
* The player doing the selection.
*/
readonly player_index: PlayerIndex
/**
* The surface selected.
*/
readonly surface: LuaSurface
/**
* The area selected.
*/
readonly area: BoundingBox
/**
* The item used to select the area.
*/
readonly item: string
/**
* The entities selected.
*/
readonly entities: LuaEntity[]
/**
* The tiles selected.
*/
readonly tiles: LuaTile[]
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_selected_area
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a player sets a quickbar slot to anything (new value, or set to empty).
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_set_quick_bar_slot Online documentation}
*/
interface OnPlayerSetQuickBarSlotEvent extends EventData {
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_set_quick_bar_slot
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a player selects an area with a blueprint.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_setup_blueprint Online documentation}
*/
interface OnPlayerSetupBlueprintEvent extends EventData {
/**
* The player doing the selection.
*/
readonly player_index: PlayerIndex
/**
* The surface selected.
*/
readonly surface: LuaSurface
/**
* The area selected.
*/
readonly area: BoundingBox
/**
* The item used to select the area.
*/
readonly item: string
/**
* If normal selection or alt selection was used.
*/
readonly alt: boolean
/**
* The blueprint entity index to source entity mapping. Note: if any mod changes the blueprint this will be incorrect.
*/
readonly mapping: LuaLazyLoadedValue<Record<uint, LuaEntity>>
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_setup_blueprint
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a player toggles alt mode, also known as "show entity info".
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_toggled_alt_mode Online documentation}
*/
interface OnPlayerToggledAltModeEvent extends EventData {
readonly player_index: PlayerIndex
/**
* The new alt mode value. This value is a shortcut for accessing {@link GameViewSettings#show_entity_info GameViewSettings::show_entity_info} on the player.
*/
readonly alt_mode: boolean
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_toggled_alt_mode
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a player toggles the map editor on or off.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_toggled_map_editor Online documentation}
*/
interface OnPlayerToggledMapEditorEvent extends EventData {
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_toggled_map_editor
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called after a players trash inventory changed in some way.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_trash_inventory_changed Online documentation}
*/
interface OnPlayerTrashInventoryChangedEvent extends EventData {
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_trash_inventory_changed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a player is un-banned.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_unbanned Online documentation}
*/
interface OnPlayerUnbannedEvent extends EventData {
/**
* The player un-banned.
*/
readonly player_index?: PlayerIndex
/**
* The player name un-banned.
*/
readonly player_name: string
/**
* The player that did the un-banning if any.
*/
readonly by_player?: PlayerIndex
/**
* The reason the player was banned if any.
*/
readonly reason?: string
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_unbanned
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a player is unmuted.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_unmuted Online documentation}
*/
interface OnPlayerUnmutedEvent extends EventData {
/**
* The player.
*/
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_unmuted
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a player uses a capsule that results in some game action.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_used_capsule Online documentation}
*/
interface OnPlayerUsedCapsuleEvent extends EventData {
/**
* The player.
*/
readonly player_index: PlayerIndex
/**
* The capsule item used.
*/
readonly item: LuaItemPrototype
/**
* The position the capsule was used.
*/
readonly position: MapPosition
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_used_capsule
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a player uses spidertron remote to send a spidertron to a given position
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_player_used_spider_remote Online documentation}
*/
interface OnPlayerUsedSpiderRemoteEvent extends EventData {
/**
* The player that used the remote.
*/
readonly player_index: PlayerIndex
/**
* Spider vehicle which was requested to move.
*/
readonly vehicle: LuaEntity
/**
* Goal position to which spidertron was sent to.
*/
readonly position: MapPosition
/**
* If the use was successful. It may fail when spidertron has different driver or when player is on different surface.
*/
readonly success: boolean
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_player_used_spider_remote
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called after an entity dies.
*
* Event filter: [LuaPostEntityDiedEventFilter](LuaPostEntityDiedEventFilter]
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_post_entity_died Online documentation}
*/
interface OnPostEntityDiedEvent extends EventData {
/**
* The ghost created by the entity dying if any.
*/
readonly ghost?: LuaEntity
/**
* The force that did the killing if any.
*/
readonly force?: LuaForce
/**
* Position where the entity died.
*/
readonly position: MapPosition
/**
* The entity prototype of the entity that died.
*/
readonly prototype: LuaEntityPrototype
/**
* The damage type if any.
*/
readonly damage_type?: LuaDamagePrototype
/**
* The corpses created by the entity dying if any.
*/
readonly corpses: LuaEntity[]
/**
* The surface the entity was on.
*/
readonly surface_index: SurfaceIndex
/**
* The unit number the entity had if any.
*/
readonly unit_number?: UnitNumber
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_post_entity_died
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when players uses an item to build something. Called before {@link OnBuiltEntityEvent on_built_entity}.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_pre_build Online documentation}
*/
interface OnPreBuildEvent extends EventData {
/**
* The player who did the placing.
*/
readonly player_index: PlayerIndex
/**
* Where the item was placed.
*/
readonly position: MapPosition
/**
* Item was placed using shift building.
*/
readonly shift_build: boolean
/**
* The direction the item was facing when placed.
*/
readonly direction: defines.direction
/**
* Whether the blueprint was flipped horizontally. `nil` if not built by a blueprint.
*/
readonly flip_horizontal: boolean | nil
/**
* Whether the blueprint was flipped vertically. `nil` if not built by a blueprint.
*/
readonly flip_vertical: boolean | nil
/**
* Whether the item was placed while moving.
*/
readonly created_by_moving: boolean
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_pre_build
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called before one or more chunks are deleted using {@link LuaSurface#delete_chunk LuaSurface::delete_chunk}.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_pre_chunk_deleted Online documentation}
*/
interface OnPreChunkDeletedEvent extends EventData {
readonly surface_index: SurfaceIndex
/**
* The chunks to be deleted.
*/
readonly positions: ChunkPosition[]
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_pre_chunk_deleted
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called before entity copy-paste is done.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_pre_entity_settings_pasted Online documentation}
*/
interface OnPreEntitySettingsPastedEvent extends EventData {
readonly player_index: PlayerIndex
/**
* The source entity settings will be copied from.
*/
readonly source: LuaEntity
/**
* The destination entity settings will be copied to.
*/
readonly destination: LuaEntity
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_pre_entity_settings_pasted
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* 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.
*
* Event filter: [LuaPreGhostDeconstructedEventFilter](LuaPreGhostDeconstructedEventFilter]
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_pre_ghost_deconstructed Online documentation}
*/
interface OnPreGhostDeconstructedEvent extends EventData {
/**
* The player that did the deconstruction if any.
*/
readonly player_index?: PlayerIndex
readonly ghost: LuaEntity
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_pre_ghost_deconstructed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called before a ghost entity is upgraded.
*
* Event filter: [LuaPreGhostUpgradedEventFilter](LuaPreGhostUpgradedEventFilter]
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_pre_ghost_upgraded Online documentation}
*/
interface OnPreGhostUpgradedEvent extends EventData {
/**
* The player that did the upgrade if any.
*/
readonly player_index?: PlayerIndex
readonly ghost: LuaEntity
readonly target: LuaEntityPrototype
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_pre_ghost_upgraded
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called directly before a permission group is deleted.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_pre_permission_group_deleted Online documentation}
*/
interface OnPrePermissionGroupDeletedEvent extends EventData {
/**
* The player doing the deletion.
*/
readonly player_index: PlayerIndex
/**
* The group to be deleted.
*/
readonly group: LuaPermissionGroup
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_pre_permission_group_deleted
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called directly before a permission string is imported.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_pre_permission_string_imported Online documentation}
*/
interface OnPrePermissionStringImportedEvent extends EventData {
/**
* The player importing the string.
*/
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_pre_permission_string_imported
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a player queues something to be crafted.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_pre_player_crafted_item Online documentation}
*/
interface OnPrePlayerCraftedItemEvent extends EventData {
/**
* The player doing the crafting.
*/
readonly player_index: PlayerIndex
/**
* The recipe being queued.
*/
readonly recipe: LuaRecipe
/**
* The items removed from the players inventory to do the crafting.
*/
readonly items: LuaInventory
/**
* The number of times the recipe is being queued.
*/
readonly queued_count: uint
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_pre_player_crafted_item
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called before a players dies.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_pre_player_died Online documentation}
*/
interface OnPrePlayerDiedEvent extends EventData {
readonly player_index: PlayerIndex
readonly cause?: LuaEntity
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_pre_player_died
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called before a player leaves the game.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_pre_player_left_game Online documentation}
*/
interface OnPrePlayerLeftGameEvent extends EventData {
readonly player_index: PlayerIndex
readonly reason: defines.disconnect_reason
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_pre_player_left_game
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* 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.
*
* Event filter: [LuaPrePlayerMinedEntityEventFilter](LuaPrePlayerMinedEntityEventFilter]
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_pre_player_mined_item Online documentation}
*/
interface OnPrePlayerMinedItemEvent extends EventData {
/**
* The entity being mined
*/
readonly entity: LuaEntity
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_pre_player_mined_item
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called before a player is removed (deleted) from the game. This is markedly different from a player temporarily {@link OnPlayerLeftGameEvent leaving} the game, and instead behaves like the player never existed in the save file.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_pre_player_removed Online documentation}
*/
interface OnPrePlayerRemovedEvent extends EventData {
/**
* The index of the removed player.
*/
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_pre_player_removed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called before a player toggles the map editor on or off.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_pre_player_toggled_map_editor Online documentation}
*/
interface OnPrePlayerToggledMapEditorEvent extends EventData {
readonly player_index: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_pre_player_toggled_map_editor
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called directly before a robot explodes cliffs.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_pre_robot_exploded_cliff Online documentation}
*/
interface OnPreRobotExplodedCliffEvent extends EventData {
readonly robot: LuaEntity
readonly cliff: LuaEntity
/**
* The cliff explosive used.
*/
readonly item: LuaItemPrototype
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_pre_robot_exploded_cliff
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called just before a script inventory is resized.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_pre_script_inventory_resized Online documentation}
*/
interface OnPreScriptInventoryResizedEvent extends EventData {
/**
* If done by console command; the player who ran the command.
*/
readonly player_index?: PlayerIndex
/**
* The mod that did the resizing. This will be `"core"` if done by console command or scenario script.
*/
readonly mod: string
readonly inventory: LuaInventory
/**
* The old inventory size.
*/
readonly old_size: uint
/**
* The new inventory size.
*/
readonly new_size: uint
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_pre_script_inventory_resized
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called just before a surface is cleared (all entities removed and all chunks deleted).
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_pre_surface_cleared Online documentation}
*/
interface OnPreSurfaceClearedEvent extends EventData {
readonly surface_index: SurfaceIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_pre_surface_cleared
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called just before a surface is deleted.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_pre_surface_deleted Online documentation}
*/
interface OnPreSurfaceDeletedEvent extends EventData {
readonly surface_index: SurfaceIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_pre_surface_deleted
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when research is cancelled.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_research_cancelled Online documentation}
*/
interface OnResearchCancelledEvent extends EventData {
/**
* A mapping of technology name to how many times it was cancelled.
*/
readonly research: Record<string, uint>
/**
* The force whose research was cancelled.
*/
readonly force: LuaForce
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_research_cancelled
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a research finishes.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_research_finished Online documentation}
*/
interface OnResearchFinishedEvent extends EventData {
/**
* The researched technology
*/
readonly research: LuaTechnology
/**
* If the technology was researched by script.
*/
readonly by_script: boolean
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_research_finished
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a research is reversed (unresearched).
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_research_reversed Online documentation}
*/
interface OnResearchReversedEvent extends EventData {
/**
* The technology un-researched
*/
readonly research: LuaTechnology
/**
* If the technology was un-researched by script.
*/
readonly by_script: boolean
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_research_reversed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a technology research starts.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_research_started Online documentation}
*/
interface OnResearchStartedEvent extends EventData {
/**
* The technology being researched
*/
readonly research: LuaTechnology
readonly last_research?: LuaTechnology
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_research_started
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a resource entity reaches 0 or its minimum yield for infinite resources.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_resource_depleted Online documentation}
*/
interface OnResourceDepletedEvent extends EventData {
readonly entity: LuaEntity
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_resource_depleted
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a construction robot builds an entity.
*
* Event filter: [LuaRobotBuiltEntityEventFilter](LuaRobotBuiltEntityEventFilter]
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_robot_built_entity Online documentation}
*/
interface OnRobotBuiltEntityEvent extends EventData {
/**
* The robot that did the building.
*/
readonly robot: LuaEntity
/**
* The entity built.
*/
readonly created_entity: LuaEntity
/**
* The item used to do the building.
*/
readonly stack: LuaItemStack
/**
* The tags associated with this entity if any.
*/
readonly tags?: Tags
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_robot_built_entity
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called after a robot builds tiles.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_robot_built_tile Online documentation}
*/
interface OnRobotBuiltTileEvent extends EventData {
/**
* The robot.
*/
readonly robot: LuaEntity
/**
* The position data.
*/
readonly tiles: OldTileAndPosition[]
/**
* The tile prototype that was placed.
*/
readonly tile: LuaTilePrototype
/**
* The item type used to build the tiles.
*/
readonly item: LuaItemPrototype
/**
* The stack used to build the tiles (may be empty if all of the items where used to build the tiles).
*/
readonly stack: LuaItemStack
/**
* The surface the tile(s) are build on.
*/
readonly surface_index: SurfaceIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_robot_built_tile
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called directly after a robot explodes cliffs.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_robot_exploded_cliff Online documentation}
*/
interface OnRobotExplodedCliffEvent extends EventData {
readonly robot: LuaEntity
/**
* The cliff explosive used.
*/
readonly item: LuaItemPrototype
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_robot_exploded_cliff
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a robot mines an entity.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_robot_mined Online documentation}
*/
interface OnRobotMinedEvent extends EventData {
/**
* The robot that did the mining.
*/
readonly robot: LuaEntity
/**
* The entity the robot just picked up.
*/
readonly item_stack: SimpleItemStack
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_robot_mined
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* 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.
*
* Event filter: [LuaRobotMinedEntityEventFilter](LuaRobotMinedEntityEventFilter]
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_robot_mined_entity Online documentation}
*/
interface OnRobotMinedEntityEvent extends EventData {
/**
* The robot doing the mining.
*/
readonly robot: LuaEntity
/**
* The entity that has been mined.
*/
readonly entity: LuaEntity
/**
* The temporary inventory that holds the result of mining the entity.
*/
readonly buffer: LuaInventory
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_robot_mined_entity
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called after a robot mines tiles.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_robot_mined_tile Online documentation}
*/
interface OnRobotMinedTileEvent extends EventData {
/**
* The robot.
*/
readonly robot: LuaEntity
/**
* The position data.
*/
readonly tiles: OldTileAndPosition[]
/**
* The surface the tile(s) were mined on.
*/
readonly surface_index: SurfaceIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_robot_mined_tile
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called before a robot mines an entity.
*
* Event filter: [LuaPreRobotMinedEntityEventFilter](LuaPreRobotMinedEntityEventFilter]
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_robot_pre_mined Online documentation}
*/
interface OnRobotPreMinedEvent extends EventData {
/**
* The robot that's about to do the mining.
*/
readonly robot: LuaEntity
/**
* The entity which is about to be mined.
*/
readonly entity: LuaEntity
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_robot_pre_mined
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a rocket silo is ordered to be launched.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_rocket_launch_ordered Online documentation}
*/
interface OnRocketLaunchOrderedEvent extends EventData {
readonly rocket: LuaEntity
readonly rocket_silo: LuaEntity
/**
* The player that is riding the rocket, if any.
*/
readonly player_index?: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_rocket_launch_ordered
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when the rocket is launched.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_rocket_launched Online documentation}
*/
interface OnRocketLaunchedEvent extends EventData {
readonly rocket: LuaEntity
readonly rocket_silo?: LuaEntity
/**
* The player that is riding the rocket, if any.
*/
readonly player_index?: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_rocket_launched
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a runtime mod setting is changed by a player.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_runtime_mod_setting_changed Online documentation}
*/
interface OnRuntimeModSettingChangedEvent extends EventData {
/**
* 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`.
*/
readonly player_index?: PlayerIndex
/**
* The prototype name of the setting that was changed.
*/
readonly setting: string
readonly setting_type: "runtime-global" | "runtime-per-user"
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_runtime_mod_setting_changed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called just after a script inventory is resized.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_script_inventory_resized Online documentation}
*/
interface OnScriptInventoryResizedEvent extends EventData {
/**
* If done by console command; the player who ran the command.
*/
readonly player_index?: PlayerIndex
/**
* The mod that did the resizing. This will be `"core"` if done by console command or scenario script.
*/
readonly mod: string
readonly inventory: LuaInventory
/**
* The old inventory size.
*/
readonly old_size: uint
/**
* The new inventory size.
*/
readonly new_size: uint
/**
* Any items which didn't fit into the new inventory size.
*/
readonly overflow_inventory: LuaInventory
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_script_inventory_resized
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a {@link LuaSurface#request_path LuaSurface::request_path} call completes.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_script_path_request_finished Online documentation}
*/
interface OnScriptPathRequestFinishedEvent extends EventData {
/**
* The actual path that the pathfinder has determined. `nil` if pathfinding failed.
*/
readonly path?: PathfinderWaypoint[]
/**
* Handle to associate the callback with a particular call to {@link LuaSurface#request_path LuaSurface::request_path}.
*/
readonly id: uint
/**
* Indicates that the pathfinder failed because it is too busy, and that you can retry later.
*/
readonly try_again_later: boolean
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_script_path_request_finished
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a script trigger effect is triggered.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_script_trigger_effect Online documentation}
*/
interface OnScriptTriggerEffectEvent extends EventData {
/**
* The effect_id specified in the trigger effect.
*/
readonly effect_id: string
/**
* The surface the effect happened on.
*/
readonly surface_index: SurfaceIndex
readonly source_position?: MapPosition
readonly source_entity?: LuaEntity
readonly target_position?: MapPosition
readonly target_entity?: LuaEntity
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_script_trigger_effect
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when an entity of type `radar` finishes scanning a sector.
*
* Event filter: [LuaSectorScannedEventFilter](LuaSectorScannedEventFilter]
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_sector_scanned Online documentation}
*/
interface OnSectorScannedEvent extends EventData {
/**
* The radar that did the scanning.
*/
readonly radar: LuaEntity
/**
* The chunk scanned.
*/
readonly chunk_position: ChunkPosition
/**
* Area of the scanned chunk.
*/
readonly area: BoundingBox
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_sector_scanned
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called after the selected entity changes for a given player.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_selected_entity_changed Online documentation}
*/
interface OnSelectedEntityChangedEvent extends EventData {
/**
* The player whose selected entity changed.
*/
readonly player_index: PlayerIndex
/**
* The last selected entity if it still exists and there was one.
*/
readonly last_entity?: LuaEntity
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_selected_entity_changed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a spider finishes moving to its autopilot position.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_spider_command_completed Online documentation}
*/
interface OnSpiderCommandCompletedEvent extends EventData {
/**
* Spider vehicle which was requested to move.
*/
readonly vehicle: LuaEntity
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_spider_command_completed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a translation request generated through {@link LuaPlayer#request_translation LuaPlayer::request_translation} or {@link LuaPlayer#request_translations LuaPlayer::request_translations} has been completed.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_string_translated Online documentation}
*/
interface OnStringTranslatedEvent extends EventData {
/**
* The player whose locale was used for the translation.
*/
readonly player_index: PlayerIndex
/**
* The localised string being translated.
*/
readonly localised_string: LocalisedString
/**
* The translated `localised_string`.
*/
readonly result: string
/**
* The unique id for this translation request.
*/
readonly id: uint
/**
* Whether the requested localised string was valid and could be translated.
*/
readonly translated: boolean
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_string_translated
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called just after a surface is cleared (all entities removed and all chunks deleted).
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_surface_cleared Online documentation}
*/
interface OnSurfaceClearedEvent extends EventData {
readonly surface_index: SurfaceIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_surface_cleared
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a surface is created.
*
* This is not called when the default surface is created as it will always exist.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_surface_created Online documentation}
*/
interface OnSurfaceCreatedEvent extends EventData {
readonly surface_index: SurfaceIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_surface_created
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called after a surface is deleted.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_surface_deleted Online documentation}
*/
interface OnSurfaceDeletedEvent extends EventData {
readonly surface_index: SurfaceIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_surface_deleted
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called after a surface is imported via the map editor.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_surface_imported Online documentation}
*/
interface OnSurfaceImportedEvent extends EventData {
readonly surface_index: SurfaceIndex
/**
* The original surface name.
*/
readonly original_name: string
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_surface_imported
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a surface is renamed.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_surface_renamed Online documentation}
*/
interface OnSurfaceRenamedEvent extends EventData {
readonly surface_index: SurfaceIndex
readonly old_name: string
readonly new_name: string
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_surface_renamed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when {@link LuaForce#reset_technology_effects LuaForce::reset_technology_effects} is finished.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_technology_effects_reset Online documentation}
*/
interface OnTechnologyEffectsResetEvent extends EventData {
readonly force: LuaForce
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_technology_effects_reset
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* It is fired once every tick. Since this event is fired every tick, its handler shouldn't include performance heavy code.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_tick Online documentation}
*/
interface OnTickEvent extends EventData {
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_tick
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a train changes state (started to stopped and vice versa)
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_train_changed_state Online documentation}
*/
interface OnTrainChangedStateEvent extends EventData {
readonly train: LuaTrain
readonly old_state: defines.train_state
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_train_changed_state
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a new train is created either through disconnecting/connecting an existing one or building a new one.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_train_created Online documentation}
*/
interface OnTrainCreatedEvent extends EventData {
readonly train: LuaTrain
/**
* The first old train id when splitting/merging trains.
*/
readonly old_train_id_1?: uint
/**
* The second old train id when splitting/merging trains.
*/
readonly old_train_id_2?: uint
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_train_created
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a trains schedule is changed either by the player or through script.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_train_schedule_changed Online documentation}
*/
interface OnTrainScheduleChangedEvent extends EventData {
readonly train: LuaTrain
/**
* The player who made the change if any.
*/
readonly player_index?: PlayerIndex
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_train_schedule_changed
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when an entity with a trigger prototype (such as capsules) create an entity AND that trigger prototype defined `trigger_created_entity=true`.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_trigger_created_entity Online documentation}
*/
interface OnTriggerCreatedEntityEvent extends EventData {
readonly entity: LuaEntity
readonly source?: LuaEntity
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_trigger_created_entity
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when an entity with a trigger prototype (such as capsules) fire an artillery projectile AND that trigger prototype defined `trigger_fired_artillery=true`.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_trigger_fired_artillery Online documentation}
*/
interface OnTriggerFiredArtilleryEvent extends EventData {
readonly entity: LuaEntity
readonly source?: LuaEntity
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_trigger_fired_artillery
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a unit is added to a unit group.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_unit_added_to_group Online documentation}
*/
interface OnUnitAddedToGroupEvent extends EventData {
readonly unit: LuaEntity
readonly group: LuaUnitGroup
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_unit_added_to_group
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a new unit group is created, before any members are added to it.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_unit_group_created Online documentation}
*/
interface OnUnitGroupCreatedEvent extends EventData {
readonly group: LuaUnitGroup
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_unit_group_created
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a unit group finishes gathering and starts executing its command.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_unit_group_finished_gathering Online documentation}
*/
interface OnUnitGroupFinishedGatheringEvent extends EventData {
readonly group: LuaUnitGroup
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_unit_group_finished_gathering
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a unit is removed from a unit group.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_unit_removed_from_group Online documentation}
*/
interface OnUnitRemovedFromGroupEvent extends EventData {
readonly unit: LuaEntity
readonly group: LuaUnitGroup
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_unit_removed_from_group
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* Called when a worker (construction or logistic) robot expires through a lack of energy.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#on_worker_robot_expired Online documentation}
*/
interface OnWorkerRobotExpiredEvent extends EventData {
readonly robot: LuaEntity
/**
* Identifier of the event
*/
readonly name: typeof defines.events.on_worker_robot_expired
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* 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 {@link LuaBootstrap#raise_event LuaBootstrap::raise_event} or {@link LuaBootstrap#raise_script_built LuaBootstrap::raise_script_built}, or when `raise_built` is passed to {@link LuaSurface#create_entity LuaSurface::create_entity}.
*
* Event filter: [LuaScriptRaisedBuiltEventFilter](LuaScriptRaisedBuiltEventFilter]
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#script_raised_built Online documentation}
*/
interface ScriptRaisedBuiltEvent extends EventData {
/**
* The entity that has been built.
*/
readonly entity: LuaEntity
/**
* Identifier of the event
*/
readonly name: typeof defines.events.script_raised_built
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* 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 {@link LuaBootstrap#raise_event LuaBootstrap::raise_event} or {@link LuaBootstrap#raise_script_destroy LuaBootstrap::raise_script_destroy}, or when `raise_destroy` is passed to {@link LuaEntity#destroy LuaEntity::destroy}.
*
* Event filter: [LuaScriptRaisedDestroyEventFilter](LuaScriptRaisedDestroyEventFilter]
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#script_raised_destroy Online documentation}
*/
interface ScriptRaisedDestroyEvent extends EventData {
/**
* The entity that was destroyed.
*/
readonly entity: LuaEntity
/**
* Identifier of the event
*/
readonly name: typeof defines.events.script_raised_destroy
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* 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 {@link LuaBootstrap#raise_event LuaBootstrap::raise_event} or {@link LuaBootstrap#raise_script_revive LuaBootstrap::raise_script_revive}, or when `raise_revive` is passed to {@link LuaEntity#revive LuaEntity::revive}.
*
* Event filter: [LuaScriptRaisedReviveEventFilter](LuaScriptRaisedReviveEventFilter]
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#script_raised_revive Online documentation}
*/
interface ScriptRaisedReviveEvent extends EventData {
/**
* The entity that was revived.
*/
readonly entity: LuaEntity
/**
* The tags associated with this entity, if any.
*/
readonly tags?: Tags
/**
* Identifier of the event
*/
readonly name: typeof defines.events.script_raised_revive
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* 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 {@link LuaBootstrap#raise_event LuaBootstrap::raise_event} or {@link LuaBootstrap#raise_script_set_tiles LuaBootstrap::raise_script_set_tiles}, or when `raise_event` is passed to {@link LuaSurface#set_tiles LuaSurface::set_tiles}.
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#script_raised_set_tiles Online documentation}
*/
interface ScriptRaisedSetTilesEvent extends EventData {
/**
* The surface whose tiles were changed.
*/
readonly surface_index: SurfaceIndex
/**
* The tiles that were changed.
*/
readonly tiles: Tile[]
/**
* Identifier of the event
*/
readonly name: typeof defines.events.script_raised_set_tiles
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* 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 {@link LuaBootstrap#raise_event LuaBootstrap::raise_event} or {@link LuaBootstrap#raise_script_teleported LuaBootstrap::raise_script_teleported}, or when `raise_teleported` is passed to {@link LuaControl#teleport LuaControl::teleport}.
*
* Event filter: [LuaScriptRaisedTeleportedEventFilter](LuaScriptRaisedTeleportedEventFilter]
* @see {@link https://lua-api.factorio.com/1.1.110/events.html#script_raised_teleported Online documentation}
*/
interface ScriptRaisedTeleportedEvent extends EventData {
/**
* The entity that was teleported.
*/
readonly entity: LuaEntity
/**
* The entity's surface before the teleportation.
*/
readonly old_surface_index: uint8
/**
* The entity's position before the teleportation.
*/
readonly old_position: MapPosition
/**
* Identifier of the event
*/
readonly name: typeof defines.events.script_raised_teleported
/**
* Tick the event was generated.
*/
readonly tick: uint
}
/**
* An event id generated by {@link LuaBootstrap#generate_event_name LuaBootstrap::generate_event_name} and raiseable via
* {@link LuaBootstrap#raise_event LuaBootstrap::raise_event}.
*/
export type CustomEventId<T extends table> = EventId<T> & {
_customEventIdBrand: any
}
}