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.
LuaControlLuaSurfaceunknownfalseThe surface this player's physical controller is on.
uint32unknownfalseUnique ID associated with the surface this player's physical controller is currently on.
MapPositionunknownfalseThe current position of this player's physical controller.
LuaEntityunknowntrueThe current vehicle of this player's physical controller.
LuaEntityLuaEntitytrueThe character attached to this player, if any. Returns nil when the player is disconnected (see LuaPlayer::connected).
LuaEntityunknowntrueWhen in a cutscene; the character this player would be using once the cutscene is over, if any. Returns nil when the player is disconnected (see LuaPlayer::connected).
uint32unknownfalseThis player's index in LuaGameScript::players (unique ID). It is assigned when a player is created, and remains so (even when the player is not connected) until the player is irreversibly removed. Indexes of removed players can be reused.
LuaGuiunknownfalsebooleanunknownfalsetrue if the player opened itself. I.e. if they opened the character or god-controller GUI.
defines.controllersunknownfalsedefines.controllersunknownfalseThe player's "physical" controller. When a player is in the remote controller, this specifies the controller they will return to. When the player is not in the remote controller, this is equivalent to LuaPlayer::controller_type.
defines.controllersunknowntrueThe stashed controller type, if any. This is mainly useful when a player is in the map editor.
Array<LuaEntity>Array<LuaEntity>trueAll SpiderVehicles currently selected by the player, if they are holding a spidertron remote.
doubledoublefalseThe current player controller's zoom level. Must be positive. The baseline zoom level is 1. Values greater than 1 will zoom in closer to the world and values between 0 and 1 will zoom out away from the world.
Writing values outside the current zoom limits is always valid, but read values will always be clamped to the range defined by LuaPlayer::zoom_limits.
ZoomLimitsZoomLimitsfalseThe player's current controller's zoom limits.
Reading this field creates a copy, so modifying the returned table's fields directly will not alter the player's zoom limits. To change the zoom limits for the player's current controller, set the entire field to the desired ZoomLimits table.
Zoom limits are defined and remembered per controller type. If you set the zoom limits of the character controller, then every time the player uses the character controller, it will remember and use the zoom limits previously set. However, other controller types will not use the character controller zoom limits; each controller type must have its zoom limits defined separately.
To set the zoom limits of ANY controller type, not just the currently active one, use LuaPlayer::set_zoom_limits.
LuaEntityLuaEntitytrueThe entity being centered on in remote view.
When writing, the player will be switched to remote view (if not already in it) and centered on the given entity.
GameViewSettingsGameViewSettingsfalseThe player's game view settings.
booleanbooleanfalsetrue if the minimap is visible.
ColorColorfalseThe color associated with the player. This will be used to tint the player's character as well as their buildings and vehicles.
ColorColorfalseThe color used when this player talks in game.
stringunknownfalseThe player's username.
stringstringfalseThe tag that is shown after the player in chat, on the map and above multiplayer selection rectangles.
booleanunknownfalsetrue if the player is currently connected to the game.
booleanbooleanfalsetrue if the player is an admin.
Trying to change player admin status from the console when you aren't an admin does nothing.
LuaEntityunknowntrueThe source entity used during entity settings copy-paste, if any.
uint32unknownfalseHow many ticks since the last action of this player.
uint32unknownfalseHow many ticks did this player spend playing this save (all sessions combined).
uint32unknownfalseAt what tick this player was last online.
LuaPermissionGroupLuaPermissionGrouptrueThe permission group this player is part of, if any.
LuaCustomTable<string, ModSetting>unknownfalseThe current per-player settings for the this player, indexed by prototype name. Returns the same structure as LuaSettings::get_player_settings. This table becomes invalid if its associated player does.
Even though this attribute is marked as read-only, individual settings can be changed by overwriting their ModSetting table. Mods can only change their own settings. Using the in-game console, all player settings can be changed.
uint32uint32trueThe number of ticks until this player will respawn. nil if this player is not waiting to respawn.
Set to nil to immediately respawn the player.
Set to any positive value to trigger the respawn state for this player.
DisplayResolutionunknownfalseThe display resolution for this player.
During on_player_created, this attribute will always return a resolution of {width=1920, height=1080}. To get the actual resolution, listen to the on_player_display_resolution_changed event raised shortly afterwards.
doubleunknownfalseThe display scale for this player.
During on_player_created, this attribute will always return a scale of 1. To get the actual scale, listen to the on_player_display_scale_changed event raised shortly afterwards.
doubleunknownfalseThe display density scale for this player. The display density scale is the factor of LuaPlayer::display_scale that is determined by the physical DPI of the screen that Factorio is running on. In most cases, the default value is 1. If the player is playing on a high-density display, this value may be 2 or greater.
During on_player_created, this attribute will always return a scale of 1. To get the actual scale, listen to the on_player_display_density_scale_changed event raised shortly afterwards.
stringunknownfalseThe active locale for this player.
During on_player_created, this attribute will be en. To get the actual value, listen to the on_player_locale_changed event raised shortly afterwards.
LuaItemStackunknownfalseThe item stack containing a blueprint to be setup.
Array<LuaRecord>unknownfalseRecords contained in the player's blueprint library.
defines.render_modeunknownfalseThe render mode of the player, like map or zoom to world.
defines.input_methodunknownfalseThe input method of the player, mouse and keyboard or game controller
booleanbooleanfalseIf 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.
booleanbooleanfalseIf true, circle and name of given player is rendered on the map/chart.
booleanbooleanfalseIf items not included in this map editor infinity inventory filters should be removed.
Array<InfinityInventoryFilter>Array<InfinityInventoryFilter>falseThe filters for this map editor infinity inventory settings.
booleanunknownfalseIf the main inventory will be auto sorted.
ItemStackLocationItemStackLocationtrueThe original location of the item in the cursor, marked with a hand. nil if the cursor stack is empty. When writing, the specified inventory slot must be empty and the cursor stack must not be empty.
booleanbooleanfalseReturns true if the current item stack in cursor will be destroyed after clearing the cursor. Manually putting it into inventory still preserves the item. If the cursor stack is not one of the supported types (blueprint, blueprint-book, deconstruction-planner, upgrade-planner), write operation will be silently ignored.
LuaUndoRedoStackunknownfalseThe undo and redo stack for this player.
DragTargetunknowntrueThe wire drag target for this player, if any.
unknownMapViewSettingsfalseThe player's map view settings. To write to this, use a table containing the fields that should be changed.
booleanunknownfalseIs this object valid? This Lua object holds a reference to an object within the game engine. It is possible that the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the object becomes invalid, i.e. this attribute will be false. Mods are advised to check for object validity if any change to the game state might have occurred between the creation of the Lua object and its access.
stringunknownfalseThe class name of this object. Available even when valid is false. For LuaStruct objects it may also be suffixed with a dotted path to a member of the struct.
LuaPlayer.set_ending_screen_data(message: LocalisedString, file?: string)
player.set_ending_screen_data(message, file)
takes_table: falsetable_optional: falseSetup the screen to be shown when the game is finished.
message: LocalisedString — Message to be shown.file?: string — Path to image to be shown.LuaPlayer.print(message: LocalisedString, print_settings?: PrintSettings)
player.print(message, print_settings)
takes_table: falsetable_optional: falsePrint text to the chat console.
By default, messages that are identical to a message sent in the last 60 ticks are not printed again.
message: LocalisedStringprint_settings?: PrintSettingsLuaPlayer.clear_console()
player.clear_console()
takes_table: falsetable_optional: falseClear the chat console.
LuaPlayer.get_goal_description() -> LocalisedString
player.get_goal_description()
takes_table: falsetable_optional: falseGet the current goal description, as a localised string.
LocalisedStringLuaPlayer.set_goal_description(text?: LocalisedString, only_update?: boolean)
player.set_goal_description()
takes_table: falsetable_optional: falseSet the text in the goal window (top left).
text?: LocalisedString — The text to display. Lines can be delimited with \n. Passing an empty string or omitting this parameter entirely will make the goal window disappear.only_update?: boolean — When true, won't play the "goal updated" sound.LuaPlayer.set_controller{ type: defines.controllers, character?: LuaEntity, waypoints?: Array<CutsceneWaypoint>, start_position?: MapPosition, start_zoom?: double, final_transition_time?: uint32, chart_mode_cutoff?: double, position?: MapPosition, surface?: SurfaceIdentification }
player.set_controller{ type=type }
takes_table: truetable_optional: falseSet the controller type of the player.
Setting a player to defines.controllers.editor auto promotes the player to admin and enables cheat mode. Setting a player to defines.controllers.editor also requires the calling player be an admin.
type: defines.controllers — Which controller to use.character?: LuaEntity — Entity to control. Mandatory when type is defines.controllers.character, ignored otherwise.waypoints?: Array<CutsceneWaypoint> — List of waypoints for the cutscene controller. This parameter is mandatory when type is defines.controllers.cutscene.start_position?: MapPosition — If specified and type is defines.controllers.cutscene, the cutscene will start at this position. If not given the start position will be the player position.start_zoom?: double — If specified and type is defines.controllers.cutscene, the cutscene will start at this zoom level. If not given the start zoom will be the player's zoom.final_transition_time?: uint32 — If specified and type is defines.controllers.cutscene, it is the time in ticks it will take for the camera to pan from the final waypoint back to the starting position. If not given the camera will not pan back to the start position/zoom.chart_mode_cutoff?: double — If specified and type is defines.controllers.cutscene, the game will switch to chart-mode (map zoomed out) rendering when the zoom level is less than this value.position?: MapPosition — If specified and type is defines.controllers.remote, the position the remote controller will be centered on.surface?: SurfaceIdentification — If specified and type is defines.controllers.remote, the surface the remote controller will be put on.LuaPlayer.drag_wire{ position: MapPosition } -> boolean
player.drag_wire{ position=position }
takes_table: truetable_optional: falseStart/end wire dragging at the specified location, wire type is based on the cursor contents
position: MapPosition — Position at which cursor was clicked. Used only to decide which side of arithmetic combinator, decider combinator or power switch is to be connected. Entity itself to be connected is based on the player's selected entity.boolean — true if the action did somethingLuaPlayer.disable_recipe_groups()
player.disable_recipe_groups()
takes_table: falsetable_optional: falseDisable recipe groups.
LuaPlayer.enable_recipe_groups()
player.enable_recipe_groups()
takes_table: falsetable_optional: falseEnable recipe groups.
LuaPlayer.disable_recipe_subgroups()
player.disable_recipe_subgroups()
takes_table: falsetable_optional: falseDisable recipe subgroups.
LuaPlayer.enable_recipe_subgroups()
player.enable_recipe_subgroups()
takes_table: falsetable_optional: falseEnable recipe subgroups.
LuaPlayer.print_entity_statistics(entities?: Array<EntityWithQualityID>)
player.print_entity_statistics()
takes_table: falsetable_optional: falsePrint entity statistics to the player's console.
entities?: Array<EntityWithQualityID> — Entity prototypes to get statistics for. If not specified or empty, display statistics for all entities.LuaPlayer.print_robot_jobs()
player.print_robot_jobs()
takes_table: falsetable_optional: falsePrint construction robot job counts to the player's console.
LuaPlayer.print_lua_object_statistics()
player.print_lua_object_statistics()
takes_table: falsetable_optional: falsePrint LuaObject counts per mod.
LuaPlayer.unlock_achievement(name: string)
player.unlock_achievement(name)
takes_table: falsetable_optional: falseUnlock 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".
name: string — name of the achievement to unlockLuaPlayer.clear_cursor() -> boolean
player.clear_cursor()
takes_table: falsetable_optional: falseInvokes the "clear cursor" action on the player as if the user pressed it.
boolean — Whether the cursor is now empty.LuaPlayer.create_character(character?: EntityWithQualityID) -> boolean
player.create_character()
takes_table: falsetable_optional: falseCreates and attaches a character entity to this player.
The player must not have a character already connected and must be online (see LuaPlayer::connected).
character?: EntityWithQualityID — The character to create else the default is used.boolean — Whether the character was created.LuaPlayer.add_alert(entity: LuaEntity, type: defines.alert_type)
player.add_alert(entity, type)
takes_table: falsetable_optional: falseAdds an alert to this player for the given entity of the given alert type.
entity: LuaEntitytype: defines.alert_typeLuaPlayer.add_custom_alert(entity: LuaEntity, icon: SignalID, message: LocalisedString, show_on_map: boolean)
player.add_custom_alert(entity, icon, message, true)
takes_table: falsetable_optional: falseAdds a custom alert to this player.
entity: LuaEntity — If the alert is clicked, the map will open at the position of this entity.icon: SignalIDmessage: LocalisedStringshow_on_map: booleanLuaPlayer.remove_alert{ entity?: LuaEntity, prototype?: EntityID, position?: MapPosition, type?: defines.alert_type, surface?: SurfaceIdentification, icon?: SignalID, message?: LocalisedString }
player.remove_alert{ entity=entity }
takes_table: truetable_optional: falseRemoves all alerts matching the given filters or if an empty filters table is given all alerts are removed.
entity?: LuaEntityprototype?: EntityIDposition?: MapPositiontype?: defines.alert_typesurface?: SurfaceIdentificationicon?: SignalIDmessage?: LocalisedStringLuaPlayer.get_alerts{ entity?: LuaEntity, prototype?: LuaEntityPrototype, position?: MapPosition, type?: defines.alert_type, surface?: SurfaceIdentification } -> Dict<uint32, Dict<defines.alert_type, Array<Alert>>>
player.get_alerts{ entity=entity }
takes_table: truetable_optional: falseGet all alerts matching the given filters, or all alerts if no filters are given.
entity?: LuaEntityprototype?: LuaEntityPrototypeposition?: MapPositiontype?: defines.alert_typesurface?: SurfaceIdentificationDict<uint32, Dict<defines.alert_type, Array<Alert>>> — A mapping of surface index to an array of arrays of alerts indexed by the alert type.LuaPlayer.mute_alert(alert_type: defines.alert_type) -> boolean
player.mute_alert(alert_type)
takes_table: falsetable_optional: falseMutes alerts for the given alert category.
alert_type: defines.alert_typeboolean — Whether the alert type was muted (false if it was already muted).LuaPlayer.unmute_alert(alert_type: defines.alert_type) -> boolean
player.unmute_alert(alert_type)
takes_table: falsetable_optional: falseUnmutes alerts for the given alert category.
alert_type: defines.alert_typeboolean — Whether the alert type was unmuted (false if it was wasn't muted).LuaPlayer.is_alert_muted(alert_type: defines.alert_type) -> boolean
player.is_alert_muted(alert_type)
takes_table: falsetable_optional: falseIf the given alert type is currently muted.
alert_type: defines.alert_typebooleanLuaPlayer.enable_alert(alert_type: defines.alert_type) -> boolean
player.enable_alert(alert_type)
takes_table: falsetable_optional: falseEnables alerts for the given alert category.
alert_type: defines.alert_typeboolean — Whether the alert type was enabled (false if it was already enabled).LuaPlayer.disable_alert(alert_type: defines.alert_type) -> boolean
player.disable_alert(alert_type)
takes_table: falsetable_optional: falseDisables alerts for the given alert category.
alert_type: defines.alert_typeboolean — Whether the alert type was disabled (false if it was already disabled).LuaPlayer.is_alert_enabled(alert_type: defines.alert_type) -> boolean
player.is_alert_enabled(alert_type)
takes_table: falsetable_optional: falseIf the given alert type is currently enabled.
alert_type: defines.alert_typebooleanLuaPlayer.add_pin{ label?: string, preview_distance?: uint16, always_visible?: boolean, entity?: LuaEntity, player?: PlayerIdentification, surface?: SurfaceIdentification, position?: MapPosition }
player.add_pin{ label=label }
takes_table: truetable_optional: falseAdds a pin to this player for the given pin specification. Either entity, player, or surface and position must be defined.
label?: stringpreview_distance?: uint16 — Defaults to 16.always_visible?: boolean — Defaults to true.entity?: LuaEntity — The entity to pin.player?: PlayerIdentification — The player to pin.surface?: SurfaceIdentification — The surface to create the pin on.position?: MapPosition — Where to create the pin. Required when surface is defined.LuaPlayer.pipette_entity(entity: EntityWithQualityID, allow_ghost?: boolean) -> boolean
player.pipette_entity(entity, true)
takes_table: falsetable_optional: falseInvokes the "smart pipette" action on the player as if the user pressed it. This method is deprecated in favor of LuaPlayer::pipette and should not be used.
entity: EntityWithQualityIDallow_ghost?: boolean — Defaults to false.boolean — Whether the smart pipette found something to place.LuaPlayer.pipette(id: PipetteID, quality?: QualityID, allow_ghost?: boolean) -> boolean
player.pipette(id, quality)
takes_table: falsetable_optional: falseInvokes the "smart pipette" action on the player as if the user pressed it.
id: PipetteIDquality?: QualityIDallow_ghost?: boolean — Defaults to false.boolean — Whether the smart pipette found something to put into the cursor.LuaPlayer.can_build_from_cursor{ position: MapPosition, direction?: defines.direction, flip_horizontal?: boolean, flip_vertical?: boolean, build_mode?: defines.build_mode, terrain_building_size?: uint32, skip_fog_of_war?: boolean } -> boolean
player.can_build_from_cursor{ position=position }
takes_table: truetable_optional: falseChecks if this player can build what ever is in the cursor on the surface the player is on.
position: MapPosition — Where the entity would be placeddirection?: defines.direction — Direction the entity would be placedflip_horizontal?: boolean — Whether to flip the blueprint horizontally. Defaults to false.flip_vertical?: boolean — Whether to flip the blueprint vertically. Defaults to false.build_mode?: defines.build_mode — Which build mode should be used instead of normal build. Defaults to defines.build_mode.normal.terrain_building_size?: uint32 — The size for building terrain if building terrain. Defaults to 2.skip_fog_of_war?: boolean — If chunks covered by fog-of-war are skipped. Defaults to false.booleanLuaPlayer.build_from_cursor{ position: MapPosition, direction?: defines.direction, mirror?: boolean, flip_horizontal?: boolean, flip_vertical?: boolean, build_mode?: defines.build_mode, terrain_building_size?: uint32, skip_fog_of_war?: boolean }
player.build_from_cursor{ position=position }
takes_table: truetable_optional: falseBuilds whatever is in the cursor on the surface the player is on. The cursor stack will automatically be reduced as if the player built normally.
position: MapPosition — Where the entity would be placeddirection?: defines.direction — Direction the entity would be placedmirror?: boolean — Whether to mirror the entityflip_horizontal?: boolean — Whether to flip the blueprint horizontally. Defaults to false.flip_vertical?: boolean — Whether to flip the blueprint vertically. Defaults to false.build_mode?: defines.build_mode — Which build mode should be used instead of normal build. Defaults to defines.build_mode.normal.terrain_building_size?: uint32 — The size for building terrain if building terrain. Defaults to 2.skip_fog_of_war?: boolean — If chunks covered by fog-of-war are skipped. Defaults to false.LuaPlayer.clear_inventory_highlights()
player.clear_inventory_highlights()
takes_table: falsetable_optional: falseClears the blinking of the inventory based on insertion of items
LuaPlayer.use_from_cursor(position: MapPosition)
player.use_from_cursor(position)
takes_table: falsetable_optional: falseUses the current item in the cursor if it's a capsule or does nothing if not.
position: MapPosition — Where the item would be used.LuaPlayer.play_sound(sound_specification: PlaySoundSpecification)
player.play_sound(sound_specification)
takes_table: falsetable_optional: falsePlay a sound for this player.
The sound is not played if its location is not charted for this player.
sound_specification: PlaySoundSpecification — The sound to play.LuaPlayer.get_associated_characters() -> Array<LuaEntity>
player.get_associated_characters()
takes_table: falsetable_optional: falseThe characters associated with this player.
The array will always be empty when the player is disconnected (see LuaPlayer::connected) regardless of there being associated characters.
Characters associated with this player will be logged off when this player disconnects but are not controlled by any player.
Array<LuaEntity>LuaPlayer.associate_character(character: LuaEntity)
player.associate_character(character)
takes_table: falsetable_optional: falseAssociates a character with this player.
The character must not be connected to any controller.
If this player is currently disconnected (see LuaPlayer::connected) the character will be immediately "logged off".
See LuaPlayer::get_associated_characters for more information.
character: LuaEntity — The character entity.LuaPlayer.disassociate_character(character: LuaEntity)
player.disassociate_character(character)
takes_table: falsetable_optional: falseDisassociates a character from this player. This is functionally the same as setting LuaEntity::associated_player to nil.
See LuaPlayer::get_associated_characters for more information.
character: LuaEntity — The character entityLuaPlayer.swap_characters(player: PlayerIdentification) -> boolean
player.swap_characters(player)
takes_table: falsetable_optional: falseSwaps this player's character with another player's character.
player: PlayerIdentification — The player to swap characters with.boolean — true if the swap was successful.LuaPlayer.create_local_flying_text{ text: LocalisedString, position?: MapPosition, surface?: SurfaceIdentification, create_at_cursor?: boolean, color?: Color, time_to_live?: uint32, speed?: double }
player.create_local_flying_text{ text=text }
takes_table: truetable_optional: falseSpawn flying text that is only visible to this player. Either position or create_at_cursor are required. When create_at_cursor is true, all parameters other than text are ignored.
If no custom speed is set and the text is longer than 25 characters, its time_to_live and speed are dynamically adjusted to give the player more time to read it.
Local flying text is not saved, which means it will disappear after a save/load-cycle.
text: LocalisedString — The flying text to show.position?: MapPosition — The location on the map at which to show the flying text.surface?: SurfaceIdentification — The surface which this text will be shown on. Defaults to player surface.create_at_cursor?: boolean — If true, the flying text is created at the player's cursor. Defaults to false.color?: Color — The color of the flying text. Defaults to white text.time_to_live?: uint32 — The amount of ticks that the flying text will be shown for. Defaults to 80.speed?: double — The speed at which the text rises upwards in tiles/second. Can't be a negative value.LuaPlayer.clear_local_flying_texts()
player.clear_local_flying_texts()
takes_table: falsetable_optional: falseClear any active flying texts for this player.
LuaPlayer.get_quick_bar_slot(index: uint32) -> ItemFilter?
player.get_quick_bar_slot(index)
takes_table: falsetable_optional: falseGets the quick bar filter for the given slot or nil.
index: uint32 — The slot index. 1 for the first slot of page one, 2 for slot two of page one, 11 for the first slot of page 2, etc.ItemFilter?LuaPlayer.set_quick_bar_slot(index: uint32, filter: LuaItemStack | ItemWithQualityID | nil)
player.set_quick_bar_slot(index, filter)
takes_table: falsetable_optional: falseSets the quick bar filter for the given slot. If a LuaItemStack is provided, the slot will be set to that particular item instance if it has extra data, for example a specific blueprint or spidertron remote. Otherwise, it will be set to all items of that prototype, for example iron plates.
index: uint32 — The slot index. 1 for the first slot of page one, 2 for slot two of page one, 11 for the first slot of page 2, etc.filter: LuaItemStack | ItemWithQualityID | nil — The filter or nil to clear it.LuaPlayer.get_active_quick_bar_page(index: uint32) -> uint8?
player.get_active_quick_bar_page(index)
takes_table: falsetable_optional: falseGets which quick bar page is being used for the given screen page or nil if not known.
index: uint32 — The screen page. Index 1 is the top row in the gui. Index can go beyond the visible number of bars on the screen to account for the interface config setting change.uint8?LuaPlayer.set_active_quick_bar_page(screen_index: uint32, page_index: uint32)
player.set_active_quick_bar_page(screen_index, page_index)
takes_table: falsetable_optional: falseSets which quick bar page is being used for the given screen page.
screen_index: uint32 — The screen page. Index 1 is the top row in the gui. Index can go beyond the visible number of bars on the screen to account for the interface config setting change.page_index: uint32 — The new quick bar page.LuaPlayer.jump_to_cutscene_waypoint(waypoint_index: uint32)
player.jump_to_cutscene_waypoint(waypoint_index)
takes_table: falsetable_optional: falseJump to the specified cutscene waypoint. Only works when the player is viewing a cutscene.
waypoint_index: uint32LuaPlayer.exit_cutscene()
player.exit_cutscene()
takes_table: falsetable_optional: falseExit the current cutscene. Errors if not in a cutscene.
LuaPlayer.exit_remote_view()
player.exit_remote_view()
takes_table: falsetable_optional: falseExit remote view if possible. Exiting will fail if the player is in a rocket or in a platform.
LuaPlayer.is_shortcut_toggled(prototype_name: string) -> boolean
player.is_shortcut_toggled(prototype_name)
takes_table: falsetable_optional: falseIs a custom Lua shortcut currently toggled?
prototype_name: string — Prototype name of the custom shortcut.booleanLuaPlayer.is_shortcut_available(prototype_name: string) -> boolean
player.is_shortcut_available(prototype_name)
takes_table: falsetable_optional: falseIs a custom Lua shortcut currently available?
prototype_name: string — Prototype name of the custom shortcut.booleanLuaPlayer.set_shortcut_toggled(prototype_name: string, toggled: boolean)
player.set_shortcut_toggled(prototype_name, true)
takes_table: falsetable_optional: falseToggle or untoggle a custom Lua shortcut
prototype_name: string — Prototype name of the custom shortcut.toggled: booleanLuaPlayer.set_shortcut_available(prototype_name: string, available: boolean)
player.set_shortcut_available(prototype_name, true)
takes_table: falsetable_optional: falseMake a custom Lua shortcut available or unavailable.
prototype_name: string — Prototype name of the custom shortcut.available: booleanLuaPlayer.connect_to_server{ address: string, name?: LocalisedString, description?: LocalisedString, password?: string }
player.connect_to_server{ address=address }
takes_table: truetable_optional: falseAsks the player if they would like to connect to the given server.
This only does anything when used on a multiplayer peer. Single player and server hosts will ignore the prompt.
address: string — The server (address:port) if port is not given the default Factorio port is used.name?: LocalisedString — The name of the server.description?: LocalisedStringpassword?: string — The password if different from the one used to join this game. Note, if the current password is not empty but the one required to join the new server is an empty string should be given for this field.LuaPlayer.toggle_map_editor()
player.toggle_map_editor()
takes_table: falsetable_optional: falseToggles this player into or out of the map editor. Does nothing if this player isn't an admin or if the player doesn't have permission to use the map editor.
LuaPlayer.request_translation(localised_string: LocalisedString) -> uint32?
player.request_translation(localised_string)
takes_table: falsetable_optional: falseRequests a translation for the given localised string. If the request is successful, the on_string_translated event will be fired with the results.
Does nothing if this player is not connected (see LuaPlayer::connected).
localised_string: LocalisedStringuint32? — The unique ID for the requested translation.LuaPlayer.request_translations(localised_strings: Array<LocalisedString>) -> Array<uint32>?
player.request_translations(localised_strings)
takes_table: falsetable_optional: falseRequests translation for the given set of localised strings. If the request is successful, a on_string_translated event will be fired for each string with the results.
Does nothing if this player is not connected (see LuaPlayer::connected).
localised_strings: Array<LocalisedString>Array<uint32>? — The unique IDs for the requested translations.LuaPlayer.get_infinity_inventory_filter(index: uint32) -> InfinityInventoryFilter?
player.get_infinity_inventory_filter(index)
takes_table: falsetable_optional: falseGets the filter for this map editor infinity filters at the given index or nil if the filter index doesn't exist or is empty.
index: uint32 — The index to get.InfinityInventoryFilter?LuaPlayer.set_infinity_inventory_filter(index: uint32, filter: InfinityInventoryFilter | nil)
player.set_infinity_inventory_filter(index, filter)
takes_table: falsetable_optional: falseSets the filter for this map editor infinity filters at the given index.
index: uint32 — The index to set.filter: InfinityInventoryFilter | nil — The new filter or nil to clear the filter.LuaPlayer.clear_recipe_notifications()
player.clear_recipe_notifications()
takes_table: falsetable_optional: falseClears all recipe notifications for this player.
LuaPlayer.add_recipe_notification(recipe: RecipeID)
player.add_recipe_notification(recipe)
takes_table: falsetable_optional: falseAdds the given recipe to the list of recipe notifications for this player.
recipe: RecipeID — Recipe to add.LuaPlayer.clear_recipe_notification(recipe: RecipeID)
player.clear_recipe_notification(recipe)
takes_table: falsetable_optional: falseClears the given recipe from the list of recipe notifications for this player.
recipe: RecipeID — Recipe to clear.LuaPlayer.get_recipe_notifications() -> Array<LuaRecipePrototype>
player.get_recipe_notifications()
takes_table: falsetable_optional: falseGet all recipes that currently have recipe notifications for this player.
Array<LuaRecipePrototype>LuaPlayer.add_to_clipboard(blueprint: LuaItemStack)
player.add_to_clipboard(blueprint)
takes_table: falsetable_optional: falseAdds the given blueprint to this player's clipboard queue.
blueprint: LuaItemStack — The blueprint to add.LuaPlayer.activate_paste()
player.activate_paste()
takes_table: falsetable_optional: falseGets a copy of the currently selected blueprint in the clipboard queue into the player's cursor, as if the player activated Paste.
LuaPlayer.start_selection(position: MapPosition, selection_mode: defines.selection_mode)
player.start_selection(position, selection_mode)
takes_table: falsetable_optional: falseStarts selection with selection tool from the specified position. Does nothing if the player's cursor is not a selection tool.
position: MapPosition — The position to start selection from.selection_mode: defines.selection_mode — The type of selection to start.LuaPlayer.clear_selection()
player.clear_selection()
takes_table: falsetable_optional: falseClears the player's selection tool selection position.
LuaPlayer.enter_space_platform(space_platform: LuaSpacePlatform) -> boolean
player.enter_space_platform(space_platform)
takes_table: falsetable_optional: falseEnters the given space platform if possible.
space_platform: LuaSpacePlatformboolean — If the player entered the platform.LuaPlayer.leave_space_platform()
player.leave_space_platform()
takes_table: falsetable_optional: falseEjects this player from the current space platform if in a platform. The player is left on the platform at the position of the hub.
LuaPlayer.land_on_planet() -> boolean
player.land_on_planet()
takes_table: falsetable_optional: falseEjects this player from the current space platform and lands on the current planet.
boolean — If the player successfully landed on the planet.LuaPlayer.set_zoom_limits(controller_type: defines.controllers, zoom_limits: ZoomLimits)
player.set_zoom_limits(controller_type, zoom_limits)
takes_table: falsetable_optional: falseSets the zoom limits for a specific controller type. To reset a controller's zoom limits to default, pass an empty table for zoom_limits.
controller_type: defines.controllers — The type of the controller to set the zoom limits for.zoom_limits: ZoomLimits — The new zoom limits. See LuaPlayer::zoom_limits for usage information.