big
This commit is contained in:
+21
-1
@@ -35,6 +35,14 @@ const MATERIALS := {
|
||||
"concrete": { "trans_db": -18.0, "trans_cutoff": 450.0, "refl_db": -7.0, "refl_cutoff": 3600.0 },
|
||||
"metal": { "trans_db": -11.0, "trans_cutoff": 1000.0, "refl_db": -4.0, "refl_cutoff": 6000.0 },
|
||||
"glass": { "trans_db": -5.0, "trans_cutoff": 2600.0, "refl_db": -9.0, "refl_cutoff": 4200.0 },
|
||||
# Loose aggregate — track ballast, a gravel path. Transmission is close to
|
||||
# concrete's, because what a ray actually passes through is the bed under
|
||||
# it, but REFLECTION is the opposite: a surface of loose stone scatters
|
||||
# rather than reflects, so it returns little and returns it dull. Standing
|
||||
# on the ballast should sound noticeably deader than standing on the road.
|
||||
"gravel": { "trans_db": -17.0, "trans_cutoff": 500.0, "refl_db": -15.0, "refl_cutoff": 1800.0 },
|
||||
# Turf and bare earth: the strongest absorbers in the set.
|
||||
"grass": { "trans_db": -19.0, "trans_cutoff": 400.0, "refl_db": -18.0, "refl_cutoff": 1200.0 },
|
||||
}
|
||||
|
||||
const OPEN_CUTOFF := 20500.0
|
||||
@@ -55,7 +63,19 @@ static func classify(collider: Object) -> String:
|
||||
return "concrete"
|
||||
var node := collider as Node
|
||||
if node.has_meta("acoustic_material"):
|
||||
return node.get_meta("acoustic_material")
|
||||
# Validated, not trusted. A level builder can set this meta to anything,
|
||||
# and an unknown value used to reach `MATERIALS[mat]` directly and take
|
||||
# the whole audio path down with it — a map tagged a slab "gravel"
|
||||
# before gravel existed here, and every hitscan impact on it threw from
|
||||
# inside occlusion(). A surface with an unrecognised material should
|
||||
# sound like concrete, not stop the game making sound.
|
||||
var tagged: String = str(node.get_meta("acoustic_material"))
|
||||
if MATERIALS.has(tagged):
|
||||
return tagged
|
||||
push_warning("Acoustics: unknown acoustic_material '%s' on '%s'; using concrete."
|
||||
% [tagged, node.name])
|
||||
node.set_meta("acoustic_material", "concrete") # cache, warn once
|
||||
return "concrete"
|
||||
|
||||
var mat := "concrete"
|
||||
var n := node.name.to_lower()
|
||||
|
||||
Reference in New Issue
Block a user