2020-07-06 22:00:39 +00:00
|
|
|
extends Control
|
|
|
|
|
|
|
|
onready var scene = $"/root/scene" as GameInstance
|
|
|
|
|
2020-07-07 18:42:22 +00:00
|
|
|
func _physics_process(_delta):
|
2020-07-14 21:28:13 +00:00
|
|
|
var speed_str = str(round(scene.world.map.current_ship_speed * 10000)) + " u/s"
|
|
|
|
$Margin/Container/VelocityBox/HBoxContainer3/CurrentSpeed.text = speed_str
|
2020-07-10 00:09:54 +00:00
|
|
|
var dir_str = str(round(rad2deg(scene.world.map.current_ship_direction))) + " deg"
|
2020-07-14 21:28:13 +00:00
|
|
|
$Margin/Container/VelocityBox/HBoxContainer2/CurrentDirection.text = dir_str
|
2020-07-16 12:37:21 +00:00
|
|
|
var current_position_str = Coordinates.as_string(scene.world.map.current_ship_position + scene.world.map.current_ship_subpos, true)
|
2020-07-14 21:28:13 +00:00
|
|
|
$Margin/Container/VelocityBox/HBoxContainer4/CurrentPosition.text = current_position_str
|
|
|
|
var current_target_str = scene.world.map.current_ship_target
|
|
|
|
if current_target_str == null:
|
|
|
|
$Margin/Container/VelocityBox/HBoxContainer/CurrentTarget.text = "None"
|
|
|
|
else:
|
|
|
|
$Margin/Container/VelocityBox/HBoxContainer/CurrentTarget.text = Coordinates.as_string(current_target_str, true)
|
2020-07-07 16:08:56 +00:00
|
|
|
|
2020-07-06 22:00:39 +00:00
|
|
|
func _ship_velocity_changed(value):
|
2020-07-14 21:28:13 +00:00
|
|
|
scene.rpc("process_command", UICommand.new(UICommand.CommandType.SetShipSpeed, [value]))
|
2020-07-06 22:00:39 +00:00
|
|
|
|
|
|
|
func _ship_direction_changed(value):
|
2020-07-14 21:28:13 +00:00
|
|
|
scene.rpc("process_command", UICommand.new(UICommand.CommandType.SetShipDirection, [deg2rad(value)]))
|
|
|
|
|
|
|
|
func _map_button_pressed():
|
|
|
|
scene.ui.open_map_popup()
|
|
|
|
|
|
|
|
func force_close():
|
|
|
|
scene.ui.close_map_popup()
|