Add weather audio cues

This commit is contained in:
2026-05-16 01:58:05 -07:00
parent dddac97658
commit 08a1df6ebe
7 changed files with 324 additions and 4 deletions
+8 -1
View File
@@ -74,6 +74,13 @@ DEMO_ACTORS = [
"fixed_z": 12000.0,
"rotation": unreal.Rotator(-42.0, -35.0, 0.0),
},
{
"label": "AGR_DemoWeatherAudioController",
"class": unreal.AgrarianWeatherAudioController,
"location_xy": unreal.Vector(-18000.0, -7000.0, 0.0),
"fixed_z": 11800.0,
"rotation": unreal.Rotator(0.0, 0.0, 0.0),
},
{
"label": "AGR_DemoNoticeActor",
"class": unreal.AgrarianDemoNoticeActor,
@@ -322,7 +329,7 @@ def spawn_foliage_actor(height_values):
reserved_points = [
spec["location_xy"]
for spec in DEMO_ACTORS
if spec["label"] not in {"AGR_DemoSkyLightingController", "AGR_DemoNoticeActor"}
if spec["label"] not in {"AGR_DemoSkyLightingController", "AGR_DemoWeatherAudioController", "AGR_DemoNoticeActor"}
]
foliage_actor = unreal.AgrarianEditorAutomationLibrary.spawn_actor_in_editor_world(
@@ -0,0 +1,62 @@
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
AUDIO_H = ROOT / "Source" / "AgrarianGame" / "AgrarianWeatherAudioController.h"
AUDIO_CPP = ROOT / "Source" / "AgrarianGame" / "AgrarianWeatherAudioController.cpp"
MAP_SETUP = ROOT / "Scripts" / "setup_ground_zero_demo_map.py"
TDD = ROOT / "Docs" / "TechnicalDesignDocument.md"
ROADMAP = ROOT / "AGRARIAN_DEVELOPMENT_ROADMAP.md"
EXPECTED = {
AUDIO_H: [
"class AAgrarianWeatherAudioController : public AActor",
"TObjectPtr<UAudioComponent> AmbientAudio;",
"TObjectPtr<UAudioComponent> RainAudio;",
"TObjectPtr<UAudioComponent> WindAudio;",
"TObjectPtr<UAudioComponent> StormAudio;",
"TObjectPtr<USoundBase> RainLoopSound;",
"void RefreshWeatherAudio(float DeltaSeconds);",
],
AUDIO_CPP: [
"#include \"AgrarianGameState.h\"",
"#include \"Components/AudioComponent.h\"",
"AmbientAudio = CreateDefaultSubobject<UAudioComponent>",
"RainAudio = CreateDefaultSubobject<UAudioComponent>",
"WindAudio = CreateDefaultSubobject<UAudioComponent>",
"StormAudio = CreateDefaultSubobject<UAudioComponent>",
"GameState->Weather",
"GameState->ActiveWeatherInputs.WindSpeedKmh",
"GameState->IsNight()",
"ApplyComponentVolume(RainAudio, CurrentRainVolume);",
"AudioComponent->SetVolumeMultiplier",
],
MAP_SETUP: [
"AGR_DemoWeatherAudioController",
"unreal.AgrarianWeatherAudioController",
],
TDD: [
"`AAgrarianWeatherAudioController`",
"ambient, rain, wind, and storm audio components",
],
ROADMAP: [
"[x] Add audio cues for weather.",
],
}
def main() -> None:
missing = []
for path, snippets in EXPECTED.items():
text = path.read_text(encoding="utf-8")
for snippet in snippets:
if snippet not in text:
missing.append(f"{path.relative_to(ROOT)}: {snippet}")
if missing:
raise RuntimeError("Weather audio controller verification failed: " + "; ".join(missing))
print("Agrarian weather audio controller verification complete.")
if __name__ == "__main__":
main()