Equipment menu

This commit is contained in:
gotfishmakesticks 2024-01-13 10:58:44 +03:00
commit bef15301cb
28 changed files with 809 additions and 48 deletions

View file

@ -17,6 +17,11 @@ var money : float = 1000
var quest : Quest = Quest.new()
var quest_completed : bool = false
var hulls : Array[String] = ["starterhull"]
var engines : Array[String] = ["starterengine"]
var shields : Array[String] = ["startershield"]
var weapons : Array[String] = ["SingleLaserMk1"]
signal destroyed
func _ready():
@ -24,9 +29,6 @@ func _ready():
quest.quest_ended.connect(kill_quest)
quest.quest_failed.connect(kill_quest)
destroyed.connect(quest._restriction_no_deaths)
secondary_slot.add_child(Game.get_weapon("SingleRocketMk1").instantiate())
#quest.create(Quest.TYPE.ELIMINATION, 2, 200)
func _process(_delta):
@ -64,3 +66,40 @@ func enemy_destroyed(_enemy):
return
if quest.type == quest.TYPE.ELIMINATION:
quest.do_progress()
func change_hull(new):
var new_hull = Game.get_module(new, 'hull').instantiate()
var old_hull = hull
add_child(new_hull)
hull = new_hull
hull.hp = old_hull.hp
hull.fuel = old_hull.fuel
get_tree().create_timer(0.05).timeout.connect(old_hull.queue_free)
func change_engine(new):
var new_engine = Game.get_module(new, 'engine').instantiate()
var old_engine = engine
add_child(new_engine)
engine = new_engine
get_tree().create_timer(0.05).timeout.connect(old_engine.queue_free)
func change_shield(new):
var new_shield = Game.get_module(new, 'shield').instantiate()
var old_shield = shield
add_child(shield)
shield = new_shield
get_tree().create_timer(0.05).timeout.connect(old_shield.queue_free)
func change_primary_weapon(new):
var weapon = Game.get_weapon(new).instantiate()
if primary_slot.get_child_count() > 0:
for child in primary_slot.get_children():
child.queue_free()
primary_slot.add_child(weapon)
func change_secondary_weapon(new):
var weapon = Game.get_weapon(new).instantiate()
if secondary_slot.get_child_count() > 0:
for child in secondary_slot.get_children():
child.queue_free()
secondary_slot.add_child(weapon)