Adapt to minecart v2.0

master
Joachim Stolberg 2021-04-30 18:58:15 +02:00
parent c377ffa8d5
commit 907a6bfa8d
5 changed files with 10 additions and 23 deletions

View File

@ -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

View File

@ -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)

View File

@ -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,
})

View File

@ -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")

View File

@ -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"