mirror of
https://github.com/Xevion/project-cybersyn.git
synced 2025-12-11 14:08:17 -06:00
604 lines
34 KiB
Lua
604 lines
34 KiB
Lua
---@meta
|
|
---@diagnostic disable
|
|
|
|
--$Factorio 1.1.72
|
|
--$Overlay 5
|
|
--$Section LuaControl
|
|
-- This file is automatically generated. Edits will be overwritten.
|
|
|
|
---This is an abstract base class containing the common functionality between [LuaPlayer](https://lua-api.factorio.com/latest/LuaPlayer.html) and entities (see [LuaEntity](https://lua-api.factorio.com/latest/LuaEntity.html)). When accessing player-related functions through a [LuaEntity](https://lua-api.factorio.com/latest/LuaEntity.html), it must refer to a character entity.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html)
|
|
---@class LuaControl:LuaObject
|
|
---[R]
|
|
---The build distance of this character or max uint when not a character or player connected to a character.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.build_distance)
|
|
---@field build_distance uint
|
|
---[RW]
|
|
---
|
|
---**Note:** When called on a [LuaPlayer](https://lua-api.factorio.com/latest/LuaPlayer.html), it must be associated with a character (see [LuaPlayer::character](https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.character)).
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.character_additional_mining_categories)
|
|
---@field character_additional_mining_categories string[]
|
|
---[RW]
|
|
---
|
|
---**Note:** When called on a [LuaPlayer](https://lua-api.factorio.com/latest/LuaPlayer.html), it must be associated with a character (see [LuaPlayer::character](https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.character)).
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.character_build_distance_bonus)
|
|
---@field character_build_distance_bonus uint
|
|
---[RW]
|
|
---
|
|
---**Note:** When called on a [LuaPlayer](https://lua-api.factorio.com/latest/LuaPlayer.html), it must be associated with a character (see [LuaPlayer::character](https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.character)).
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.character_crafting_speed_modifier)
|
|
---@field character_crafting_speed_modifier double
|
|
---[RW]
|
|
---
|
|
---**Note:** When called on a [LuaPlayer](https://lua-api.factorio.com/latest/LuaPlayer.html), it must be associated with a character (see [LuaPlayer::character](https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.character)).
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.character_health_bonus)
|
|
---@field character_health_bonus float
|
|
---[RW]
|
|
---
|
|
---**Note:** When called on a [LuaPlayer](https://lua-api.factorio.com/latest/LuaPlayer.html), it must be associated with a character (see [LuaPlayer::character](https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.character)).
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.character_inventory_slots_bonus)
|
|
---@field character_inventory_slots_bonus uint
|
|
---[RW]
|
|
---
|
|
---**Note:** When called on a [LuaPlayer](https://lua-api.factorio.com/latest/LuaPlayer.html), it must be associated with a character (see [LuaPlayer::character](https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.character)).
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.character_item_drop_distance_bonus)
|
|
---@field character_item_drop_distance_bonus uint
|
|
---[RW]
|
|
---
|
|
---**Note:** When called on a [LuaPlayer](https://lua-api.factorio.com/latest/LuaPlayer.html), it must be associated with a character (see [LuaPlayer::character](https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.character)).
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.character_item_pickup_distance_bonus)
|
|
---@field character_item_pickup_distance_bonus uint
|
|
---[RW]
|
|
---
|
|
---**Note:** When called on a [LuaPlayer](https://lua-api.factorio.com/latest/LuaPlayer.html), it must be associated with a character (see [LuaPlayer::character](https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.character)).
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.character_loot_pickup_distance_bonus)
|
|
---@field character_loot_pickup_distance_bonus uint
|
|
---[RW]
|
|
---
|
|
---**Note:** When called on a [LuaPlayer](https://lua-api.factorio.com/latest/LuaPlayer.html), it must be associated with a character (see [LuaPlayer::character](https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.character)).
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.character_maximum_following_robot_count_bonus)
|
|
---@field character_maximum_following_robot_count_bonus uint
|
|
---[R]
|
|
---The current mining progress between 0 and 1 of this character, or 0 if they aren't mining.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.character_mining_progress)
|
|
---@field character_mining_progress double
|
|
---[RW]
|
|
---
|
|
---**Note:** When called on a [LuaPlayer](https://lua-api.factorio.com/latest/LuaPlayer.html), it must be associated with a character (see [LuaPlayer::character](https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.character)).
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.character_mining_speed_modifier)
|
|
---@field character_mining_speed_modifier double
|
|
---[RW]
|
|
---If personal logistic requests are enabled for this character or players character.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.character_personal_logistic_requests_enabled)
|
|
---@field character_personal_logistic_requests_enabled boolean
|
|
---[RW]
|
|
---
|
|
---**Note:** When called on a [LuaPlayer](https://lua-api.factorio.com/latest/LuaPlayer.html), it must be associated with a character (see [LuaPlayer::character](https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.character)).
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.character_reach_distance_bonus)
|
|
---@field character_reach_distance_bonus uint
|
|
---[RW]
|
|
---
|
|
---**Note:** When called on a [LuaPlayer](https://lua-api.factorio.com/latest/LuaPlayer.html), it must be associated with a character (see [LuaPlayer::character](https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.character)).
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.character_resource_reach_distance_bonus)
|
|
---@field character_resource_reach_distance_bonus uint
|
|
---[R]
|
|
---The current movement speed of this character, including effects from exoskeletons, tiles, stickers and shooting.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.character_running_speed)
|
|
---@field character_running_speed double
|
|
---[RW]
|
|
---Modifies the running speed of this character by the given value as a percentage. Setting the running modifier to `0.5` makes the character run 50% faster. The minimum value of `-1` reduces the movement speed by 100%, resulting in a speed of `0`.
|
|
---
|
|
---**Note:** When called on a [LuaPlayer](https://lua-api.factorio.com/latest/LuaPlayer.html), it must be associated with a character (see [LuaPlayer::character](https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.character)).
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.character_running_speed_modifier)
|
|
---@field character_running_speed_modifier double
|
|
---[RW]
|
|
---
|
|
---**Note:** When called on a [LuaPlayer](https://lua-api.factorio.com/latest/LuaPlayer.html), it must be associated with a character (see [LuaPlayer::character](https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.character)).
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.character_trash_slot_count_bonus)
|
|
---@field character_trash_slot_count_bonus uint
|
|
---[RW]
|
|
---When `true` hand crafting is free and instant.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.cheat_mode)
|
|
---@field cheat_mode boolean
|
|
---[R]
|
|
---The current crafting queue items.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.crafting_queue)
|
|
---@field crafting_queue CraftingQueueItem[]
|
|
---[RW]
|
|
---The crafting queue progress in the range `[0-1]`. `0` when no recipe is being crafted.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.crafting_queue_progress)
|
|
---@field crafting_queue_progress double
|
|
---[R]
|
|
---Size of the crafting queue.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.crafting_queue_size)
|
|
---@field crafting_queue_size uint
|
|
---[RW]
|
|
---The ghost prototype in the player's cursor. When read, it will be a [LuaItemPrototype](https://lua-api.factorio.com/latest/LuaItemPrototype.html).
|
|
---
|
|
---**Note:** Items in the cursor stack will take priority over the cursor ghost.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.cursor_ghost)
|
|
---@field cursor_ghost? ItemPrototypeIdentification
|
|
---[R]
|
|
---The player's cursor stack. `nil` if the player controller is a spectator.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.cursor_stack)
|
|
---
|
|
---### Example
|
|
---Even though this property is marked as read-only, it returns a [LuaItemStack](https://lua-api.factorio.com/latest/LuaItemStack.html), meaning it can be manipulated like so:
|
|
---```
|
|
---player.cursor_stack.clear()
|
|
---```
|
|
---@field cursor_stack? LuaItemStack
|
|
---[RW]
|
|
---`true` if the player is in a vehicle. Writing to this attribute puts the player in or out of a vehicle.
|
|
---
|
|
---**Events:**
|
|
--- * May raise [on_player_driving_changed_state](https://lua-api.factorio.com/latest/events.html#on_player_driving_changed_state) instantly.
|
|
---Raised if the driving state successfully changed.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.driving)
|
|
---@field driving boolean
|
|
---[R]
|
|
---The item drop distance of this character or max uint when not a character or player connected to a character.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.drop_item_distance)
|
|
---@field drop_item_distance uint
|
|
---[R]
|
|
---The current combat robots following the character.
|
|
---
|
|
---**Note:** When called on a [LuaPlayer](https://lua-api.factorio.com/latest/LuaPlayer.html), it must be associated with a character(see [LuaPlayer::character](https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.character)).
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.following_robots)
|
|
---@field following_robots LuaEntity[]
|
|
---[RW]
|
|
---The force of this entity. Reading will always give a [LuaForce](https://lua-api.factorio.com/latest/LuaForce.html), but it is possible to assign either [string](https://lua-api.factorio.com/latest/Builtin-Types.html#string) or [LuaForce](https://lua-api.factorio.com/latest/LuaForce.html) to this attribute to change the force.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.force)
|
|
---@field force ForceIdentification
|
|
---[R]
|
|
---Whether this character entity is in combat.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.in_combat)
|
|
---@field in_combat boolean
|
|
---[R]
|
|
---The item pickup distance of this character or max double when not a character or player connected to a character.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.item_pickup_distance)
|
|
---@field item_pickup_distance double
|
|
---[R]
|
|
---The loot pickup distance of this character or max double when not a character or player connected to a character.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.loot_pickup_distance)
|
|
---@field loot_pickup_distance double
|
|
---[RW]
|
|
---Current mining state.
|
|
---
|
|
---**Note:** When the player isn't mining tiles the player will mine what ever entity is currently selected. See [LuaControl::selected](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.selected) and [LuaControl::update_selected_entity](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.update_selected_entity).
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.mining_state)
|
|
---@field mining_state LuaControl.mining_state
|
|
---[RW]
|
|
---The GUI the player currently has open.
|
|
---
|
|
---This is the GUI that will asked to close (by firing the [on_gui_closed](https://lua-api.factorio.com/latest/events.html#on_gui_closed) event) when the `Esc` or `E` keys are pressed. If this attribute is not `nil`, and a new GUI is written to it, the existing one will be asked to close.
|
|
---
|
|
---**Note:** Write supports any of the types. Read will return the `entity`, `equipment`, `equipment-grid`, `player`, `element`, `inventory`, `technology`, or `nil`.
|
|
---
|
|
---**Events:**
|
|
--- * May raise [on_gui_opened](https://lua-api.factorio.com/latest/events.html#on_gui_opened) instantly.
|
|
---Raised when writing a valid GUI target to this attribute.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.opened)
|
|
---@field opened? LuaEntity|LuaItemStack|LuaEquipment|LuaEquipmentGrid|LuaPlayer|LuaGuiElement|LuaInventory|LuaTechnology|defines.gui_type
|
|
---[R]
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.opened_gui_type)
|
|
---@field opened_gui_type? defines.gui_type
|
|
---[RW]
|
|
---Current item-picking state.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.picking_state)
|
|
---@field picking_state boolean
|
|
---[R]
|
|
---The current position of the entity.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.position)
|
|
---@field position MapPosition
|
|
---[R]
|
|
---The reach distance of this character or max uint when not a character or player connected to a character.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.reach_distance)
|
|
---@field reach_distance uint
|
|
---[RW]
|
|
---Current repair state.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.repair_state)
|
|
---@field repair_state LuaControl.repair_state
|
|
---[R]
|
|
---The resource reach distance of this character or max double when not a character or player connected to a character.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.resource_reach_distance)
|
|
---@field resource_reach_distance double
|
|
---[RW]
|
|
---Current riding state of this car, or of the car this player is riding in.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.riding_state)
|
|
---@field riding_state RidingState
|
|
---[RW]
|
|
---The currently selected entity. Assigning an entity will select it if is selectable, otherwise the selection is cleared.
|
|
---
|
|
---**Events:**
|
|
--- * May raise [on_selected_entity_changed](https://lua-api.factorio.com/latest/events.html#on_selected_entity_changed) instantly.
|
|
---Raised when a selectable entity is written to this attribute.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.selected)
|
|
---@field selected? LuaEntity
|
|
---[RW]
|
|
---Current shooting state.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.shooting_state)
|
|
---@field shooting_state LuaControl.shooting_state
|
|
---[R]
|
|
---The surface this entity is currently on.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.surface)
|
|
---@field surface LuaSurface
|
|
---[R]
|
|
---The vehicle the player is currently sitting in.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.vehicle)
|
|
---@field vehicle? LuaEntity
|
|
---[RW]
|
|
---If personal logistic requests are enabled for this vehicle (spidertron).
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.vehicle_logistic_requests_enabled)
|
|
---@field vehicle_logistic_requests_enabled boolean
|
|
---[RW]
|
|
---Current walking state.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.walking_state)
|
|
---
|
|
---### Example
|
|
---Make the player go north. Note that a one-shot action like this will only make the player walk for one tick.
|
|
---```
|
|
---game.player.walking_state = {walking = true, direction = defines.direction.north}
|
|
---```
|
|
---@field walking_state LuaControl.walking_state
|
|
local LuaControl={
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.begin_crafting)
|
|
---@class LuaControl.begin_crafting_param
|
|
---The count to craft.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.begin_crafting)
|
|
---@field count uint
|
|
---The recipe to craft.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.begin_crafting)
|
|
---@field recipe string|LuaRecipe
|
|
---If false and the recipe can't be crafted the requested number of times printing the failure is skipped.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.begin_crafting)
|
|
---@field silent? boolean
|
|
|
|
|
|
---Begins crafting the given count of the given recipe.
|
|
---
|
|
---**Events:**
|
|
--- * May raise [on_player_main_inventory_changed](https://lua-api.factorio.com/latest/events.html#on_player_main_inventory_changed) later in the current tick.
|
|
---Raised if crafting was able to be started.
|
|
---
|
|
--- * May raise [on_pre_player_crafted_item](https://lua-api.factorio.com/latest/events.html#on_pre_player_crafted_item) instantly.
|
|
---Raised if crafting was able to be started.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.begin_crafting)
|
|
---@param param LuaControl.begin_crafting_param
|
|
---@return uint@The count that was actually started crafting.
|
|
begin_crafting=function(param)end,
|
|
---Can at least some items be inserted?
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.can_insert)
|
|
---@param items ItemStackIdentification@Items that would be inserted.
|
|
---@return boolean@`true` if at least a part of the given items could be inserted into this inventory.
|
|
can_insert=function(items)end,
|
|
---Can a given entity be opened or accessed?
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.can_reach_entity)
|
|
---@param entity LuaEntity
|
|
---@return boolean
|
|
can_reach_entity=function(entity)end,
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.cancel_crafting)
|
|
---@class LuaControl.cancel_crafting_param
|
|
---The crafting queue index.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.cancel_crafting)
|
|
---@field index uint
|
|
---The count to cancel crafting.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.cancel_crafting)
|
|
---@field count uint
|
|
|
|
|
|
---Cancels crafting the given count of the given crafting queue index.
|
|
---
|
|
---**Events:**
|
|
--- * May raise [on_player_cancelled_crafting](https://lua-api.factorio.com/latest/events.html#on_player_cancelled_crafting) instantly.
|
|
---Raised if crafting was able to be cancelled.
|
|
---
|
|
--- * May raise [on_player_main_inventory_changed](https://lua-api.factorio.com/latest/events.html#on_player_main_inventory_changed) later in the current tick.
|
|
---Raised if crafting was able to be cancelled.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.cancel_crafting)
|
|
---@param param LuaControl.cancel_crafting_param
|
|
cancel_crafting=function(param)end,
|
|
---Removes the arrow created by `set_gui_arrow`.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.clear_gui_arrow)
|
|
clear_gui_arrow=function()end,
|
|
---Remove all items from this entity.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.clear_items_inside)
|
|
clear_items_inside=function()end,
|
|
---**Note:** This will silently fail if personal logistics are not researched yet.
|
|
---
|
|
---**Events:**
|
|
--- * May raise [on_entity_logistic_slot_changed](https://lua-api.factorio.com/latest/events.html#on_entity_logistic_slot_changed) instantly.
|
|
---Raised if clearing of logistic slot was successful.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.clear_personal_logistic_slot)
|
|
---@param slot_index uint@The slot to clear.
|
|
clear_personal_logistic_slot=function(slot_index)end,
|
|
---Unselect any selected entity.
|
|
---
|
|
---**Events:**
|
|
--- * May raise [on_selected_entity_changed](https://lua-api.factorio.com/latest/events.html#on_selected_entity_changed) instantly.
|
|
---Raised if there is a currently selected entity.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.clear_selected_entity)
|
|
clear_selected_entity=function()end,
|
|
---**Note:** This will silently fail if the vehicle does not use logistics.
|
|
---
|
|
---**Events:**
|
|
--- * May raise [on_entity_logistic_slot_changed](https://lua-api.factorio.com/latest/events.html#on_entity_logistic_slot_changed) instantly.
|
|
---Raised if clearing of logistic slot was successful.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.clear_vehicle_logistic_slot)
|
|
---@param slot_index uint@The slot to clear.
|
|
clear_vehicle_logistic_slot=function(slot_index)end,
|
|
---Disable the flashlight.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.disable_flashlight)
|
|
disable_flashlight=function()end,
|
|
---Enable the flashlight.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.enable_flashlight)
|
|
enable_flashlight=function()end,
|
|
---Gets the entities that are part of the currently selected blueprint, regardless of it being in a blueprint book or picked from the blueprint library.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.get_blueprint_entities)
|
|
---@return BlueprintEntity[]?@Returns `nil` if there is no currently selected blueprint.
|
|
get_blueprint_entities=function()end,
|
|
---Gets the count of the given recipe that can be crafted.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.get_craftable_count)
|
|
---@param recipe string|LuaRecipe@The recipe.
|
|
---@return uint@The count that can be crafted.
|
|
get_craftable_count=function(recipe)end,
|
|
---Get an inventory belonging to this entity. This can be either the "main" inventory or some auxiliary one, like the module slots or logistic trash slots.
|
|
---
|
|
---**Note:** A given [defines.inventory](https://lua-api.factorio.com/latest/defines.html#defines.inventory) is only meaningful for the corresponding LuaObject type. EG: get_inventory(defines.inventory.character_main) is only meaningful if 'this' is a player character. You may get a value back but if the type of 'this' isn't the type referred to by the [defines.inventory](https://lua-api.factorio.com/latest/defines.html#defines.inventory) it's almost guaranteed to not be the inventory asked for.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.get_inventory)
|
|
---@param inventory defines.inventory
|
|
---@return LuaInventory?@The inventory or `nil` if none with the given index was found.
|
|
get_inventory=function(inventory)end,
|
|
---Get the number of all or some items in this entity.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.get_item_count)
|
|
---@param item string?@Prototype name of the item to count. If not specified, count all items.
|
|
---@return uint
|
|
get_item_count=function(item)end,
|
|
---Gets the main inventory for this character or player if this is a character or player.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.get_main_inventory)
|
|
---@return LuaInventory?@The inventory or `nil` if this entity is not a character or player.
|
|
get_main_inventory=function()end,
|
|
---Gets the parameters of a personal logistic request and auto-trash slot.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.get_personal_logistic_slot)
|
|
---@param slot_index uint@The slot to get.
|
|
---@return LogisticParameters@The logistic parameters. If personal logistics are not researched yet, their `name` will be `nil`.
|
|
get_personal_logistic_slot=function(slot_index)end,
|
|
---Gets the parameters of a vehicle logistic request and auto-trash slot. Only used on `spider-vehicle`.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.get_vehicle_logistic_slot)
|
|
---@param slot_index uint@The slot to get.
|
|
---@return LogisticParameters@The logistic parameters. If the vehicle does not use logistics, their `name` will be `nil`.
|
|
get_vehicle_logistic_slot=function(slot_index)end,
|
|
---Does this entity have any item inside it?
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.has_items_inside)
|
|
---@return boolean
|
|
has_items_inside=function()end,
|
|
---Insert items into this entity. This works the same way as inserters or shift-clicking: the "best" inventory is chosen automatically.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.insert)
|
|
---@param items ItemStackIdentification@The items to insert.
|
|
---@return uint@The number of items that were actually inserted.
|
|
insert=function(items)end,
|
|
---Returns whether the player is holding a blueprint. This takes both blueprint items as well as blueprint records from the blueprint library into account.
|
|
---
|
|
---Note that both this method and [LuaControl::get_blueprint_entities](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.get_blueprint_entities) refer to the currently selected blueprint, meaning a blueprint book with a selected blueprint will return the information as well.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.is_cursor_blueprint)
|
|
---@return boolean
|
|
is_cursor_blueprint=function()end,
|
|
---Returns whether the player is holding something in the cursor. It takes into account items from the blueprint library, as well as items and ghost cursor.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.is_cursor_empty)
|
|
---@return boolean
|
|
is_cursor_empty=function()end,
|
|
---Is the flashlight enabled.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.is_flashlight_enabled)
|
|
---@return boolean
|
|
is_flashlight_enabled=function()end,
|
|
---When `true` control adapter is a LuaPlayer object, `false` for entities including characters with players.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.is_player)
|
|
---@return boolean
|
|
is_player=function()end,
|
|
---Mines the given entity as if this player (or character) mined it.
|
|
---
|
|
---**Events:**
|
|
--- * May raise [on_player_mined_entity](https://lua-api.factorio.com/latest/events.html#on_player_mined_entity) instantly.
|
|
---Raised if mining is successful.
|
|
---
|
|
--- * May raise [on_player_mined_item](https://lua-api.factorio.com/latest/events.html#on_player_mined_item) instantly.
|
|
---Raised if mining is successful.
|
|
---
|
|
--- * May raise [on_pre_player_mined_item](https://lua-api.factorio.com/latest/events.html#on_pre_player_mined_item) instantly.
|
|
---Raised if mining is possible.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.mine_entity)
|
|
---@param entity LuaEntity@The entity to mine
|
|
---@param force boolean?@Forces mining the entity even if the items can't fit in the player.
|
|
---@return boolean@Whether the mining succeeded.
|
|
mine_entity=function(entity,force)end,
|
|
---Mines the given tile as if this player (or character) mined it.
|
|
---
|
|
---**Events:**
|
|
--- * May raise [on_player_mined_item](https://lua-api.factorio.com/latest/events.html#on_player_mined_item) instantly.
|
|
---Raised if mining is successful.
|
|
---
|
|
--- * May raise [on_player_mined_tile](https://lua-api.factorio.com/latest/events.html#on_player_mined_tile) instantly.
|
|
---Raised if mining is successful.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.mine_tile)
|
|
---@param tile LuaTile@The tile to mine.
|
|
---@return boolean@Whether the mining succeeded.
|
|
mine_tile=function(tile)end,
|
|
---Open the technology GUI and select a given technology.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.open_technology_gui)
|
|
---@param technology TechnologyIdentification?@The technology to select after opening the GUI.
|
|
open_technology_gui=function(technology)end,
|
|
---Remove items from this entity.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.remove_item)
|
|
---@param items ItemStackIdentification@The items to remove.
|
|
---@return uint@The number of items that were actually removed.
|
|
remove_item=function(items)end,
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.set_gui_arrow)
|
|
---@class LuaControl.set_gui_arrow_param
|
|
---Where to point to. This field determines what other fields are mandatory. May be `"nowhere"`, `"goal"`, `"entity_info"`, `"active_window"`, `"entity"`, `"position"`, `"crafting_queue"`, or `"item_stack"`.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.set_gui_arrow)
|
|
---@field type string
|
|
---Applies to **"entity"**: (required)
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.set_gui_arrow)
|
|
---@field entity LuaEntity
|
|
---Applies to **"position"**: (required)
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.set_gui_arrow)
|
|
---@field position MapPosition
|
|
---Applies to **"crafting_queue"**: (required)
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.set_gui_arrow)
|
|
---@field crafting_queueindex uint
|
|
---Applies to **"item_stack"**: (required)
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.set_gui_arrow)
|
|
---@field inventory_index defines.inventory
|
|
---Applies to **"item_stack"**: (required)
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.set_gui_arrow)
|
|
---@field item_stack_index uint
|
|
---Applies to **"item_stack"**: (required)
|
|
---May be either `"player"` or `"target"`.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.set_gui_arrow)
|
|
---@field source string
|
|
|
|
|
|
---Create an arrow which points at this entity. This is used in the tutorial. For examples, see `control.lua` in the campaign missions.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.set_gui_arrow)
|
|
---@param param LuaControl.set_gui_arrow_param
|
|
set_gui_arrow=function(param)end,
|
|
---Sets a personal logistic request and auto-trash slot to the given value.
|
|
---
|
|
---**Note:** This will silently fail if personal logistics are not researched yet.
|
|
---
|
|
---**Events:**
|
|
--- * May raise [on_entity_logistic_slot_changed](https://lua-api.factorio.com/latest/events.html#on_entity_logistic_slot_changed) instantly.
|
|
---Raised if setting of logistic slot was successful.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.set_personal_logistic_slot)
|
|
---@param slot_index uint@The slot to set.
|
|
---@param value LogisticParameters@The logistic request parameters.
|
|
---@return boolean@Whether the slot was set successfully. `false` if personal logistics are not researched yet.
|
|
set_personal_logistic_slot=function(slot_index,value)end,
|
|
---Sets a vehicle logistic request and auto-trash slot to the given value. Only used on `spider-vehicle`.
|
|
---
|
|
---**Events:**
|
|
--- * May raise [on_entity_logistic_slot_changed](https://lua-api.factorio.com/latest/events.html#on_entity_logistic_slot_changed) instantly.
|
|
---Raised if setting of logistic slot was successful.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.set_vehicle_logistic_slot)
|
|
---@param slot_index uint@The slot to set.
|
|
---@param value LogisticParameters@The logistic request parameters.
|
|
---@return boolean@Whether the slot was set successfully. `false` if the vehicle does not use logistics.
|
|
set_vehicle_logistic_slot=function(slot_index,value)end,
|
|
---Teleport the entity to a given position, possibly on another surface.
|
|
---
|
|
---**Note:** Some entities may not be teleported. For instance, transport belts won't allow teleportation and this method will always return `false` when used on any such entity.
|
|
---
|
|
---**Note:** You can also pass 1 or 2 numbers as the parameters and they will be used as relative teleport coordinates `'teleport(0, 1)'` to move the entity 1 tile positive y. `'teleport(4)'` to move the entity 4 tiles to the positive x.
|
|
---
|
|
---**Events:**
|
|
--- * May raise [on_player_changed_position](https://lua-api.factorio.com/latest/events.html#on_player_changed_position) instantly.
|
|
---Raised if the teleported entity is a player character.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.teleport)
|
|
---@param position MapPosition@Where to teleport to.
|
|
---@param surface SurfaceIdentification?@Surface to teleport to. If not given, will teleport to the entity's current surface. Only players, cars, and spidertrons can be teleported cross-surface.
|
|
---@return boolean@`true` if the entity was successfully teleported.
|
|
teleport=function(position,surface)end,
|
|
---Select an entity, as if by hovering the mouse above it.
|
|
---
|
|
---**Events:**
|
|
--- * May raise [on_selected_entity_changed](https://lua-api.factorio.com/latest/events.html#on_selected_entity_changed) instantly.
|
|
---Raised if there is an entity at the given position to select.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.update_selected_entity)
|
|
---@param position MapPosition@Position of the entity to select.
|
|
update_selected_entity=function(position)end,
|
|
}
|
|
|
|
|