Clean up bad trapdoor code

This commit is contained in:
Wuzzy 2017-03-12 04:26:25 +01:00
parent 31617009fc
commit 867df4636d

View file

@ -500,10 +500,6 @@ function mcl_doors:register_trapdoor(name, def)
minetest.set_node(pos, node) minetest.set_node(pos, node)
end end
local me
local meta
local state = 0
if not def.sound_open then if not def.sound_open then
def.sound_open = "doors_door_open" def.sound_open = "doors_door_open"
end end
@ -512,9 +508,9 @@ function mcl_doors:register_trapdoor(name, def)
end end
local function punch(pos) local function punch(pos)
meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
state = meta:get_int("state") local state = meta:get_int("state")
me = minetest.get_node(pos) local me = minetest.get_node(pos)
local tmp_node local tmp_node
local tmp_node2 local tmp_node2
local oben = {x=pos.x, y=pos.y+1, z=pos.z} local oben = {x=pos.x, y=pos.y+1, z=pos.z}
@ -550,8 +546,9 @@ function mcl_doors:register_trapdoor(name, def)
fixed = { fixed = {
{-8/16, -8/16, -8/16, 8/16, -5/16, 8/16},}, {-8/16, -8/16, -8/16, 8/16, -5/16, 8/16},},
}, },
on_creation = function(pos) on_construct = function(pos)
state = 0 local meta = minetest.get_meta(pos)
meta:set_int("state", 0)
end, end,
mesecons = {effector = { mesecons = {effector = {
action_on = (function(pos, node) action_on = (function(pos, node)
@ -583,9 +580,9 @@ function mcl_doors:register_trapdoor(name, def)
punch(pos) punch(pos)
end, end,
mesecons = {effector = { mesecons = {effector = {
action_on = (function(pos, node) action_on = (function(pos, node)
punch(pos) punch(pos)
end), end),
}}, }},
}) })