NPCs can take quests!
This commit is contained in:
@@ -12,7 +12,7 @@ enum Phases {
|
||||
ARRIVE,
|
||||
QUEUE,
|
||||
WAIT,
|
||||
SERVICE,
|
||||
INTERACT,
|
||||
COMPLETE
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ func _generate_name() -> String:
|
||||
func _enter() -> void:
|
||||
var eq = Guild.hall.interactables.get(equipment_name)
|
||||
if !eq:
|
||||
printerr("Use Guild Equipment (%s) - %s, '%s' not found!", equipment_name, service_name, equipment_name)
|
||||
printerr("Use Guild Equipment (%s) - %s, '%s' not found!" % [equipment_name, service_name, equipment_name])
|
||||
return
|
||||
equipment = eq
|
||||
queue = equipment.queue
|
||||
@@ -61,11 +61,11 @@ func _tick(delta: float) -> Status:
|
||||
pass
|
||||
Phases.WAIT:
|
||||
pass
|
||||
Phases.SERVICE:
|
||||
Phases.INTERACT:
|
||||
if wait_time_remaining > 0:
|
||||
wait_time_remaining -= delta
|
||||
if wait_time_remaining <= 0:
|
||||
equipment.service_provided.connect(_on_service_complete)
|
||||
equipment.interaction_complete.connect(_on_interaction_complete)
|
||||
equipment.interact(agent, service_name)
|
||||
Phases.COMPLETE:
|
||||
return SUCCESS
|
||||
@@ -81,10 +81,11 @@ func _on_navigation_failed() -> void:
|
||||
wait_time_remaining = randf_range(.5, 2)
|
||||
agent.navigation_finished.disconnect(_on_navigation_complete)
|
||||
|
||||
func use_service():
|
||||
phase = Phases.SERVICE
|
||||
func interact():
|
||||
phase = Phases.INTERACT
|
||||
wait_time_remaining = randf_range(2,5)
|
||||
#TODO: Make them both do the talking emoji
|
||||
equipment.busy = true
|
||||
agent.show_speech_bubble("busy")
|
||||
|
||||
func wait():
|
||||
@@ -98,12 +99,14 @@ func _on_queue_advanced() -> void:
|
||||
if equipment.busy:
|
||||
wait()
|
||||
else:
|
||||
use_service()
|
||||
interact()
|
||||
pass
|
||||
|
||||
func _on_service_complete() -> void:
|
||||
equipment.service_provided.disconnect(_on_service_complete)
|
||||
func _on_interaction_complete() -> void:
|
||||
equipment.interaction_complete.disconnect(_on_interaction_complete)
|
||||
equipment.busy = false
|
||||
agent.show_speech_bubble("")
|
||||
queue.remove_member(agent)
|
||||
phase = Phases.COMPLETE
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
extends BTCondition
|
||||
var invert : bool
|
||||
@export var invert : bool
|
||||
func _tick(delta: float) -> Status:
|
||||
if agent.data and ((agent.data.quest == null) == invert):
|
||||
return SUCCESS
|
||||
|
||||
Reference in New Issue
Block a user