Skip to content

Commit

Permalink
Fix misuse of nodedef custom fields in fence gates
Browse files Browse the repository at this point in the history
Custom fields must start with an underscore, this is very relevant for `sound` which is already defined by the engine.
  • Loading branch information
sfan5 committed Sep 24, 2021
1 parent 953fcfe commit 4b8b335
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions mods/doors/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -804,17 +804,17 @@ 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}
}

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",
Expand Down

0 comments on commit 4b8b335

Please sign in to comment.