diff options
author | orwell96 <orwell@bleipb.de> | 2018-10-10 23:17:31 +0200 |
---|---|---|
committer | orwell96 <orwell@bleipb.de> | 2018-10-10 23:17:31 +0200 |
commit | 9db52bcd32b49d6b98644dcb7edcf14987850fa5 (patch) | |
tree | 6ed4e2859c433cdd4e42b6f4163294b4b3bd2fdc /advtrains/wagons.lua | |
parent | 842a85606e4495dd631c2916d09a760d74a0ce13 (diff) | |
download | advtrains-9db52bcd32b49d6b98644dcb7edcf14987850fa5.tar.gz advtrains-9db52bcd32b49d6b98644dcb7edcf14987850fa5.tar.bz2 advtrains-9db52bcd32b49d6b98644dcb7edcf14987850fa5.zip |
Remote Routesetting from Onboard Computer
+ Fix lzb oncoming item deletion/speed restriction
Diffstat (limited to 'advtrains/wagons.lua')
-rw-r--r-- | advtrains/wagons.lua | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/advtrains/wagons.lua b/advtrains/wagons.lua index 9cf6cc4..c69b5e6 100644 --- a/advtrains/wagons.lua +++ b/advtrains/wagons.lua @@ -840,7 +840,23 @@ function wagon:show_bordcom(pname) else
form=form.."label[0.5,4.5;Train overview / coupling control is only shown when the train stands.]"
end
- form = form .. "button[0.5,8;3,1;Save;save]"
+ form = form .. "button[0.5,8;3,1;save;Save]"
+
+ -- Interlocking functionality: If the interlocking module is loaded, you can set the signal aspect
+ -- from inside the train
+ if advtrains.interlocking and train.lzb and #train.lzb.oncoming > 0 then
+ local i=1
+ while train.lzb.oncoming[i] do
+ local oci = train.lzb.oncoming[i]
+ if oci.pos then
+ if advtrains.interlocking.db.get_sigd_for_signal(oci.pos) then
+ form = form .. "button[4.5,8;5,1;ilrs;Remote Routesetting]"
+ break
+ end
+ end
+ i=i+1
+ end
+ end
minetest.show_formspec(pname, "advtrains_bordcom_"..self.id, form)
end
@@ -924,6 +940,23 @@ function wagon:handle_bordcom_fields(pname, formname, fields) train.couple_lck_back=false
end
+ -- Interlocking functionality: If the interlocking module is loaded, you can set the signal aspect
+ -- from inside the train
+ if fields.ilrs and advtrains.interlocking and train.lzb and #train.lzb.oncoming > 0 then
+ local i=1
+ while train.lzb.oncoming[i] do
+ local oci = train.lzb.oncoming[i]
+ if oci.pos then
+ local sigd = advtrains.interlocking.db.get_sigd_for_signal(oci.pos)
+ if sigd then
+ advtrains.interlocking.show_signalling_form(sigd, pname)
+ return
+ end
+ end
+ i=i+1
+ end
+ end
+
if not fields.quit then
self:show_bordcom(pname)
|