summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcheapie <no-email-for-you@example.com>2022-01-02 16:42:59 -0600
committercheapie <no-email-for-you@example.com>2022-01-02 16:42:59 -0600
commit9050d5b2282af82e56f26f4c57c05a01352ef567 (patch)
treee00ceb5fce0b3d437c2a434f4c65222a2aa09da0
parentda8d9e5dee1fcdba476f8ad4cfc79cb5a4f88a8b (diff)
downloadmesecons-9050d5b2282af82e56f26f4c57c05a01352ef567.tar
mesecons-9050d5b2282af82e56f26f4c57c05a01352ef567.tar.gz
mesecons-9050d5b2282af82e56f26f4c57c05a01352ef567.tar.bz2
mesecons-9050d5b2282af82e56f26f4c57c05a01352ef567.tar.xz
mesecons-9050d5b2282af82e56f26f4c57c05a01352ef567.zip
Make off events count towards pistons overheating too
-rw-r--r--mesecons_pistons/init.lua21
1 files changed, 12 insertions, 9 deletions
diff --git a/mesecons_pistons/init.lua b/mesecons_pistons/init.lua
index c068ec9..6e36f3f 100644
--- a/mesecons_pistons/init.lua
+++ b/mesecons_pistons/init.lua
@@ -118,16 +118,19 @@ local function piston_off(pos, node)
local pistonspec = get_pistonspec(node.name, "onname")
minetest.swap_node(pos, {param2 = node.param2, name = pistonspec.offname})
piston_remove_pusher(pos, node, not pistonspec.sticky) -- allow that even in protected area
-
- if not pistonspec.sticky then
- return
+ if pistonspec.sticky then
+ local dir = minetest.facedir_to_dir(node.param2)
+ local pullpos = vector.add(pos, vector.multiply(dir, -2))
+ local meta = minetest.get_meta(pos)
+ local success, stack, oldstack = mesecon.mvps_pull_single(pullpos, dir, max_pull, meta:get_string("owner"))
+ if success then
+ mesecon.mvps_move_objects(pullpos, vector.multiply(dir, -1), oldstack, -1)
+ end
end
- local dir = minetest.facedir_to_dir(node.param2)
- local pullpos = vector.add(pos, vector.multiply(dir, -2))
- local meta = minetest.get_meta(pos)
- local success, stack, oldstack = mesecon.mvps_pull_single(pullpos, dir, max_pull, meta:get_string("owner"))
- if success then
- mesecon.mvps_move_objects(pullpos, vector.multiply(dir, -1), oldstack, -1)
+ if mesecon.do_overheat(pos) then
+ minetest.swap_node(pos, {param2 = node.param2, name = pistonspec.hotname})
+ mesecon.queue:add_action(pos, "piston_cooldown", {}, 5, "piston_cooldown")
+ return
end
end