UNPKG

typed-factorio

Version:

Featureful typescript definitions for the Factorio modding api.

1,665 lines (1,663 loc) 130 kB
// 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