40 lines
991 B
GDScript
40 lines
991 B
GDScript
extends StateNode
|
|
|
|
@export var employee_name : String = ""
|
|
@export var speech_bubble : String = ""
|
|
@export var wait_duration : float = 1
|
|
@export var interaction_args : Array[String] = []
|
|
var wait_remaining : float = 0
|
|
|
|
var employee : GuildEmployee
|
|
var actor
|
|
|
|
func exit() -> void:
|
|
actor.show_speech_bubble("")
|
|
|
|
func _process(delta: float) -> void:
|
|
if wait_remaining > 0:
|
|
wait_remaining -= delta
|
|
if wait_remaining <= 0:
|
|
wait_remaining = 0
|
|
employee.interact(actor, interaction_args[0])
|
|
complete_state()
|
|
|
|
func execute(subject, ...args : Array) -> void:
|
|
wait_remaining = wait_duration
|
|
actor = subject
|
|
|
|
if len(args) > 0 and args[0] != "":
|
|
subject.show_speech_bubble(speech_bubble)
|
|
|
|
#TODO: Possibly an error later with preexisting and extended lists
|
|
for arg in args.slice(1):
|
|
interaction_args.append(arg)
|
|
var emp = Guild.hall.employees.get(employee_name)
|
|
|
|
if emp == null:
|
|
printerr("Employee %s not found!" % employee_name)
|
|
complete_state()
|
|
else:
|
|
employee = emp
|