From 9050d5b2282af82e56f26f4c57c05a01352ef567 Mon Sep 17 00:00:00 2001 From: cheapie Date: Sun, 2 Jan 2022 16:42:59 -0600 Subject: Make off events count towards pistons overheating too --- mesecons_pistons/init.lua | 21 ++++++++++++--------- 1 file 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 -- cgit v1.2.3