Quest taking and rejecting

This commit is contained in:
2ndbeam 2024-05-31 11:23:15 +03:00
commit c6d8ae8be0
12 changed files with 87 additions and 14 deletions

View file

@ -10,6 +10,10 @@ const BUY_ITEM = "BASE_BUY_ITEM"
const SELL_ITEM = "BASE_SELL_ITEM"
## This message will trigger quest node to make answer format
const TAKE_QUEST = "BASE_TAKE_QUEST"
## This message will trigger quest node to assign quest to player
const ACCEPT_QUEST = "BASE_QUEST_ACCEPT"
## This message will trigger quest node to take quest from player
const CANCEL_QUEST = "BASE_QUEST_CANCEL"
@onready var dialogue = $DialogueView
@onready var buy_sell = $"../../BuySell"
@ -45,6 +49,13 @@ func send_message(msg: Message):
format["item_name"] = item_name
TAKE_QUEST:
format["answer"] = quest.answer
if quest.answer == tr(quest.NO_QUEST):
get_tree().create_timer(0.05).timeout.connect(actions_menu.transit_menu.bind(0))
ACCEPT_QUEST:
actions_menu.player_ship.quest = quest.assign_to_player()
CANCEL_QUEST:
actions_menu.player_ship.quest = null
var new_msg = tr(msg.fact + "_RECEIVED").format(format)
var old_len = len(dialogue.get_parsed_text())
dialogue.append_text(new_msg)