diff options
author | orwell96 <orwell@bleipb.de> | 2019-01-24 17:50:26 +0100 |
---|---|---|
committer | orwell96 <orwell@bleipb.de> | 2019-01-24 17:50:26 +0100 |
commit | 9da148347d304ec2f26af6f813e26cb02bc6a6e7 (patch) | |
tree | 5cd8b9f486821bcaa984246153e957c157765912 /advtrains | |
parent | 2976bae4522a1682808db55473d9f824c7155cc6 (diff) | |
download | advtrains-9da148347d304ec2f26af6f813e26cb02bc6a6e7.tar.gz advtrains-9da148347d304ec2f26af6f813e26cb02bc6a6e7.tar.bz2 advtrains-9da148347d304ec2f26af6f813e26cb02bc6a6e7.zip |
Basic functions of "stop rail", missing ARS rules and signal.
For signal, need to think of a callback system for signals and moving atlatc queue to core?
Diffstat (limited to 'advtrains')
-rw-r--r-- | advtrains/helpers.lua | 1 | ||||
-rw-r--r-- | advtrains/init.lua | 14 |
2 files changed, 14 insertions, 1 deletions
diff --git a/advtrains/helpers.lua b/advtrains/helpers.lua index 511d32e..3514f55 100644 --- a/advtrains/helpers.lua +++ b/advtrains/helpers.lua @@ -381,6 +381,7 @@ end -- decodes a position encoded with encode_pos
function advtrains.decode_pos(pts)
+ if not pts or not #pts==6 then return nil end
local stry = string.sub(pts, 1,4)
local strx = string.sub(pts, 5,8)
local strz = string.sub(pts, 9,12)
diff --git a/advtrains/init.lua b/advtrains/init.lua index 21b414e..8173a22 100644 --- a/advtrains/init.lua +++ b/advtrains/init.lua @@ -196,7 +196,7 @@ dofile(advtrains.modpath.."/passive.lua") --load/save -- backup variables, used if someone should accidentally delete a sub-mod -local MDS_interlocking +local MDS_interlocking, MDS_lines advtrains.fpath=minetest.get_worldpath().."/advtrains" @@ -226,6 +226,11 @@ function advtrains.avt_load() else MDS_interlocking = tbl.interlocking end + if advtrains.lines then + advtrains.lines.load(tbl.lines) + else + MDS_lines = tbl.lines + end --remove wagon_save entries that are not part of a train local todel=advtrains.merge_tables(advtrains.wagon_save) for tid, train in pairs(advtrains.trains) do @@ -327,6 +332,12 @@ advtrains.avt_save = function(remove_players_from_wagons) else il_save = MDS_interlocking end + local ln_save + if advtrains.lines then + ln_save = advtrains.lines.save() + else + ln_save = MDS_lines + end local save_tbl={ trains = tmp_trains, wagon_save = advtrains.wagons, @@ -334,6 +345,7 @@ advtrains.avt_save = function(remove_players_from_wagons) atc = advtrains.atc.save_data(), ndb = advtrains.ndb.save_data(), interlocking = il_save, + lines = ln_save, version = 2, } local datastr = minetest.serialize(save_tbl) |