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,35 @@
|
||||
class_name SitePlacement
|
||||
extends Resource
|
||||
|
||||
enum Kind {
|
||||
WRECK_TARGET,
|
||||
WRECK_DECOY,
|
||||
SECONDARY_ITEM,
|
||||
DEBRIS,
|
||||
LANDMARK,
|
||||
VESSEL_ANCHOR,
|
||||
}
|
||||
|
||||
@export var placement_id: StringName
|
||||
@export var kind: Kind = Kind.LANDMARK
|
||||
@export var position_m: Vector3 = Vector3.ZERO
|
||||
@export var yaw_radians: float = 0.0
|
||||
@export var footprint_m: Vector3 = Vector3.ZERO
|
||||
|
||||
|
||||
func is_sonar_metal() -> bool:
|
||||
return kind in [Kind.WRECK_TARGET, Kind.WRECK_DECOY, Kind.SECONDARY_ITEM, Kind.DEBRIS]
|
||||
|
||||
|
||||
func validation_error() -> String:
|
||||
if placement_id.is_empty():
|
||||
return "placement id is empty"
|
||||
if not (is_finite(position_m.x) and is_finite(position_m.y) and is_finite(position_m.z)):
|
||||
return "placement position must be finite"
|
||||
if not is_finite(yaw_radians):
|
||||
return "placement yaw must be finite"
|
||||
if footprint_m.x < 0.0 or footprint_m.y < 0.0 or footprint_m.z < 0.0:
|
||||
return "placement footprint must not be negative"
|
||||
if is_sonar_metal() and footprint_m.length_squared() == 0.0:
|
||||
return "sonar bodies need a footprint"
|
||||
return ""
|
||||
Reference in new issue
Block a user