Base docking system (areas don't monitor ship somehow)

This commit is contained in:
2ndbeam 2024-05-14 00:24:36 +03:00
commit 739cdbe4c3
11 changed files with 190 additions and 18 deletions

View file

@ -2,6 +2,8 @@ extends Node2D
## Shortcut to get_parent()
@onready var ship: Ship = get_parent()
## Reference to the star system
@onready var star_system: StarSystem = get_tree().current_scene
var expected_rotation: float = 0.0:
set(value):
@ -25,4 +27,7 @@ func _physics_process(_delta) -> void:
var angle_to_mouse = ship.hull.position.angle_to_point(get_global_mouse_position())
expected_rotation = rad_to_deg(angle_to_mouse - ship.hull.rotation)
weapon.gun_rotation = expected_rotation
if Input.is_action_just_released("select_target"):
ship.selected_node = star_system.targeted_node
if ship.selected_node is Base and Input.is_action_just_released("dock"):
ship.selected_node.dock_requested.emit()