35 lines
964 B
GDScript
35 lines
964 B
GDScript
extends Area2D
|
|
|
|
@export var menu : PackedScene
|
|
@onready var base_collider = $"../BaseCollider/BaseColliderDetector"
|
|
var menu_inst
|
|
var ship_in_menu = false
|
|
|
|
func onbcbodyentered(body):
|
|
if body is MainShip:
|
|
body.engine.speed = 0
|
|
|
|
func _input(event):
|
|
if event is InputEventKey and ship_in_menu:
|
|
if Input.is_action_just_released("hide_menu"):
|
|
menu_inst.visible = !menu_inst.visible
|
|
|
|
func _on_body_entered(body):
|
|
if body is MainShip:
|
|
ship_in_menu = true
|
|
body.allow_shooting = false
|
|
menu_inst = menu.instantiate()
|
|
menu_inst.modulate = get_parent().modulate
|
|
menu_inst.base = get_parent()
|
|
body.find_child("GUI").add_child(menu_inst)
|
|
body.minimap.visible = false
|
|
if body.quest.type == Quest.TYPE.DELIVERY:
|
|
if body.quest.data['destination'] == get_parent():
|
|
body.quest.do_progress()
|
|
|
|
func _on_body_exited(body):
|
|
if body is MainShip:
|
|
body.allow_shooting = true
|
|
body.minimap.visible = true
|
|
menu_inst.queue_free()
|
|
ship_in_menu = false
|