Fixed docking area

This commit is contained in:
2ndbeam 2024-05-14 07:52:18 +03:00
commit 1982eb5e4e

View file

@ -44,25 +44,24 @@ func on_dock_requested():
dock_ready() dock_ready()
func gate_area_body_entered(body): func gate_area_body_entered(body):
if body is PlayerShip: if body.ship is PlayerShip:
touching_gate = true touching_gate = true
func gate_area_body_exited(body): func gate_area_body_exited(body):
if body is PlayerShip: if body.ship is PlayerShip:
touching_gate = false touching_gate = false
func dock_area_body_entered(body): func dock_area_body_entered(body):
if body is PlayerShip: if body.ship is PlayerShip:
touching_dock = true touching_dock = true
func dock_area_body_exited(body): func dock_area_body_exited(body):
if body is PlayerShip: if body.ship is PlayerShip:
touching_dock = false touching_dock = false
func _process(_delta): func _process(_delta):
if dock_state == DockState.Process: if dock_state == DockState.Process:
var distance_to_player = global_position.distance_to(player_ship.global_position) var distance_to_player = global_position.distance_to(player_ship.global_position)
print(touching_dock, " ", touching_gate)
if touching_dock and !touching_gate: if touching_dock and !touching_gate:
dock_busy() dock_busy()
if !touching_dock and !touching_gate and distance_to_player > 2048: if !touching_dock and !touching_gate and distance_to_player > 2048:
@ -70,7 +69,6 @@ func _process(_delta):
## Sets dock state to Ready ## Sets dock state to Ready
func dock_ready(): func dock_ready():
print("no shit")
dock_state = DockState.Ready dock_state = DockState.Ready
gate_static.visible = true gate_static.visible = true
gate_static.process_mode = Node.PROCESS_MODE_INHERIT gate_static.process_mode = Node.PROCESS_MODE_INHERIT
@ -80,7 +78,6 @@ func dock_ready():
touching_dock = false touching_dock = false
## Sets dock state to Process ## Sets dock state to Process
func dock_process(): func dock_process():
print("wanna dock")
dock_state = DockState.Process dock_state = DockState.Process
gate_static.visible = false gate_static.visible = false
gate_static.process_mode = Node.PROCESS_MODE_DISABLED gate_static.process_mode = Node.PROCESS_MODE_DISABLED
@ -97,5 +94,4 @@ func dock_busy():
dock_area.visible = false dock_area.visible = false
touching_gate = false touching_gate = false
touching_dock = true touching_dock = true
print("busy kozyzy")
# TODO: implement opening the base menu # TODO: implement opening the base menu