Small stoprail fixes
This commit is contained in:
parent
fcb3dec0c0
commit
4112476bc9
|
@ -137,11 +137,19 @@ local adefunc = function(def, preset, suffix, rotation)
|
|||
on_train_approach = function(pos,train_id, train, index)
|
||||
if train.path_cn[index] == 1 then
|
||||
advtrains.interlocking.lzb_add_oncoming_npr(train, index, 2)
|
||||
local pe = advtrains.encode_pos(pos)
|
||||
local stdata = advtrains.lines.stops[pe]
|
||||
if stdata and stdata.stn then
|
||||
local stn = advtrains.lines.stations[stdata.stn]
|
||||
local stnname = stn and stn.name or "Unknown Station"
|
||||
train.text_inside = "Next Stop:\n"..stnname
|
||||
end
|
||||
end
|
||||
end,
|
||||
on_train_enter = function(pos, train_id)
|
||||
local train = advtrains.trains[train_id]
|
||||
|
||||
local index = atfloor(train.index)
|
||||
if train.path_cn[index] == 1 then
|
||||
local pe = advtrains.encode_pos(pos)
|
||||
local stdata = advtrains.lines.stops[pe]
|
||||
if not stdata then
|
||||
|
@ -155,7 +163,10 @@ local adefunc = function(def, preset, suffix, rotation)
|
|||
-- Send ATC command and set text
|
||||
advtrains.atc.train_set_command(train, "B0 W O"..stdata.doors..(stdata.reverse and "R" or "").." D"..stdata.wait.." OC D1 SM", true)
|
||||
train.text_inside = stnname
|
||||
|
||||
if tonumber(stdata.wait) then
|
||||
minetest.after(tonumber(stdata.wait), function() train.text_inside = "" end)
|
||||
end
|
||||
end
|
||||
end
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue