diff options
author | orwell96 <orwell@bleipb.de> | 2018-10-10 23:31:12 +0200 |
---|---|---|
committer | orwell96 <orwell@bleipb.de> | 2018-10-10 23:31:12 +0200 |
commit | 11fe530e18248b14c40edb6b56e9e3f47af3461c (patch) | |
tree | c403c8c9f2a87d7bde055da9804f2341c777b5f6 /advtrains | |
parent | 9db52bcd32b49d6b98644dcb7edcf14987850fa5 (diff) | |
download | advtrains-11fe530e18248b14c40edb6b56e9e3f47af3461c.tar.gz advtrains-11fe530e18248b14c40edb6b56e9e3f47af3461c.tar.bz2 advtrains-11fe530e18248b14c40edb6b56e9e3f47af3461c.zip |
Properly handle speed restrictions
Diffstat (limited to 'advtrains')
-rw-r--r-- | advtrains/init.lua | 2 | ||||
-rw-r--r-- | advtrains/trainhud.lua | 3 | ||||
-rw-r--r-- | advtrains/trainlogic.lua | 2 |
3 files changed, 5 insertions, 2 deletions
diff --git a/advtrains/init.lua b/advtrains/init.lua index c1f280d..fc7e423 100644 --- a/advtrains/init.lua +++ b/advtrains/init.lua @@ -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 diff --git a/advtrains/trainhud.lua b/advtrains/trainhud.lua index 9ea7466..d880ffc 100644 --- a/advtrains/trainhud.lua +++ b/advtrains/trainhud.lua @@ -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 diff --git a/advtrains/trainlogic.lua b/advtrains/trainlogic.lua index f94bda0..4ca212f 100644 --- a/advtrains/trainlogic.lua +++ b/advtrains/trainlogic.lua @@ -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. |