diff options
author | Jeija <norrepli@googlemail.com> | 2012-01-26 16:22:04 +0100 |
---|---|---|
committer | Jeija <norrepli@googlemail.com> | 2012-01-26 16:22:04 +0100 |
commit | c1d4228cebda32c0b0d72c51e5554529b84e8543 (patch) | |
tree | 599723508fdb0e856fb3df633ff9b3807b8d5a1d /.minetest/usermods/jeija/pressureplates.lua | |
parent | c0eb0982aa65dc28abc49a2767b5a4abff96ddfe (diff) |
Updated to new Minetest version (22.01.2012)
Diffstat (limited to '.minetest/usermods/jeija/pressureplates.lua')
-rw-r--r-- | .minetest/usermods/jeija/pressureplates.lua | 151 |
1 files changed, 151 insertions, 0 deletions
diff --git a/.minetest/usermods/jeija/pressureplates.lua b/.minetest/usermods/jeija/pressureplates.lua new file mode 100644 index 0000000..f882230 --- /dev/null +++ b/.minetest/usermods/jeija/pressureplates.lua @@ -0,0 +1,151 @@ +-- PRESSURE PLATE WOOD + +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", + paramtype = "light", + is_ground_content = true, + walkable = false, + selection_box = { + type = "fixed", + }, + material = minetest.digprop_constanttime(0.3), +}) + +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, + selection_box = { + type = "fixed", + }, + material = minetest.digprop_constanttime(0.3), + drop='"jeija:pressure_plate_wood_off" 1' +}) + +minetest.register_craft({ + output = '"jeija:pressure_plate_wood_off" 1', + recipe = { + {'"default:wood"', '"default:wood"'}, + } +}) + +minetest.register_abm( + {nodenames = {"jeija:pressure_plate_wood_off"}, + interval = 1.0, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + local objs = minetest.env:get_objects_inside_radius(pos, 1) + for k, obj in pairs(objs) do + local objpos=obj:getpos() + if objpos.y>pos.y-1 and objpos.y<pos.y then + minetest.env:add_node(pos, {name="jeija:pressure_plate_wood_on"}) + mesecon:receptor_on(pos, "pressureplate") + end + end + end, +}) + +minetest.register_abm( + {nodenames = {"jeija:pressure_plate_wood_on"}, + interval = 1.0, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + local objs = minetest.env:get_objects_inside_radius(pos, 1) + if objs[1]==nil then + minetest.env:add_node(pos, {name="jeija:pressure_plate_wood_off"}) + mesecon:receptor_off(pos, "pressureplate") + end + end, +}) + +minetest.register_on_dignode( + function(pos, oldnode, digger) + if oldnode.name == "jeija:pressure_plate_wood_on" then + mesecon:receptor_off(pos, "pressureplate") + end + end +) + +mesecon:add_receptor_node("jeija:pressure_plate_wood_on") +mesecon:add_receptor_node_off("jeija:pressure_plate_wood_off") + +-- PRESSURE PLATE STONE + +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", + paramtype = "light", + is_ground_content = true, + walkable = false, + selection_box = { + type = "fixed", + }, + material = minetest.digprop_constanttime(0.3), +}) + +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, + selection_box = { + type = "fixed", + }, + material = minetest.digprop_constanttime(0.3), + drop='"jeija:pressure_plate_stone_off" 1' +}) + +minetest.register_craft({ + output = '"jeija:pressure_plate_stone_off" 1', + recipe = { + {'"default:cobble"', '"default:cobble"'}, + } +}) + +minetest.register_abm( + {nodenames = {"jeija:pressure_plate_stone_off"}, + interval = 1.0, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + local objs = minetest.env:get_objects_inside_radius(pos, 1) + for k, obj in pairs(objs) do + local objpos=obj:getpos() + if objpos.y>pos.y-1 and objpos.y<pos.y then + minetest.env:add_node(pos, {name="jeija:pressure_plate_stone_on"}) + mesecon:receptor_on(pos, "pressureplate") + end + end + end, +}) + +minetest.register_abm( + {nodenames = {"jeija:pressure_plate_stone_on"}, + interval = 1.0, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + local objs = minetest.env:get_objects_inside_radius(pos, 1) + if objs[1]==nil then + minetest.env:add_node(pos, {name="jeija:pressure_plate_stone_off"}) + mesecon:receptor_off(pos, "pressureplate") + end + end, +}) + +minetest.register_on_dignode( + function(pos, oldnode, digger) + if oldnode.name == "jeija:pressure_plate_stone_on" then + mesecon:receptor_off(pos, "pressureplate") + end + end +) + +mesecon:add_receptor_node("jeija:pressure_plate_stone_on") +mesecon:add_receptor_node_off("jeija:pressure_plate_stone_off") |