Allow to disable the LBM due to needed computing time
This commit is contained in:
parent
b5fe888f70
commit
0e957733e7
37
robot.lua
37
robot.lua
@ -3,7 +3,7 @@
|
||||
Signs Bot
|
||||
=========
|
||||
|
||||
Copyright (C) 2019-2021 Joachim Stolberg
|
||||
Copyright (C) 2019-2023 Joachim Stolberg
|
||||
|
||||
GPL v3
|
||||
See LICENSE.txt for more information
|
||||
@ -13,6 +13,7 @@
|
||||
]]--
|
||||
|
||||
local lib = signs_bot.lib
|
||||
local enable_LBM = minetest.settings:get_bool("signs_bot_enable_LBM") == true
|
||||
|
||||
-- Called when robot is started
|
||||
function signs_bot.place_robot(pos1, pos2, param2)
|
||||
@ -122,21 +123,23 @@ minetest.register_node("signs_bot:robot_foot", {
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_lbm({
|
||||
label = "[signs_bot] Remove lost robots",
|
||||
name = "signs_bot:lost_robot_remove",
|
||||
nodenames = {"signs_bot:robot"},
|
||||
run_at_every_load = true,
|
||||
action = function(pos, node)
|
||||
local found = false
|
||||
tubelib2.walk_over_all(function(npos, node, mem)
|
||||
if node.name == "signs_bot:box" and mem.robot_pos and
|
||||
vector.equals(pos, mem.robot_pos) then
|
||||
found = true
|
||||
if enable_LBM then
|
||||
minetest.register_lbm({
|
||||
label = "[signs_bot] Remove lost robots",
|
||||
name = "signs_bot:lost_robot_remove",
|
||||
nodenames = {"signs_bot:robot"},
|
||||
run_at_every_load = true,
|
||||
action = function(pos, node)
|
||||
local found = false
|
||||
tubelib2.walk_over_all(function(npos, node, mem)
|
||||
if node.name == "signs_bot:box" and mem.robot_pos and
|
||||
vector.equals(pos, mem.robot_pos) then
|
||||
found = true
|
||||
end
|
||||
end, "robot_pos")
|
||||
if not found then
|
||||
signs_bot.remove_robot({robot_pos = pos})
|
||||
end
|
||||
end, "robot_pos")
|
||||
if not found then
|
||||
signs_bot.remove_robot({robot_pos = pos})
|
||||
end
|
||||
end
|
||||
})
|
||||
})
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user