aboutsummaryrefslogtreecommitdiff
path: root/advtrains
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2019-12-11 12:25:08 +0100
committerorwell96 <orwell@bleipb.de>2021-02-10 16:35:45 +0100
commit816245588d62e3364b974be07989298887c45cfe (patch)
treeb4166f07a0396b43d6af7bd41d1295101117d947 /advtrains
parent74a219937dd031743c880510f10571adec0cf8a8 (diff)
downloadadvtrains-816245588d62e3364b974be07989298887c45cfe.tar.gz
advtrains-816245588d62e3364b974be07989298887c45cfe.tar.bz2
advtrains-816245588d62e3364b974be07989298887c45cfe.zip
Disable ARS train flag and surrounding uses
Diffstat (limited to 'advtrains')
-rw-r--r--advtrains/atc.lua5
-rw-r--r--advtrains/init.lua3
-rw-r--r--advtrains/wagons.lua28
3 files changed, 25 insertions, 11 deletions
diff --git a/advtrains/atc.lua b/advtrains/atc.lua
index 2fa3929..1c6df36 100644
--- a/advtrains/atc.lua
+++ b/advtrains/atc.lua
@@ -256,6 +256,11 @@ local matchptn={
end
return 1
end,
+ ["A([01])"]=function(id, train, match)
+ if not advtrains.interlocking then return 2 end
+ advtrains.interlocking.ars_set_disable(train, match=="0")
+ return 2
+ end,
}
eval_conditional = function(command, arrow, speed)
diff --git a/advtrains/init.lua b/advtrains/init.lua
index 6e622e5..f61701c 100644
--- a/advtrains/init.lua
+++ b/advtrains/init.lua
@@ -464,7 +464,8 @@ 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", "line", "routingcode",
- "il_sections", "speed_restriction", "is_shunt", "points_split", "autocouple"
+ "il_sections", "speed_restriction", "is_shunt",
+ "points_split", "autocouple", "ars_disable",
})
--then save it
tmp_trains[id]=v
diff --git a/advtrains/wagons.lua b/advtrains/wagons.lua
index 1c663fe..522b649 100644
--- a/advtrains/wagons.lua
+++ b/advtrains/wagons.lua
@@ -999,6 +999,9 @@ function wagon:show_bordcom(pname)
end
i=i+1
end
+ if train.ars_disable then
+ form = form .. "button[4.5,7;5,1;ilarsenable;Clear 'Disable ARS' flag]"
+ end
end
minetest.show_formspec(pname, "advtrains_bordcom_"..self.id, form)
@@ -1071,18 +1074,23 @@ function wagon:handle_bordcom_fields(pname, formname, fields)
-- 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.udata and oci.udata.signal_pos then
- local sigd = advtrains.interlocking.db.get_sigd_for_signal(oci.udata.signal_pos)
- if sigd then
- advtrains.interlocking.show_signalling_form(sigd, pname)
- return
+ if advtrains.interlocking then
+ if fields.ilrs 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.udata and oci.udata.signal_pos then
+ local sigd = advtrains.interlocking.db.get_sigd_for_signal(oci.udata.signal_pos)
+ if sigd then
+ advtrains.interlocking.show_signalling_form(sigd, pname)
+ return
+ end
end
+ i=i+1
end
- i=i+1
+ end
+ if fields.ilarsenable then
+ advtrains.interlocking.ars_set_disable(train, false)
end
end