diff options
author | orwell <orwell@bleipb.de> | 2025-06-23 23:06:44 +0200 |
---|---|---|
committer | orwell <orwell@bleipb.de> | 2025-06-23 23:09:15 +0200 |
commit | e04728f0424d4e42943fc187f295eb62a73bc5ce (patch) | |
tree | 99f6b82bc7bba4bbef5138e55b940d3a33bc4e2b | |
parent | 67511ec1f13023a402af69a4e5ce36c8503b344c (diff) | |
download | advtrains-e04728f0424d4e42943fc187f295eb62a73bc5ce.tar.gz advtrains-e04728f0424d4e42943fc187f295eb62a73bc5ce.tar.bz2 advtrains-e04728f0424d4e42943fc187f295eb62a73bc5ce.zip |
Get door closing time from wagon definition, no longer user configurable, and restore waitsig in stoprail atc command
-rw-r--r-- | advtrains/api_doc.txt | 3 | ||||
-rw-r--r-- | advtrains/trainlogic.lua | 2 | ||||
-rw-r--r-- | advtrains_line_automation/line_editor.lua | 6 | ||||
-rw-r--r-- | advtrains_line_automation/line_functions.lua | 13 | ||||
-rw-r--r-- | advtrains_line_automation/stoprail.lua | 10 |
5 files changed, 21 insertions, 13 deletions
diff --git a/advtrains/api_doc.txt b/advtrains/api_doc.txt index 6b338a7..faaac7c 100644 --- a/advtrains/api_doc.txt +++ b/advtrains/api_doc.txt @@ -72,6 +72,9 @@ advtrains.register_wagon(name, prototype, description, inventory_image) ^- optional. If defined, defines the locations of the doors on the model as distance from the object center on the path. ^- Getting on by walking in then takes effect. ^- Positive values mean front, negative ones back. Resulting position is automatically shifted to the right side. + door_operation_time = 2 + ^- Time in seconds specifying how long opening/closing the doors takes. The maximum of this value is used + ^- by the stop rail (and possibly ATC) to wait for closing the doors before departure. Default is 1 second. coupler_types_front = {scharfenberg=true}, coupler_types_back = {chain=true}, diff --git a/advtrains/trainlogic.lua b/advtrains/trainlogic.lua index c0ac179..559c029 100644 --- a/advtrains/trainlogic.lua +++ b/advtrains/trainlogic.lua @@ -1048,6 +1048,7 @@ function advtrains.update_trainpart_properties(train_id, invert_flipstate) --FIX: deep-copy the table!!! train.max_speed=20 train.extent_h = 0; + train.door_operation_time = 1 local rel_pos=0 local count_l=0 @@ -1088,6 +1089,7 @@ function advtrains.update_trainpart_properties(train_id, invert_flipstate) train.max_speed=math.min(train.max_speed, wagon.max_speed) train.extent_h = math.max(train.extent_h, wagon.extent_h or 1); + train.door_operation_time = math.max(train.door_operation_time, wagon.door_operation_time or 2) end end train.trainlen = rel_pos diff --git a/advtrains_line_automation/line_editor.lua b/advtrains_line_automation/line_editor.lua index 30e52fb..fcba9dd 100644 --- a/advtrains_line_automation/line_editor.lua +++ b/advtrains_line_automation/line_editor.lua @@ -220,9 +220,9 @@ local function get_formspec(custom_state) "na žádné další vlaky\\, stávající vlaky však mohou dojet do svých koncových zastávek.]") table.insert(formspec, "container[0,8.75]".. - "label[0.5,0.25;"..S("Departure").."]".. - "label[2,0.25;"..S("Stop").."]".. - "label[3.5,0.25;"..S("Code Dop.").."]".. + "label[0.5,0.25;"..S("Dep.").."]".. + "label[2,0.25;"..S("St.Time").."]".. + "label[3.5,0.25;"..S("Station Code").."]".. "label[6.25,0.25;"..S("Mode").."]".. "label[11,0.25;"..S("Track").."]".. "label[12.5,0.25;"..S("Position").."]".. diff --git a/advtrains_line_automation/line_functions.lua b/advtrains_line_automation/line_functions.lua index be2b29a..de5d133 100644 --- a/advtrains_line_automation/line_functions.lua +++ b/advtrains_line_automation/line_functions.lua @@ -769,9 +769,16 @@ function al.on_train_enter(pos, train_id, train, index) end -- ATC příkaz - local atc_command = "B0 W O"..stdata.doors..(stdata.kick and "K" or "").." D"..wait.. - (stdata.keepopen and " " or " OC ")..(stdata.reverse and "R" or "").." D"..(stdata.ddelay or 1).. - " A1 S" ..(stdata.speed or "M") + local trn_door_delay = math.ceil(train.door_operation_time or 1) -- must round to whole number + local atc_command = "B0 W O"..stdata.doors -- stop and open doors + ..(stdata.kick and "K" or "") -- potentially kick passengers out + ..(stdata.reverse and "R" or "") -- reverse if requested + .." D"..wait.." " -- wait for the requested time (TODO: replace this by a RWT scheduler at some point!) + .." A1 "..(stdata.waitsig and "G " or " ") -- enable ARS again and potentially wait for signal + ..(stdata.keepopen and "" or "OC") -- close doors, unless keepopen was set + .." D"..trn_door_delay -- wait for the door delay + .." S"..(stdata.speed or "M") -- depart with specified speed + advtrains.atc.train_set_command(train, atc_command, true) -- provést změny vlaku diff --git a/advtrains_line_automation/stoprail.lua b/advtrains_line_automation/stoprail.lua index f80e1f3..e7bc379 100644 --- a/advtrains_line_automation/stoprail.lua +++ b/advtrains_line_automation/stoprail.lua @@ -64,7 +64,7 @@ local function show_stoprailform(pos, player) local stdata = advtrains.lines.stops[pe] if not stdata then advtrains.lines.stops[pe] = { - stn="", track="", doors="R", wait=10, ars={default=true}, ddelay=1,speed="M" + stn="", track="", doors="R", wait=10, ars={default=true}, speed="M" } stdata = advtrains.lines.stops[pe] end @@ -100,8 +100,6 @@ local function show_stoprailform(pos, player) "checkbox[4.5,4.75;waitsig;"..S("Wait for signal to clear")..";"..(stdata.waitsig and "true" or "false").."]".. "label[0.25,4.3;"..S("Stop Time").."]".. "field[0.25,4.5;1,0.75;wait;;"..stdata.wait.."]".. - "label[1.5,4.9;+]".. - "field[2,4.5;1,0.75;ddelay;;"..minetest.formspec_escape(stdata.ddelay).."]".. -- "..attrans("Door Delay").." (advtrains.lines.open_station_editor ~= nil and "button[5.75,11;2.0,0.75;editstn;"..S("Station Editor").."]" or "").. "field[0.25,6;2,0.75;speed;"..S("Dep. Speed")..";"..minetest.formspec_escape(stdata.speed).."]".. "field[2.5,6;2,0.75;line;"..S("Dep. Line")..";"..minetest.formspec_escape(stdata.line or "").."]".. @@ -120,7 +118,6 @@ local function show_stoprailform(pos, player) "tooltip[stn;Dopravna\\, ke které tato zastávka patří. Jedna dopravna může mít víc kolejí. K vytvoření a úpravám dopraven použijte Editor dopraven.]".. "tooltip[track;Číslo koleje]".. "tooltip[wait;Základní doba stání s otevřenými dveřmi]".. - "tooltip[ddelay;Dodatečná doba stání před odjezdem po uzavření dveří]".. "tooltip[speed;Cílová rychlost zastavivšího vlaku na odjezdu. Platné hodnoty jsou M pro nejvyšší rychlost vlaku a čísla 0 až 20.]".. "tooltip[line;Nová linka na odjezdu. Prázdné pole = zachovat stávající linku. Pro smazání linky zadejte znak -]".. "tooltip[routingcode;Nový směrový kód na odjezdu. Prázdné pole = zachovat stávající směrový kód. Pro smazání kódu vlaku zadejte znak -]".. @@ -226,9 +223,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) stdata.ars = advtrains.interlocking.text_to_ars(fields.ars) end - if fields.ddelay then - stdata.ddelay = to_int(fields.ddelay) or 1 - end + stdata.ddelay = nil -- delete legacy field + if fields.speed then stdata.speed = to_int(fields.speed) or "M" end |