aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2017-10-11 12:45:37 +0200
committerorwell96 <orwell@bleipb.de>2017-10-11 12:45:37 +0200
commitbe771d9413f3ddddaa5dcb4cbad9055a580499cb (patch)
treeb31ff319923ddbdc2c5d6ffcf4fbb889c6f64aa8
parent6ade65b6d6814526d6c99c2123b2ccd702bb703b (diff)
downloadadvtrains-be771d9413f3ddddaa5dcb4cbad9055a580499cb.tar.gz
advtrains-be771d9413f3ddddaa5dcb4cbad9055a580499cb.tar.bz2
advtrains-be771d9413f3ddddaa5dcb4cbad9055a580499cb.zip
Prefer saved nodedb node before node loaded from map
Possibly fixes bug on linuxworks server.
-rw-r--r--advtrains/nodedb.lua10
1 files changed, 6 insertions, 4 deletions
diff --git a/advtrains/nodedb.lua b/advtrains/nodedb.lua
index 862fd53..947c92a 100644
--- a/advtrains/nodedb.lua
+++ b/advtrains/nodedb.lua
@@ -102,14 +102,16 @@ end
--function to get node. track database is not helpful here.
function ndb.get_node_or_nil(pos)
- local node=minetest.get_node_or_nil(pos)
+ -- FIX for bug found on linuxworks server:
+ -- a loaded node might get read before the LBM has updated its state, resulting in wrongly set signals and switches
+ -- -> Using the saved node prioritarily.
+ local node = ndb.get_node_raw(pos)
if node then
return node
else
- --maybe we have the node in the database...
- return ndb.get_node_raw(pos)
+ --try reading the node from the map
+ return minetest.get_node_or_nil(pos)
end
- atprint("ndb.get_node_or_nil",pos,"not found")
end
function ndb.get_node(pos)
local n=ndb.get_node_or_nil(pos)