ShowUIPanelInteraction ​
Inherits: Interaction < Resource
Opens a panel of the interface when the NPC or the object is used: a wardrobe that opens the inventory, a notice board that opens a bounty panel of your own, a mirror that opens the character sheet. The panel is one of the panels in the UIPanels node of the in-game scene (the ones the panel keys open), found by its Panel Name. A panel of your own extends PanelUI, has a Panel Name, and can override on_opened_by_interaction to know what opened it. The panel closes when the player walks away, or when the interaction is ended.
Description ​
Use it for custom UI panels too: the interaction does not care what the panel shows.
Properties ​
String | panel_name | "" |
bool | close_when_far | true |
Variables ​
Player | current_user | |
bool | panel_is_open | false |
Methods ​
bool | can_interact( _player: Player ) |
String | get_block_reason( _user: Entity ) |
void | start_interaction( player: Player ) |
void | end_interaction() |
Array[String] | find_panel_names() static |
Constants ​
floatDISTANCE_CHECK_INTERVAL =0.5- How often (seconds) the distance of the player is checked
Property descriptions ​
String panel_name = "" ​
The name of the panel to open (the Panel Name of a panel in the UIPanels node of the in-game scene)
bool close_when_far = true ​
The panel closes when the player walks further than the interaction distance from the NPC or the object
Variable descriptions ​
Player current_user ​
The player who uses the panel
bool panel_is_open = false ​
The panel is open because of this interaction
Method descriptions ​
bool can_interact( _player: Player ) ​
An interaction with no panel does nothing
String get_block_reason( _user: Entity ) ​
Why the interaction cannot start now ("" = it can, or it says nothing): the user is told when can_interact is false (from Interaction)
void start_interaction( player: Player ) ​
Opens the panel
void end_interaction() ​
Closes the panel
Array[String] find_panel_names() ​
The names of the panels the in-game scene has (the Panel Name of each child of its UIPanels node that has one), for the editor to list. Read from the scene file chosen in the UI settings, or the scene of the toolkit