Quest save/load + beta tag for prereleases

This commit is contained in:
gotfishmakesticks 2023-11-16 17:51:07 +03:00
commit 33bcd65c53
5 changed files with 25 additions and 2 deletions

View file

@ -50,6 +50,16 @@ func _ready():
var weapon_inst = Game.get_weapon(save['secondaryweapon']).instantiate()
weapon_inst.id = save['secondaryweapon']
ship.secondary_slot.add_child(weapon_inst)
if save.has('quest'):
var data = save['quest']
var type = data['type'] as Quest.TYPE
var restrictions : Array[Quest.RESTRICTIONS] = []
for rest in data['restrictions']:
restrictions.append(rest as Quest.RESTRICTIONS)
ship.quest.create(type, data['progress_max'], data['reward_money'], restrictions, data['data'])
if data['got_reward']:
ship.quest.new = true
ship.quest_completed = true
func addtargetlist(body : Node2D):
if !can_target.has(body):

View file

@ -11,6 +11,7 @@ const DEFAULT_WEAPON = preload("res://scenes/weapons/presets/SingleLaserMk1.tscn
const salt = "2ndbeam"
const gameversion = "Ictar 1.1"
const beta = false
static var profile : Profile = Profile.new()
@ -30,6 +31,15 @@ static func profile_save(scene : Node) -> void:
"money" : scene.ship.money,
"cargo" : scene.ship.hull.cargo
}
if !scene.ship.quest.new or scene.ship.quest_completed:
profile.profile_meta['game']['quest'] = {
'type' : scene.ship.quest.type,
'progress_max' : scene.ship.quest.progress_max,
'reward_money' : scene.ship.quest.reward_money,
'restrictions' : scene.ship.quest.restrictions,
'data' : scene.ship.quest.data,
'got_reward' : scene.ship.quest_completed
}
if scene.ship.primary_slot.get_child_count() > 0:
profile.profile_meta['game']['primaryweapon'] = scene.ship.primary_slot.get_child(0).id
if scene.ship.secondary_slot.get_child_count() > 0:

View file

@ -135,7 +135,7 @@ 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.'
Quest.RESTRICTIONS.TIMER : '- You have {sec} seconds to complete the quest.'
}
if upd_quest.data.has('timer'):
restriction_typing[Quest.RESTRICTIONS.TIMER] = restriction_typing[Quest.RESTRICTIONS.TIMER].format({"sec" : upd_quest.data['timer']})

View file

@ -4,3 +4,6 @@ func _ready():
text = "GammaCosmicRays version {version}".format({"version" : Game.gameversion})
if OS.has_feature("editor"):
text += " uncompiled\nThis is a debug/prerelease version."
else:
if Game.beta:
text += " beta\nThis is a closed beta version."

View file

@ -57,7 +57,7 @@ func timer_failed():
return
kill_quest(false)
func enemy_destroyed(enemy):
func enemy_destroyed(_enemy):
if quest.new:
return
if quest.type == quest.TYPE.ELIMINATION: