aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--advtrains/trackplacer.lua19
-rw-r--r--advtrains_luaautomation/active_common.lua2
2 files changed, 12 insertions, 9 deletions
diff --git a/advtrains/trackplacer.lua b/advtrains/trackplacer.lua
index ffae736..258c9cd 100644
--- a/advtrains/trackplacer.lua
+++ b/advtrains/trackplacer.lua
@@ -207,15 +207,18 @@ function tp.placetrack(pos, nnpref, placer, itemstack, pointed_thing, yaw)
if (dconn1[conn1.."_"..conn2]) then
using = dconn1[conn1.."_"..conn2]
end
-
- tp.bend_rail(p_railpos[conn1], conn1, nnpref)
- tp.bend_rail(p_railpos[conn2], conn2, nnpref)
- advtrains.ndb.swap_node(pos, using)
- local nname=using.name
- if minetest.registered_nodes[nname] and minetest.registered_nodes[nname].after_place_node then
- minetest.registered_nodes[nname].after_place_node(pos, placer, itemstack, pointed_thing)
+ if using then
+ -- has found a fitting rail in either direction
+ -- if not, continue loop
+ tp.bend_rail(p_railpos[conn1], conn1, nnpref)
+ tp.bend_rail(p_railpos[conn2], conn2, nnpref)
+ advtrains.ndb.swap_node(pos, using)
+ local nname=using.name
+ if minetest.registered_nodes[nname] and minetest.registered_nodes[nname].after_place_node then
+ minetest.registered_nodes[nname].after_place_node(pos, placer, itemstack, pointed_thing)
+ end
+ return
end
- return
end
end
end
diff --git a/advtrains_luaautomation/active_common.lua b/advtrains_luaautomation/active_common.lua
index 62dc83c..d4cc0da 100644
--- a/advtrains_luaautomation/active_common.lua
+++ b/advtrains_luaautomation/active_common.lua
@@ -118,7 +118,7 @@ function ac.run_in_env(pos, evtdata, customfct_p)
atlatc.interrupt.add(t, pos, {type="int", int=true, message=imesg})
end
-- add digiline_send function, if digiline is loaded
- if digiline then
+ if minetest.global_exists("digiline") then
customfct.digiline_send=function(channel, msg)
assertt(channel, "string")
digiline:receptor_send(pos, digiline.rules.default, channel, msg)