feat(sonar): add SAND terrain material

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
OlivierandClaude Haiku 4.5 committed 2026-10-06 19:40:10 +02:00
1 parent 41c86a408e
commit fdbfd773e2
2 files changed
+17 -2

No files matched your search

+6 -1
View File
@@ -5,8 +5,13 @@ enum Value {
UNKNOWN,
ROCK,
METAL,
SAND,
}
static func is_valid(value: int) -> bool:
return value >= Value.UNKNOWN and value <= Value.METAL
return value >= Value.UNKNOWN and value <= Value.SAND
static func is_terrain(value: int) -> bool:
return value == Value.ROCK or value == Value.SAND
+11 -1
View File
@@ -20,7 +20,7 @@ const SonarAcquisitionPort = preload(
)
const SonarService = preload("res://game/application/sonar/sonar_service.gd")
const TEST_COUNT := 32
const TEST_COUNT := 34
var _failures: Array[String] = []
@@ -76,6 +76,16 @@ func _test_sample_buffer_contract() -> void:
true
)
_expect(sample.validation_error().is_empty(), "observed typed sample is valid")
var sand_sample := SonarSample.new(
Vector3(2.0, -4.0, 9.0),
Vector3.UP,
0.4,
-4.0,
SonarMaterial.Value.SAND,
true
)
_expect(sand_sample.validation_error().is_empty(), "sand is a valid terrain material")
_expect(SonarMaterial.is_valid(SonarMaterial.Value.SAND), "sand is inside the material range")
var buffer := SonarSampleBuffer.new(3, 2)
_expect(buffer.set_sample(1, 2, sample).is_empty(), "sample writes inside buffer bounds")
_expect(buffer.observed_count() == 1, "buffer counts observed cells")