Properly handle speed restrictions

master
orwell96 2018-10-10 23:31:12 +02:00
parent 9db52bcd32
commit 11fe530e18
3 changed files with 5 additions and 2 deletions

View File

@ -274,7 +274,7 @@ advtrains.avt_save = function(remove_players_from_wagons)
"trainparts", "recently_collided_with_env",
"atc_brake_target", "atc_wait_finish", "atc_command", "atc_delay", "door_open",
"text_outside", "text_inside", "couple_lck_front", "couple_lck_back", "line",
"il_sections"
"il_sections", "speed_restriction",
})
--then save it
tmp_trains[id]=v

View File

@ -197,6 +197,9 @@ function advtrains.hud_train_format(train, flip)
topLine=" ["..mletter[fct].."] {"..levers.."} "..doorstr[(train.door_open or 0) * fct]
firstLine=attrans("Speed:").." |"..string.rep("+", vel)..string.rep("_", res-vel).."|"..string.rep("_", max-res).."> "..vel_kmh.." km/h"
if train.speed_restriction == 0 then
firstLine = "OVERRUN RED SIGNAL! Examine situation and reverse train to move again."
end
return (train.debug or "").."\n"..topLine.."\n"..firstLine.."\n"..secondLine
end

View File

@ -1029,7 +1029,7 @@ function advtrains.invert_train(train_id)
advtrains.update_trainpart_properties(train_id, true)
-- TODO: this should actually be SHUNT_MAX_SPEED, but signals and lzb is not present everywhere
advtrains.speed_restriction = nil
train.speed_restriction = nil
end
-- returns: train id, index of one of the trains that stand at this position.