Quest generating + quest adding interface + some bugfixes

This commit is contained in:
gotfishmakesticks 2023-11-16 16:46:31 +03:00
commit f4cf1ef4e9
7 changed files with 71 additions and 20 deletions

View file

@ -37,8 +37,10 @@ func _physics_process(_delta):
runawaystate()
var format = {"HP" : "%0.2f" % hull.hp, "SC" : "%0.2f" % shield.capacity}
healthbar.text = "{HP} HS + {SC} SC".format(format)
if Vector2.ZERO.distance_to(global_position) > 5800 or hull.hp <= 0:
if hull.hp <= 0:
destroy()
if Vector2.ZERO.distance_to(global_position) > 5800:
destroy(true)
func switchdestination():
engine.destination_angle = randi_range(0, 360)
@ -71,7 +73,7 @@ func runawaystate():
if global_position.distance_to(ship.global_position) > 1024 or !ship.allow_shooting:
state = "idle"
func destroy():
func destroy(silent : bool = false):
hull.hp = hull.max_hp
hull.fuel = hull.max_fuel
shield.capacity = shield.max_capacity
@ -82,4 +84,5 @@ func destroy():
bounty_inst.amount = randi_range(bounty_min, bounty_max)
bounty_inst.text.text = str(bounty_inst.amount) + " MU"
global_position = Vector2(randi_range(-4096, 4096), randi_range(-4096, 4096))
destroyed.emit(self)
if !silent:
destroyed.emit(self)