From c55d2d6a4a8008dc89c2416a862a1fc9f482b250 Mon Sep 17 00:00:00 2001 From: rnd1 Date: Wed, 2 Aug 2017 07:25:33 +0200 Subject: [PATCH] minetest 0.4.16 doors fix ( will open properly with signal and mesecons wont crash when activating doors) --- mesecon_doors.lua | 15 ++++++--------- mesecon_lights.lua | 2 -- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/mesecon_doors.lua b/mesecon_doors.lua index 590ae94..1db08cb 100644 --- a/mesecon_doors.lua +++ b/mesecon_doors.lua @@ -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 } }; diff --git a/mesecon_lights.lua b/mesecon_lights.lua index 02fae4f..de5445d 100644 --- a/mesecon_lights.lua +++ b/mesecon_lights.lua @@ -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 }