aboutsummaryrefslogtreecommitdiff
path: root/advtrains_interlocking
diff options
context:
space:
mode:
authorSingularis <singularis@volny.cz>2025-04-21 12:31:34 +0200
committerorwell <orwell@bleipb.de>2025-05-27 20:22:02 +0200
commit4f5ec9170e8b7890d2a6e70cab3a39067c84b3e2 (patch)
tree76f54650c8e21bc736be537c9cd0190a2167d46b /advtrains_interlocking
parent95a5586e0fe196e2291acaf128b8d1b4f8a32510 (diff)
downloadadvtrains-4f5ec9170e8b7890d2a6e70cab3a39067c84b3e2.tar.gz
advtrains-4f5ec9170e8b7890d2a6e70cab3a39067c84b3e2.tar.bz2
advtrains-4f5ec9170e8b7890d2a6e70cab3a39067c84b3e2.zip
[advtrains,*] přechod na Advtrains 2.5.0 (2. fáze)
Diffstat (limited to 'advtrains_interlocking')
-rw-r--r--advtrains_interlocking/database.lua4
-rw-r--r--advtrains_interlocking/route_prog.lua12
-rw-r--r--advtrains_interlocking/route_ui.lua48
-rw-r--r--advtrains_interlocking/routesetting.lua4
-rw-r--r--advtrains_interlocking/signal_aspect_ui.lua38
-rw-r--r--advtrains_interlocking/tcb_ts_ui.lua112
-rw-r--r--advtrains_interlocking/tool.lua21
7 files changed, 126 insertions, 113 deletions
diff --git a/advtrains_interlocking/database.lua b/advtrains_interlocking/database.lua
index 844d350..9bcd441 100644
--- a/advtrains_interlocking/database.lua
+++ b/advtrains_interlocking/database.lua
@@ -760,7 +760,7 @@ function ildb.update_rs_cache(ts_id)
--atdebug("== Running update_rs_cache for ",ts_id)
-- start on every of the TS's TCBs, walk the track forward and store locks along the way
for start_tcbi, start_tcbs in ipairs(ts.tc_breaks) do
- start_pkey = advtrains.encode_pos(start_tcbs.p)
+ local start_pkey = advtrains.encode_pos(start_tcbs.p)
rscache[start_pkey] = {}
--atdebug("Starting for ",start_tcbi, start_tcbs)
local locks_found = {}
@@ -770,7 +770,7 @@ function ildb.update_rs_cache(ts_id)
-- now result_table contains found route locks. Match them with the other TCBs we have in this section
for end_tcbi, end_tcbs in ipairs(ts.tc_breaks) do
if end_tcbi ~= start_tcbi then
- end_pkey = advtrains.encode_pos(end_tcbs.p)
+ local end_pkey = advtrains.encode_pos(end_tcbs.p)
if result_table[end_pkey] then
--atdebug("Set RSCache entry",end_pkey.."-"..end_pkey,"=",result_table[end_pkey])
local lockstab = result_table[end_pkey]
diff --git a/advtrains_interlocking/route_prog.lua b/advtrains_interlocking/route_prog.lua
index e0634d4..76dad28 100644
--- a/advtrains_interlocking/route_prog.lua
+++ b/advtrains_interlocking/route_prog.lua
@@ -176,7 +176,7 @@ function advtrains.interlocking.visualize_route(origin, route, context, tmp_lcks
end
-- display locks
for pts, state in pairs(v.locks) do
- local pos = minetest.string_to_pos(pts)
+ local pos = assert(advtrains.decode_pos(pts))
routesprite(context, pos, "fix"..k..pts, "at_il_route_lock.png", "Zajištěna ve stavu '"..state.."' po cestě "..route.name.." dokud není úsek #"..k.." uvolněn.")
end
end
@@ -215,7 +215,7 @@ local player_rte_prog = {}
function advtrains.interlocking.init_route_prog(pname, sigd, default_route)
if not minetest.check_player_privs(pname, "interlocking") then
- minetest.chat_send_player(pname, "Insufficient privileges to use this!")
+ minetest.chat_send_player(pname, attrans("Insufficient privileges to use this!"))
return
end
local rp = {
@@ -239,7 +239,7 @@ function advtrains.interlocking.init_route_prog(pname, sigd, default_route)
end
player_rte_prog[pname] = rp
advtrains.interlocking.visualize_route(sigd, rp.route, "prog_"..pname, rp.tmp_lcks, pname)
- minetest.chat_send_player(pname, "Route programming mode active. Punch TCBs to add route segments, punch turnouts to lock them.")
+ minetest.chat_send_player(pname, "Režim programování cesty je aktivní. Klikejte levým tlačítkem na TCB pro přidání úseků a na výhybky pro jejich uzamčení.")
end
local function get_last_route_item(origin, route)
@@ -252,7 +252,7 @@ end
local function do_advance_route(pname, rp, sigd, tsref)
table.insert(rp.route, {next = sigd, locks = rp.tmp_lcks})
rp.tmp_lcks = {}
- chat(pname, "Úsek '"..(tsref and (tsref.name or "") or "--EOI--").."' přidán na cestu.")
+ chat(pname, "Úsek '"..(tsref and (tsref.name or "") or "--konec zab.--").."' přidán na cestu.")
end
local function finishrpform(pname)
@@ -419,7 +419,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
local tcbpts = string.match(formname, "^at_il_rprog_([^_]+)$")
local tcbpos
if tcbpts then
- tcbpos = minetest.string_to_pos(tcbpts)
+ tcbpos = assert(minetest.string_to_pos(tcbpts))
end
if tcbpos then
-- RPROG form
@@ -531,7 +531,7 @@ minetest.register_on_punchnode(function(pos, node, player, pointed_thing)
chat(pname, "Tato TCB není nastavena, nejprve k ní musíte přiřadit kolej")
return
end
- local tcbpos = minetest.string_to_pos(tcbpts)
+ local tcbpos = assert(minetest.string_to_pos(tcbpts))
-- show formspec
diff --git a/advtrains_interlocking/route_ui.lua b/advtrains_interlocking/route_ui.lua
index 3fb5bc6..baaa957 100644
--- a/advtrains_interlocking/route_ui.lua
+++ b/advtrains_interlocking/route_ui.lua
@@ -26,7 +26,7 @@ function atil.show_route_edit_form(pname, sigd, routeid, sel_rpartidx)
local route = tcbs.routes[routeid]
if not route then return end
- local form = "size[9,10]label[0.5,0.2;Přehled cesty]"
+ local form = "size[9,11]label[0.5,0.2;Přehled cesty]"
form = form.."field[0.8,1.2;6.5,1;name;Název cesty;"..minetest.formspec_escape(route.name).."]"
form = form.."button[7.0,0.9;1.5,1;setname;Nastavit]"
@@ -37,7 +37,7 @@ function atil.show_route_edit_form(pname, sigd, routeid, sel_rpartidx)
tab[#tab+1] = minetest.formspec_escape(string.gsub(t, ",", " "))
tabref[#tab] = { [rty] = true, param = rpara, seg = rseg, idx = #tab }
end
- itab(1, "("..(tcbs.signal_name or "+")..") Route #"..routeid, "signal", sigd)
+ itab(1, "("..(tcbs.signal_name or "+")..") Cesta #"..routeid, "signal", sigd)
-- this code is partially copy-pasted from routesetting.lua
-- we start at the tc designated by signal
@@ -62,15 +62,15 @@ function atil.show_route_edit_form(pname, sigd, routeid, sel_rpartidx)
local signame = "-"
if c_tcbs and c_tcbs.signal then signame = c_tcbs.signal_name or "o" end
itab(i, ""..i.." "..sigd_to_string(c_sigd).." ("..signame..")", "signal", c_sigd)
- itab(i, "= "..(c_ts and c_ts.name or c_ts_id).." ="..(c_rseg.call_on and " [CO]" or ""), "section", c_ts_id)
+ itab(i, "= "..(c_ts and c_ts.name or c_ts_id).." ="..(c_rseg.call_on and " [pov.]" or ""), "section", c_ts_id)
if c_rseg.locks then
for pts, state in pairs(c_rseg.locks) do
local pos = advtrains.decode_pos(pts)
- itab(i, "Zámek "..pts.." -> "..state, "lock", pos)
+ itab(i, "Zámek "..core.pos_to_string(pos).." -> "..state, "lock", pos)
if not advtrains.is_passive(pos) then
- itab("-!- Na "..pts.." není žádná pasivní komponenta. Prosím, přenastavte cestu!")
+ itab("-!- Na "..core.pos_to_string(pos).." není žádná pasivní komponenta. Prosím, přenastavte cestu!")
break
end
end
@@ -80,7 +80,7 @@ function atil.show_route_edit_form(pname, sigd, routeid, sel_rpartidx)
if nvar then
local re_tcbs = ildb.get_tcbs({p = nvar.p, s = (nvar.s==1) and 2 or 1})
if not re_tcbs or not re_tcbs.ts_id or re_tcbs.ts_id~=c_ts_id then
- itab(i, "-!- At "..sigd_to_string(c_sigd)..".Section Start and End do not match!", "err", nil)
+ itab(i, "-!- Na "..sigd_to_string(c_sigd)..".neodpovídají začátek a konec úseku!", "err", nil)
break
end
end
@@ -92,13 +92,13 @@ function atil.show_route_edit_form(pname, sigd, routeid, sel_rpartidx)
local e_tcbs = ildb.get_tcbs(c_sigd)
local signame = "-"
if e_tcbs and e_tcbs.signal then signame = e_tcbs.signal_name or "o" end
- itab(i, "E "..sigd_to_string(c_sigd).." ("..signame..")", "end", c_sigd)
+ itab(i, "K "..sigd_to_string(c_sigd).." ("..signame..")", "end", c_sigd)
else
- itab(i, "E (none)", "end", nil)
+ itab(i, "K (žádný)", "end", nil)
end
if not sel_rpartidx then sel_rpartidx = 1 end
- form = form.."textlist[0.5,2;3.5,3.9;routelog;"..table.concat(tab, ",")..";"..(sel_rpartidx or 1)..";false]"
+ form = form.."textlist[0.5,2;4.5,3.9;routelog;"..table.concat(tab, ",")..";"..(sel_rpartidx or 1)..";false]"
-- to the right of rtelog, controls are displayed for the thing in focus
-- What is in focus is determined by the parameter sel_rpartidx
@@ -113,10 +113,10 @@ function atil.show_route_edit_form(pname, sigd, routeid, sel_rpartidx)
-- main aspect list
local signalpos = s_tcbs and s_tcbs.signal
if signalpos and rseg then
- form = form..F.label(4.5, 2, "Signal Aspect:")
+ form = form..F.label(5.5, 2, "Signál:")
local ndef = signalpos and advtrains.ndb.get_ndef(signalpos)
if ndef and ndef.advtrains and ndef.advtrains.main_aspects then
- local entries = { "<Default Aspect>" }
+ local entries = { "<výchozí>" }
local sel = 1
for i, mae in ipairs(ndef.advtrains.main_aspects) do
entries[i+1] = mae.description
@@ -124,7 +124,7 @@ function atil.show_route_edit_form(pname, sigd, routeid, sel_rpartidx)
sel = i+1
end
end
- form = form..F.dropdown(4.5, 3.0, 4, "sa_main_aspect", entries, sel, true)
+ form = form..F.dropdown(5.5, 3.0, 4, "sa_main_aspect", entries, sel, true)
end
-- checkbox for assign distant signal
local assign_dst = rseg.assign_dst
@@ -133,21 +133,21 @@ function atil.show_route_edit_form(pname, sigd, routeid, sel_rpartidx)
-- defaults to false for the very first signal and true for all others (= minimal user configuration overhead)
-- Note: on save, the value will be fixed at either false or true
end
- form = form..string.format("checkbox[4.5,4.0;sa_distant;Announce distant signal;%s]", assign_dst)
+ form = form..string.format("checkbox[5.5,4.0;sa_distant;Ohlásit předzvěst;%s]", assign_dst)
else
- form = form..F.label(4.5, 2, "No Signal at this TCB")
+ form = form..F.label(5.5, 2, "Tato TCB nemá žádné návěstidlo")
end
elseif sel_rpart and sel_rpart.section then
local rseg = route[sel_rpart.seg]
if rseg then
- form = form..F.label(4.5, 2, "Section Options:")
+ form = form..F.label(5.5, 2, "Volby:")
-- checkbox for call-on
- form = form..string.format("checkbox[4.5,4.0;se_callon;Call-on (section may be occupied);%s]", rseg.call_on)
+ form = form..string.format("checkbox[5.5,4.0;se_callon;Povolit (úsek může být obsazen);%s]", rseg.call_on)
end
elseif sel_rpart and sel_rpart.err then
- form = form.."textarea[4.5,2.5;4,4;errorta;Error:;"..tab[sel_rpartidx].."]"
+ form = form.."textarea[5.5,2.5;4,4;errorta;Chyba:;"..tab[sel_rpartidx].."]"
else
- form = form..F.label(4.5, 2, "<< Select a route part to edit options")
+ form = form..F.label(5.5, 2, "<< Vyberte část cesty pro nastavení voleb")
end
form = form.."button[0.5,6;1,1;prev;<<<]"
@@ -158,15 +158,15 @@ function atil.show_route_edit_form(pname, sigd, routeid, sel_rpartidx)
--if route.smartroute_generated or route.default_autoworking then
-- form = form.."button[3.5,6;2,1;noautogen;Clr Autogen]"
--end
- form = form.."button[5.5,6;3,1;delete;Delete Route]"
- form = form.."button[0.5,7;3,1;back;Back to signal]"
- form = form.."button[3.5,7;2,1;clone;Clone Route]"
- form = form.."button[5.5,7;3,1;newfrom;New From Route]"
+ form = form.."button[5.5,6;3,1;delete;Smazat cestu]"
+ form = form.."button[0.5,7;3,1;back;Zpět na návěstidlo]"
+ form = form.."button[3.5,7;2,1;clone;Klonovat cestu]"
+ form = form.."button[5.5,7;3,1;newfrom;Nová z cesty]"
--atdebug(route.ars)
form = form.."style[ars;font=mono]"
- form = form.."textarea[0.8,8.3;5,3;ars;ARS Rule List;"..atil.ars_to_text(route.ars).."]"
- form = form.."button[5.5,8.23;3,1;savears;Save ARS List]"
+ form = form.."textarea[0.8,8.3;5,3;ars;ARS pravidla;"..atil.ars_to_text(route.ars).."]"
+ form = form.."button[5.5,8.23;3,1;savears;Uložit ARS pravidla]"
local formname = "at_il_routeedit_"..minetest.pos_to_string(sigd.p).."_"..sigd.s.."_"..routeid
minetest.show_formspec(pname, formname, form)
diff --git a/advtrains_interlocking/routesetting.lua b/advtrains_interlocking/routesetting.lua
index 6544a92..1065cad 100644
--- a/advtrains_interlocking/routesetting.lua
+++ b/advtrains_interlocking/routesetting.lua
@@ -86,8 +86,8 @@ function ilrs.set_route(signal, route, try)
local c_locks = {}
if route.use_rscache and c_ts.rs_cache and c_rseg.next then
-- rscache needs to be enabled, present and next must be defined
- start_pkey = advtrains.encode_pos(c_sigd.p)
- end_pkey = advtrains.encode_pos(c_rseg.next.p)
+ local start_pkey = advtrains.encode_pos(c_sigd.p)
+ local end_pkey = advtrains.encode_pos(c_rseg.next.p)
if c_ts.rs_cache[start_pkey] and c_ts.rs_cache[start_pkey][end_pkey] then
for lp,lst in pairs(c_ts.rs_cache[start_pkey][end_pkey]) do
--atdebug("Add lock from RSCache:",lp,"->",lst)
diff --git a/advtrains_interlocking/signal_aspect_ui.lua b/advtrains_interlocking/signal_aspect_ui.lua
index 98a332a..818f6d6 100644
--- a/advtrains_interlocking/signal_aspect_ui.lua
+++ b/advtrains_interlocking/signal_aspect_ui.lua
@@ -38,14 +38,14 @@ function advtrains.interlocking.make_ip_formspec_component(pos, x, y, w)
local ipos = minetest.string_to_pos(pts)
ipmarker(ipos, connid)
return table.concat {
- F.S_label(x, y, "Influence point is set at @1.", string.format("%s/%s", pts, connid)),
- F.S_button_exit(x, y+0.5, w/2-0.125, "ip_set", "Modify"),
- F.S_button_exit(x+w/2+0.125, y+0.5, w/2-0.125, "ip_clear", "Clear"),
+ F.S_label(x, y, "Bod účinku nastaven na @1.", string.format("%s/%s", pts, connid)),
+ F.S_button_exit(x, y+0.5, w/2-0.125, "ip_set", "Změnit"),
+ F.S_button_exit(x+w/2+0.125, y+0.5, w/2-0.125, "ip_clear", "Odebrat bod účinku"),
}
else
return table.concat {
- F.S_label(x, y, "Influence point is not set."),
- F.S_button_exit(x, y+0.5, w, "ip_set", "Set influence point"),
+ F.S_label(x, y, "Bod účinku není nastaven."),
+ F.S_button_exit(x, y+0.5, w, "ip_set", "Nastavit bod účinku"),
}
end
end
@@ -83,10 +83,10 @@ function advtrains.interlocking.show_ip_sa_form(pos, pname)
-- Create Signal aspect formspec elements
local ndef = advtrains.ndb.get_ndef(pos)
if ndef and ndef.advtrains then
- form[#form+1] = F.label(0.5, 2, "Signal Aspect:")
+ form[#form+1] = F.label(0.5, 2, "signál:")
-- main aspect list
if ndef.advtrains.main_aspects then
- local entries = { "<none>" }
+ local entries = { "<žádný>" }
local sel = 1
for i, mae in ipairs(ndef.advtrains.main_aspects) do
entries[i+1] = mae.description
@@ -98,9 +98,9 @@ function advtrains.interlocking.show_ip_sa_form(pos, pname)
end
-- distant signal assign (is shown either when main_aspect is not none, or when pure distant signal)
if rpos then
- form[#form+1] = F.button_exit(0.5, 3.5, 4, "sa_undistant", "Dst: " .. minetest.pos_to_string(rpos))
+ form[#form+1] = F.button_exit(0.5, 3.5, 4, "sa_undistant", "odpojit od: " .. minetest.pos_to_string(rpos))
elseif (ma and not ma.halt) or not ndef.advtrains.main_aspects then
- form[#form+1] = F.button_exit(0.5, 3.5, 4, "sa_distant", "<assign distant>")
+ form[#form+1] = F.button_exit(0.5, 3.5, 4, "sa_distant", "<přiřadit předzvěst>")
end
end
@@ -165,12 +165,12 @@ end)
-- inits the signal IP assignment process
function advtrains.interlocking.init_ip_assign(pos, pname)
if not minetest.check_player_privs(pname, "interlocking") then
- minetest.chat_send_player(pname, "Insufficient privileges to use this!")
+ minetest.chat_send_player(pname, attrans("Insufficient privileges to use this!"))
return
end
--remove old IP
--advtrains.interlocking.db.clear_ip_by_signalpos(pos)
- minetest.chat_send_player(pname, "Configuring Signal: Please look in train's driving direction and punch rail to set influence point.")
+ minetest.chat_send_player(pname, attrans("Configuring Signal: Please look in train's driving direction and punch rail to set influence point."))
players_assign_ip[pname] = pos
end
@@ -178,10 +178,10 @@ end
-- inits the distant signal assignment process
function advtrains.interlocking.init_distant_assign(pos, pname)
if not minetest.check_player_privs(pname, "interlocking") then
- minetest.chat_send_player(pname, "Insufficient privileges to use this!")
+ minetest.chat_send_player(pname, attrans("Insufficient privileges to use this!"))
return
end
- minetest.chat_send_player(pname, "Set distant signal: Punch the main signal to assign!")
+ minetest.chat_send_player(pname, attrans("Set distant signal: Punch the main signal to assign!"))
players_assign_distant[pname] = pos
end
@@ -203,7 +203,7 @@ local function try_auto_assign_to_tcb(signalpos, pos, connid, pname)
advtrains.interlocking.db.assign_signal_to_tcbs(signalpos, sigd)
-- use auto-naming
advtrains.interlocking.add_autoname_to_tcbs(tcb[aconnid], pname)
- minetest.chat_send_player(pname, "Assigned signal to the TCB at "..core.pos_to_string(apos))
+ minetest.chat_send_player(pname, attrans("Assigned signal to the TCB at @1", core.pos_to_string(apos)))
advtrains.interlocking.show_tcb_marker(apos)
advtrains.interlocking.show_signalling_form(sigd, pname)
end
@@ -215,7 +215,7 @@ local function try_auto_assign_to_tcb(signalpos, pos, connid, pname)
local mainsig = advtrains.interlocking.db.get_ip_signal(pts, aconnid)
if mainsig and advtrains.interlocking.signal.get_signal_cap_level(mainsig) >= 3 then
advtrains.interlocking.signal.set_aspect(signalpos, "_default", mainsig)
- minetest.chat_send_player(pname, "Assigned distant signal to the main signal at "..core.pos_to_string(mainsig))
+ minetest.chat_send_player(pname, attrans("Assigned distant signal to the main signal at @1", core.pos_to_string(mainsig)))
return
end
end
@@ -245,19 +245,19 @@ minetest.register_on_punchnode(function(pos, node, player, pointed_thing)
if not advtrains.interlocking.db.get_ip_signal_asp(pts, plconnid) then
advtrains.interlocking.db.set_ip_signal(pts, plconnid, signalpos)
ipmarker(pos, plconnid)
- minetest.chat_send_player(pname, "Configuring Signal: Successfully set influence point")
+ minetest.chat_send_player(pname, attrans("Configuring Signal: Successfully set influence point"))
-- Try to find a TCB ahead and auto assign this signal there
if advtrains.interlocking.signal.get_signal_cap_level(signalpos) >= 2 then
try_auto_assign_to_tcb(signalpos, pos, plconnid, pname)
end
else
- minetest.chat_send_player(pname, "Configuring Signal: Influence point of another signal is already present!")
+ minetest.chat_send_player(pname, attrans("Configuring Signal: Influence point of another signal is already present!"))
end
else
- minetest.chat_send_player(pname, "Configuring Signal: This is not a normal two-connection rail! Aborted.")
+ minetest.chat_send_player(pname, attrans("Configuring Signal: This is not a normal two-connection rail! Aborted."))
end
else
- minetest.chat_send_player(pname, "Configuring Signal: Node is too far away. Aborted.")
+ minetest.chat_send_player(pname, attrans("Configuring Signal: Node is too far away. Aborted."))
end
players_assign_ip[pname] = nil
end
diff --git a/advtrains_interlocking/tcb_ts_ui.lua b/advtrains_interlocking/tcb_ts_ui.lua
index 9a44b4d..167b791 100644
--- a/advtrains_interlocking/tcb_ts_ui.lua
+++ b/advtrains_interlocking/tcb_ts_ui.lua
@@ -247,12 +247,12 @@ function advtrains.interlocking.self_tcb_make_after_place_callback(fail_silently
local pname = player:get_player_name()
if not minetest.check_player_privs(pname, "interlocking") then
if not fail_silently_on_noprivs then
- minetest.chat_send_player(pname, "Insufficient privileges to use this!")
+ minetest.chat_send_player(pname, attrans("Insufficient privileges to use this!"))
end
return
end
if ildb.get_tcb(pos) then
- minetest.chat_send_player(pname, "TCB already existed at this position, now linked to this node")
+ minetest.chat_send_player(pname, attrans("TCB already existed at this position, now linked to this node"))
else
ildb.create_tcb_at(pos, pname)
end
@@ -261,7 +261,7 @@ function advtrains.interlocking.self_tcb_make_after_place_callback(fail_silently
local tcbs = ildb.get_tcbs(sigd)
-- make sure signal doesn't already exist
if tcbs.signal then
- minetest.chat_send_player(pname, "Signal on B side already assigned!")
+ minetest.chat_send_player(pname, attrans("Signal on B side already assigned!"))
return
end
ildb.assign_signal_to_tcbs(pos, sigd)
@@ -281,7 +281,7 @@ function advtrains.interlocking.self_tcb_make_can_dig_callback(is_signal)
local pname = player and player:get_player_name() or ""
-- need to duplicate logic of the regular "can_dig_or_modify_track()" function in core/tracks.lua
if advtrains.get_train_at_pos(pos) then
- minetest.chat_send_player(pname, "Can't remove track, a train is here!")
+ minetest.chat_send_player(pname, attrans("Can't remove track, a train is here!"))
return false
end
-- end of standard checks
@@ -376,8 +376,12 @@ local sidecolorB = minetest.get_color_escape_sequence("#068b00")
local function mktcbformspec(pos, side, tcbs, offset, pname)
local form = ""
- local btnpref = side==1 and "A" or "B"
- local ts
+ local btncolor, btnpref, ts
+ if side == 1 then
+ btncolor, btnpref = sidecolorA, "A"
+ else
+ btncolor, btnpref = sidecolorB, "B"
+ end
-- ensure that mapping and xlink are up to date
ildb.tcbs_ensure_ts_ref_exists({p=pos, s=side, tcbs=tcbs})
ildb.validate_tcb_xlink({p=pos, s=side, tcbs=tcbs})
@@ -386,12 +390,12 @@ local function mktcbformspec(pos, side, tcbs, offset, pname)
ts = ildb.get_ts(tcbs.ts_id)
end
if ts then
- form = form.."label[0.5,"..offset..";Side "..btnpref..": "..minetest.formspec_escape(ts.name or tcbs.ts_id).."]"
- form = form.."button[0.5,"..(offset+0.5)..";5,1;"..btnpref.."_gotots;Show track section]"
+ form = form.."label[0.5,"..offset..";"..btncolor..attrans("Side "..btnpref)..": "..minetest.formspec_escape(ts.name or tcbs.ts_id).."]"
+ form = form.."button[0.5,"..(offset+0.5)..";5,1;"..btnpref.."_gotots;"..attrans("Show track section").."]"
else
tcbs.ts_id = nil
- form = form.."label[0.5,"..offset..";Side "..btnpref..": ".."End of interlocking]"
- form = form.."button[0.5,"..(offset+0.5)..";5,1;"..btnpref.."_makeil;Create Interlocked Track Section]"
+ form = form.."label[0.5,"..offset..";"..btncolor..attrans("Side "..btnpref)..": "..attrans("End of interlocking").."]"
+ form = form.."button[0.5,"..(offset+0.5)..";5,1;"..btnpref.."_makeil;"..attrans("Create Interlocked Track Section").."]"
end
-- xlink
if tcbs.xlink then
@@ -399,10 +403,10 @@ local function mktcbformspec(pos, side, tcbs, offset, pname)
form = form.."button[4.5,"..(offset+1.5)..";1,1;"..btnpref.."_xlinkdel;X]"
else
if players_assign_xlink[pname] then
- form = form.."button[0.5,"..(offset+1.5)..";4,1;"..btnpref.."_xlinklink;Link "..ildb.sigd_to_string(players_assign_xlink[pname]).."]"
+ form = form.."button[0.5,"..(offset+1.5)..";4,1;"..btnpref.."_xlinklink;"..attrans("Link @1", ildb.sigd_to_string(players_assign_xlink[pname])).."]"
form = form.."button[4.5,"..(offset+1.5)..";1,1;"..btnpref.."_xlinkabrt;X]"
else
- form = form.."label[0.5,"..(offset+1.5)..";No Link]"
+ form = form.."label[0.5,"..(offset+1.5)..";"..attrans("No Link").."]"
form = form.."button[4.5,"..(offset+1.5)..";1,1;"..btnpref.."_xlinkadd;+]"
end
end
@@ -490,7 +494,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
else
if f_xlinkadd[connid] then
players_assign_xlink[pname] = {p=pos, s=connid}
- minetest.chat_send_player(pname, "TCB Link: Select linked TCB now!")
+ minetest.chat_send_player(pname, attrans("TCB Link: Select linked TCB now!"))
minetest.close_formspec(pname, formname)
return -- to not reopen form
end
@@ -536,7 +540,7 @@ function advtrains.interlocking.show_ts_form(ts_id, pname)
advtrains.interlocking.show_tcb_marker(sigd.p)
end
- form = form.."label[0.5,2.5;Boundary TCBs:]"
+ form = form.."label[0.5,2.5;"..attrans("Boundary TCBs")..":]"
form = form.."textlist[0.5,3;4,3;tcblist;"..table.concat(strtab, ",").."]"
-- additional route locks (e.g. for level crossings)
@@ -548,15 +552,15 @@ function advtrains.interlocking.show_ts_form(ts_id, pname)
minetest.pos_to_string(advtrains.decode_pos(pts)).." = "..state)
end
end
- form = form.."label[5.5,2.5;Fixed route locks (e.g. level crossings):]"
+ form = form.."label[5.5,2.5;"..attrans("Fixed route locks (e.g. level crossings)")..":]"
form = form.."textlist[5.5,3;4,3;fixedlocks;"..table.concat(strtab, ",").."]"
if ildb.may_modify_ts(ts) then
- form = form.."button[5.5,6;2,1;flk_add;Add locks]"
- form = form.."button[7.5,6;2,1;flk_clear;Clear locks]"
+ form = form.."button[5.5,6;2,1;flk_add;"..attrans("Add locks").."]"
+ form = form.."button[7.5,6;2,1;flk_clear;"..attrans("Clear locks").."]"
- form = form.."button[5.5,8;4,1;remove;Remove Section]"
- form = form.."tooltip[remove;This will remove the track section and set all its end points to End Of Interlocking]"
+ form = form.."button[5.5,8;4,1;remove;"..attrans("Remove Section").."]"
+ form = form.."tooltip[remove;"..attrans("This will remove the track section and set all its end points to End Of Interlocking").."]"
else
hint=3
end
@@ -574,10 +578,10 @@ function advtrains.interlocking.show_ts_form(ts_id, pname)
form = form.."label[0.5,7.1;"..attrans("No trains on this section.").."]"
end
- form = form.."button[5.5,7;4,1;reset;Reset section state]"
+ form = form.."button[5.5,7;4,1;reset;"..attrans("Reset section state").."]"
if hint == 3 then
- form = form.."label[0.5,0.75;You cannot modify track sections when a route is set or a train is on the section.]"
+ form = form.."label[0.5,0.75;"..attrans("You cannot modify track sections when a route is set or a train is on the section.").."]"
--form = form.."label[0.5,1;Trying to unlink a TCB directly connected to this track will not work.]"
end
@@ -618,7 +622,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
ts.fixed_locks = {}
end
players_assign_fixedlocks[pname] = ts_id
- minetest.chat_send_player(pname, "Punch components to add fixed locks. (punch anything else = end)")
+ minetest.chat_send_player(pname, attrans("Punch components to add fixed locks. (punch anything else = end)"))
minetest.close_formspec(pname, formname)
return
elseif fields.flk_clear then
@@ -709,7 +713,7 @@ function advtrains.interlocking.show_tcb_marker(pos)
if ts then
itex[connid] = ts.name or tcbs.ts_id or "???"
else
- itex[connid] = "--EOI--"
+ itex[connid] = "--kon.zab.ob.--"
end
end
@@ -769,11 +773,11 @@ function advtrains.interlocking.check_route_valid(route, sigd)
while c_sigd and i<=#route do
c_tcbs = ildb.get_tcbs(c_sigd)
if not c_tcbs then
- return false, "No TCBS at "..sigd_to_string(c_sigd)
+ return false, attrans("No TCBS at @1", sigd_to_string(c_sigd))
end
c_ts_id = c_tcbs.ts_id
if not c_ts_id then
- return false, "No track section adjacent to "..sigd_to_string(c_sigd)
+ return false, attrans("No track section adjacent to @1", sigd_to_string(c_sigd))
end
c_ts = ildb.get_ts(c_ts_id)
@@ -783,7 +787,7 @@ function advtrains.interlocking.check_route_valid(route, sigd)
for pts, state in pairs(c_rseg.locks) do
local pos = advtrains.decode_pos(pts)
if not advtrains.is_passive(pos) then
- return false, "No passive component for lock at "..pts
+ return false, attrans("No passive component for lock at @1", pts)
end
end
end
@@ -792,7 +796,7 @@ function advtrains.interlocking.check_route_valid(route, sigd)
if nvar then
local re_tcbs = ildb.get_tcbs({p = nvar.p, s = (nvar.s==1) and 2 or 1})
if not re_tcbs or not re_tcbs.ts_id or re_tcbs.ts_id~=c_ts_id then
- return false, "TCB at "..minetest.pos_to_string(nvar.p).." has different section than previous TCB."
+ return false, attrans("TCB at @1 has different section than previous TCB.", minetest.pos_to_string(nvar.p))
end
end
-- advance
@@ -801,11 +805,11 @@ function advtrains.interlocking.check_route_valid(route, sigd)
end
-- check end TCB
if not c_sigd then
- return false, "Final TCBS unset (legacy-style buffer route)"
+ return false, attrans("Final TCBS unset (legacy-style buffer route)")
end
c_tcbs = ildb.get_tcbs(c_sigd)
if not c_tcbs then
- return false, "Final TCBS missing at "..sigd_to_string(c_sigd)
+ return false, attrans("Final TCBS missing at @1", sigd_to_string(c_sigd))
end
return true, nil, c_sigd
end
@@ -827,7 +831,8 @@ function advtrains.interlocking.show_signalling_form(sigd, pname, sel_rte, calle
if not tcbs.signal then return end
if not tcbs.routes then tcbs.routes = {} end
-
+ if not tcbs.signal_name then tcbs.signal_name = minetest.pos_to_string(sigd.p) end
+
local form = "size[7,10]label[0.5,0.5;"..attrans("Signal at @1", minetest.pos_to_string(sigd.p)).."]"
form = form.."field[0.8,1.5;5.2,1;name;"..attrans("Signal name")..";"..minetest.formspec_escape(tcbs.signal_name).."]"
form = form.."button[5.5,1.2;1,1;setname;"..attrans("Set").."]"
@@ -878,35 +883,35 @@ function advtrains.interlocking.show_signalling_form(sigd, pname, sel_rte, calle
end
strtab[#strtab+1] = clr .. minetest.formspec_escape(rname)
end
- form = form.."label[0.5,2.5;Routes:]"
+ form = form.."label[0.5,2.5;"..attrans("Routes:").."]"
form = form.."textlist[0.5,3;5,3;rtelist;"..table.concat(strtab, ",")
if sel_rte then
form = form .. ";" .. sel_rte .."]"
- form = form.."button[0.5,6; 5,1;setroute;Set Route]"
- form = form.."button[0.5,7;2,1;dsproute;Show]"
+ form = form.."button[0.5,6; 5,1;setroute;"..attrans("Set Route").."]"
+ form = form.."button[0.5,7;2,1;dsproute;"..attrans("Show").."]"
if hasprivs then
- form = form.."button[5.5,3.3;1,0.3;setarsdefault;D]tooltip[setarsdefault;Set ARS default route]"
- form = form.."button[3.5,7;2,1;editroute;Edit]"
+ form = form.."button[5.5,3.3;1,0.3;setarsdefault;Vých]tooltip[setarsdefault;"..attrans("Set ARS default route").."]"
+ form = form.."button[3.5,7;2,1;editroute;"..attrans("Edit").."]"
if sel_rte > 1 then
form = form .. "button[5.5,4;1,0.3;moveup;↑]"
end
if sel_rte < #strtab then
form = form .. "button[5.5,4.7;1,0.3;movedown;↓]"
end
- form = form.."button[5.5,5.4;1,0.3;delroute;X]tooltip[delroute;Delete this route]"
+ form = form.."button[5.5,5.4;1,0.3;delroute;X]tooltip[delroute;"..attrans("Delete this route").."]"
end
else
form = form .. "]"
if tcbs.ars_disabled then
- form = form.."label[0.5,6 ;NOTE: ARS is disabled.]"
- form = form.."label[0.5,6.5;Routes are not automatically set.]"
+ form = form.."label[0.5,6 ;"..attrans("NOTE: ARS is disabled.").."]"
+ form = form.."label[0.5,6.5;"..attrans("Routes are not automatically set.").."]"
end
end
if hasprivs then
- form = form.."button[0.5,8;2.5,1;smartroute;Smart Route]"
- form = form.."button[ 3,8;2.5,1;newroute;New (Manual)]"
- form = form..string.format("checkbox[0.5,8.75;ars;Automatic routesetting;%s]", not tcbs.ars_disabled)
- form = form..string.format("checkbox[0.5,9.25;dstarstrig;Distant signal triggers ARS;%s]", not tcbs.no_dst_ars_trig)
+ form = form.."button[0.5,8;2.5,1;smartroute;"..attrans("Smart Route").."]"
+ form = form.."button[ 3,8;2.5,1;newroute;"..attrans("New (Manual)").."]"
+ form = form..string.format("checkbox[0.5,8.75;ars;"..attrans("Automatic routesetting")..";%s]", not tcbs.ars_disabled)
+ form = form..string.format("checkbox[0.5,9.25;dstarstrig;"..attrans("Distant signal triggers ARS")..";%s]", not tcbs.no_dst_ars_trig)
end
else
-- no route is active, and no route is so far defined
@@ -914,19 +919,19 @@ function advtrains.interlocking.show_signalling_form(sigd, pname, sel_rte, calle
local caps = advtrains.interlocking.signal.get_signal_cap_level(tcbs.signal)
if caps >= 4 then
-- offer user the "block signal mode"
- form = form.."label[0.5,2.5;No routes are yet defined.]"
+ form = form.."label[0.5,2.5;"..attrans("No routes are yet defined.").."]"
if hasprivs then
- form = form.."button[0.5,4;2.5,1;smartroute;Smart Route]"
- form = form.."button[ 3,4;2.5,1;newroute;New (Manual)]"
+ form = form.."button[0.5,4;2.5,1;smartroute;"..attrans("Smart Route").."]"
+ form = form.."button[ 3,4;2.5,1;newroute;"..attrans("New (Manual)").."]"
end
elseif caps >= 3 then
-- it's a buffer!
- form = form.."label[0.5,2.5;This is an always-halt signal (e.g. a buffer)\n"
- .."No routes can be set from here.]"
+ form = form.."label[0.5,2.5;Tento signál vždy ukazuje červenou.\n"
+ .."Vlakové cesty odsud nemohou být nastaveny.]"
else
-- signal caps say it cannot be route start/end
- form = form.."label[0.5,2.5;This is a pure distant signal\n"
- .."No route is currently set through.]"
+ form = form.."label[0.5,2.5;Toto je vzdálená předzvěst.\n"
+ .."Aktuálně tudy není nastavena vlaková cesta.]"
end
end
@@ -1059,7 +1064,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
if fields.delroute and hasprivs then
if tcbs.routes[sel_rte] and tcbs.routes[sel_rte].ars then
- minetest.chat_send_player(pname, "Cannot delete route which has ARS rules, please review and then delete through edit dialog!")
+ minetest.chat_send_player(pname, attrans("Cannot delete route which has ARS rules, please review and then delete through edit dialog!"))
else
table.remove(tcbs.routes,sel_rte)
end
@@ -1069,6 +1074,13 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
if fields.ars then
tcbs.ars_disabled = not minetest.is_yes(fields.ars)
+ local action
+ if tcbs.ars_disabled then
+ action = "disabled"
+ else
+ action = "enabled"
+ end
+ core.log("action", pname.." "..action.." ARS at "..pts)
end
if fields.dstarstrig then
diff --git a/advtrains_interlocking/tool.lua b/advtrains_interlocking/tool.lua
index 7ccab46..c8f8521 100644
--- a/advtrains_interlocking/tool.lua
+++ b/advtrains_interlocking/tool.lua
@@ -5,17 +5,17 @@ local ilrs = advtrains.interlocking.route
local function node_right_click(pos, pname, player)
if advtrains.is_passive(pos) then
- local form = "size[7,5]label[0.5,0.5;Route lock inspector]"
+ local form = "size[7,5]label[0.5,0.5;Průzkumník zámků]"
local pts = advtrains.encode_pos(pos)
local rtl = ilrs.has_route_lock(pts)
if rtl then
- form = form.."label[0.5,1;Route locks currently put:\n"..rtl.."]"
- form = form.."button_exit[0.5,3.5; 5,1;clear;Clear]"
+ form = form.."label[0.5,1;Právě uzamčeno:\n"..rtl.."]"
+ form = form.."button_exit[0.5,3.5; 5,1;clear;Odemknout vše]"
else
- form = form.."label[0.5,1;No route locks set]"
- form = form.."button_exit[0.5,3.5; 5,1;emplace;Emplace manual lock]"
+ form = form.."label[0.5,1;Nic není uzamčeno]"
+ form = form.."button_exit[0.5,3.5; 5,1;emplace;Uzamknout ručně]"
end
minetest.show_formspec(pname, "at_il_rtool_"..pts, form)
@@ -25,7 +25,7 @@ local function node_right_click(pos, pname, player)
-- If not a turnout, check the track section and show a form
local node_ok, conns, rail_y=advtrains.get_rail_info_at(pos)
if not node_ok then
- minetest.chat_send_player(pname, "Node is not a track!")
+ minetest.chat_send_player(pname, "Tento blok není kolej!")
return
end
if advtrains.interlocking.db.get_tcb(pos) then
@@ -37,14 +37,14 @@ local function node_right_click(pos, pname, player)
if ts_id then
advtrains.interlocking.show_ts_form(ts_id, pname)
else
- minetest.chat_send_player(pname, "No track section at this location!")
+ minetest.chat_send_player(pname, "Zde není zabezpečený traťový úsek!")
end
end
local function node_left_click(pos, pname, player)
local node_ok, conns, rail_y=advtrains.get_rail_info_at(pos)
if not node_ok then
- minetest.chat_send_player(pname, "Node is not a track!")
+ minetest.chat_send_player(pname, "Tento blok není kolej!")
return
end
@@ -62,13 +62,14 @@ local function node_left_click(pos, pname, player)
advtrains.interlocking.db.update_rs_cache(ts_id)
advtrains.interlocking.highlight_track_section(pos)
else
- minetest.chat_send_player(pname, "No track section at this location!")
+ minetest.chat_send_player(pname, "Zde není zabezpečený traťový úsek!")
end
end
minetest.register_craftitem("advtrains_interlocking:tool",{
- description = "Interlocking tool\nPunch: Highlight track section\nPlace: check route locks/show track section info",
+ description = "ovladač traťového zabezpečení",
+ _ch_help = "levý klik: zvýraznit traťový úsek\npravý klik: prozkoumat/zkontrolovat zámky nebo zobrazit informace o traťovém úseku",
groups = {cracky=1}, -- key=name, value=rating; rating=1..3.
inventory_image = "at_il_tool.png",
wield_image = "at_il_tool.png",