From a78406977760d678618c10bb632626ef81a6637c Mon Sep 17 00:00:00 2001 From: Joachim Stolberg Date: Sun, 25 Apr 2021 17:55:14 +0200 Subject: [PATCH] Adapt to minecart v2.00 --- logic/cart_detector.lua | 9 ++++++--- logic/lib.lua | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/logic/cart_detector.lua b/logic/cart_detector.lua index 57344ff..8fae87a 100644 --- a/logic/cart_detector.lua +++ b/logic/cart_detector.lua @@ -27,8 +27,9 @@ end local function switch_on(pos) logic.swap_node(pos, "techage:ta3_cartdetector_on") - logic.send_on(pos, M(pos)) - minetest.after(1, switch_off, pos) + if logic.send_on(pos, M(pos)) then + minetest.after(1, switch_off, pos) + end end local function node_timer(pos) @@ -135,7 +136,7 @@ techage.register_node({"techage:ta3_cartdetector_off", "techage:ta3_cartdetector if topic == "on" then local node = minetest.get_node(pos) local dir = minetest.facedir_to_dir(node.param2) - minecart.punch_cart(pos, nil, 1.5, dir) + minecart.punch_cart(pos, nil, 1.6, dir) elseif topic == "state" then local node = techage.get_node_lvm(pos) if node.name == "techage:ta3_cartdetector_on" then @@ -152,3 +153,5 @@ techage.register_node({"techage:ta3_cartdetector_off", "techage:ta3_cartdetector end, }) +-- Register default cart in addition +minecart.tEntityNames["carts:cart"] = true \ No newline at end of file diff --git a/logic/lib.lua b/logic/lib.lua index 6e45767..7feb550 100644 --- a/logic/lib.lua +++ b/logic/lib.lua @@ -64,6 +64,7 @@ function techage.logic.send_on(pos, meta, time) minetest.get_node_timer(pos):start(time) end techage.send_multi(own_num, numbers, "on") + return own_num == numbers end function techage.logic.send_off(pos, meta)