summaryrefslogtreecommitdiff
path: root/mesecons/mesecons_pressureplates
diff options
context:
space:
mode:
Diffstat (limited to 'mesecons/mesecons_pressureplates')
-rw-r--r--mesecons/mesecons_pressureplates/depends.txt1
-rw-r--r--mesecons/mesecons_pressureplates/doc/pressureplate_stone/description.html1
-rw-r--r--mesecons/mesecons_pressureplates/doc/pressureplate_stone/preview.pngbin0 -> 55619 bytes
-rw-r--r--mesecons/mesecons_pressureplates/doc/pressureplate_stone/recipe.pngbin0 -> 8056 bytes
-rw-r--r--mesecons/mesecons_pressureplates/doc/pressureplate_wood/description.html1
-rw-r--r--mesecons/mesecons_pressureplates/doc/pressureplate_wood/preview.pngbin0 -> 63535 bytes
-rw-r--r--mesecons/mesecons_pressureplates/doc/pressureplate_wood/recipe.pngbin0 -> 7717 bytes
-rw-r--r--mesecons/mesecons_pressureplates/init.lua94
-rw-r--r--mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_stone_inv.pngbin0 -> 604 bytes
-rw-r--r--mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_stone_off.pngbin0 -> 555 bytes
-rw-r--r--mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_stone_off_edges.pngbin0 -> 292 bytes
-rw-r--r--mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_stone_on.pngbin0 -> 579 bytes
-rw-r--r--mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_stone_on_edges.pngbin0 -> 336 bytes
-rw-r--r--mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_stone_wield.pngbin0 -> 604 bytes
-rw-r--r--mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_wood_inv.pngbin0 -> 716 bytes
-rw-r--r--mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_wood_off.pngbin0 -> 663 bytes
-rw-r--r--mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_wood_off_edges.pngbin0 -> 295 bytes
-rw-r--r--mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_wood_on.pngbin0 -> 675 bytes
-rw-r--r--mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_wood_on_edges.pngbin0 -> 336 bytes
-rw-r--r--mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_wood_wield.pngbin0 -> 716 bytes
20 files changed, 97 insertions, 0 deletions
diff --git a/mesecons/mesecons_pressureplates/depends.txt b/mesecons/mesecons_pressureplates/depends.txt
new file mode 100644
index 0000000..acaa924
--- /dev/null
+++ b/mesecons/mesecons_pressureplates/depends.txt
@@ -0,0 +1 @@
+mesecons
diff --git a/mesecons/mesecons_pressureplates/doc/pressureplate_stone/description.html b/mesecons/mesecons_pressureplates/doc/pressureplate_stone/description.html
new file mode 100644
index 0000000..3edc95b
--- /dev/null
+++ b/mesecons/mesecons_pressureplates/doc/pressureplate_stone/description.html
@@ -0,0 +1 @@
+This receptor turns on if there's an object above it. And object can be a player, an item, a mob...
diff --git a/mesecons/mesecons_pressureplates/doc/pressureplate_stone/preview.png b/mesecons/mesecons_pressureplates/doc/pressureplate_stone/preview.png
new file mode 100644
index 0000000..235ffc4
--- /dev/null
+++ b/mesecons/mesecons_pressureplates/doc/pressureplate_stone/preview.png
Binary files differ
diff --git a/mesecons/mesecons_pressureplates/doc/pressureplate_stone/recipe.png b/mesecons/mesecons_pressureplates/doc/pressureplate_stone/recipe.png
new file mode 100644
index 0000000..62acf45
--- /dev/null
+++ b/mesecons/mesecons_pressureplates/doc/pressureplate_stone/recipe.png
Binary files differ
diff --git a/mesecons/mesecons_pressureplates/doc/pressureplate_wood/description.html b/mesecons/mesecons_pressureplates/doc/pressureplate_wood/description.html
new file mode 100644
index 0000000..3edc95b
--- /dev/null
+++ b/mesecons/mesecons_pressureplates/doc/pressureplate_wood/description.html
@@ -0,0 +1 @@
+This receptor turns on if there's an object above it. And object can be a player, an item, a mob...
diff --git a/mesecons/mesecons_pressureplates/doc/pressureplate_wood/preview.png b/mesecons/mesecons_pressureplates/doc/pressureplate_wood/preview.png
new file mode 100644
index 0000000..7063cb0
--- /dev/null
+++ b/mesecons/mesecons_pressureplates/doc/pressureplate_wood/preview.png
Binary files differ
diff --git a/mesecons/mesecons_pressureplates/doc/pressureplate_wood/recipe.png b/mesecons/mesecons_pressureplates/doc/pressureplate_wood/recipe.png
new file mode 100644
index 0000000..429d491
--- /dev/null
+++ b/mesecons/mesecons_pressureplates/doc/pressureplate_wood/recipe.png
Binary files differ
diff --git a/mesecons/mesecons_pressureplates/init.lua b/mesecons/mesecons_pressureplates/init.lua
new file mode 100644
index 0000000..b00db9a
--- /dev/null
+++ b/mesecons/mesecons_pressureplates/init.lua
@@ -0,0 +1,94 @@
+local pp_box_off = {
+ type = "fixed",
+ fixed = { -7/16, -8/16, -7/16, 7/16, -7/16, 7/16 },
+}
+
+local pp_box_on = {
+ type = "fixed",
+ fixed = { -7/16, -8/16, -7/16, 7/16, -7.5/16, 7/16 },
+}
+
+pp_on_timer = function (pos, elapsed)
+ local node = minetest.get_node(pos)
+ local basename = minetest.registered_nodes[node.name].pressureplate_basename
+
+ -- This is a workaround for a strange bug that occurs when the server is started
+ -- For some reason the first time on_timer is called, the pos is wrong
+ if not basename then return end
+
+ local objs = minetest.get_objects_inside_radius(pos, 1)
+ local two_below = mesecon.addPosRule(pos, {x = 0, y = -2, z = 0})
+
+ if objs[1] == nil and node.name == basename .. "_on" then
+ minetest.add_node(pos, {name = basename .. "_off"})
+ mesecon.receptor_off(pos, mesecon.rules.pplate)
+ elseif node.name == basename .. "_off" then
+ for k, obj in pairs(objs) do
+ local objpos = obj:getpos()
+ if objpos.y > pos.y-1 and objpos.y < pos.y then
+ minetest.add_node(pos, {name = basename .. "_on"})
+ mesecon.receptor_on(pos, mesecon.rules.pplate )
+ end
+ end
+ end
+ return true
+end
+
+-- Register a Pressure Plate
+-- offstate: name of the pressure plate when inactive
+-- onstate: name of the pressure plate when active
+-- description: description displayed in the player's inventory
+-- tiles_off: textures of the pressure plate when inactive
+-- tiles_on: textures of the pressure plate when active
+-- image: inventory and wield image of the pressure plate
+-- recipe: crafting recipe of the pressure plate
+
+function mesecon.register_pressure_plate(basename, description, textures_off, textures_on, image_w, image_i, recipe)
+ mesecon.register_node(basename, {
+ drawtype = "nodebox",
+ inventory_image = image_i,
+ wield_image = image_w,
+ paramtype = "light",
+ description = description,
+ pressureplate_basename = basename,
+ on_timer = pp_on_timer,
+ on_construct = function(pos)
+ minetest.get_node_timer(pos):start(mesecon.setting("pplate_interval", 0.1))
+ end,
+ },{
+ mesecons = {receptor = { state = mesecon.state.off, rules = mesecon.rules.pplate }},
+ node_box = pp_box_off,
+ selection_box = pp_box_off,
+ groups = {snappy = 2, oddly_breakable_by_hand = 3},
+ tiles = textures_off
+ },{
+ mesecons = {receptor = { state = mesecon.state.on, rules = mesecon.rules.pplate }},
+ node_box = pp_box_on,
+ selection_box = pp_box_on,
+ groups = {snappy = 2, oddly_breakable_by_hand = 3, not_in_creative_inventory = 1},
+ tiles = textures_on
+ })
+
+ minetest.register_craft({
+ output = basename .. "_off",
+ recipe = recipe,
+ })
+end
+
+mesecon.register_pressure_plate(
+ "mesecons_pressureplates:pressure_plate_wood",
+ "Wooden Pressure Plate",
+ {"jeija_pressure_plate_wood_off.png","jeija_pressure_plate_wood_off.png","jeija_pressure_plate_wood_off_edges.png"},
+ {"jeija_pressure_plate_wood_on.png","jeija_pressure_plate_wood_on.png","jeija_pressure_plate_wood_on_edges.png"},
+ "jeija_pressure_plate_wood_wield.png",
+ "jeija_pressure_plate_wood_inv.png",
+ {{"group:wood", "group:wood"}})
+
+mesecon.register_pressure_plate(
+ "mesecons_pressureplates:pressure_plate_stone",
+ "Stone Pressure Plate",
+ {"jeija_pressure_plate_stone_off.png","jeija_pressure_plate_stone_off.png","jeija_pressure_plate_stone_off_edges.png"},
+ {"jeija_pressure_plate_stone_on.png","jeija_pressure_plate_stone_on.png","jeija_pressure_plate_stone_on_edges.png"},
+ "jeija_pressure_plate_stone_wield.png",
+ "jeija_pressure_plate_stone_inv.png",
+ {{"default:cobble", "default:cobble"}})
diff --git a/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_stone_inv.png b/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_stone_inv.png
new file mode 100644
index 0000000..bfe5a1d
--- /dev/null
+++ b/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_stone_inv.png
Binary files differ
diff --git a/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_stone_off.png b/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_stone_off.png
new file mode 100644
index 0000000..46140da
--- /dev/null
+++ b/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_stone_off.png
Binary files differ
diff --git a/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_stone_off_edges.png b/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_stone_off_edges.png
new file mode 100644
index 0000000..2ad9acc
--- /dev/null
+++ b/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_stone_off_edges.png
Binary files differ
diff --git a/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_stone_on.png b/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_stone_on.png
new file mode 100644
index 0000000..dc64931
--- /dev/null
+++ b/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_stone_on.png
Binary files differ
diff --git a/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_stone_on_edges.png b/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_stone_on_edges.png
new file mode 100644
index 0000000..51add95
--- /dev/null
+++ b/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_stone_on_edges.png
Binary files differ
diff --git a/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_stone_wield.png b/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_stone_wield.png
new file mode 100644
index 0000000..c533567
--- /dev/null
+++ b/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_stone_wield.png
Binary files differ
diff --git a/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_wood_inv.png b/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_wood_inv.png
new file mode 100644
index 0000000..36dacd0
--- /dev/null
+++ b/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_wood_inv.png
Binary files differ
diff --git a/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_wood_off.png b/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_wood_off.png
new file mode 100644
index 0000000..ca98757
--- /dev/null
+++ b/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_wood_off.png
Binary files differ
diff --git a/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_wood_off_edges.png b/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_wood_off_edges.png
new file mode 100644
index 0000000..665ae97
--- /dev/null
+++ b/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_wood_off_edges.png
Binary files differ
diff --git a/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_wood_on.png b/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_wood_on.png
new file mode 100644
index 0000000..e1a7d8e
--- /dev/null
+++ b/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_wood_on.png
Binary files differ
diff --git a/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_wood_on_edges.png b/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_wood_on_edges.png
new file mode 100644
index 0000000..358f2ea
--- /dev/null
+++ b/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_wood_on_edges.png
Binary files differ
diff --git a/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_wood_wield.png b/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_wood_wield.png
new file mode 100644
index 0000000..50b321d
--- /dev/null
+++ b/mesecons/mesecons_pressureplates/textures/jeija_pressure_plate_wood_wield.png
Binary files differ