diff options
-rw-r--r-- | jeija/alias.lua | 2 | ||||
-rw-r--r-- | jeija/init.lua | 2 | ||||
-rw-r--r-- | jeija/pressureplates.lua | 6 | ||||
-rw-r--r-- | jeija/temperest.lua | 132 |
4 files changed, 57 insertions, 85 deletions
diff --git a/jeija/alias.lua b/jeija/alias.lua index 079bb8d..8d091cc 100644 --- a/jeija/alias.lua +++ b/jeija/alias.lua @@ -17,5 +17,5 @@ minetest.register_alias("jeija:pressure_plate_wood", "jeija:pressure_plate_wood_ if ENABLE_TEMPEREST==1 then minetest.register_alias("jeija:mesecon_socket", "jeija:mesecon_socket_off") - minetest.register_alias("jeija:mesecon_inverter", "jeija:mesecon_inverter_off") + minetest.register_alias("jeija:mesecon_inverter", "jeija:mesecon_inverter_on") end
\ No newline at end of file diff --git a/jeija/init.lua b/jeija/init.lua index d216324..1a5fce7 100644 --- a/jeija/init.lua +++ b/jeija/init.lua @@ -96,7 +96,6 @@ minetest.register_node("jeija:mesecon_off", { minetest.register_node("jeija:mesecon_on", { drawtype = "raillike", tile_images = {"jeija_mesecon_on.png", "jeija_mesecon_curved_on.png", "jeija_mesecon_t_junction_on.png", "jeija_mesecon_crossing_on.png"}, - inventory_image = "jeija_mesecon_on.png", paramtype = "light", is_ground_content = true, walkable = false, @@ -106,7 +105,6 @@ minetest.register_node("jeija:mesecon_on", { material = minetest.digprop_constanttime(0.1), drop = '"jeija:mesecon_off" 1', light_source = LIGHT_MAX-11, - description="Mesecons", }) minetest.register_craft({ diff --git a/jeija/pressureplates.lua b/jeija/pressureplates.lua index 133715d..edc96c0 100644 --- a/jeija/pressureplates.lua +++ b/jeija/pressureplates.lua @@ -4,6 +4,7 @@ minetest.register_node("jeija:pressure_plate_wood_off", { drawtype = "raillike", tile_images = {"jeija_pressure_plate_wood_off.png"}, inventory_image = "jeija_pressure_plate_wood_off.png", + wield_image = "jeija_pressure_plate_wood_off.png", paramtype = "light", is_ground_content = true, walkable = false, @@ -17,7 +18,6 @@ minetest.register_node("jeija:pressure_plate_wood_off", { minetest.register_node("jeija:pressure_plate_wood_on", { drawtype = "raillike", tile_images = {"jeija_pressure_plate_wood_on.png"}, - inventory_image = "jeija_pressure_plate_wood_on.png", paramtype = "light", is_ground_content = true, walkable = false, @@ -26,7 +26,6 @@ minetest.register_node("jeija:pressure_plate_wood_on", { }, material = minetest.digprop_constanttime(0.3), drop='"jeija:pressure_plate_wood_off" 1', - description="Wood Pressure Plate", }) minetest.register_craft({ @@ -82,6 +81,7 @@ minetest.register_node("jeija:pressure_plate_stone_off", { drawtype = "raillike", tile_images = {"jeija_pressure_plate_stone_off.png"}, inventory_image = "jeija_pressure_plate_stone_off.png", + wield_image = "jeija_pressure_plate_stone_off.png", paramtype = "light", is_ground_content = true, walkable = false, @@ -95,7 +95,6 @@ minetest.register_node("jeija:pressure_plate_stone_off", { minetest.register_node("jeija:pressure_plate_stone_on", { drawtype = "raillike", tile_images = {"jeija_pressure_plate_stone_on.png"}, - inventory_image = "jeija_pressure_plate_stone_on.png", paramtype = "light", is_ground_content = true, walkable = false, @@ -104,7 +103,6 @@ minetest.register_node("jeija:pressure_plate_stone_on", { }, material = minetest.digprop_constanttime(0.3), drop='"jeija:pressure_plate_stone_off" 1', - description="Stone Pressure Plate", }) minetest.register_craft({ diff --git a/jeija/temperest.lua b/jeija/temperest.lua index 7fa61e3..6a3214f 100644 --- a/jeija/temperest.lua +++ b/jeija/temperest.lua @@ -1,106 +1,82 @@ --TEMPEREST-PLUG minetest.register_node("jeija:mesecon_plug", { - description = "Plug", drawtype = "raillike", paramtype = "light", is_ground_content = true, tile_images = {"jeija_mesecon_plug.png"}, inventory_image = "jeija_mesecon_plug.png", + wield_image = "jeija_mesecon_plug.png", material = minetest.digprop_constanttime(0.1), walkable = false, selection_box = { type = "fixed", }, + description = "Plug", }) -mesecon:register_on_signal_on(function(pos, node) - if node.name=="jeija:mesecon_plug" then - local set_node_on = function(pos) - local node = minetest.env:get_node(pos) - if node.name=="jeija:mesecon_socket_off" then - minetest.env:add_node(pos, {name="jeija:mesecon_socket_on"}) - nodeupdate(pos) - mesecon:receptor_on(pos) - elseif node.name=="jeija:mesecon_inverter_on" then - minetest.env:add_node(pos, {name="jeija:mesecon_inverter_off"}) - nodeupdate(pos) - mesecon:receptor_off(pos) - end - end - - local lnode = minetest.env:get_node({x=pos.x-1, y=pos.y, z=pos.z}) --a node between this node and the one two nodes away - if lnode.name=="air" then set_node_on({x=pos.x-2, y=pos.y, z=pos.z}) end - - local lnode = minetest.env:get_node({x=pos.x+1, y=pos.y, z=pos.z}) --a node between this node and the one two nodes away - if lnode.name=="air" then set_node_on({x=pos.x+2, y=pos.y, z=pos.z}) end - - local lnode = minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z-1}) --a node between this node and the one two nodes away - if lnode.name=="air" then set_node_on({x=pos.x, y=pos.y, z=pos.z-2}) end - - local lnode = minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z+1}) --a node between this node and the one two nodes away - if lnode.name=="air" then set_node_on({x=pos.x, y=pos.y, z=pos.z+2}) end - end -end) - -mesecon:register_on_signal_off(function(pos, node) - if node.name=="jeija:mesecon_plug" then - local set_node_off = function(pos) - node = minetest.env:get_node(pos) - if node.name=="jeija:mesecon_socket_on" then - minetest.env:add_node(pos, {name="jeija:mesecon_socket_off"}) - nodeupdate(pos) - mesecon:receptor_off(pos) - elseif node.name=="jeija:mesecon_inverter_off" then - minetest.env:add_node(pos, {name="jeija:mesecon_inverter_on"}) - nodeupdate(pos) - mesecon:receptor_on(pos) - end - end - - lnode = minetest.env:get_node({x=pos.x-1, y=pos.y, z=pos.z}) --a node between this node and the one two nodes away - if lnode.name=="air" then set_node_off({x=pos.x-2, y=pos.y, z=pos.z}) end - - lnode = minetest.env:get_node({x=pos.x+1, y=pos.y, z=pos.z}) --a node between this node and the one two nodes away - if lnode.name=="air" then set_node_off({x=pos.x+2, y=pos.y, z=pos.z}) end - - lnode = minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z-1}) --a node between this node and the one two nodes away - if lnode.name=="air" then set_node_off({x=pos.x, y=pos.y, z=pos.z-2}) end - - lnode = minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z+1}) --a node between this node and the one two nodes away - if lnode.name=="air" then set_node_off({x=pos.x, y=pos.y, z=pos.z+2}) end +local set_node_on = function(pos) + local node = minetest.env:get_node(pos) + if node.name=="jeija:mesecon_socket_off" then + minetest.env:add_node(pos, {name="jeija:mesecon_socket_on"}) + nodeupdate(pos) + mesecon:receptor_on(pos) + elseif node.name=="jeija:mesecon_inverter_on" then + minetest.env:add_node(pos, {name="jeija:mesecon_inverter_off"}) + nodeupdate(pos) + mesecon:receptor_off(pos) end -end) +end -minetest.register_on_dignode(function(pos, oldnode, digger) - if oldnode.name == "jeija:mesecon_plug" then - local set_node_deactivated = function(pos) +local set_node_off = function(pos) node = minetest.env:get_node(pos) if node.name=="jeija:mesecon_socket_on" then minetest.env:add_node(pos, {name="jeija:mesecon_socket_off"}) nodeupdate(pos) mesecon:receptor_off(pos) - elseif node.name=="jeija:mesecon_inverter_on" then - minetest.env:add_node(pos, {name="jeija:mesecon_inverter_off"}) + elseif node.name=="jeija:mesecon_inverter_off" then + minetest.env:add_node(pos, {name="jeija:mesecon_inverter_on"}) nodeupdate(pos) - mesecon:receptor_off(pos) + mesecon:receptor_on(pos) end +end + +local plug_on = function(pos, node) + if node.name=="jeija:mesecon_plug" then + local lnode = minetest.env:get_node({x=pos.x-1, y=pos.y, z=pos.z}) --a node between this node and the one two nodes away + if lnode.name=="air" then set_node_on({x=pos.x-2, y=pos.y, z=pos.z}) end + + local lnode = minetest.env:get_node({x=pos.x+1, y=pos.y, z=pos.z}) --a node between this node and the one two nodes away + if lnode.name=="air" then set_node_on({x=pos.x+2, y=pos.y, z=pos.z}) end + + local lnode = minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z-1}) --a node between this node and the one two nodes away + if lnode.name=="air" then set_node_on({x=pos.x, y=pos.y, z=pos.z-2}) end + + local lnode = minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z+1}) --a node between this node and the one two nodes away + if lnode.name=="air" then set_node_on({x=pos.x, y=pos.y, z=pos.z+2}) end end - - lnode = minetest.env:get_node({x=pos.x-1, y=pos.y, z=pos.z}) --a node between this node and the one two nodes away - if lnode.name=="air" then set_node_deactivated({x=pos.x-2, y=pos.y, z=pos.z}) end - - lnode = minetest.env:get_node({x=pos.x+1, y=pos.y, z=pos.z}) --a node between this node and the one two nodes away - if lnode.name=="air" then set_node_deactivated({x=pos.x+2, y=pos.y, z=pos.z}) end - - lnode = minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z-1}) --a node between this node and the one two nodes away - if lnode.name=="air" then set_node_deactivated({x=pos.x, y=pos.y, z=pos.z-2}) end - - lnode = minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z+1}) --a node between this node and the one two nodes away - if lnode.name=="air" then set_node_deactivated({x=pos.x, y=pos.y, z=pos.z+2}) end +end + +local plug_off = function(pos, node) + if node.name=="jeija:mesecon_plug" then + lnode = minetest.env:get_node({x=pos.x-1, y=pos.y, z=pos.z}) --a node between this node and the one two nodes away + if lnode.name=="air" then set_node_off({x=pos.x-2, y=pos.y, z=pos.z}) end + + lnode = minetest.env:get_node({x=pos.x+1, y=pos.y, z=pos.z}) --a node between this node and the one two nodes away + if lnode.name=="air" then set_node_off({x=pos.x+2, y=pos.y, z=pos.z}) end + + lnode = minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z-1}) --a node between this node and the one two nodes away + if lnode.name=="air" then set_node_off({x=pos.x, y=pos.y, z=pos.z-2}) end + + lnode = minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z+1}) --a node between this node and the one two nodes away + if lnode.name=="air" then set_node_off({x=pos.x, y=pos.y, z=pos.z+2}) end end -end) +end + +mesecon:register_on_signal_on(plug_on) +mesecon:register_on_signal_off(plug_off) +minetest.register_on_dignode(plug_off) minetest.register_craft({ output = 'node "jeija:mesecon_plug" 2', @@ -120,6 +96,7 @@ minetest.register_node("jeija:mesecon_socket_off", { is_ground_content = true, tile_images = {"jeija_mesecon_socket_off.png"}, inventory_image = "jeija_mesecon_socket_off.png", + wield_image = "jeija_mesecon_socket_off.png", material = minetest.digprop_constanttime(0.1), walkable = false, selection_box = { @@ -132,7 +109,6 @@ minetest.register_node("jeija:mesecon_socket_on", { paramtype = "light", is_ground_content = true, tile_images = {"jeija_mesecon_socket_on.png"}, - inventory_image = "jeija_mesecon_socket_on.png", material = minetest.digprop_constanttime(0.1), walkable = false, selection_box = { @@ -170,6 +146,7 @@ minetest.register_node("jeija:mesecon_inverter_off", { is_ground_content = true, tile_images = {"jeija_mesecon_inverter_off.png"}, inventory_image = "jeija_mesecon_inverter_off.png", + wield_image = "jeija_mesecon_inverter_off.png", material = minetest.digprop_constanttime(0.1), walkable = false, selection_box = { @@ -182,7 +159,6 @@ minetest.register_node("jeija:mesecon_inverter_on", { paramtype = "light", is_ground_content = true, tile_images = {"jeija_mesecon_inverter_on.png"}, - inventory_image = "jeija_mesecon_inverter_on.png", material = minetest.digprop_constanttime(0.1), walkable = false, selection_box = { |