set_ending_screen_data(message, file) | Setup the screen to be shown when the game is finished. |
print(message, color) | Print text to the chat console. |
clear_console() | Clear the chat console. |
get_goal_description() → LocalisedString | 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. |
disable_recipe_groups() | Disable recipe groups. |
enable_recipe_groups() | Enable recipe groups. |
disable_recipe_subgroups() | Disable recipe subgroups. |
enable_recipe_subgroups() | Enable recipe subgroups. |
print_entity_statistics(entities) | Print entity statistics to the player's console. |
unlock_achievement(name) | Unlock the achievements of the given player. |
clean_cursor() → boolean | Invokes the "clean cursor" action on the player as if the user pressed it. |
create_character(character) | Creates and attaches a character entity to this player. |
add_alert(entity, type) | Adds an alert to this player for the given entity of the given alert type. |
add_custom_alert(entity, icon, message, show_on_map) | Adds a custom alert to this player. |
remove_alert{entity=…, prototype=…, position=…, type=…, surface=…, icon=…, message=…} | Removes all alerts matching the given filters or if an empty filters table is given all alerts are removed. |
get_alerts{entity=…, prototype=…, position=…, type=…, surface=…} → dictionary uint → dictionary defines.alert_type → array of alert | Gets all alerts matching the given filters or if no filters are given all alerts are returned. |
mute_alert(alert_type) → boolean | Mutes alerts for the given alert category. |
unmute_alert(alert_type) → boolean | Unmutes alerts for the given alert category. |
is_alert_muted(alert_type) → boolean | If the given alert type is currently muted. |
enable_alert(alert_type) → boolean | Enables alerts for the given alert category. |
disable_alert(alert_type) → boolean | Disables alerts for the given alert category. |
is_alert_enabled(alert_type) → boolean | If the given alert type is currently enabled. |
pipette_entity(entity) → boolean | Invokes the "smart pipette" action on the player as if the user pressed it. |
can_place_entity{name=…, position=…, direction=…} → boolean | Checks if this player can build the give entity at the given location on the surface the player is on. |
can_build_from_cursor{position=…, direction=…, alt=…, terrain_building_size=…, skip_fog_of_war=…} → boolean | Checks if this player can build what ever is in the cursor on the surface the player is on. |
build_from_cursor{position=…, direction=…, alt=…, terrain_building_size=…, skip_fog_of_war=…} | Builds what ever is in the cursor on the surface the player is on. |
play_sound{path=…, position=…, volume_modifier=…} → boolean | Plays a sound for this player |
get_associated_characters() | The characters associated with this player. |
associate_character(character) | Associates a character with this player. |
disassociate_character(character) | Disassociates a character from this player. |
character :: LuaEntity [RW] | The character attached to this player, or nil if no character. |
index :: uint [R] | This player's index in LuaGameScript::players. |
gui :: LuaGui [R] | |
opened_self :: boolean [R] | true if the player opened itself. |
controller_type :: defines.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. |
chat_color :: Color [RW] | The color used when this player talks in game. |
name :: string [RW] | The player's username. |
tag :: string [RW] | The tag that is shown after the player in chat and on the map. |
connected :: boolean [R] | true if the player is currently connected to the game. |
admin :: boolean [RW] | true if the player is an admin. |
entity_copy_source :: LuaEntity [R] | The source entity used during entity settings copy-paste if any. |
afk_time :: uint [R] | How many ticks since the last action of this player |
online_time :: uint [R] | How many ticks did this player spend playing this save (all sessions combined) |
permission_group :: LuaPermissionGroup [RW] | The permission group this player is part of or nil if not part of any group. |
mod_settings [R] | |
ticks_to_respawn :: uint [RW] | The number of ticks until this player will respawn or nil if not waiting to respawn. |
display_resolution :: DisplayResolution [R] | The display resolution for this player. |
display_scale :: double [R] | The display scale for this player. |
blueprint_to_setup :: LuaItemStack [R] | The item stack containing a blueprint to be setup. |
spectator :: boolean [RW] | If true , zoom-to-world noise effect will be disabled and environmental sounds will be based
on zoom-to-world view instead of position of player's character. |
zoom :: double [W] | The player's zoom-level. |
valid :: boolean [R] | Is this object valid? |
help() → string | All methods, and properties that this object supports. |
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.
Setup the screen to be shown when the game is finished.
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.Disable recipe groups.
Enable recipe groups.
Disable recipe subgroups.
Enable recipe subgroups.
Print entity statistics to the player's console.
Unlock the achievements of the given player. This has any effect only when this is the local player, the achievement isn't unlocked so far and the achievement is of the type "achievement".
Invokes the "clean cursor" action on the player as if the user pressed it.
Creates and attaches a character entity to this player.
Adds an alert to this player for the given entity of the given alert type.
Adds a custom alert to this player.
Removes all alerts matching the given filters or if an empty filters table is given all alerts are removed.
Gets all alerts matching the given filters or if no filters are given all alerts are returned.
A mapping of surface index to an array of arrays of alerts indexed by the alert type. An alert is a table:
Mutes alerts for the given alert category.
Unmutes alerts for the given alert category.
Enables alerts for the given alert category.
Disables alerts for the given alert category.
Invokes the "smart pipette" action on the player as if the user pressed it.
Checks if this player can build the give entity at the given location on the surface the player is on.
Checks if this player can build what ever is in the cursor on the surface the player is on.
Builds what ever is in the cursor on the surface the player is on.
The characters associated with this player.
Associates a character with this player.
Disassociates a character from this player.
This is functionally the same as setting LuaEntity::associated_player to nil
.
The character attached to this player, or nil
if no character.
nil
when the player is disconnected (see LuaPlayer::connected).
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 color used when this player talks in game.
The player's username.
The tag that is shown after the player in chat and on the map.
true
if the player is currently connected to the game.
true
if the player is an admin.
The source entity used during entity settings copy-paste if any.
nil
if there isn't currently a source entity.
How many ticks since the last action of this player
How many ticks did this player spend playing this save (all sessions combined)
The permission group this player is part of or nil
if not part of any group.
The number of ticks until this player will respawn or nil
if not waiting to respawn.
nil
to immediately respawn the player.The display resolution for this player.
The display scale for this player.
The item stack containing a blueprint to be setup.
If true
, zoom-to-world noise effect will be disabled and environmental sounds will be based
on zoom-to-world view instead of position of player's character.
The player's zoom-level.