diff --git a/project.godot b/project.godot index e881ca0..b1171b1 100644 --- a/project.godot +++ b/project.godot @@ -86,7 +86,7 @@ select_target={ } dock={ "deadzone": 0.5, -"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":80,"key_label":0,"unicode":112,"echo":false,"script":null) +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":73,"key_label":0,"unicode":105,"echo":false,"script":null) ] } diff --git a/scenes/Ships/NPC Ships/kamikaze_ship.tscn b/scenes/Ships/NPC Ships/kamikaze_ship.tscn index 5c01cb3..a56b4c5 100644 --- a/scenes/Ships/NPC Ships/kamikaze_ship.tscn +++ b/scenes/Ships/NPC Ships/kamikaze_ship.tscn @@ -19,7 +19,12 @@ script/source = "extends Label @onready var ship: Ship = get_parent().get_parent().get_parent() func _process(_delta): - text = unformatted_text.format([ship.hull.hp, ship.hull.max_hp, ship.shield.capacity, ship.shield.max_capacity]) + text = unformatted_text.format([ + round(ship.hull.hp * 100) / 100.0, + ship.hull.max_hp, + round(ship.shield.capacity * 100) / 100.0, + ship.shield.max_capacity + ]) " [node name="KamikazeShip" type="Node2D"] diff --git a/scenes/Ships/NPC Ships/shooter_ship.tscn b/scenes/Ships/NPC Ships/shooter_ship.tscn index ee32cff..c491a5c 100644 --- a/scenes/Ships/NPC Ships/shooter_ship.tscn +++ b/scenes/Ships/NPC Ships/shooter_ship.tscn @@ -20,7 +20,12 @@ script/source = "extends Label @onready var ship: Ship = get_parent().get_parent().get_parent() func _process(_delta): - text = unformatted_text.format([ship.hull.hp, ship.hull.max_hp, ship.shield.capacity, ship.shield.max_capacity]) + text = unformatted_text.format([ + round(ship.hull.hp * 100) / 100.0, + ship.hull.max_hp, + round(ship.shield.capacity * 100) / 100.0, + ship.shield.max_capacity + ]) " [node name="ShooterShip" type="Node2D"] diff --git a/scenes/Ships/player_ship.tscn b/scenes/Ships/player_ship.tscn index 9a9deb6..5194917 100644 --- a/scenes/Ships/player_ship.tscn +++ b/scenes/Ships/player_ship.tscn @@ -45,7 +45,10 @@ script/source = "extends Label @onready var ship: PlayerShip = get_parent().get_parent() func _process(_delta): - text = unformatted_text.format([ship.hull.hp, ship.hull.max_hp]) + text = unformatted_text.format([ + round(ship.hull.hp * 100) / 100.0, + ship.hull.max_hp + ]) " [sub_resource type="GDScript" id="GDScript_q1sx2"] @@ -58,7 +61,10 @@ script/source = "extends Label @onready var ship: PlayerShip = get_parent().get_parent() func _process(_delta): - text = unformatted_text.format([ship.shield.capacity, ship.shield.max_capacity]) + text = unformatted_text.format([ + round(ship.shield.capacity * 100) / 100.0, + ship.shield.max_capacity + ]) " [sub_resource type="GDScript" id="GDScript_rrgab"] @@ -72,7 +78,7 @@ script/source = "extends Label func _process(_delta): var format = [ - ship.hull.ammunition[\"Laser Energy\"], + round(ship.hull.ammunition[\"Laser Energy\"] * 100) / 100.0, ship.hull.max_ammunition[\"Laser Energy\"], ship.hull.ammunition[\"Rockets\"], ship.hull.max_ammunition[\"Rockets\"] diff --git a/scripts/Ship/player_ship.gd b/scripts/Ship/player_ship.gd index 8e3a36a..1d3bed3 100644 --- a/scripts/Ship/player_ship.gd +++ b/scripts/Ship/player_ship.gd @@ -10,3 +10,12 @@ class_name PlayerShip var selected_node: Node2D = null ## Currency variable var money: float = 1000.0 +## Base which was requested to dock last +var docking_base: Base = null + +func destroy(): + super.destroy() + if docking_base != null: + docking_base.dock_ready() + docking_base = null + selected_node = null diff --git a/scripts/star_system.gd b/scripts/star_system.gd index 85bfff9..6148561 100644 --- a/scripts/star_system.gd +++ b/scripts/star_system.gd @@ -15,6 +15,7 @@ class_name StarSystem ## Pause controller packed scene @export var pause_controller_scene: PackedScene +## Node which is colliding with mouse var targeted_node: Node2D = null ## Player ship reference. May be null. @@ -53,11 +54,9 @@ func unpause(): pause_controller.visible = false func _process(_delta): + # pausing if Input.is_action_just_released("pause"): unpause() if get_tree().paused else pause() - - if player_ship != null: - pause_controller.position = player_ship.global_position func set_targeted_node(node): targeted_node = node