mirror of
https://codeberg.org/tenplus1/ambience.git
synced 2024-12-24 17:50:29 +01:00
added flame_sound and fire redo check
This commit is contained in:
parent
7bb0275f1e
commit
b7f794c1fe
7
init.lua
7
init.lua
@ -22,13 +22,15 @@ local set_nodes = {} -- all the nodes needed for sets
|
|||||||
-- global functions
|
-- global functions
|
||||||
ambience.add_set = function(set_name, def)
|
ambience.add_set = function(set_name, def)
|
||||||
|
|
||||||
if set_name and def then
|
if not set_name or not def then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
sound_sets[set_name] = {
|
sound_sets[set_name] = {
|
||||||
frequency = def.frequency or 50,
|
frequency = def.frequency or 50,
|
||||||
sounds = def.sounds,
|
sounds = def.sounds,
|
||||||
sound_check = def.sound_check,
|
sound_check = def.sound_check,
|
||||||
nodes = def.nodes,
|
nodes = def.nodes
|
||||||
}
|
}
|
||||||
|
|
||||||
-- add set name to the sound_set_order table
|
-- add set name to the sound_set_order table
|
||||||
@ -64,7 +66,6 @@ ambience.add_set = function(set_name, def)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,9 +89,20 @@ ambience.add_set("river", {
|
|||||||
nodes = {"default:river_water_flowing"}
|
nodes = {"default:river_water_flowing"}
|
||||||
})
|
})
|
||||||
else
|
else
|
||||||
print ("[Ambience] found env_sounds, flowing water sounds disabled")
|
print ("[Ambience] found env_sounds, flowing water sounds disabled.")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Only add fire sounds set if flame_sound is disabled or fire redo active
|
||||||
|
|
||||||
|
local flame_sound = minetest.settings:get_bool("flame_sound", true)
|
||||||
|
local fire_redo = minetest.get_modpath("fire") and fire.mod and fire.mod == "redo"
|
||||||
|
|
||||||
|
if flame_sound and not fire_redo then
|
||||||
|
|
||||||
|
print ("[Ambience] fire sounds not enabled, already active in fire mod.")
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
-- Small fire sound plays when near flame, will get louder if more than 3
|
-- Small fire sound plays when near flame, will get louder if more than 3
|
||||||
|
|
||||||
ambience.add_set("smallfire", {
|
ambience.add_set("smallfire", {
|
||||||
@ -101,8 +112,6 @@ ambience.add_set("smallfire", {
|
|||||||
},
|
},
|
||||||
sound_check = function(def)
|
sound_check = function(def)
|
||||||
|
|
||||||
if fire and fire.mod and fire.mod == "redo" then
|
|
||||||
|
|
||||||
local c = (def.totals["fire:basic_flame"] or 0)
|
local c = (def.totals["fire:basic_flame"] or 0)
|
||||||
+ (def.totals["fire:permanent_flame"] or 0)
|
+ (def.totals["fire:permanent_flame"] or 0)
|
||||||
|
|
||||||
@ -112,7 +121,6 @@ ambience.add_set("smallfire", {
|
|||||||
elseif c > 0 and c < 4 then
|
elseif c > 0 and c < 4 then
|
||||||
return "smallfire"
|
return "smallfire"
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
nodes = {"fire:basic_flame", "fire:permanent_flame"}
|
nodes = {"fire:basic_flame", "fire:permanent_flame"}
|
||||||
})
|
})
|
||||||
@ -126,8 +134,6 @@ ambience.add_set("largefire", {
|
|||||||
},
|
},
|
||||||
sound_check = function(def)
|
sound_check = function(def)
|
||||||
|
|
||||||
if fire and fire.mod and fire.mod == "redo" then
|
|
||||||
|
|
||||||
local c = (def.totals["fire:basic_flame"] or 0)
|
local c = (def.totals["fire:basic_flame"] or 0)
|
||||||
+ (def.totals["fire:permanent_flame"] or 0)
|
+ (def.totals["fire:permanent_flame"] or 0)
|
||||||
|
|
||||||
@ -137,11 +143,12 @@ ambience.add_set("largefire", {
|
|||||||
elseif c > 8 then
|
elseif c > 8 then
|
||||||
return "largefire"
|
return "largefire"
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
nodes = {"fire:basic_flame", "fire:permanent_flame"}
|
nodes = {"fire:basic_flame", "fire:permanent_flame"}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
-- Lava sound plays when near lava, will get louder if more than 50
|
-- Lava sound plays when near lava, will get louder if more than 50
|
||||||
|
|
||||||
ambience.add_set("lava", {
|
ambience.add_set("lava", {
|
||||||
|
Loading…
Reference in New Issue
Block a user