Fix misuse of nodedef custom fields in fence gates

Custom fields must start with an underscore, this is very relevant for `sound` which is already defined by the engine.
This commit is contained in:
sfan5 2021-09-24 21:01:52 +02:00
parent 953fcfe09e
commit 4b8b33587c

@ -775,8 +775,8 @@ function doors.register_fencegate(name, def)
sounds = def.sounds,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local node_def = minetest.registered_nodes[node.name]
minetest.swap_node(pos, {name = node_def.gate, param2 = node.param2})
minetest.sound_play(node_def.sound, {pos = pos, gain = 0.15,
minetest.swap_node(pos, {name = node_def._gate, param2 = node.param2})
minetest.sound_play(node_def._gate_sound, {pos = pos, gain = 0.15,
max_hear_distance = 8}, true)
return itemstack
end,
@ -804,8 +804,8 @@ function doors.register_fencegate(name, def)
local fence_closed = table.copy(fence)
fence_closed.mesh = "doors_fencegate_closed.obj"
fence_closed.gate = name .. "_open"
fence_closed.sound = "doors_fencegate_open"
fence_closed._gate = name .. "_open"
fence_closed._gate_sound = "doors_fencegate_open"
fence_closed.collision_box = {
type = "fixed",
fixed = {-1/2, -1/2, -1/8, 1/2, 1/2 + fence_collision_extra, 1/8}
@ -813,8 +813,8 @@ function doors.register_fencegate(name, def)
local fence_open = table.copy(fence)
fence_open.mesh = "doors_fencegate_open.obj"
fence_open.gate = name .. "_closed"
fence_open.sound = "doors_fencegate_close"
fence_open._gate = name .. "_closed"
fence_open._gate_sound = "doors_fencegate_close"
fence_open.groups.not_in_creative_inventory = 1
fence_open.collision_box = {
type = "fixed",