minetest 0.4.16 doors fix ( will open properly with signal and mesecons wont crash when activating doors)
parent
0bdc55c32c
commit
c55d2d6a4a
|
@ -2,18 +2,15 @@
|
||||||
local function door_signal_overwrite(name)
|
local function door_signal_overwrite(name)
|
||||||
local table = minetest.registered_nodes[name]; if not table then return end
|
local table = minetest.registered_nodes[name]; if not table then return end
|
||||||
local table2 = {}
|
local table2 = {}
|
||||||
for i,v in pairs(table) do
|
for i,v in pairs(table) do table2[i] = v end
|
||||||
table2[i] = v
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 0.4.15: line 370 in doors defines thins
|
-- 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
|
-- this will make door toggle whenever its used
|
||||||
table2.mesecons = {effector = {
|
table2.mesecons = {effector = {
|
||||||
action_on = function (pos,node,ttl)
|
action_on = function (pos,node)
|
||||||
if ttl<0 then return end
|
local meta = minetest.get_meta(pos);local name = meta:get_string("owner");
|
||||||
local meta = minetest.get_meta(pos);local name = meta:get_string("doors_owner");
|
|
||||||
-- create virtual player
|
-- create virtual player
|
||||||
local clicker = {};
|
local clicker = {};
|
||||||
function clicker:get_wielded_item()
|
function clicker:get_wielded_item()
|
||||||
|
@ -23,8 +20,8 @@ local function door_signal_overwrite(name)
|
||||||
end
|
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: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
|
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
|
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})
|
--minetest.swap_node(pos, {name = "protector:trapdoor", param1 = node.param1, param2 = node.param2}) -- more direct approach?, need to set param2 then too
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,7 +14,6 @@ local table = minetest.registered_nodes[name]; if not table then return end
|
||||||
|
|
||||||
table2.mesecons = {effector = { -- action to toggle light off
|
table2.mesecons = {effector = { -- action to toggle light off
|
||||||
action_off = function (pos,node,ttl)
|
action_off = function (pos,node,ttl)
|
||||||
if ttl<0 then return end
|
|
||||||
minetest.swap_node(pos,{name = offname});
|
minetest.swap_node(pos,{name = offname});
|
||||||
end
|
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.light_source = 0; -- off block has light off
|
||||||
table3.mesecons = {effector = {
|
table3.mesecons = {effector = {
|
||||||
action_on = function (pos,node,ttl)
|
action_on = function (pos,node,ttl)
|
||||||
if ttl<0 then return end
|
|
||||||
minetest.swap_node(pos,{name = name});
|
minetest.swap_node(pos,{name = name});
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue