aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Pérez-Cerezo <gabriel@gpcf.eu>2019-07-16 17:26:53 +0200
committerGabriel Pérez-Cerezo <gabriel@gpcf.eu>2019-07-16 17:26:53 +0200
commitdaba00b6a2edd57b2674168f05194c4ff80280e1 (patch)
treee61d8586952abda2e5c7b156271964acff93ab7e
parent7a6740eb8c8e6902d1379273ba9dc7c4c2c14cdf (diff)
downloadadvtrains-daba00b6a2edd57b2674168f05194c4ff80280e1.tar.gz
advtrains-daba00b6a2edd57b2674168f05194c4ff80280e1.tar.bz2
advtrains-daba00b6a2edd57b2674168f05194c4ff80280e1.zip
Various small fixes
- Also do atomic operations on nodedb - no longer require Worldedit for at_sync_ndb - "overrun LZB 0 restriction" should now show where it happened.
-rw-r--r--advtrains/nodedb.lua6
-rw-r--r--advtrains_interlocking/approach.lua2
2 files changed, 5 insertions, 3 deletions
diff --git a/advtrains/nodedb.lua b/advtrains/nodedb.lua
index d38a9d8..b17841c 100644
--- a/advtrains/nodedb.lua
+++ b/advtrains/nodedb.lua
@@ -81,7 +81,8 @@ end
--save
function ndb.save_data()
- local file, err = io.open(path, "wb")
+ local tmppath = path.."~"
+ local file, err = io.open(tmppath, "wb")
if not file then
atwarn("Couldn't save the node database: ", err or "Unknown Error")
else
@@ -97,6 +98,7 @@ function ndb.save_data()
end
file:close()
end
+ os.rename(tmppath, path)
return {nodeids = ndb_nodeids}
end
@@ -288,7 +290,7 @@ minetest.register_chatcommand("at_sync_ndb",
{
params = "", -- Short parameter description
description = "Write node db back to map and find ghost nodes", -- Full description
- privs = {train_operator=true, worldedit=true}, -- Require the "privs" privilege to run
+ privs = {train_operator=true},
func = function(name, param)
return advtrains.pcall(function()
if not minetest.check_player_privs(name, {server=true}) and os.time() < ptime+30 then
diff --git a/advtrains_interlocking/approach.lua b/advtrains_interlocking/approach.lua
index 3fe72f6..8e90b5a 100644
--- a/advtrains_interlocking/approach.lua
+++ b/advtrains_interlocking/approach.lua
@@ -17,7 +17,7 @@ local il = advtrains.interlocking
local function get_over_function(speed, shunt)
return function(pos, id, train, index, speed, lzbdata)
if speed == 0 and minetest.settings:get_bool("at_il_force_lzb_halt") then
- atwarn(id,"overrun LZB 0 restriction (red signal) ",ent.pos)
+ atwarn(id,"overrun LZB 0 restriction (red signal) ",pos)
-- Set train 1 index backward. Hope this does not lead to bugs...
train.index = index - 0.5
train.velocity = 0