Skip to content

PopochiuClickable

Carenalga edited this page Nov 27, 2022 · 7 revisions

Description

Base class of the objects which players interact with inside rooms: Props, Hotspots and characters.

Properties

Export

  • script_name String. Default ''. The identifier of the object used in scripts.
  • description String. Default ''. The name shown to players when the cursor hovers the object.
  • clickable bool. Default true. Whether the object will listen to interactions.
  • baseline int. Default 0. The y position of the baseline relative to the center of the object..
  • walk_to_point Vector2. Default Vector2.ZERO. The position where characters will move when aproaching the object.
  • cursor Cursor. Default Cursor.NONE. The texture to use when the cursor hovers the object.
  • always_on_top bool. Default false. Wheter the object will be rendered always above other objects in the room.

Public

  • room PopochiuRoom. Default null. The room to which the object belongs.

Private

  • _description_code String. Default ''. The code to use as the description of the object when using localization.

Methods

Virtual

  • on_interact() void

    Called when players INTERACT (click) with the object.

  • on_look() void

    Called when players LOOK AT/EXAMINE (right click) the object.

  • on_item_used( item: PopochiuInventoryItem ) void

    Called when a PopochiuInventoryItem is used on the object.

  • on_room_set() void

    Called once the PopochiuRoom which this object belongs to finishes its _ready() call.

Public

  • hide_helpers() void

    Used by the plugin to hide the visual helpers that show the baseline and walk_to_point of the object in Godot´s 2D Canvas.

  • show_helpers() void

    Used by the plugin to make visible the visual helpers that show the baseline and walk_to_point of the object in Godot´s 2D Canvas when a PopochiuClickable is selected in the scene tree.

  • disable( is_in_queue := true ) void

    Makes the object invisible, and consequently disables it from registering interactions.

  • enable( is_in_queue := true ) void

    Makes the object visible, and consequently enables it from registering interactions.

Set and get

  • get_description() String

    Returns the description of the object passing it through E.get_text(), which can be used to show it in different languages when using localization.

  • set_baseline(value: int) void

    When in the Editor, makes the $BaselineHelper child to be rendered in the Canvas showing a line where the baseline of this object is.

  • set_walk_to_point( value: Vector2 ) void

    When in the Editor, makes the $WalkToHelper child to be rendered in the Canvas showing a Position2D where the walk_to_point of this object is.

  • get_walk_to_point() Vector2

    When running the game, returns the global position of the walk_to_point. When in the Editor, returns the value of the walk_to_point.

  • set_room( value: Node2D ) void

    Calls on_room_set() when the room to which this object belongs is setted.

Private

  • _toggle_description( display: bool ) void

    Shows and hides the description when the cursor hovers or leaves the object. When the cursor is over it takes into account the queue of hovered objects in Popochiu (E) to add itself to its head or tale depending on its relation to the other objects in the queue. The description shown by Popochiu will be always the object in the tale of the queue.

  • _toggle_input() void

    Calles when the visibility of the object changes. If it is clickable, then the input will be enabled or disabled wheter the object is or not visible.

  • _translate() void

    When the game is using localization, this changes the value of description to match the code used by the TranslationServer to show the text in the current language.

Clone this wiki locally