set_ending_screen_data(message, file) | Setup the screen to be shown when the game is finished. |
print(message) | Print text to the chat console. |
clear_console() | Clear the chat console. |
get_goal_description() → string | Get the current goal description, as a localised string. |
set_goal_description(text, only_update) | Set the text in the goal window (top left). |
set_controller{type=…, character=…} | Set the controller type of the player. |
has_game_view() | Does the player have a game view? |
build_from_cursor() → boolean | Build the entity in the player's cursor (hand). |
rotate_for_build() → boolean | Rotate the entity in cursor before building. |
disable_recipe_groups() | Disable recipe groups. |
print_entity_statistics(entities) | Print entity statistics to the player's console. |
get_inventory(inventory) → LuaInventory | Get an inventory belonging to this entity. |
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. |
character :: LuaEntity [RW] | The character attached to this player, or nil if no character. |
index :: uint [R] | This player's index in LuaGameScript::players. |
force :: string or LuaForce [RW] | The force of this player. |
gui :: LuaGui [R] | |
opened_self :: boolean [R] | true if the player opened itself. |
controller_type :: controllers [R] | |
game_view_settings :: GameViewSettings [RW] | The player's game view settings. |
minimap_enabled :: boolean [RW] | true if the minimap is visible. |
color :: Color [RW] | The colour associated with the player. |
name :: string [RW] | The player's username. |
connected :: boolean [R] | true if the player is currently connected to the game. |
cursor_position :: Position [W] | Position of the player's mouse cursor. |
zoom :: double [W] | The player's zoom-level. |
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. |
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 [RW] | Current walking state. |
riding_state [RW] | Current riding state of the vehicle the player is currently in. |
mining_state [RW] | Current mining state. |
cursor_stack :: LuaItemStack [R] | The player's cursor stack. |
driving :: boolean [RW] | true if the player is in a vehicle. |
A player in the game. Pay attention that a player may or may not have a character, which is the LuaEntity of the little guy running around the world doing things.
Print text to the chat console.
Clear the chat console.
Get the current goal description, as a localised string.
Set the text in the goal window (top left).
Set the controller type of the player.
type
is
defines.controllers.character, ignored otherwise.Does the player have a game view?
Build the entity in the player's cursor (hand). The effect is the same as if the player clicked the build button (left mouse).
true
if the building was successfull.Rotate the entity in cursor before building.
true
if the rotation was successful.Disable recipe groups.
Print entity statistics to the player's console.
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.
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?
Can a given entity be opened or accessed?
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.
The character attached to this player, or nil
if no character.
This player's index in LuaGameScript::players.
true
if the player opened itself. I.e. if they opened the character or god-controller GUI.
The player's game view settings.
true
if the minimap is visible.
The colour associated with the player. This will be used to tint the player's character as well as their buildings and vehicles.
The player's username.
true
if the player is currently connected to the game.
Position of the player's mouse cursor. This is in screen coordinates.
The player's zoom-level.
The surface this entity is currently on.
Current position of the entity.
The vehicle the player is currently sitting in; nil
if none.
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 somewheregame.local_player.walking_state = {walking = true, direction = defines.direction.north}
Current riding state of the vehicle the player is currently 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.