From b642bc0af4d271e374a8ebf709e12ae12d3a49f1 Mon Sep 17 00:00:00 2001 From: "A.C.M" Date: Sun, 27 Jan 2019 14:21:50 +0100 Subject: [PATCH] fixed check for Mesecons. --- nodeboxes.lua | 101 ++++++++++++++++++++++++++------------------------ 1 file changed, 52 insertions(+), 49 deletions(-) diff --git a/nodeboxes.lua b/nodeboxes.lua index 3a0e77d..ebaa635 100644 --- a/nodeboxes.lua +++ b/nodeboxes.lua @@ -461,53 +461,6 @@ minetest.register_node("scifi_nodes:lightbar", { sounds = default.node_sound_glass_defaults() }) ---wall switch, currently does not do anything -minetest.register_node("scifi_nodes:switch_off", { - description = "Wall switch", - tiles = { - "scifi_nodes_switch_off.png", - }, - inventory_image = "scifi_nodes_switch_on.png", - wield_image = "scifi_nodes_switch_on.png", - drawtype = "signlike", - sunlight_propagates = true, - selection_box = { - type = "wallmounted", - fixed = {-0.5, -0.3, -0.3, -0.45, 0.3, 0.3} - }, - paramtype = "light", - paramtype2 = "wallmounted", - groups = {cracky=1, oddly_breakable_by_hand=1}, - on_rightclick = function(pos, node, clicker, item, _) - minetest.set_node(pos, {name="scifi_nodes:switch_on", param2=node.param2}) - end, - sounds = default.node_sound_glass_defaults() -}) - -minetest.register_node("scifi_nodes:switch_on", { - description = "Wall switch", - sunlight_propagates = true, - tiles = { - "scifi_nodes_switch_on.png", - }, - inventory_image = "scifi_nodes_switch_on.png", - wield_image = "scifi_nodes_switch_on.png", - drawtype = "signlike", - selection_box = { - type = "wallmounted", - fixed = {-0.5, -0.3, -0.3, -0.45, 0.3, 0.3} - }, - paramtype = "light", - paramtype2 = "wallmounted", - light_source = 5, - groups = {cracky=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1}, - on_rightclick = function(pos, node, clicker, item, _) - minetest.set_node(pos, {name="scifi_nodes:switch_off", param2=node.param2}) - end, - sounds = default.node_sound_glass_defaults() -}) ---end of wall switch - minetest.register_node("scifi_nodes:light_dynamic", { description = "Wall light", tiles = { @@ -1244,7 +1197,8 @@ minetest.register_node("scifi_nodes:windowpanel", { sounds = default.node_sound_glass_defaults(), }) -if (mesecon.receptor_on ~= nil) and +if (mesecon ~= nil) and + (mesecon.receptor_on ~= nil) and (mesecon.receptor_off ~= nil) then minetest.register_node("scifi_nodes:switch_off", { description = "Wall switch", @@ -1302,4 +1256,53 @@ if (mesecon.receptor_on ~= nil) and } }) -end +else + --wall switch, currently does not do anything + minetest.register_node("scifi_nodes:switch_off", { + description = "Wall switch", + tiles = { + "scifi_nodes_switch_off.png", + }, + inventory_image = "scifi_nodes_switch_on.png", + wield_image = "scifi_nodes_switch_on.png", + drawtype = "signlike", + sunlight_propagates = true, + selection_box = { + type = "wallmounted", + fixed = {-0.5, -0.3, -0.3, -0.45, 0.3, 0.3} + }, + paramtype = "light", + paramtype2 = "wallmounted", + groups = {cracky=1, oddly_breakable_by_hand=1}, + on_rightclick = function(pos, node, clicker, item, _) + minetest.set_node(pos, {name="scifi_nodes:switch_on", param2=node.param2}) + end, + sounds = default.node_sound_glass_defaults() + }) + + minetest.register_node("scifi_nodes:switch_on", { + description = "Wall switch", + sunlight_propagates = true, + tiles = { + "scifi_nodes_switch_on.png", + }, + inventory_image = "scifi_nodes_switch_on.png", + wield_image = "scifi_nodes_switch_on.png", + drawtype = "signlike", + selection_box = { + type = "wallmounted", + fixed = {-0.5, -0.3, -0.3, -0.45, 0.3, 0.3} + }, + paramtype = "light", + paramtype2 = "wallmounted", + light_source = 5, + groups = {cracky=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1}, + on_rightclick = function(pos, node, clicker, item, _) + minetest.set_node(pos, {name="scifi_nodes:switch_off", param2=node.param2}) + end, + sounds = default.node_sound_glass_defaults() + }) + + --end of wall switch + +end -- if(mesecon.receptor ~= on