aboutsummaryrefslogtreecommitdiff
path: root/advtrains/nodedb.lua
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2017-12-18 23:20:29 +0100
committerorwell96 <orwell@bleipb.de>2017-12-18 23:20:29 +0100
commit09838252fe11672d89eb00d1da13b15a293ad230 (patch)
treef081504a9a6208541834759572ddf1a4a8b64b3c /advtrains/nodedb.lua
parent46c4447da089146c662f217bf3269d78d4c462c2 (diff)
downloadadvtrains-09838252fe11672d89eb00d1da13b15a293ad230.tar.gz
advtrains-09838252fe11672d89eb00d1da13b15a293ad230.tar.bz2
advtrains-09838252fe11672d89eb00d1da13b15a293ad230.zip
Do not spam the server chat with messages from /at_sync_ndb and trains going off_track
The off-track warning has moved into the info text of wagons
Diffstat (limited to 'advtrains/nodedb.lua')
-rw-r--r--advtrains/nodedb.lua17
1 files changed, 11 insertions, 6 deletions
diff --git a/advtrains/nodedb.lua b/advtrains/nodedb.lua
index 763edbc..a4fbf0a 100644
--- a/advtrains/nodedb.lua
+++ b/advtrains/nodedb.lua
@@ -233,8 +233,9 @@ minetest.register_lbm({
--used when restoring stuff after a crash
ndb.restore_all = function()
- atwarn("Updating the map from the nodedb, this may take a while")
+ --atlog("Updating the map from the nodedb, this may take a while")
local cnt=0
+ local dcnt=0
for y, ny in pairs(ndb_nodes) do
for x, nx in pairs(ny) do
for z, _ in pairs(nx) do
@@ -246,17 +247,21 @@ ndb.restore_all = function()
if ori_ndef and ori_ndef.groups.save_in_at_nodedb then --check if this node has been worldedited, and don't replace then
if (ndbnode.name~=node.name or ndbnode.param2~=node.param2) then
minetest.swap_node(pos, ndbnode)
- atwarn("Replaced",node.name,"@",pos,"with",ndbnode.name)
+ --atlog("Replaced",node.name,"@",pos,"with",ndbnode.name)
+ cnt=cnt+1
end
else
ndb.clear(pos)
- atwarn("Found ghost node (former",ndbnode and ndbnode.name,") @",pos,"deleting")
+ dcnt=dcnt+1
+ --atlog("Found ghost node (former",ndbnode and ndbnode.name,") @",pos,"deleting")
end
end
end
end
end
- atwarn("Updated",cnt,"nodes")
+ local text="Restore node database: Replaced",cnt,"nodes, removed",dcnt,"ghost nodes"
+ atlog(text)
+ return text
end
minetest.register_on_dignode(function(pos, oldnode, digger)
@@ -287,9 +292,9 @@ minetest.register_chatcommand("at_sync_ndb",
if not minetest.check_player_privs(name, {server=true}) and os.time() < ptime+30 then
return false, "Please wait at least 30s from the previous execution of /at_restore_ndb!"
end
- ndb.restore_all()
+ local text = ndb.restore_all()
ptime=os.time()
- return true
+ return true, text
end)
end,
privs = {train_operator=true}, -- Require the "privs" privilege to run