Files
gymkhana-actions/docs/api/ESCItem.md
Julian Murgia 0e6e8aa161 Re-implemented turn_to command (#390)
* Re-implemented turn_to command

Fixes #385
Fixed a bug in esc_movable blocking player_orients_on_arrival for ESCLocation nodes

* docs: Automatic update of API docs

* Fixes

Co-authored-by: StraToN <StraToN@users.noreply.github.com>
2021-09-09 22:57:03 +02:00

7.2 KiB

ESCItem

Extends: Area2D

Description

ESCItem is a Sprite that defines an item, potentially interactive

Property Descriptions

global_id

export var global_id = ""

The global ID of this item

esc_script

export var esc_script = ""

The ESC script for this item

is_exit

export var is_exit = false

If true, the ESC script may have an ":exit_scene" event to manage scene changes

is_trigger

export var is_trigger = false

If true, object is considered as trigger. Allows using :trigger_in and :trigger_out verbs in ESC scripts.

trigger_in_verb

export var trigger_in_verb = "trigger_in"

The verb used for the trigger in ESC events

trigger_out_verb

export var trigger_out_verb = "trigger_out"

The verb used for the trigger out ESC events

is_interactive

export var is_interactive = true

If true, the player can interact with this item

is_movable

export var is_movable = false

Wether this item is movable

player_orients_on_arrival

export var player_orients_on_arrival = true

If true, player orients towards 'interaction_direction' as player character arrives.

interaction_direction

export var interaction_direction = 0

Let the player turn to this direction when the player arrives at the item

tooltip_name

export var tooltip_name = ""

The name for the tooltip of this item

default_action

export var default_action = ""

Default action to use if object is not in the inventory

default_action_inventory

export var default_action_inventory = ""

Default action to use if object is in the inventory

combine_if_action_used_among

export var combine_if_action_used_among = []

If action used by player is in this list, the game will wait for a second click on another item to combine objects together (typical USE <X> WITH <Y>, GIVE <X> TO <Y>)

combine_is_one_way

export var combine_is_one_way = false

If true, combination must be done in the way it is written in ESC script ie. :use ON_ITEM If false, combination will be tried in the other way.

use_from_inventory_only

export var use_from_inventory_only = false

If true, then the object must have been picked up before using it. A false value is useful for items in the background, such as buttons.

inventory_item_scene_file

export var inventory_item_scene_file: PackedScene = "[Object:null]"

Scene based on ESCInventoryItem used in inventory for the object if it is picked up, that displays and handles the item

dialog_color

export var dialog_color = "0,0,0,1"

Color used for dialogs

dont_apply_terrain_scaling

export var dont_apply_terrain_scaling = false

If true, terrain scaling will not be applied and node will remain at the scale set in the scene.

speed

export var speed: int = 300

Speed of this item ifmovable

v_speed_damp

export var v_speed_damp: float = 1

Speed damp of this item if movable

animation_player_node

export var animation_player_node: NodePath = ""

The node used to play animations

animations

var animations: ESCAnimationResource

 ESCAnimationsResource (for walking, idling...)

animation_sprite

var animation_sprite

Reference to the animation node (null if none was found)

terrain

var terrain: ESCTerrain

Reference to the current terrain

collision

var collision: Node

Reference to this items collision shape node

inventory_item

var inventory_item: ESCInventoryItem

The representation of this item in the scene. Will be loaded, if inventory_item_scene_file is set.

Method Descriptions

get_animation_player

func get_animation_player() -> Node

Return the animation player node

get_interact_position

func get_interact_position() -> Vector2

Return the position the player needs to walk to to interact with this item. That can either be a direct Position2D child or a collision shape

Returns The interaction position

manage_input

func manage_input(_viewport: Viewport, event: InputEvent, _shape_idx: int) -> void

element_entered

func element_entered(body)

Another item (e.g. the player) has entered this item

Parameters

  • body: Other object that has entered the item

element_exited

func element_exited(body)

Another item (e.g. the player) has exited this element

Parameters

  • body: Other object that has entered the item

teleport

func teleport(target: Node) -> void

Use the movable node to teleport this item to the target item

Parameters

  • target: Target node to teleport to

teleport_to

func teleport_to(target: Vector2) -> void

Use the movable node to teleport this item to the target position

Parameters

  • target: Vector2 position to teleport to

walk_to

func walk_to(pos: Vector2, p_walk_context: ESCWalkContext = null) -> void

Use the movable node to make the item walk to the given position

Parameters

  • pos: Position to walk to
  • p_walk_context: Walk context to use

set_speed

func set_speed(speed_value: int) -> void

Set the moving speed

Parameters

  • speed_value: Set the new speed

has_moved

func has_moved() -> bool

Check wether this item moved

get_sprite

func get_sprite() -> Node

Return the sprite node

set_angle

func set_angle(deg: int, immediate = true)

Set the angle

Parameters

  • deg: The angle degree to set
  • immediate: Set the angle immediately. If false will show intermediate angles

turn_to

func turn_to(object: Node, immediate = true)

Turn to face another object

Parameters

  • deg: The angle degree to set
  • immediate: Set the angle immediately. If false will show intermediate angles

start_talking

func start_talking()

Play the talking animation

stop_talking

func stop_talking()

Stop playing the talking animation

Signals

  • signal mouse_entered_item(item): Emitted when the mouse has entered this item

Parameters

  • items: The inventory item node
  • signal mouse_exited_item(item): Emitted when the mouse has exited this item

Parameters

  • items: The inventory item node
  • signal mouse_left_clicked_item(global_id): Emitted when the item was left cliced

Parameters

  • global_id: ID of this item
  • signal mouse_double_left_clicked_item(global_id): Emitted when the item was double cliced

Parameters

  • global_id: ID of this item
  • signal mouse_right_clicked_item(global_id): Emitted when the item was right cliced

Parameters

  • global_id: ID of this item
  • signal arrived(walk_context): Emitted when the item walked to a destination

Parameters

  • walk_context: The walk context of the command