minetest 0.4.16 doors fix ( will open properly with signal and mesecons wont crash when activating doors)

master
rnd1 2017-08-02 07:25:33 +02:00
parent 0bdc55c32c
commit c55d2d6a4a
2 changed files with 6 additions and 11 deletions

View File

@ -2,18 +2,15 @@
local function door_signal_overwrite(name)
local table = minetest.registered_nodes[name]; if not table then return end
local table2 = {}
for i,v in pairs(table) do
table2[i] = v
end
for i,v in pairs(table) do table2[i] = v end
-- 0.4.15: line 370 in doors defines thins
local door_on_rightclick = table.on_rightclick;
local door_on_rightclick = table2.on_rightclick;
-- this will make door toggle whenever its used
table2.mesecons = {effector = {
action_on = function (pos,node,ttl)
if ttl<0 then return end
local meta = minetest.get_meta(pos);local name = meta:get_string("doors_owner");
action_on = function (pos,node)
local meta = minetest.get_meta(pos);local name = meta:get_string("owner");
-- create virtual player
local clicker = {};
function clicker:get_wielded_item()
@ -23,8 +20,8 @@ local function door_signal_overwrite(name)
end
function clicker:get_player_name() return name end; -- define method get_player_name() returning owner name so that we can call on_rightclick function in door
function clicker:is_player() return false end; -- method needed for mods that check this: like denaid areas mod
if door_on_rightclick then door_on_rightclick(pos, node, clicker,ItemStack("")) end -- safety if it doesnt exist
--minetest.swap_node(pos, {name = "protector:trapdoor", param1 = node.param1, param2 = node.param2})
if door_on_rightclick then door_on_rightclick(pos, nil, clicker,ItemStack(""),{}) end -- safety if it doesnt exist
--minetest.swap_node(pos, {name = "protector:trapdoor", param1 = node.param1, param2 = node.param2}) -- more direct approach?, need to set param2 then too
end
}
};

View File

@ -14,7 +14,6 @@ local table = minetest.registered_nodes[name]; if not table then return end
table2.mesecons = {effector = { -- action to toggle light off
action_off = function (pos,node,ttl)
if ttl<0 then return end
minetest.swap_node(pos,{name = offname});
end
}
@ -32,7 +31,6 @@ local table = minetest.registered_nodes[name]; if not table then return end
table3.light_source = 0; -- off block has light off
table3.mesecons = {effector = {
action_on = function (pos,node,ttl)
if ttl<0 then return end
minetest.swap_node(pos,{name = name});
end
}