diff --git a/README.md b/README.md index a5e44c1..451ff07 100644 --- a/README.md +++ b/README.md @@ -170,4 +170,5 @@ optional: farming redo, node_io, doc, techage, minecart - 2020-10-01 v1.04 * Many improvements and bugfixes (Thanks to Thomas-S) - 2021-01-30 v1.05 * Many improvements and bugfixes - 2021-03-14 v1.06 * Switch translation from intllib to minetest.translator +- 2021-04-24 v1.07 * Adapted to minecart v2.0 diff --git a/cart_sensor.lua b/cart_sensor.lua index b3c4a30..350e035 100644 --- a/cart_sensor.lua +++ b/cart_sensor.lua @@ -38,18 +38,8 @@ local function swap_node(pos, name) return true end -local function check_cart(pos) - for _, object in pairs(minetest.get_objects_inside_radius(pos, 1)) do - if object:get_entity_name() == "minecart:cart" then - return true - end - end - return false -end - local function node_timer(pos) - local pos1 = lib.next_pos(pos, M(pos):get_int("param2")) - if check_cart(pos1) then + if minecart.is_cart_available(pos, M(pos):get_int("param2"), 1) then if swap_node(pos, "signs_bot:cart_sensor_on") then signs_bot.send_signal(pos) signs_bot.lib.activate_extender_nodes(pos, true) diff --git a/cmd_item.lua b/cmd_item.lua index 5a639ae..4ed7d70 100644 --- a/cmd_item.lua +++ b/cmd_item.lua @@ -245,16 +245,8 @@ signs_bot.register_botcommand("punch_cart", { num_param = 0, description = S("Punch a rail cart to start it"), cmnd = function(base_pos, mem) - local pos = lib.dest_pos(mem.robot_pos, mem.robot_param2, {0}) - for _, object in pairs(minetest.get_objects_inside_radius(pos, 2)) do - if object:get_entity_name() == "minecart:cart" then - object:punch(object, 1.0, { - full_punch_interval = 1.0, - damage_groups = {fleshy = 1}, - }, minetest.facedir_to_dir(mem.robot_param2)) - break -- start only one cart - end - end + local punch_dir = minetest.facedir_to_dir(mem.robot_param2) + minecart.punch_cart(mem.robot_pos, mem.robot_param2, 1, punch_dir) return signs_bot.DONE end, }) diff --git a/init.lua b/init.lua index 4a2a5f6..db1e27a 100644 --- a/init.lua +++ b/init.lua @@ -15,7 +15,7 @@ signs_bot = {} -- Version for compatibility checks, see readme.md/history -signs_bot.version = 1.06 +signs_bot.version = 1.07 -- Test for MT 5.4 new string mode signs_bot.CLIP = minetest.features.use_texture_alpha_string_modes and "clip" or true @@ -28,6 +28,10 @@ if tubelib2.version < 1.9 then error("[signs_bot] Signs Bot requires tubelib2 version 1.9 or newer!") end +if minetest.global_exists("minecart") and minecart.version < 2.0 then + error("[signs_bot] Signs Bot requires minecart version 2.0 or newer!") +end + -- Load support for I18n. signs_bot.S = minetest.get_translator("signs_bot") diff --git a/techage.lua b/techage.lua index 3a3f91f..c1914ba 100644 --- a/techage.lua +++ b/techage.lua @@ -182,7 +182,7 @@ if minetest.get_modpath("techage") then elseif mem.capa >= signs_bot.MAX_CAPA then return "stopped" else - return "loading" + return "charging" end else return "stopped"