22 lines
710 B
GDScript
22 lines
710 B
GDScript
class_name SiteRoute
|
|
extends Resource
|
|
|
|
@export var route_id: StringName
|
|
@export var waypoints_m := PackedVector3Array()
|
|
@export var maximum_depth_m: float = 0.0
|
|
|
|
|
|
func validation_error() -> String:
|
|
if route_id.is_empty():
|
|
return "route id is empty"
|
|
if waypoints_m.size() < 2:
|
|
return "route needs at least two waypoints"
|
|
if not is_finite(maximum_depth_m) or maximum_depth_m <= 0.0:
|
|
return "route maximum depth must be positive"
|
|
for waypoint: Vector3 in waypoints_m:
|
|
if not (is_finite(waypoint.x) and is_finite(waypoint.y) and is_finite(waypoint.z)):
|
|
return "route waypoints must be finite"
|
|
if -waypoint.y > maximum_depth_m:
|
|
return "route waypoint exceeds the route maximum depth"
|
|
return ""
|