mirror of
https://codeberg.org/tenplus1/ambience.git
synced 2024-12-27 11:10:29 +01:00
remove fire sounds, added Mineclone support.
This commit is contained in:
parent
c1a076ec8c
commit
e55d4b8b62
61
init.lua
61
init.lua
@ -1,7 +1,10 @@
|
|||||||
|
|
||||||
|
-- global
|
||||||
|
|
||||||
ambience = {}
|
ambience = {}
|
||||||
|
|
||||||
-- settings
|
-- settings
|
||||||
|
|
||||||
local SOUNDVOLUME = 1.0
|
local SOUNDVOLUME = 1.0
|
||||||
local MUSICVOLUME = 0.6
|
local MUSICVOLUME = 0.6
|
||||||
local MUSICINTERVAL = 60 * 20
|
local MUSICINTERVAL = 60 * 20
|
||||||
@ -13,14 +16,14 @@ local sound_set_order = {} -- needed because pairs loops randomly through tables
|
|||||||
local set_nodes = {} -- all the nodes needed for sets
|
local set_nodes = {} -- all the nodes needed for sets
|
||||||
|
|
||||||
-- translation
|
-- translation
|
||||||
|
|
||||||
local S = minetest.get_translator("ambience")
|
local S = minetest.get_translator("ambience")
|
||||||
|
|
||||||
-- add set to list
|
-- add set to list
|
||||||
|
|
||||||
ambience.add_set = function(set_name, def)
|
ambience.add_set = function(set_name, def)
|
||||||
|
|
||||||
if not set_name or not def then
|
if not set_name or not def then return end
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
sound_sets[set_name] = {
|
sound_sets[set_name] = {
|
||||||
frequency = def.frequency or 50,
|
frequency = def.frequency or 50,
|
||||||
@ -34,14 +37,10 @@ ambience.add_set = function(set_name, def)
|
|||||||
|
|
||||||
for i = 1, #sound_set_order do
|
for i = 1, #sound_set_order do
|
||||||
|
|
||||||
if sound_set_order[i] == set_name then
|
if sound_set_order[i] == set_name then can_add = false end
|
||||||
can_add = false
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if can_add then
|
if can_add then table.insert(sound_set_order, set_name) end
|
||||||
table.insert(sound_set_order, set_name)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- add any missing nodes to the set_nodes table
|
-- add any missing nodes to the set_nodes table
|
||||||
if def.nodes then
|
if def.nodes then
|
||||||
@ -52,26 +51,22 @@ ambience.add_set = function(set_name, def)
|
|||||||
|
|
||||||
for j = 1, #set_nodes do
|
for j = 1, #set_nodes do
|
||||||
|
|
||||||
if def.nodes[i] == set_nodes[j] then
|
if def.nodes[i] == set_nodes[j] then can_add = false end
|
||||||
can_add = false
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if can_add then
|
if can_add then table.insert(set_nodes, can_add) end
|
||||||
table.insert(set_nodes, can_add)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- return set from list using name
|
-- return set from list using name
|
||||||
|
|
||||||
ambience.get_set = function(set_name)
|
ambience.get_set = function(set_name)
|
||||||
return sound_sets[set_name]
|
return sound_sets[set_name]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- remove set from list
|
-- remove set from list
|
||||||
|
|
||||||
ambience.del_set = function(set_name)
|
ambience.del_set = function(set_name)
|
||||||
|
|
||||||
sound_sets[set_name] = nil
|
sound_sets[set_name] = nil
|
||||||
@ -80,18 +75,14 @@ ambience.del_set = function(set_name)
|
|||||||
|
|
||||||
for i = 1, #sound_set_order do
|
for i = 1, #sound_set_order do
|
||||||
|
|
||||||
if sound_set_order[i] == set_name then
|
if sound_set_order[i] == set_name then can_del = i end
|
||||||
can_del = i
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if can_del then
|
if can_del then table.remove(sound_set_order, can_del) end
|
||||||
table.remove(sound_set_order, can_del)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- setup table when player joins
|
-- setup table when player joins
|
||||||
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
minetest.register_on_joinplayer(function(player)
|
||||||
|
|
||||||
if player then
|
if player then
|
||||||
@ -109,15 +100,14 @@ minetest.register_on_joinplayer(function(player)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
-- remove table when player leaves
|
-- remove table when player leaves
|
||||||
|
|
||||||
minetest.register_on_leaveplayer(function(player)
|
minetest.register_on_leaveplayer(function(player)
|
||||||
|
|
||||||
if player then
|
if player then playing[player:get_player_name()] = nil end
|
||||||
playing[player:get_player_name()] = nil
|
|
||||||
end
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
-- plays music and selects sound set
|
-- plays music and selects sound set
|
||||||
|
|
||||||
local get_ambience = function(player, tod, name)
|
local get_ambience = function(player, tod, name)
|
||||||
|
|
||||||
-- if enabled and not already playing, play local/server music on interval check
|
-- if enabled and not already playing, play local/server music on interval check
|
||||||
@ -183,9 +173,7 @@ local get_ambience = function(player, tod, name)
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- if conditions met return set name and gain value
|
-- if conditions met return set name and gain value
|
||||||
if set_name then
|
if set_name then return set_name, gain end
|
||||||
return set_name, gain
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -197,6 +185,7 @@ local timer = 0
|
|||||||
local random = math.random
|
local random = math.random
|
||||||
|
|
||||||
-- players routine
|
-- players routine
|
||||||
|
|
||||||
minetest.register_globalstep(function(dtime)
|
minetest.register_globalstep(function(dtime)
|
||||||
|
|
||||||
-- one second timer
|
-- one second timer
|
||||||
@ -268,9 +257,7 @@ minetest.register_globalstep(function(dtime)
|
|||||||
minetest.after(ambience.length, function(handler, player_name)
|
minetest.after(ambience.length, function(handler, player_name)
|
||||||
|
|
||||||
--print("-- timed stop", set_name, handler)
|
--print("-- timed stop", set_name, handler)
|
||||||
if handler then
|
if handler then minetest.sound_stop(handler) end
|
||||||
minetest.sound_stop(handler)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- reset variables if handlers match
|
-- reset variables if handlers match
|
||||||
if playing[player_name]
|
if playing[player_name]
|
||||||
@ -288,8 +275,8 @@ minetest.register_globalstep(function(dtime)
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
-- sound volume command
|
-- sound volume command
|
||||||
|
|
||||||
minetest.register_chatcommand("svol", {
|
minetest.register_chatcommand("svol", {
|
||||||
params = S("<svol>"),
|
params = S("<svol>"),
|
||||||
description = S("set sound volume (0.1 to 1.0)"),
|
description = S("set sound volume (0.1 to 1.0)"),
|
||||||
@ -313,8 +300,8 @@ minetest.register_chatcommand("svol", {
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
-- music volume command (0 stops music)
|
-- music volume command (0 stops music)
|
||||||
|
|
||||||
minetest.register_chatcommand("mvol", {
|
minetest.register_chatcommand("mvol", {
|
||||||
params = S("<mvol>"),
|
params = S("<mvol>"),
|
||||||
description = S("set music volume (0.1 to 1.0, 0 to stop music)"),
|
description = S("set music volume (0.1 to 1.0, 0 to stop music)"),
|
||||||
@ -348,8 +335,8 @@ minetest.register_chatcommand("mvol", {
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
-- load default sound sets
|
-- load default sound sets
|
||||||
|
|
||||||
dofile(minetest.get_modpath("ambience") .. "/soundsets.lua")
|
dofile(minetest.get_modpath("ambience") .. "/soundsets.lua")
|
||||||
|
|
||||||
|
|
||||||
|
3
mod.conf
3
mod.conf
@ -1,5 +1,4 @@
|
|||||||
name = ambience
|
name = ambience
|
||||||
description = Adds realistic sound effects into your world.
|
description = Adds realistic sound effects into your world.
|
||||||
depends = default
|
optional_depends = default, mcl_core, mclx_core
|
||||||
optional_depends = fire
|
|
||||||
min_minetest_version = 5.0
|
min_minetest_version = 5.0
|
||||||
|
201
soundsets.lua
201
soundsets.lua
@ -2,10 +2,15 @@
|
|||||||
Default Sound Sets
|
Default Sound Sets
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
Order is very important when adding a sound set so it will play a certain
|
Order is very important when adding a sound set so it will play
|
||||||
set of sounds before any another.
|
certain sound sets before any another.
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
|
-- mod support
|
||||||
|
|
||||||
|
local mod_def = minetest.get_modpath("default")
|
||||||
|
local mod_mcl = minetest.get_modpath("mcl_core")
|
||||||
|
|
||||||
-- Underwater sounds play when player head is submerged
|
-- Underwater sounds play when player head is submerged
|
||||||
|
|
||||||
ambience.add_set("underwater", {
|
ambience.add_set("underwater", {
|
||||||
@ -18,8 +23,9 @@ ambience.add_set("underwater", {
|
|||||||
|
|
||||||
sound_check = function(def)
|
sound_check = function(def)
|
||||||
|
|
||||||
if minetest.registered_nodes[def.head_node]
|
local nodef = minetest.registered_nodes[def.head_node]
|
||||||
and minetest.registered_nodes[def.head_node].groups.water then
|
|
||||||
|
if nodef and nodef.groups and nodef.groups.water then
|
||||||
return "underwater"
|
return "underwater"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -29,13 +35,21 @@ ambience.add_set("underwater", {
|
|||||||
|
|
||||||
if minetest.settings:get_bool("ambience_water_move") ~= false then
|
if minetest.settings:get_bool("ambience_water_move") ~= false then
|
||||||
|
|
||||||
-- override default water sounds
|
-- override default water sounds
|
||||||
minetest.override_item("default:water_source", { sounds = {} })
|
|
||||||
minetest.override_item("default:water_flowing", { sounds = {} })
|
|
||||||
minetest.override_item("default:river_water_source", { sounds = {} })
|
|
||||||
minetest.override_item("default:river_water_flowing", { sounds = {} })
|
|
||||||
|
|
||||||
ambience.add_set("splash", {
|
if mod_def then
|
||||||
|
minetest.override_item("default:water_source", { sounds = {} })
|
||||||
|
minetest.override_item("default:water_flowing", { sounds = {} })
|
||||||
|
minetest.override_item("default:river_water_source", { sounds = {} })
|
||||||
|
minetest.override_item("default:river_water_flowing", { sounds = {} })
|
||||||
|
elseif mod_mcl then
|
||||||
|
minetest.override_item("mcl_core:water_source", { sounds = {} })
|
||||||
|
minetest.override_item("mcl_core:water_flowing", { sounds = {} })
|
||||||
|
minetest.override_item("mclx_core:river_water_source", { sounds = {} })
|
||||||
|
minetest.override_item("mclx_core:river_water_flowing", { sounds = {} })
|
||||||
|
end
|
||||||
|
|
||||||
|
ambience.add_set("splash", {
|
||||||
|
|
||||||
frequency = 1000,
|
frequency = 1000,
|
||||||
|
|
||||||
@ -45,8 +59,9 @@ ambience.add_set("splash", {
|
|||||||
|
|
||||||
sound_check = function(def)
|
sound_check = function(def)
|
||||||
|
|
||||||
if minetest.registered_nodes[def.feet_node]
|
local nodef = minetest.registered_nodes[def.feet_node]
|
||||||
and minetest.registered_nodes[def.feet_node].groups.water then
|
|
||||||
|
if nodef and nodef.groups and nodef.groups.water then
|
||||||
|
|
||||||
local control = def.player:get_player_control()
|
local control = def.player:get_player_control()
|
||||||
|
|
||||||
@ -55,8 +70,7 @@ ambience.add_set("splash", {
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- check for env_sounds mod, if not found enable water flowing and lava sounds
|
-- check for env_sounds mod, if not found enable water flowing and lava sounds
|
||||||
@ -72,18 +86,16 @@ ambience.add_set("flowing_water", {
|
|||||||
{name = "waterfall", length = 6}
|
{name = "waterfall", length = 6}
|
||||||
},
|
},
|
||||||
|
|
||||||
nodes = {"default:water_flowing"},
|
nodes = {"group:water"},
|
||||||
|
|
||||||
sound_check = function(def)
|
sound_check = function(def)
|
||||||
|
|
||||||
local c = (def.totals["default:water_flowing"] or 0)
|
local c = (def.totals["default:water_flowing"] or 0)
|
||||||
|
+ (def.totals["mcl_core:water_flowing"] or 0)
|
||||||
|
|
||||||
if c > 40 then
|
if c > 40 then return "flowing_water", 0.5
|
||||||
return "flowing_water", 0.5
|
|
||||||
|
|
||||||
elseif c > 5 then
|
elseif c > 5 then return "flowing_water" end
|
||||||
return "flowing_water"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -97,18 +109,14 @@ ambience.add_set("river", {
|
|||||||
{name = "river", length = 4, gain = 0.1}
|
{name = "river", length = 4, gain = 0.1}
|
||||||
},
|
},
|
||||||
|
|
||||||
nodes = {"default:river_water_flowing"},
|
|
||||||
|
|
||||||
sound_check = function(def)
|
sound_check = function(def)
|
||||||
|
|
||||||
local c = (def.totals["default:river_water_flowing"] or 0)
|
local c = (def.totals["default:river_water_flowing"] or 0)
|
||||||
|
+ (def.totals["mclx_core:river_water_flowing"] or 0)
|
||||||
|
|
||||||
if c > 20 then
|
if c > 20 then return "river", 0.5
|
||||||
return "river", 0.5
|
|
||||||
|
|
||||||
elseif c > 5 then
|
elseif c > 5 then return "river" end
|
||||||
return "river"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -122,19 +130,18 @@ ambience.add_set("lava", {
|
|||||||
{name = "lava", length = 7}
|
{name = "lava", length = 7}
|
||||||
},
|
},
|
||||||
|
|
||||||
nodes = {"default:lava_source", "default:lava_flowing"},
|
nodes = {"group:lava"},
|
||||||
|
|
||||||
sound_check = function(def)
|
sound_check = function(def)
|
||||||
|
|
||||||
local c = (def.totals["default:lava_source"] or 0)
|
local c = (def.totals["default:lava_source"] or 0)
|
||||||
+ (def.totals["default:lava_flowing"] or 0)
|
+ (def.totals["default:lava_flowing"] or 0)
|
||||||
|
+ (def.totals["mcl_core:lava_source"] or 0)
|
||||||
|
+ (def.totals["mcl_core:lava_flowing"] or 0)
|
||||||
|
|
||||||
if c > 20 then
|
if c > 20 then return "lava", 0.5
|
||||||
return "lava", 0.5
|
|
||||||
|
|
||||||
elseif c > 5 then
|
elseif c > 5 then return "lava" end
|
||||||
return "lava"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -142,68 +149,6 @@ else
|
|||||||
print ("[MOD] Ambience - found env_sounds, using for water and lava sounds.")
|
print ("[MOD] Ambience - found env_sounds, using for water and lava sounds.")
|
||||||
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 ("[MOD] Ambience - fire sounds not enabled, already active in fire mod.")
|
|
||||||
else
|
|
||||||
|
|
||||||
-- Small fire sound plays when near lower than 9 flames
|
|
||||||
|
|
||||||
ambience.add_set("smallfire", {
|
|
||||||
|
|
||||||
frequency = 1000,
|
|
||||||
|
|
||||||
sounds = {
|
|
||||||
{name = "fire_small", length = 6, gain = 0.1}
|
|
||||||
},
|
|
||||||
|
|
||||||
nodes = {"fire:basic_flame", "fire:permanent_flame"},
|
|
||||||
|
|
||||||
sound_check = function(def)
|
|
||||||
|
|
||||||
local c = (def.totals["fire:basic_flame"] or 0)
|
|
||||||
+ (def.totals["fire:permanent_flame"] or 0)
|
|
||||||
|
|
||||||
if c > 5 and c < 9 then
|
|
||||||
return "smallfire", 0.5
|
|
||||||
|
|
||||||
elseif c > 0 and c < 9 then
|
|
||||||
return "smallfire"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Large fire sound plays when near more than 9 flames
|
|
||||||
|
|
||||||
ambience.add_set("largefire", {
|
|
||||||
|
|
||||||
frequency = 1000,
|
|
||||||
|
|
||||||
sounds = {
|
|
||||||
{name = "fire_large", length = 8, gain = 0.4}
|
|
||||||
},
|
|
||||||
|
|
||||||
sound_check = function(def)
|
|
||||||
|
|
||||||
-- fire nodes were added in last set, so don't need to be added in this one
|
|
||||||
local c = (def.totals["fire:basic_flame"] or 0)
|
|
||||||
+ (def.totals["fire:permanent_flame"] or 0)
|
|
||||||
|
|
||||||
if c > 20 then
|
|
||||||
return "largefire", 0.5
|
|
||||||
|
|
||||||
elseif c > 8 then
|
|
||||||
return "largefire"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Beach sounds play when below y-pos 6 and 150+ water source found
|
-- Beach sounds play when below y-pos 6 and 150+ water source found
|
||||||
|
|
||||||
ambience.add_set("beach", {
|
ambience.add_set("beach", {
|
||||||
@ -218,11 +163,10 @@ ambience.add_set("beach", {
|
|||||||
{name = "beach_2", length = 6}
|
{name = "beach_2", length = 6}
|
||||||
},
|
},
|
||||||
|
|
||||||
nodes = {"default:water_source"},
|
|
||||||
|
|
||||||
sound_check = function(def)
|
sound_check = function(def)
|
||||||
|
|
||||||
local c = (def.totals["default:water_source"] or 0)
|
local c = (def.totals["default:water_source"] or 0)
|
||||||
|
+ (def.totals["mcl_core:water_source"] or 0)
|
||||||
|
|
||||||
if def.pos.y < 6 and def.pos.y > 0 and c > 150 then
|
if def.pos.y < 6 and def.pos.y > 0 and c > 150 then
|
||||||
return "beach"
|
return "beach"
|
||||||
@ -242,15 +186,15 @@ ambience.add_set("ice", {
|
|||||||
{name = "wind", length = 9}
|
{name = "wind", length = 9}
|
||||||
},
|
},
|
||||||
|
|
||||||
nodes = {"default:ice"},
|
nodes = (mod_mcl and {"mcl_core:ice", "mcl_core:packed_ice"} or {"default:ice"}),
|
||||||
|
|
||||||
sound_check = function(def)
|
sound_check = function(def)
|
||||||
|
|
||||||
local c = (def.totals["default:ice"] or 0)
|
local c = (def.totals["default:ice"] or 0)
|
||||||
|
+(def.totals["mcl_core:ice"] or 0)
|
||||||
|
+ (def.totals["mcl_core:packed_ice"] or 0)
|
||||||
|
|
||||||
if c > 100 then
|
if c > 100 then return "ice" end
|
||||||
return "ice"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -266,16 +210,19 @@ ambience.add_set("desert", {
|
|||||||
{name = "desertwind", length = 8}
|
{name = "desertwind", length = 8}
|
||||||
},
|
},
|
||||||
|
|
||||||
nodes = {"default:desert_sand", "default:sand"},
|
nodes = {
|
||||||
|
(mod_mcl and "mcl_core:redsand" or "default:desert_sand"),
|
||||||
|
(mod_mcl and "mcl_core:sand" or "default:sand")
|
||||||
|
},
|
||||||
|
|
||||||
sound_check = function(def)
|
sound_check = function(def)
|
||||||
|
|
||||||
local c = (def.totals["default:desert_sand"] or 0)
|
local c = (def.totals["default:desert_sand"] or 0)
|
||||||
+ (def.totals["default:sand"] or 0)
|
+ (def.totals["default:sand"] or 0)
|
||||||
|
+ (def.totals["mcl_core:sand"] or 0)
|
||||||
|
+ (def.totals["mcl_core:redsand"] or 0)
|
||||||
|
|
||||||
if c > 150 and def.pos.y > 10 then
|
if c > 150 and def.pos.y > 10 then return "desert" end
|
||||||
return "desert"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -296,10 +243,9 @@ ambience.add_set("cave", {
|
|||||||
sound_check = function(def)
|
sound_check = function(def)
|
||||||
|
|
||||||
local c = (def.totals["default:water_source"] or 0)
|
local c = (def.totals["default:water_source"] or 0)
|
||||||
|
+ (def.totals["mcl_core:water_source"] or 0)
|
||||||
|
|
||||||
if c > 0 and def.pos.y < -25 then
|
if c > 0 and def.pos.y < -25 then return "cave" end
|
||||||
return "cave"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -318,15 +264,14 @@ ambience.add_set("jungle", {
|
|||||||
{name = "peacock", length = 2, pitch = 1.2, ephemeral = true}
|
{name = "peacock", length = 2, pitch = 1.2, ephemeral = true}
|
||||||
},
|
},
|
||||||
|
|
||||||
nodes = {"default:jungletree"},
|
nodes = {(mod_mcl and "mcl_trees:tree_jungle" or "default:jungletree")},
|
||||||
|
|
||||||
sound_check = function(def)
|
sound_check = function(def)
|
||||||
|
|
||||||
local c = (def.totals["default:jungletree"] or 0)
|
local c = (def.totals["default:jungletree"] or 0)
|
||||||
|
+ (def.totals["mcl_trees:tree_jungle"] or 0)
|
||||||
|
|
||||||
if def.tod > 0.2 and def.tod < 0.8 and c > 90 then
|
if def.tod > 0.2 and def.tod < 0.8 and c > 79 then return "jungle" end
|
||||||
return "jungle"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -348,10 +293,9 @@ ambience.add_set("jungle_night", {
|
|||||||
|
|
||||||
-- jungle tree was added in last set, so doesnt need to be added in this one
|
-- jungle tree was added in last set, so doesnt need to be added in this one
|
||||||
local c = (def.totals["default:jungletree"] or 0)
|
local c = (def.totals["default:jungletree"] or 0)
|
||||||
|
+ (def.totals["mcl_trees:tree_jungle"] or 0)
|
||||||
|
|
||||||
if (def.tod < 0.2 or def.tod > 0.8) and c > 90 then
|
if (def.tod < 0.2 or def.tod > 0.8) and c > 79 then return "jungle_night" end
|
||||||
return "jungle_night"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -385,10 +329,13 @@ ambience.add_set("day", {
|
|||||||
+ (def.totals["default:bush_leaves"] or 0)
|
+ (def.totals["default:bush_leaves"] or 0)
|
||||||
+ (def.totals["default:pine_needles"] or 0)
|
+ (def.totals["default:pine_needles"] or 0)
|
||||||
+ (def.totals["default:aspen_leaves"] or 0)
|
+ (def.totals["default:aspen_leaves"] or 0)
|
||||||
|
+ (def.totals["mcl_trees:leaves_spruce"] or 0)
|
||||||
|
+ (def.totals["mcl_trees:leaves_oak"] or 0)
|
||||||
|
+ (def.totals["mcl_trees:leaves_mangrove"] or 0)
|
||||||
|
+ (def.totals["mcl_trees:leaves_birch"] or 0)
|
||||||
|
+ (def.totals["mcl_trees:leaves_acacia"] or 0)
|
||||||
|
|
||||||
if (def.tod > 0.2 and def.tod < 0.8)
|
if (def.tod > 0.2 and def.tod < 0.8) and def.pos.y > -10 and c > 5 then
|
||||||
and def.pos.y > -10
|
|
||||||
and c > 5 then
|
|
||||||
return "day"
|
return "day"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -417,10 +364,14 @@ ambience.add_set("night", {
|
|||||||
+ (def.totals["default:bush_leaves"] or 0)
|
+ (def.totals["default:bush_leaves"] or 0)
|
||||||
+ (def.totals["default:pine_needles"] or 0)
|
+ (def.totals["default:pine_needles"] or 0)
|
||||||
+ (def.totals["default:aspen_leaves"] or 0)
|
+ (def.totals["default:aspen_leaves"] or 0)
|
||||||
|
+ (def.totals["mcl_trees:leaves_spruce"] or 0)
|
||||||
|
+ (def.totals["mcl_trees:leaves_oak"] or 0)
|
||||||
|
+ (def.totals["mcl_trees:leaves_mangrove"] or 0)
|
||||||
|
+ (def.totals["mcl_trees:leaves_birch"] or 0)
|
||||||
|
+ (def.totals["mcl_trees:leaves_acacia"] or 0)
|
||||||
|
|
||||||
if (def.tod < 0.2 or def.tod > 0.8)
|
|
||||||
and def.pos.y > -10
|
if (def.tod < 0.2 or def.tod > 0.8) and def.pos.y > -10 and c > 5 then
|
||||||
and c > 5 then
|
|
||||||
return "night"
|
return "night"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -439,15 +390,13 @@ ambience.add_set("high_up", {
|
|||||||
{name = "wind", length = 9, pitch = 1.4}
|
{name = "wind", length = 9, pitch = 1.4}
|
||||||
},
|
},
|
||||||
|
|
||||||
nodes = {"default:snowblock"},
|
nodes = {(mod_mcl and "mcl_core:snowblock" or "default:snowblock")},
|
||||||
|
|
||||||
sound_check = function(def)
|
sound_check = function(def)
|
||||||
|
|
||||||
local c = (def.totals["default:snowblock"] or 0)
|
local c = (def.totals["default:snowblock"] or 0)
|
||||||
|
+ (def.totals["mcl_core:snowblock"] or 0)
|
||||||
|
|
||||||
if def.pos.y > 50 or c > 150 then
|
if def.pos.y > 50 or c > 100 then return "high_up" end
|
||||||
return "high_up"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user