Skip to content

ReadableInteraction ​

Inherits: InteractableObjectInteraction < Interaction < Resource

Readable interaction - displays multi-page text content in UI panel Used for signs, books, plaques, notes, etc.

Properties ​

Array[String]pages_text[]
Stringreadable_title"":
Texture2Dbackground_texture

Methods ​

voidsetup_for_interactable_objects( interactable: InteractableObject )
boolcan_interact( player: Player )
voidstart_interaction( player: Player )
voidend_interaction()
Stringget_interaction_prompt()
voidadd_page( page_text: String )
boolremove_page( index: int )
voidclear_pages()
intget_page_count()
Stringget_page_text( index: int )
boolset_page_text( index: int, text: String )
boolhas_content()
Dictionarysave_state()
voidload_state( state: Dictionary )
voidcleanup()

Property descriptions ​

Array[String] pages_text = [] ​

Array of text content for each page Each string represents one page - supports BBCode rich text formatting Example: ["Page 1 content...", "Page 2 content...", "Final page..."]

String readable_title = "": ​

Optional title for the readable content (displayed in UI header)

Texture2D background_texture ​

Optional background texture for the readable panel

Method descriptions ​

void setup_for_interactable_objects( interactable: InteractableObject ) ​

Sets the readable up on its object.

bool can_interact( player: Player ) ​

Can the player read it now?

void start_interaction( player: Player ) ​

Opens the reading window with the pages.

void end_interaction() ​

Does nothing: the reading window closes itself.

String get_interaction_prompt() ​

The text of the prompt above the object ("Read", or "Empty" when it has no pages).

void add_page( page_text: String ) ​

Add a page to the readable content

bool remove_page( index: int ) ​

Remove a page by index

void clear_pages() ​

Clear all pages

int get_page_count() ​

Get page count

String get_page_text( index: int ) ​

Get specific page text

bool set_page_text( index: int, text: String ) ​

Set specific page text

bool has_content() ​

Check if has any content

Dictionary save_state() ​

The pages and the title for a save.

void load_state( state: Dictionary ) ​

Restores the pages and the title from a save.

void cleanup() ​

Does nothing: it has no timers.