courier/scripts/contract.gd

24 lines
741 B
GDScript

extends Area2D
@export var Destination : Node2D
@onready var DestinationDialogue : Control = $Dialogue
@export var InteractibleManager : Node
var Player : Node2D
@export var Money : int = 100
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
DestinationDialogue.DialogueLabel.text = Destination.get_address() + " - $" + str(Money)
Player = get_tree().get_first_node_in_group("player")
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
if Input.is_action_just_pressed("interact") and InteractibleManager.selected and not Player.ActiveContract:
Player.ActiveContract = Destination
Destination.WaitingCash = Money
queue_free()