Extends: Area2D
ESCItem is a Sprite that defines an item, potentially interactive
export var global_id = ""
The global ID of this item
export var esc_script = ""
The ESC script for this item
export var is_exit = false
If true, the ESC script may have an ":exit_scene" event to manage scene changes
export var is_trigger = false
If true, object is considered as trigger. Allows using :trigger_in and :trigger_out verbs in ESC scripts.
export var trigger_in_verb = "trigger_in"
The verb used for the trigger in ESC events
export var trigger_out_verb = "trigger_out"
The verb used for the trigger out ESC events
export var is_interactive = true
If true, the player can interact with this item
export var is_movable = false
Wether this item is movable
export var player_orients_on_arrival = true
If true, player orients towards 'interaction_direction' as player character arrives.
export var interaction_direction = 0
Let the player turn to this direction when the player arrives at the item
export var tooltip_name = ""
The name for the tooltip of this item
export var default_action = ""
Default action to use if object is not in the inventory
export var default_action_inventory = ""
Default action to use if object is in the inventory
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>
)
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.
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.
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
export var dialog_color = "0,0,0,1"
Color used for dialogs
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.
export var speed: int = 300
Speed of this item ifmovable
export var v_speed_damp: float = 1
Speed damp of this item if movable
export var animations = "[Object:null]"
Animations script (for walking, idling...)
var animation_sprite
Reference to the animation node (null if none was found)
var terrain: ESCTerrain
Reference to the current terrain
var collision: Node
Reference to this items collision shape node
var inventory_item: ESCInventoryItem
The representation of this item in the scene. Will be loaded, if inventory_item_scene_file is set.
func get_animation_player()
Return the animation player node
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
func manage_input(_viewport: Viewport, event: InputEvent, _shape_idx: int) -> void
func element_entered(body)
Another item (e.g. the player) has entered this item
- body: Other object that has entered the item
func element_exited(body)
Another item (e.g. the player) has exited this element
- body: Other object that has entered the item
func teleport(target: Node) -> void
Use the movable node to teleport this item to the target item
- target: Target item to teleport 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
- pos: Position to walk to
- p_walk_context: Walk context to use
func set_speed(speed_value: int) -> void
Set the moving speed
- speed_value: Set the new speed
func has_moved() -> bool
Check wether this item moved
func set_angle(deg: int, immediate = true)
Set the angle
Set the angle
func start_talking()
Play the talking animation
func stop_talking()
Stop playing the talking animation
- signal mouse_entered_item(item): Emitted when the mouse has entered this item
- items: The inventory item node
- signal mouse_exited_item(item): Emitted when the mouse has exited this item
- items: The inventory item node
- signal mouse_left_clicked_item(global_id): Emitted when the item was left cliced
- global_id: ID of this item
- signal mouse_double_left_clicked_item(global_id): Emitted when the item was double cliced
- global_id: ID of this item
- signal mouse_right_clicked_item(global_id): Emitted when the item was right cliced
- global_id: ID of this item
- signal arrived(walk_context): Emitted when the item walked to a destination
- walk_context: The walk context of the command