From b37bdbf55cf6d3205d5dd7a2491a8bd855cbbd76 Mon Sep 17 00:00:00 2001 From: Jeija Date: Sun, 9 Dec 2012 00:42:30 +0100 Subject: [PATCH] Port a lot more (basically everything apart from gates, pistons and extrawire crossing) to the new nodedef system. There are some problems with wall button and wall lever (in the way they visually connect to wires) --- mesecons/presets.lua | 17 ---- mesecons_button/init.lua | 4 +- mesecons_delayer/init.lua | 1 - mesecons_detector/init.lua | 10 +- mesecons_lamp/init.lua | 33 +++--- mesecons_microcontroller/init.lua | 63 ++++++------ mesecons_movestones/init.lua | 163 +++++++++++++++--------------- mesecons_noteblock/init.lua | 31 +++--- mesecons_pistons/init.lua | 26 +++-- mesecons_powerplant/init.lua | 8 +- mesecons_pressureplates/init.lua | 26 ++--- mesecons_random/init.lua | 44 ++++---- mesecons_receiver/init.lua | 56 +++++----- mesecons_solarpanel/init.lua | 14 +-- mesecons_torch/init.lua | 146 +++++++++++++------------- mesecons_walllever/init.lua | 73 +++++++------ 16 files changed, 336 insertions(+), 379 deletions(-) diff --git a/mesecons/presets.lua b/mesecons/presets.lua index ffbcae9..463a0f8 100644 --- a/mesecons/presets.lua +++ b/mesecons/presets.lua @@ -23,22 +23,5 @@ mesecon.rules.buttonlike = {x = 1, y =-1, z =-1}, {x = 2, y = 0, z = 0}} -mesecon.rules.pressurplatelike = -{{x=0, y=1, z=-1}, -{x=0, y=0, z=-1}, -{x=0, y=-1, z=-1}, -{x=0, y=1, z=1}, -{x=0, y=-1, z=1}, -{x=0, y=0, z=1}, -{x=1, y=0, z=0}, -{x=1, y=1, z=0}, -{x=1, y=-1, z=0}, -{x=-1, y=1, z=0}, -{x=-1, y=-1, z=0}, -{x=-1, y=0, z=0}, -{x=0, y=-1, z=0}, -{x=0, y=-2, z=0}, -{x=0, y=1, z=0}} - mesecon.state.on = "on" mesecon.state.off = "off" diff --git a/mesecons_button/init.lua b/mesecons_button/init.lua index f5c0eb9..d4e6802 100644 --- a/mesecons_button/init.lua +++ b/mesecons_button/init.lua @@ -32,7 +32,7 @@ minetest.register_node("mesecons_button:button_off", { description = "Button", on_punch = function (pos, node) mesecon:swap_node(pos, "mesecons_button:button_on") - local rules=mesecon.button_get_rules(node.param2) + local rules=mesecon.button_get_rules(node) mesecon:receptor_on(pos, rules) minetest.after(1, mesecon.button_turnoff, {pos=pos, param2=node.param2}) end, @@ -81,7 +81,7 @@ minetest.register_node("mesecons_button:button_on", { mesecon.button_turnoff = function (params) if minetest.env:get_node(params.pos).name=="mesecons_button:button_on" then mesecon:swap_node(params.pos, "mesecons_button:button_off") - local rules=mesecon.button_get_rules(params.param2) + local rules=mesecon.button_get_rules(params) mesecon:receptor_off(params.pos, rules) end end diff --git a/mesecons_delayer/init.lua b/mesecons_delayer/init.lua index ca28258..6bdb72d 100644 --- a/mesecons_delayer/init.lua +++ b/mesecons_delayer/init.lua @@ -40,7 +40,6 @@ local delayer_turnoff = function(params) end local delayer_update = function(pos, node) - print("update") if string.find(node.name, "mesecons_delayer:delayer_off")~=nil then local time = 0 if node.name=="mesecons_delayer:delayer_off_1" then diff --git a/mesecons_detector/init.lua b/mesecons_detector/init.lua index 1d5b214..2394e96 100644 --- a/mesecons_detector/init.lua +++ b/mesecons_detector/init.lua @@ -9,8 +9,7 @@ minetest.register_node("mesecons_detector:object_detector_off", { groups = {cracky=3}, description="Player Detector", mesecons = {receptor = { - state = mesecon.state.off, - rules = mesecon.rules.pressurplatelike + state = mesecon.state.off }} }) @@ -21,8 +20,7 @@ minetest.register_node("mesecons_detector:object_detector_on", { groups = {cracky=3,not_in_creative_inventory=1}, drop = 'mesecons_detector:object_detector_off', mesecons = {receptor = { - state = mesecon.state.on, - rules = mesecon.rules.pressurplatelike + state = mesecon.state.on }} }) @@ -50,7 +48,7 @@ minetest.register_abm( end local objpos=obj:getpos() minetest.env:add_node(pos, {name="mesecons_detector:object_detector_on"}) - mesecon:receptor_on(pos, mesecon:get_rules("pressureplate")) + mesecon:receptor_on(pos) end end end, @@ -78,7 +76,7 @@ minetest.register_abm( end if objectfound==0 then minetest.env:add_node(pos, {name="mesecons_detector:object_detector_off"}) - mesecon:receptor_off(pos, mesecon:get_rules("pressureplate")) + mesecon:receptor_off(pos) end end, }) diff --git a/mesecons_lamp/init.lua b/mesecons_lamp/init.lua index 553941c..d20236b 100644 --- a/mesecons_lamp/init.lua +++ b/mesecons_lamp/init.lua @@ -1,4 +1,7 @@ -- MESELAMPS +-- A lamp is "is an electrical device used to create artificial light" (wikipedia) +-- guess what? + minetest.register_node("mesecons_lamp:lamp_on", { drawtype = "nodebox", tiles = {"jeija_meselamp_on.png"}, @@ -20,8 +23,13 @@ minetest.register_node("mesecons_lamp:lamp_on", { wall_bottom = {-0.3125,-0.5,-0.3125,0.3125,-0.375,0.3125}, wall_side = {-0.375,-0.3125,-0.3125,-0.5,0.3125,0.3125}, }, - groups = {dig_immediate=3,not_in_creative_inventory=1, mesecon_effector_on = 1, mesecon = 2}, + groups = {dig_immediate=3,not_in_creative_inventory=1, mesecon_effector_on = 1}, drop='"mesecons_lamp:lamp_off" 1', + mesecons = {effector = { + action_off = function (pos, node) + mesecon:swap_node(pos, "mesecons_lamp:lamp_off") + end + }} }) minetest.register_node("mesecons_lamp:lamp_off", { @@ -45,8 +53,13 @@ minetest.register_node("mesecons_lamp:lamp_off", { wall_bottom = {-0.3125,-0.5,-0.3125,0.3125,-0.375,0.3125}, wall_side = {-0.375,-0.3125,-0.3125,-0.5,0.3125,0.3125}, }, - groups = {dig_immediate=3, mesecon_receptor_off = 1, mesecon_effector_off = 1, mesecon = 2}, + groups = {dig_immediate=3, mesecon_receptor_off = 1, mesecon_effector_off = 1}, description="Meselamp", + mesecons = {effector = { + action_on = function (pos, node) + mesecon:swap_node(pos, "mesecons_lamp:lamp_on") + end + }} }) minetest.register_craft({ @@ -57,19 +70,3 @@ minetest.register_craft({ {'', '"default:glass"', ''}, } }) - -mesecon:register_on_signal_on(function(pos, node) - if node.name == "mesecons_lamp:lamp_off" then - minetest.env:add_node(pos, {name="mesecons_lamp:lamp_on", param2 = node.param2}) - nodeupdate(pos) - end -end) - -mesecon:register_on_signal_off(function(pos, node) - if node.name == "mesecons_lamp:lamp_on" then - minetest.env:add_node(pos, {name="mesecons_lamp:lamp_off", param2 = node.param2}) - nodeupdate(pos) - end -end) - -mesecon:register_effector("mesecons_lamp:lamp_on", "mesecons_lamp:lamp_off") diff --git a/mesecons_microcontroller/init.lua b/mesecons_microcontroller/init.lua index 121eb25..19fc42d 100644 --- a/mesecons_microcontroller/init.lua +++ b/mesecons_microcontroller/init.lua @@ -23,6 +23,33 @@ if tostring(d)..tostring(c)..tostring(b)..tostring(a) ~= "0000" then else groups = {dig_immediate=2, mesecon = 3} end +local rules={} +if (a == 1) then table.insert(rules, {x = -1, y = 0, z = 0}) end +if (b == 1) then table.insert(rules, {x = 0, y = 0, z = 1}) end +if (c == 1) then table.insert(rules, {x = 1, y = 0, z = 0}) end +if (d == 1) then table.insert(rules, {x = 0, y = 0, z = -1}) end + +local input_rules={} +if (a == 0) then table.insert(input_rules, {x = -1, y = 0, z = 0}) end +if (b == 0) then table.insert(input_rules, {x = 0, y = 0, z = 1}) end +if (c == 0) then table.insert(input_rules, {x = 1, y = 0, z = 0}) end +if (d == 0) then table.insert(input_rules, {x = 0, y = 0, z = -1}) end +mesecon:add_rules(nodename, rules) + +local mesecons = {effector = +{ + rules = input_rules, + action_change = function (pos, node) + update_yc(pos) + end +}} +if nodename ~= "mesecons_microcontroller:microcontroller0000" then + mesecons.receptor = { + state = mesecon.state.on, + rules = rules + } +end + minetest.register_node(nodename, { description = "Microcontroller", drawtype = "nodebox", @@ -101,25 +128,12 @@ minetest.register_node(nodename, { yc_reset (pos) update_yc(pos) end, + mesecons = mesecons, + on_dig = function (pos, node) + rules = mesecon:get_rules(node.name) + mesecon:receptor_off(pos, rules) + end, }) - -local rules={} -if (a == 1) then table.insert(rules, {x = -1, y = 0, z = 0}) end -if (b == 1) then table.insert(rules, {x = 0, y = 0, z = 1}) end -if (c == 1) then table.insert(rules, {x = 1, y = 0, z = 0}) end -if (d == 1) then table.insert(rules, {x = 0, y = 0, z = -1}) end - -local input_rules={} -if (a == 0) then table.insert(input_rules, {x = -1, y = 0, z = 0}) end -if (b == 0) then table.insert(input_rules, {x = 0, y = 0, z = 1}) end -if (c == 0) then table.insert(input_rules, {x = 1, y = 0, z = 0}) end -if (d == 0) then table.insert(input_rules, {x = 0, y = 0, z = -1}) end -mesecon:add_rules(nodename, rules) - -mesecon:register_effector(nodename, nodename, input_rules) -if nodename ~= "mesecons_microcontroller:microcontroller0000" then - mesecon:add_receptor_node(nodename, rules) -end end end end @@ -682,16 +696,3 @@ function yc_overheat_off(pos) rules = mesecon:get_rules("mesecons_microcontroller:microcontroller1111") mesecon:receptor_off(pos, rules) end - -mesecon:register_on_signal_change(function(pos, node) - if string.find(node.name, "mesecons_microcontroller:microcontroller")~=nil then - update_yc(pos) - end -end) - -minetest.register_on_dignode(function(pos, node) - if string.find(node.name, "mesecons_microcontroller:microcontroller") then - rules = mesecon:get_rules(node.name) - mesecon:receptor_off(pos, rules) - end -end) diff --git a/mesecons_movestones/init.lua b/mesecons_movestones/init.lua index 5198a29..b17874f 100644 --- a/mesecons_movestones/init.lua +++ b/mesecons_movestones/init.lua @@ -1,33 +1,53 @@ -- MOVESTONE +-- Non-sticky: +-- Moves along mesecon lines +-- Pushes all blocks in front of it +-- +-- Sticky one +-- Moves along mesecon lines +-- Pushes all block in front of it +-- Pull all blocks in its back function mesecon:get_movestone_direction(pos) - getactivated=0 + getactivated = 0 local lpos - local getactivated=0 - local rules=mesecon:get_rules("movestone") + local getactivated = 0 + local rules = { + {x=0, y=1, z=-1}, + {x=0, y=0, z=-1}, + {x=0, y=-1, z=-1}, + {x=0, y=1, z=1}, + {x=0, y=-1, z=1}, + {x=0, y=0, z=1}, + {x=1, y=0, z=0}, + {x=1, y=1, z=0}, + {x=1, y=-1, z=0}, + {x=-1, y=1, z=0}, + {x=-1, y=-1, z=0}, + {x=-1, y=0, z=0}} - lpos={x=pos.x+1, y=pos.y, z=pos.z} - for n=1, 3 do + lpos = {x=pos.x+1, y=pos.y, z=pos.z} + for n = 1, 3 do if mesecon:is_power_on(lpos, rules[n].x, rules[n].y, rules[n].z) then return {x=0, y=0, z=-1} end end - lpos={x=pos.x-1, y=pos.y, z=pos.z} + lpos = {x = pos.x-1, y = pos.y, z = pos.z} for n=4, 6 do if mesecon:is_power_on(lpos, rules[n].x, rules[n].y, rules[n].z) then return {x=0, y=0, z=1} end end - lpos={x=pos.x, y=pos.y, z=pos.z+1} + lpos = {x = pos.x, y = pos.y, z = pos.z+1} for n=7, 9 do if mesecon:is_power_on(lpos, rules[n].x, rules[n].y, rules[n].z) then return {x=-1, y=0, z=0} end end - lpos={x=pos.x, y=pos.y, z=pos.z-1} + lpos = {x = pos.x, y = pos.y, z = pos.z-1} for n=10, 12 do if mesecon:is_power_on(lpos, rules[n].x, rules[n].y, rules[n].z) then return {x=1, y=0, z=0} @@ -41,8 +61,27 @@ minetest.register_node("mesecons_movestones:movestone", { legacy_facedir_simple = true, groups = {cracky=3}, description="Movestone", + mesecons = {effector = { + action_on = function (pos, node) + local direction=mesecon:get_movestone_direction(pos) + if not direction then return end + local checknode={} + local collpos={x=pos.x, y=pos.y, z=pos.z} + repeat -- Check if it collides with a stopper + collpos = addPosRule(collpos, direction) + checknode=minetest.env:get_node(collpos) + if mesecon:is_mvps_stopper(checknode.name) then + return + end + until checknode.name=="air" + or checknode.name=="ignore" + or not(minetest.registered_nodes[checknode.name].liquidtype == "none") + minetest.env:remove_node(pos) + mesecon:update_autoconnect(pos) + minetest.env:add_entity(pos, "mesecons_movestones:movestone_entity") + end + }} }) -mesecon:register_effector("mesecons_movestones:movestone", "mesecons_movestones:movestone") minetest.register_entity("mesecons_movestones:movestone_entity", { physical = false, @@ -50,10 +89,6 @@ minetest.register_entity("mesecons_movestones:movestone_entity", { textures = {"jeija_movestone_side.png", "jeija_movestone_side.png", "jeija_movestone_side.png", "jeija_movestone_side.png", "jeija_movestone_arrows.png", "jeija_movestone_arrows.png"}, collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5}, visual = "cube", - --on_activate = function(self, staticdata) - --self.object:setsprite({x=0,y=0}, 1, 0, true) - --self.object:setvelocity({x=-3, y=0, z=0}) - --end, on_punch = function(self, hitter) self.object:remove() @@ -73,7 +108,7 @@ minetest.register_entity("mesecons_movestones:movestone_entity", { self.object:setvelocity({x=direction.x*3, y=direction.y*3, z=direction.z*3}) mesecon:mvps_push(pos, direction) - end + end, }) minetest.register_craft({ @@ -85,28 +120,6 @@ minetest.register_craft({ } }) -mesecon:register_on_signal_on(function (pos, node) - if node.name=="mesecons_movestones:movestone" then - local direction=mesecon:get_movestone_direction(pos) - if not direction then return end - local checknode={} - local collpos={x=pos.x, y=pos.y, z=pos.z} - repeat -- Check if it collides with a stopper - collpos={x=collpos.x+direction.x, y=collpos.y+direction.y, z=collpos.z+direction.z} - checknode=minetest.env:get_node(collpos) - if mesecon:is_mvps_stopper(checknode.name) then - return - end - until checknode.name=="air" - or checknode.name=="ignore" - or not(minetest.registered_nodes[checknode.name].liquidtype == "none") - minetest.env:remove_node(pos) - nodeupdate(pos) - minetest.env:add_entity(pos, "mesecons_movestones:movestone_entity") - end -end) - - -- STICKY_MOVESTONE @@ -118,8 +131,36 @@ minetest.register_node("mesecons_movestones:sticky_movestone", { legacy_facedir_simple = true, groups = {cracky=3}, description="Sticky Movestone", + mesecons = {effector = { + action_on = function (pos, node) + local direction=mesecon:get_movestone_direction(pos) + if not direction then return end + local checknode={} + local collpos={x=pos.x, y=pos.y, z=pos.z} + repeat -- Check if it collides with a stopper + collpos = addPosRule(collpos, direction) + checknode=minetest.env:get_node(collpos) + if mesecon:is_mvps_stopper(checknode.name) then + return + end + until checknode.name=="air" + or checknode.name=="ignore" + or not(minetest.registered_nodes[checknode.name].liquidtype == "none") + repeat -- Check if it collides with a stopper (pull direction) + collpos={x=collpos.x-direction.x, y=collpos.y-direction.y, z=collpos.z-direction.z} + checknode=minetest.env:get_node(collpos) + if mesecon:is_mvps_stopper(checknode.name) then + return + end + until checknode.name=="air" + or checknode.name=="ignore" + or not(minetest.registered_nodes[checknode.name].liquidtype == "none") + minetest.env:remove_node(pos) + mesecon:update_autoconnect(pos) + minetest.env:add_entity(pos, "mesecons_movestones:sticky_movestone_entity") + end + }} }) -mesecon:register_effector("mesecons_movestones:sticky_movestone", "mesecons_movestones:sticky_movestone") minetest.register_craft({ output = '"mesecons_movestones:sticky_movestone" 2', @@ -146,8 +187,6 @@ minetest.register_entity("mesecons_movestones:sticky_movestone_entity", { local direction=mesecon:get_movestone_direction(colp) if not direction then - --or (minetest.env:get_node_or_nil(pos).name ~="air" - --and minetest.env:get_node_or_nil(pos).name ~= nil) then minetest.env:add_node(pos, {name="mesecons_movestones:sticky_movestone"}) self.object:remove() return @@ -159,49 +198,5 @@ minetest.register_entity("mesecons_movestones:sticky_movestone_entity", { --STICKY mesecon:mvps_pull_all(pos, direction) - end + end, }) - -mesecon:register_on_signal_on(function (pos, node) - if node.name=="mesecons_movestones:sticky_movestone" then - local direction=mesecon:get_movestone_direction(pos) - if not direction then return end - local checknode={} - local collpos={x=pos.x, y=pos.y, z=pos.z} - repeat -- Check if it collides with a stopper - collpos={x=collpos.x+direction.x, y=collpos.y+direction.y, z=collpos.z+direction.z} - checknode=minetest.env:get_node(collpos) - if mesecon:is_mvps_stopper(checknode.name) then - return - end - until checknode.name=="air" - or checknode.name=="ignore" - or not(minetest.registered_nodes[checknode.name].liquidtype == "none") - repeat -- Check if it collides with a stopper (pull direction) - collpos={x=collpos.x-direction.x, y=collpos.y-direction.y, z=collpos.z-direction.z} - checknode=minetest.env:get_node(collpos) - if mesecon:is_mvps_stopper(checknode.name) then - return - end - until checknode.name=="air" - or checknode.name=="ignore" - or not(minetest.registered_nodes[checknode.name].liquidtype == "none") - minetest.env:remove_node(pos) - nodeupdate(pos) - minetest.env:add_entity(pos, "mesecons_movestones:sticky_movestone_entity") - end -end) - -mesecon:add_rules("movestone", { -{x=0, y=1, z=-1}, -{x=0, y=0, z=-1}, -{x=0, y=-1, z=-1}, -{x=0, y=1, z=1}, -{x=0, y=-1, z=1}, -{x=0, y=0, z=1}, -{x=1, y=0, z=0}, -{x=1, y=1, z=0}, -{x=1, y=-1, z=0}, -{x=-1, y=1, z=0}, -{x=-1, y=-1, z=0}, -{x=-1, y=0, z=0}}) diff --git a/mesecons_noteblock/init.lua b/mesecons_noteblock/init.lua index 0b05bbb..073524c 100644 --- a/mesecons_noteblock/init.lua +++ b/mesecons_noteblock/init.lua @@ -1,15 +1,25 @@ minetest.register_node("mesecons_noteblock:noteblock", { description = "Noteblock", tiles = {"mesecons_noteblock.png"}, - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon = 2}, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, drawtype = "allfaces_optional", visual_scale = 1.3, paramtype="light", after_place_node = function(pos) minetest.env:add_node(pos, {name="mesecons_noteblock:noteblock", param2=0}) - end + end, + on_punch = function (pos, node) -- change sound when punched + local param2 = node.param2+1 + if param2==12 then param2=0 end + minetest.env:add_node(pos, {name = node.name, param2 = param2}) + mesecon.noteblock_play(pos, param2) + end, + mesecons = {effector = { -- play sound when activated + action_on = function (pos, node) + mesecon.noteblock_play(pos, node.param2) + end + }} }) -mesecon:register_effector("mesecons_noteblock:noteblock", "mesecons_noteblock:noteblock") minetest.register_craft({ output = '"mesecons_noteblock:noteblock" 1', @@ -20,15 +30,6 @@ minetest.register_craft({ } }) -minetest.register_on_punchnode(function (pos, node) - if node.name=="mesecons_noteblock:noteblock" then - local param2 = node.param2+1 - if param2==12 then param2=0 end - minetest.env:add_node(pos, {name=node.name, param2=param2}) - mesecon.noteblock_play(pos, param2) - end -end) - mesecon.noteblock_play = function (pos, param2) local soundname if param2==8 then @@ -75,9 +76,3 @@ mesecon.noteblock_play = function (pos, param2) minetest.sound_play(soundname, {pos = pos, gain = 1.0, max_hear_distance = 32,}) end - -mesecon:register_on_signal_on(function(pos, node) - if node.name=="mesecons_noteblock:noteblock" then - mesecon.noteblock_play(pos, node.param2) - end -end) diff --git a/mesecons_pistons/init.lua b/mesecons_pistons/init.lua index 935ca66..dd3f599 100644 --- a/mesecons_pistons/init.lua +++ b/mesecons_pistons/init.lua @@ -1,5 +1,11 @@ --PISTONS +local update = function(pos, node) + local timer = minetest.env:get_node_timer(pos) + timer:stop() + timer:start(0) +end + minetest.register_node("mesecons_pistons:piston_normal", { description = "Piston", tiles = {"jeija_piston_tb.png", "jeija_piston_tb.png", "jeija_piston_tb.png", "jeija_piston_tb.png", "jeija_piston_tb.png", "jeija_piston_side.png"}, @@ -25,8 +31,10 @@ minetest.register_node("mesecons_pistons:piston_normal", { end return false end, + mesecons = {effector={ + action_change = update + }} }) -mesecon:register_effector("mesecons_pistons:piston_normal", "mesecons_pistons:piston_normal") minetest.register_node("mesecons_pistons:piston_sticky", { description = "Sticky Piston", @@ -53,8 +61,10 @@ minetest.register_node("mesecons_pistons:piston_sticky", { end return false end, + mesecons = {effector={ + action_change = update + }} }) -mesecon:register_effector("mesecons_pistons:piston_sticky", "mesecons_pistons:piston_sticky") minetest.register_craft({ output = '"mesecons_pistons:piston_normal" 2', @@ -127,18 +137,6 @@ minetest.register_node("mesecons_pistons:piston_pusher_sticky", { mesecon:register_mvps_stopper("mesecons_pistons:piston_pusher_normal") mesecon:register_mvps_stopper("mesecons_pistons:piston_pusher_sticky") -local update = function(pos, node) - if node.name ~= "mesecons_pistons:piston_normal" and node.name ~= "mesecons_pistons:piston_sticky" then - return - end - - local timer = minetest.env:get_node_timer(pos) - timer:stop() - timer:start(0) -end -mesecon:register_on_signal_on(update) --push action -mesecon:register_on_signal_off(update) --pull action - function mesecon:piston_push(pos) local node = minetest.env:get_node(pos) local dir = mesecon:piston_get_direction(node) diff --git a/mesecons_powerplant/init.lua b/mesecons_powerplant/init.lua index a45f5cc..006fc19 100644 --- a/mesecons_powerplant/init.lua +++ b/mesecons_powerplant/init.lua @@ -1,4 +1,5 @@ - -- The POWER_PLANT +-- The POWER_PLANT +-- Just emits power. always. minetest.register_node("mesecons_powerplant:power_plant", { drawtype = "plantlike", @@ -14,6 +15,9 @@ minetest.register_node("mesecons_powerplant:power_plant", { type = "fixed", fixed = {-0.1, -0.5, -0.1, 0.1, -0.5+0.6, 0.1}, }, + mesecons = {receptor = { + state = mesecon.state.on + }} }) minetest.register_craft({ @@ -24,5 +28,3 @@ minetest.register_craft({ {'"default:sapling"'}, } }) - -mesecon:add_receptor_node("mesecons_powerplant:power_plant") diff --git a/mesecons_pressureplates/init.lua b/mesecons_pressureplates/init.lua index f7a2edd..2e88d2f 100644 --- a/mesecons_pressureplates/init.lua +++ b/mesecons_pressureplates/init.lua @@ -25,7 +25,7 @@ minetest.register_node("mesecons_pressureplates:pressure_plate_wood_off", { local objpos=obj:getpos() if objpos.y>pos.y-1 and objpos.ypos.y-1 and objpos.y