Real thunder (Gitea #4): six CC0 recordings, close cracks and distant rolls, in place of the synthesised rumble; a storm's flash is followed by a roll seconds later or a crack sooner, quieter indoors, and a strike on a tree cracks from the tree

This commit is contained in:
Paul Bailey
2026-11-08 20:29:48 +00:00
parent 07b8db1683
commit 8f3c58c810
18 changed files with 132 additions and 14 deletions

View File

@@ -19,6 +19,7 @@ extends Node
const K := "res://assets/audio/sfx/kenney/"
const S := "res://assets/audio/sfx/synth/"
const C := "res://assets/audio/sfx/creatures/"
const T := "res://assets/audio/sfx/thunder/"
const EARSHOT := 45.0 ## a server sends a sound to players this close
## id -> files (or a [prefix, count] pair), volume (dB), pitch range, reach (m),
@@ -28,6 +29,10 @@ const SOUNDS := {
"tree_fall": {"set": [K + "wood_heavy_%d.ogg", 5], "db": 0.0, "pitch": [0.6, 0.7], "reach": 60.0, "with": "creak"},
"creak": {"set": [K + "creak_%d.ogg", 3], "db": -2.0, "pitch": [0.8, 0.95], "reach": 50.0},
"mine": {"set": [K + "mine_%d.ogg", 5], "db": -1.0, "pitch": [0.9, 1.1]},
# Thunder (0.6.2, CC0 recordings: assets/audio/CREDITS.md). The weather
# plays the storm's own (weather_fx.gd); a strike on a tree cracks from it.
"thunder_near": {"set": [T + "thunder_near_%d.ogg", 3], "db": 0.0, "pitch": [0.92, 1.05], "reach": 400.0},
"thunder_far": {"set": [T + "thunder_far_%d.ogg", 3], "db": -5.0, "pitch": [0.9, 1.05], "reach": 400.0},
"rock_break": {"set": [K + "mine_%d.ogg", 5], "db": 1.0, "pitch": [0.6, 0.7], "reach": 50.0},
"rustle": {"set": [K + "cloth_%d.ogg", 4], "db": -4.0, "pitch": [0.7, 0.9]},
"pickup": {"set": [K + "leather_%d.ogg", 3], "db": -6.0, "pitch": [0.95, 1.15], "reach": 15.0},
@@ -196,6 +201,17 @@ func me(id: String) -> void:
_log(id, null)
_play2(id)
## A random one of sound `id`'s files, and its volume: for a player of your
## own (the weather's thunder). Not logged: call log_heard() when it plays.
func stream_for(id: String) -> AudioStream:
return _pick(id) if SOUNDS.has(id) else null
func db_for(id: String) -> float:
return float(SOUNDS.get(id, {}).get("db", 0.0))
func log_heard(id: String) -> void:
_log(id, null)
## Menus and the HUD.
func ui(id: String) -> void:
_log(id, null)