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:
@@ -269,6 +269,31 @@ func _lightning() -> void:
|
||||
var tree: Node3D = hz._burning.keys()[0]
|
||||
check(tree.global_position.distance_to(at) < hz.STRIKE_RANGE, "near you (%.0f m away)" % tree.global_position.distance_to(at))
|
||||
check(_toast_has("Lightning struck"), "you see it (%s)" % [_toasts])
|
||||
# Gitea #4: thunder is recorded now; the strike cracks from the tree.
|
||||
var SX: Node = root.get_node("Sfx")
|
||||
var cracks: Array = SX.heard.filter(func(h): return h[0] == "thunder_near" and h[1] is Vector3 and (h[1] as Vector3).distance_to(tree.global_position) < 8.0)
|
||||
check(cracks.size() == 1, "and hear it: a thunder crack from the tree")
|
||||
check(SX.files("thunder_near").size() == 3 and SX.files("thunder_far").size() == 3 and
|
||||
SX.files("thunder_near").all(func(f): return ResourceLoader.exists(f)) and SX.files("thunder_far").all(func(f): return ResourceLoader.exists(f)),
|
||||
"(three recorded cracks and three distant rolls)")
|
||||
var fx: Node3D = load("res://scripts/world/weather_fx.gd").new()
|
||||
world.add_child(fx)
|
||||
fx.setup(wx, player)
|
||||
var kinds := {}
|
||||
var delays := {"thunder_near": [], "thunder_far": []}
|
||||
for _i in range(60):
|
||||
fx.lightning()
|
||||
kinds[fx._thunder_id] = int(kinds.get(fx._thunder_id, 0)) + 1
|
||||
delays[fx._thunder_id].append(fx._thunder_delay)
|
||||
check(kinds.has("thunder_near") and kinds.has("thunder_far") and int(kinds.thunder_far) > int(kinds.thunder_near),
|
||||
"a storm's flashes: mostly distant rolls, sometimes a crack close by (%s)" % [kinds])
|
||||
check(delays.thunder_near.all(func(d): return d < 1.0) and delays.thunder_far.all(func(d): return d >= 1.5),
|
||||
"a close one follows its flash quickly, a distant one seconds later")
|
||||
var h0: int = SX.heard.size()
|
||||
fx._thunder_delay = 0.01
|
||||
fx._process(0.05)
|
||||
check(SX.heard.size() > h0 and SX.heard.slice(h0).any(func(h): return String(h[0]).begins_with("thunder_")), "and then you hear it")
|
||||
fx.queue_free()
|
||||
check(world.heat_at(tree.global_position + Vector3(2.5, 0, 0)) > 0.3, "it burns: you can warm yourself by it")
|
||||
check(not tree.depleted, "still standing while it burns")
|
||||
for _i in range(41):
|
||||
|
||||
Reference in New Issue
Block a user