Quest taking and rejecting
This commit is contained in:
parent
8a40de576e
commit
c6d8ae8be0
12 changed files with 87 additions and 14 deletions
|
|
@ -26,6 +26,14 @@ const BASE_BUY_SELL = "BASE_BUY_SELL"
|
|||
const BASE_BUY_ITEM = "BASE_BUY_ITEM"
|
||||
## Button to sell amount of item
|
||||
const BASE_SELL_ITEM = "BASE_SELL_ITEM"
|
||||
## Button to fetch quest
|
||||
const BASE_TAKE_QUEST = "BASE_TAKE_QUEST"
|
||||
## Button to get current quest info
|
||||
const BASE_QUEST_INFO = "BASE_QUEST_INFO"
|
||||
## Button to cancel current quest
|
||||
const BASE_QUEST_CANCEL = "BASE_QUEST_CANCEL"
|
||||
## Button to get reward from quest
|
||||
const BASE_QUEST_REWARD = "BASE_QUEST_REWARD"
|
||||
## Null button ID
|
||||
const NULL = "NULL"
|
||||
|
||||
|
|
@ -44,18 +52,19 @@ var buy_sell_selected_item: int = -1
|
|||
var buy_sell_amount = 0
|
||||
|
||||
func _ready():
|
||||
load_menu()
|
||||
get_tree().create_timer(0.05).timeout.connect(post_ready)
|
||||
|
||||
func post_ready():
|
||||
base = get_parent().get_parent().get_parent().base
|
||||
player_ship = base.player_ship
|
||||
load_menu()
|
||||
|
||||
## Called when menu is changed
|
||||
func load_menu():
|
||||
var format = {}
|
||||
# iterating through all actions
|
||||
for i in range(len(menu.item_ids)):
|
||||
actions[i].disabled = false
|
||||
match menu.item_ids[i]:
|
||||
BASE_BUY_SELL:
|
||||
if i <= buy_sell_options:
|
||||
|
|
@ -67,7 +76,15 @@ func load_menu():
|
|||
format = get_buy_sell_button_format(buy_sell_selected_item, i)
|
||||
BASE_SELL_ITEM:
|
||||
format = get_buy_sell_button_format(buy_sell_selected_item, i)
|
||||
actions[i].disabled = false
|
||||
BASE_TAKE_QUEST:
|
||||
actions[i].disabled = player_ship.quest != null
|
||||
BASE_QUEST_INFO:
|
||||
actions[i].disabled = player_ship.quest == null
|
||||
BASE_QUEST_CANCEL:
|
||||
actions[i].disabled = player_ship.quest.status != Quest.Status.Taken
|
||||
BASE_QUEST_REWARD:
|
||||
actions[i].disabled = player_ship.quest.status != Quest.Status.Reward
|
||||
|
||||
# disconnect previous action
|
||||
if actions[i] is TransitButton:
|
||||
actions[i].button_up.disconnect(transit_menu)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue