Quest system done
This commit is contained in:
parent
9bff79e019
commit
231ff2bb1d
10 changed files with 52 additions and 9 deletions
|
|
@ -16,6 +16,8 @@ const ACCEPT_QUEST = "BASE_QUEST_ACCEPT"
|
|||
const CANCEL_QUEST = "BASE_QUEST_CANCEL"
|
||||
## This message will trigger quest node to get quest info
|
||||
const QUEST_INFO = "BASE_QUEST_INFO"
|
||||
## This message will trigger dialogue node to reward player
|
||||
const QUEST_REWARD = "BASE_QUEST_REWARD"
|
||||
|
||||
## Quest progress template
|
||||
const QUEST_PROGRESS = "{cur} / {max}"
|
||||
|
|
@ -26,8 +28,7 @@ const QUEST_PROGRESS = "{cur} / {max}"
|
|||
@onready var quest = $"../../Quest"
|
||||
|
||||
func _ready():
|
||||
var tween = create_tween() \
|
||||
.tween_property(dialogue,"visible_ratio",1.0, 2)
|
||||
create_tween().tween_property(dialogue,"visible_ratio",1.0, 2)
|
||||
|
||||
func send_message(msg: Message):
|
||||
var format = {}
|
||||
|
|
@ -69,10 +70,14 @@ func send_message(msg: Message):
|
|||
format["answer"] = quest.info
|
||||
format["given_by"] = tr(cur_quest.data["given_by"])
|
||||
format["progress"] = QUEST_PROGRESS.format({"cur": cur_quest.progress, "max": cur_quest.progress_max})
|
||||
|
||||
QUEST_REWARD:
|
||||
var player_ship = actions_menu.player_ship
|
||||
var reward = player_ship.quest.reward_money
|
||||
player_ship.money += reward
|
||||
player_ship.quest = null
|
||||
format["reward"] = reward
|
||||
var new_msg = tr(msg.fact + "_RECEIVED").format(format)
|
||||
var old_len = len(dialogue.get_parsed_text())
|
||||
dialogue.append_text(new_msg)
|
||||
dialogue.visible_characters = old_len
|
||||
var tween = create_tween() \
|
||||
.tween_property(dialogue,"visible_ratio",1.0, 2)
|
||||
create_tween().tween_property(dialogue,"visible_ratio",1.0, 2)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue