Added current quest interface + new quest template interface
This commit is contained in:
parent
2bca6b2fe5
commit
008e74eba3
4 changed files with 169 additions and 2 deletions
|
|
@ -9,6 +9,12 @@ var base
|
|||
@onready var buy_input = $TradingMenu/BuyInput
|
||||
@onready var sell_button = $TradingMenu/SellButton
|
||||
@onready var buy_button = $TradingMenu/BuyButton
|
||||
@onready var current_quest_status = $QuestMenu/CurrentQuest/QuestStatus
|
||||
@onready var abandon_quest = $QuestMenu/CurrentQuest/AbandonQuest
|
||||
@onready var complete_quest = $QuestMenu/CurrentQuest/CompleteQuest
|
||||
@onready var current_quest = $QuestMenu/CurrentQuest
|
||||
@onready var new_quest = $QuestMenu/NewQuest
|
||||
@onready var accept_quest = $QuestMenu/NewQuest/AcceptQuest
|
||||
|
||||
var base_types = ["Power Supply", "Mining", "Food Production", "Trading", "Modules"]
|
||||
|
||||
|
|
@ -19,6 +25,9 @@ func _ready():
|
|||
sell_button.button_up.connect(sell_item)
|
||||
buy_input.text_changed.connect(buy_text_changed)
|
||||
sell_input.text_changed.connect(sell_text_changed)
|
||||
abandon_quest.button_up.connect(quest_abandon)
|
||||
complete_quest.button_up.connect(quest_complete)
|
||||
accept_quest.button_up.connect(quest_accept)
|
||||
|
||||
func update_lists():
|
||||
buy_list.clear()
|
||||
|
|
@ -95,3 +104,54 @@ func buy_text_changed(_new_text):
|
|||
|
||||
func sell_text_changed(_new_text):
|
||||
sell_input.placeholder_text = "Amount to buy"
|
||||
|
||||
func quest_abandon():
|
||||
ship.quest.fail()
|
||||
current_quest.visible = false
|
||||
new_quest.visible = true
|
||||
|
||||
func quest_complete():
|
||||
if !ship.quest_completed:
|
||||
return
|
||||
ship.money += ship.quest.reward_money
|
||||
ship.quest_completed = false
|
||||
current_quest.visible = false
|
||||
new_quest.visible = true
|
||||
|
||||
func quest_accept():
|
||||
pass
|
||||
|
||||
func quest_status_update():
|
||||
var restriction_typing = {
|
||||
Quest.RESTRICTIONS.NO_DEATHS : '- Destruction of your ship will lead to quest failure.',
|
||||
Quest.RESTRICTIONS.NO_WEAPON : '- Using any weapon (even accidently) is prohibited.',
|
||||
Quest.RESTRICTIONS.TIMER : '- You have {sec} seconds to complete the quest since it is accepted.'
|
||||
}
|
||||
if ship.quest.data.has('timer'):
|
||||
restriction_typing[Quest.RESTRICTIONS.TIMER] = restriction_typing[Quest.RESTRICTIONS.TIMER].format(ship.quest.data['timer'])
|
||||
var template = "Type: {type}\n\nObjective: {objective_text}\n\nReward: {reward} money units\n\nRestrictions: {restrictions}"
|
||||
var typed_templates = {
|
||||
Quest.TYPE.ELIMINATION : {
|
||||
"type" : "Elimination",
|
||||
"objective" : "Destroy {req} hostile ships [ {cur} / {req} ]".format({"cur" : ship.quest.progress, "req" : ship.quest.progress_max})
|
||||
},
|
||||
|
||||
Quest.TYPE.DELIVERY : {
|
||||
"type" : "Delivery",
|
||||
"objective" : "Deliver a cargo to markered base (check the minimap)."
|
||||
}
|
||||
}
|
||||
var restrictions = ""
|
||||
if len(ship.quest.restrictions) == 0 :
|
||||
restrictions = "None"
|
||||
else:
|
||||
for restriction in ship.quest.restrictions:
|
||||
restrictions.append("\n", restriction_typing[restriction])
|
||||
var formatting = {
|
||||
"type" : typed_templates[ship.quest.type]['type'],
|
||||
"objective_text" : typed_templates[ship.quest.type]['objective'],
|
||||
"reward" : ship.quest.reward_money,
|
||||
"restrictions" : restrictions
|
||||
}
|
||||
current_quest_status.text = template.format(formatting)
|
||||
complete_quest.disabled = !ship.quest_completed
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue