Allow to set gain of fence gate sounds
This commit is contained in:
parent
bfbb6d145e
commit
24a69977f0
2 changed files with 16 additions and 9 deletions
|
@ -64,7 +64,7 @@ mcl_fences.register_fence = function(id, fence_name, texture, groups, connects_t
|
|||
return fence_id
|
||||
end
|
||||
|
||||
mcl_fences.register_fence_gate = function(id, fence_gate_name, texture, groups, sounds, sound_open, sound_close, sound_gain)
|
||||
mcl_fences.register_fence_gate = function(id, fence_gate_name, texture, groups, sounds, sound_open, sound_close, sound_gain_open, sound_gain_close)
|
||||
local meta2
|
||||
local state2 = 0
|
||||
|
||||
|
@ -80,8 +80,11 @@ mcl_fences.register_fence_gate = function(id, fence_gate_name, texture, groups,
|
|||
if not sound_close then
|
||||
sound_close = "doors_fencegate_close"
|
||||
end
|
||||
if not sound_gain then
|
||||
sound_gain = 0.3
|
||||
if not sound_gain_open then
|
||||
sound_gain_open = 0.3
|
||||
end
|
||||
if not sound_gain_close then
|
||||
sound_gain_close = 0.3
|
||||
end
|
||||
local function punch_gate(pos, node)
|
||||
meta2 = minetest.get_meta(pos)
|
||||
|
@ -89,11 +92,11 @@ mcl_fences.register_fence_gate = function(id, fence_gate_name, texture, groups,
|
|||
local tmp_node2
|
||||
if state2 == 1 then
|
||||
state2 = 0
|
||||
minetest.sound_play(sound_close, {gain = 0.5, max_hear_distance = 10})
|
||||
minetest.sound_play(sound_close, {gain = sound_gain_close, max_hear_distance = 10})
|
||||
tmp_node2 = {name=gate_id, param1=node.param1, param2=node.param2}
|
||||
else
|
||||
state2 = 1
|
||||
minetest.sound_play(sound_open, {gain = 0.5, max_hear_distance = 10})
|
||||
minetest.sound_play(sound_open, {gain = sound_gain_open, max_hear_distance = 10})
|
||||
tmp_node2 = {name=open_gate_id, param1=node.param1, param2=node.param2}
|
||||
end
|
||||
update_gate(pos, tmp_node2)
|
||||
|
@ -207,9 +210,9 @@ mcl_fences.register_fence_gate = function(id, fence_gate_name, texture, groups,
|
|||
return gate_id, open_gate_id
|
||||
end
|
||||
|
||||
mcl_fences.register_fence_and_fence_gate = function(id, fence_name, fence_gate_name, texture, groups, connects_to, sounds, sound_open, sound_close)
|
||||
mcl_fences.register_fence_and_fence_gate = function(id, fence_name, fence_gate_name, texture, groups, connects_to, sounds, sound_open, sound_close, sound_gain_open, sound_gain_close)
|
||||
local fence_id = mcl_fences.register_fence(id, fence_name, texture, groups, connects_to, sounds)
|
||||
local gate_id, open_gate_id = mcl_fences.register_fence_gate(id, fence_gate_name, texture, groups, sounds, sound_open, sound_close)
|
||||
local gate_id, open_gate_id = mcl_fences.register_fence_gate(id, fence_gate_name, texture, groups, sounds, sound_open, sound_close, sound_gain_open, sound_gain_close)
|
||||
return fence_id, gate_id, open_gate_id
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue