aboutsummaryrefslogtreecommitdiff
path: root/advtrains
diff options
context:
space:
mode:
Diffstat (limited to 'advtrains')
-rw-r--r--advtrains/atc.lua4
-rw-r--r--advtrains/nodedb.lua7
2 files changed, 7 insertions, 4 deletions
diff --git a/advtrains/atc.lua b/advtrains/atc.lua
index 10321d9..465a0ec 100644
--- a/advtrains/atc.lua
+++ b/advtrains/atc.lua
@@ -71,8 +71,8 @@ end
--nodes
local idxtrans={static=1, mesecon=2, digiline=3}
-local apn_func=function(pos, node)
- advtrains.ndb.update(pos, node)
+local apn_func=function(pos)
+ -- FIX for long-persisting ndb bug: there's no node in parameter 2 of this function!
local meta=minetest.get_meta(pos)
if meta then
meta:set_string("infotext", attrans("ATC controller, unconfigured."))
diff --git a/advtrains/nodedb.lua b/advtrains/nodedb.lua
index 592e730..ad58b37 100644
--- a/advtrains/nodedb.lua
+++ b/advtrains/nodedb.lua
@@ -151,10 +151,13 @@ function ndb.update(pos, pnode)
nid=#ndb_nodeids+1
ndb_nodeids[nid]=node.name
end
- ndbset(pos.x, pos.y, pos.z, (nid * 4) + (l2b(node.param2 or 0)) )
- --atprint("nodedb: updating node", pos, "stored nid",nid,"assigned",ndb_nodeids[nid],"resulting cid",ndb_nodes[hash])
+ local resid = (nid * 4) + (l2b(node.param2 or 0))
+ ndbset(pos.x, pos.y, pos.z, resid )
+ --atdebug("nodedb: updating node", pos, "stored nid",nid,"assigned",ndb_nodeids[nid],"resulting cid",resid)
+ advtrains.invalidate_all_paths(pos)
else
--at this position there is no longer a node that needs to be tracked.
+ --atdebug("nodedb: updating node", pos, "cleared")
ndbset(pos.x, pos.y, pos.z, nil)
end
end