get_inventory(inventory) → LuaInventory | Get an inventory belonging to this entity. |
get_quickbar() → LuaInventory | Get the quickbar belonging to this entity if any. |
can_insert(items) → boolean | Can at least some items be inserted? |
insert(items) → uint | Insert items into this entity. |
set_gui_arrow{type=…} | Create an arrow which points at this entity. |
clear_gui_arrow() | Removes the arrow created by set_gui_arrow . |
get_item_count(item) → uint | Get the number of all or some items in this entity. |
has_items_inside() → boolean | Does this entity have any item inside it? |
can_reach_entity(entity) → boolean | Can a given entity be opened or accessed? |
clear_items_inside() | Remove all items from this entity. |
remove_item(items) → uint | Remove items from this entity. |
teleport(position, surface) → boolean | Teleport the entity to a given position, possibly on another surface. |
update_selected_entity(position) | Select an entity, as if by hovering the mouse above it. |
clear_selected_entity() | Unselect any selected entity. |
disable_flashlight() | Disable the flashlight. |
enable_flashlight() | Enable the flashlight. |
get_craftable_count(recipe) → uint | Gets the count of the given recipe that can be crafted. |
begin_crafting{count=…, recipe=…, silent=…} → uint | Begins crafting the given count of the given recipe |
cancel_crafting(options) | Cancels crafting the given count of the given crafting queue index |
surface :: LuaSurface [R] | The surface this entity is currently on. |
position :: Position [R] | Current position of the entity. |
vehicle :: LuaEntity [R] | The vehicle the player is currently sitting in; nil if none. |
force :: LuaForce [R] | The force of this entity. |
selected :: LuaEntity [R] | The currently selected entity; nil if none. |
opened :: LuaEntity [R] | The entity whose GUI the player currently has open; nil if none. |
crafting_queue_size :: uint [R] | Size of the crafting queue. |
walking_state [R] | Current walking state. |
riding_state [R] | Current riding state of this car or the vehicle this player is riding in. |
mining_state [R] | Current mining state. |
cursor_stack :: LuaItemStack [R] | The player's cursor stack. |
driving :: boolean [R] | true if the player is in a vehicle. |
crafting_queue :: array of CraftingQueueItem [R] | Gets the current crafting queue items. |
cheat_mode :: boolean [R] | When true hand crafting is free and instant
|
character_crafting_speed_modifier :: double [R] | |
character_mining_speed_modifier :: double [R] | |
character_running_speed_modifier :: double [R] | |
character_build_distance_bonus :: uint [R] | |
character_item_drop_distance_bonus :: uint [R] | |
character_reach_distance_bonus :: uint [R] | |
character_resource_reach_distance_bonus :: uint [R] | |
character_item_pickup_distance_bonus :: uint [R] | |
character_loot_pickup_distance_bonus :: uint [R] | |
quickbar_count_bonus :: uint [R] | |
character_inventory_slots_bonus :: uint [R] | |
character_logistic_slot_count_bonus :: uint [R] | |
character_trash_slot_count_bonus :: uint [R] | |
character_maximum_following_robot_count_bonus :: uint [R] | |
character_health_bonus :: float [R] | |
auto_trash_filters :: dictionary string → uint [R] | The auto-trash filters. |
This is an abstract base class containing the common functionality between LuaPlayer and character entities (see LuaEntity). When accessing these members through a LuaEntity, it must refer to a character entity.
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.
nil
if this entity doesn't have an inventory with the given index.Get the quickbar belonging to this entity if any. This works for both the character entity (the little guy running around) and the god controller (sandbox, character-less players).
nil
if this entity doesn't have a quickbar.Can at least some items be inserted?
true
if at least a part of the given items could be inserted into this inventory.Insert items into this entity. This works the same way as inserters or shift-clicking: the "best" inventory is chosen automatically.
Create an arrow which points at this entity. This is used in the tutorial. For examples, see control.lua
in the campaign missions.
"nowhere"
, "goal"
, "entity_info"
, "active_window"
, "entity"
, "position"
,
"crafting_queue"
, or "item_stack"
.type
-specific parameters Removes the arrow created by set_gui_arrow
.
Get the number of all or some items in this entity.
Does this entity have any item inside it?
Remove all items from this entity.
Remove items from this entity.
Teleport the entity to a given position, possibly on another surface.
true
when the entity was successfully teleported.false
when used
on any such entity.Select an entity, as if by hovering the mouse above it.
Unselect any selected entity.
Disable the flashlight.
Enable the flashlight.
Begins crafting the given count of the given recipe
The surface this entity is currently on.
Current position of the entity.
The vehicle the player is currently sitting in; nil
if none.
The force of this entity.
The currently selected entity; nil
if none.
The entity whose GUI the player currently has open; nil
if none.
Size of the crafting queue.
Current walking state.
It is a table with two fields:
false
, the player is currently not walking; otherwise it's going somewhere
game.player.walking_state = {walking = true, direction = defines.direction.north}
Current riding state of this car or the vehicle this player is riding in.
It is a table with two fields:
The player's cursor stack.
true
if the player is in a vehicle. Writing to this attribute puts the player in or out of a
vehicle.
When true
hand crafting is free and instant
The auto-trash filters. The keys are item prototype names, the values are the slot values.
game.player.auto_trash_filters = {["iron-plate"] = 20, ["copper-cable"] = 42}