TailgunnerGodot/scripts/flyer_controller.gd

23 lines
531 B
GDScript

@tool
class_name FlyerController
extends Node
# references
@export var controlled_flyer: Flyer:
set(new_flyer):
controlled_flyer = new_flyer
update_configuration_warnings()
func _ready() -> void:
if Engine.is_editor_hint():
var parent = get_parent()
if (parent is Flyer):
controlled_flyer = parent
update_configuration_warnings()
func _get_configuration_warnings():
var warnings = []
if controlled_flyer == null:
warnings.append("Please select a flyer to be controlled by this controller.")
return warnings