mirror of
https://codeberg.org/tenplus1/ambience.git
synced 2025-07-12 13:30:28 +02:00
Compare commits
4 Commits
a566fa9acc
...
4acc464a8a
Author | SHA1 | Date | |
---|---|---|---|
4acc464a8a | |||
e19fca8446 | |||
d0cea9d033 | |||
19673910d9 |
8
init.lua
8
init.lua
@ -104,7 +104,8 @@ end)
|
|||||||
local get_ambience = function(player, tod, name)
|
local get_ambience = function(player, tod, name)
|
||||||
|
|
||||||
-- play server or local music if music enabled and music not already playing
|
-- play server or local music if music enabled and music not already playing
|
||||||
if play_music and MUSICVOLUME > 0 and playing[name].music < 0 then
|
if play_music and MUSICVOLUME > 0
|
||||||
|
and playing[name] and playing[name].music < 0 then
|
||||||
|
|
||||||
-- count backwards
|
-- count backwards
|
||||||
playing[name].music = playing[name].music -1
|
playing[name].music = playing[name].music -1
|
||||||
@ -133,13 +134,14 @@ local get_ambience = function(player, tod, name)
|
|||||||
-- get foot and head level nodes at player position
|
-- get foot and head level nodes at player position
|
||||||
local pos = player:get_pos() ; if not pos then return end
|
local pos = player:get_pos() ; if not pos then return end
|
||||||
local prop = player:get_properties()
|
local prop = player:get_properties()
|
||||||
|
local eyeh = prop.eye_height or 1.47 -- eye level with fallback
|
||||||
|
|
||||||
pos.y = pos.y + prop.eye_height -- eye level
|
pos.y = pos.y + eyeh
|
||||||
|
|
||||||
local nod_head = pplus and name and playerplus[name]
|
local nod_head = pplus and name and playerplus[name]
|
||||||
and playerplus[name].nod_head or minetest.get_node(pos).name
|
and playerplus[name].nod_head or minetest.get_node(pos).name
|
||||||
|
|
||||||
pos.y = (pos.y - prop.eye_height) + 0.2 -- foot level
|
pos.y = (pos.y - eyeh) + 0.2 -- foot level
|
||||||
|
|
||||||
local nod_feet = pplus and name and playerplus[name]
|
local nod_feet = pplus and name and playerplus[name]
|
||||||
and playerplus[name].nod_feet or minetest.get_node(pos).name
|
and playerplus[name].nod_feet or minetest.get_node(pos).name
|
||||||
|
@ -139,7 +139,7 @@ ambience.add_set("lava", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
else
|
else
|
||||||
print ("[Ambience] found env_sounds, flowing water sounds disabled.")
|
print ("[Ambience] found env_sounds, flowing water and lava sounds disabled.")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Only add fire sounds set if flame_sound is disabled or fire redo active
|
-- Only add fire sounds set if flame_sound is disabled or fire redo active
|
||||||
@ -238,7 +238,7 @@ ambience.add_set("ice", {
|
|||||||
frequency = 250,
|
frequency = 250,
|
||||||
|
|
||||||
sounds = {
|
sounds = {
|
||||||
{name = "icecrack", length = 23},
|
{name = "icecrack", length = 23, gain = 0.7},
|
||||||
{name = "desertwind", length = 8},
|
{name = "desertwind", length = 8},
|
||||||
{name = "wind", length = 9}
|
{name = "wind", length = 9}
|
||||||
},
|
},
|
||||||
@ -280,7 +280,7 @@ ambience.add_set("desert", {
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Cave sounds play when below player position Y -25
|
-- Cave sounds play when below player position Y -25 and water nearby
|
||||||
|
|
||||||
ambience.add_set("cave", {
|
ambience.add_set("cave", {
|
||||||
|
|
||||||
@ -293,7 +293,9 @@ ambience.add_set("cave", {
|
|||||||
|
|
||||||
sound_check = function(def)
|
sound_check = function(def)
|
||||||
|
|
||||||
if def.pos.y < -25 then
|
local c = (def.totals["default:water_source"] or 0)
|
||||||
|
|
||||||
|
if c > 0 and def.pos.y < -25 then
|
||||||
return "cave"
|
return "cave"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user