feat(sites): typed dive site definition with placements and routes
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1c1f0b87da
commit
506f6dd0c8
5 files changed
+255
-2
No files matched your search
@@ -0,0 +1,21 @@
|
||||
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 ""
|
||||
Reference in new issue
Block a user