mirror of
https://github.com/minetest-mods/mesecons.git
synced 2024-12-27 15:57:28 +01:00
AND block changed! Now in its own dir. Also, auto power on (NOT off) has been added.
This commit is contained in:
parent
51539ef173
commit
39ed74bef7
@ -4,6 +4,6 @@ README for Whiskers75's contributions
|
|||||||
1: You need Temperest's code enabled (ENABLE_TEMPEREST=1 in settings.lua).
|
1: You need Temperest's code enabled (ENABLE_TEMPEREST=1 in settings.lua).
|
||||||
2: To work it, place mesecons (on) in the position x plus or minus 1 from the block.
|
2: To work it, place mesecons (on) in the position x plus or minus 1 from the block.
|
||||||
3: Then punch, and off mesecons in the position y plus or minus 1 from the block will be powered.
|
3: Then punch, and off mesecons in the position y plus or minus 1 from the block will be powered.
|
||||||
4: Currently, you will have to dig the mesecons in the above positions up if the circuit changes, but that will be fixed.
|
4: The AND gate will auto power on, but NOT off, punch to update (help here)
|
||||||
5: The name of the block is mesecons_temperest:andblock.
|
5: The name of the block is mesecons_whiskers75:andblock.
|
||||||
6: Enjoy!
|
6: Enjoy!
|
||||||
|
@ -243,29 +243,4 @@ if ENABLE_TEMPEREST==1 then
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
--End Temperest's code
|
|
||||||
|
|
||||||
--Whiskers75's code
|
|
||||||
--AND block
|
|
||||||
|
|
||||||
-- Make the block:
|
|
||||||
|
|
||||||
minetest.register_node("mesecons_temperest:andblock", {
|
|
||||||
description = "AND block",
|
|
||||||
drawtype = "raillike",
|
|
||||||
tile_images = {"whiskers75andblock.png"},
|
|
||||||
inventory_image = {"whiskers75andblock.png"},
|
|
||||||
sunlight_propagates = true,
|
|
||||||
paramtype = 'light',
|
|
||||||
walkable = true,
|
|
||||||
groups = {dig_immediate=2},
|
|
||||||
material = minetest.digprop_constanttime(1.0),
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_on_punchnode(function(pos, node, puncher)
|
|
||||||
if node.name=="mesecons_temperest:andblock" then
|
|
||||||
anode = minetest.env:get_node({x=pos.x-1, y=pos.y, z=pos.z})
|
|
||||||
bnode = minetest.env:get_node({x=pos.x+1, y=pos.y, z=pos.z})
|
|
||||||
if anode.name=="mesecons:mesecon_on" and bnode.name=="mesecons:mesecon_on" then mesecon:receptor_on({x=pos.x, y=pos.y+1, z=pos.z}) end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
2
mesecons_whiskers75/depends.txt
Normal file
2
mesecons_whiskers75/depends.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
default
|
||||||
|
mesecons
|
60
mesecons_whiskers75/init.lua
Normal file
60
mesecons_whiskers75/init.lua
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
--Whiskers75's code
|
||||||
|
--AND block
|
||||||
|
|
||||||
|
-- Make the block:
|
||||||
|
|
||||||
|
minetest.register_node("mesecons_whiskers75:andblock", {
|
||||||
|
description = "AND block",
|
||||||
|
drawtype = "raillike",
|
||||||
|
tile_images = {"whiskers75andblock.png"},
|
||||||
|
inventory_image = {"whiskers75andblock.png"},
|
||||||
|
sunlight_propagates = true,
|
||||||
|
paramtype = 'light',
|
||||||
|
walkable = true,
|
||||||
|
groups = {dig_immediate=2},
|
||||||
|
material = minetest.digprop_constanttime(1.0),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_on_punchnode(function(pos, node, puncher)
|
||||||
|
if node.name=="mesecons_whiskers75:andblock" then
|
||||||
|
anode = minetest.env:get_node({x=pos.x-1, y=pos.y, z=pos.z})
|
||||||
|
bnode = minetest.env:get_node({x=pos.x+1, y=pos.y, z=pos.z})
|
||||||
|
if anode.name=="mesecons:mesecon_on" and bnode.name=="mesecons:mesecon_on" then mesecon:receptor_on({x=pos.x, y=pos.y+1, z=pos.z}) end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
minetest.register_on_punchnode(function(pos, node, puncher)
|
||||||
|
if node.name=="mesecons_whiskers75:andblock" then
|
||||||
|
anode = minetest.env:get_node({x=pos.x-1, y=pos.y, z=pos.z})
|
||||||
|
bnode = minetest.env:get_node({x=pos.x+1, y=pos.y, z=pos.z})
|
||||||
|
if anode.name=="mesecons:mesecon_off" then mesecon:receptor_off({x=pos.x, y=pos.y+1, z=pos.z}) end
|
||||||
|
if bnode.name=="mesecons:mesecon_off" then mesecon:receptor_off({x=pos.x, y=pos.y+1, z=pos.z}) end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
function update(pos, node)
|
||||||
|
if node.name=="mesecons_whiskers75:andblock" then
|
||||||
|
anode = minetest.env:get_node({x=pos.x-1, y=pos.y, z=pos.z})
|
||||||
|
bnode = minetest.env:get_node({x=pos.x+1, y=pos.y, z=pos.z})
|
||||||
|
if anode.name=="mesecons:mesecon_off" then mesecon:receptor_off({x=pos.x, y=pos.y+1, z=pos.z}) end
|
||||||
|
if bnode.name=="mesecons:mesecon_off" then mesecon:receptor_off({x=pos.x, y=pos.y+1, z=pos.z}) end
|
||||||
|
end
|
||||||
|
|
||||||
|
if node.name=="mesecons_whiskers75:andblock" then
|
||||||
|
anode = minetest.env:get_node({x=pos.x-1, y=pos.y, z=pos.z})
|
||||||
|
bnode = minetest.env:get_node({x=pos.x+1, y=pos.y, z=pos.z})
|
||||||
|
if anode.name=="mesecons:mesecon_on" and bnode.name=="mesecons:mesecon_on" then mesecon:receptor_on({x=pos.x, y=pos.y+1, z=pos.z}) end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = '"mesecons_whiskers75:andblock" 2',
|
||||||
|
recipe = {
|
||||||
|
{'"default:wood"', '', '"default:dirt"'},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
mesecon:register_on_signal_on(update)
|
||||||
|
mesecon:register_on_signal_off(update)
|
||||||
|
|
Before Width: | Height: | Size: 364 B After Width: | Height: | Size: 364 B |
Loading…
Reference in New Issue
Block a user