aboutsummaryrefslogtreecommitdiff
path: root/advtrains
diff options
context:
space:
mode:
authorY. Wang <yw05@forksworld.de>2022-08-13 21:16:15 +0200
committerY. Wang <yw05@forksworld.de>2023-03-23 20:06:02 +0100
commit34405b8431b7c758988b56cc09d21d6de74b727b (patch)
tree7f0235409f624a052ab2defe5706f2d394a34af9 /advtrains
parenta4abbf8824f893558861bff2893181ae02ed284d (diff)
downloadadvtrains-34405b8431b7c758988b56cc09d21d6de74b727b.tar.gz
advtrains-34405b8431b7c758988b56cc09d21d6de74b727b.tar.bz2
advtrains-34405b8431b7c758988b56cc09d21d6de74b727b.zip
Allow assigning distant signals from the main signal
Diffstat (limited to 'advtrains')
-rw-r--r--advtrains/formspec.lua27
1 files changed, 27 insertions, 0 deletions
diff --git a/advtrains/formspec.lua b/advtrains/formspec.lua
index 20dab59..58968da 100644
--- a/advtrains/formspec.lua
+++ b/advtrains/formspec.lua
@@ -32,6 +32,21 @@ local function f_dropdown(x, y, w, id, entries, sel, indexed)
indexed and ";true" or "")
end
+local function f_image_button(x, y, w, h, texture, id, label, noclip, drawborder, pressed)
+ local st = {string.format("%f,%f;%f,%f;%s;%s;%s", x, y, w, h, fsescape(texture), fsescape(id), fsescape(label))}
+ if pressed then
+ st[#st+1] = tostring(noclip or false)
+ st[#st+1] = tostring(drawborder or false)
+ st[#st+1] = fsescape(pressed)
+ end
+ return sformat("image_button[%s]", table.concat(st, ";"))
+end
+
+local function f_image_button_exit(x, y, w, h, texture, id, label)
+ local st = {string.format("%f,%f;%f,%f;%s;%s;%s", x, y, w, h, fsescape(texture), fsescape(id), fsescape(label))}
+ return sformat("image_button_exit[%s]", table.concat(st, ";"))
+end
+
local function f_label(x, y, text)
return sformat("label[%f,%f;%s]", x, y, fsescape(text))
end
@@ -61,13 +76,25 @@ local function f_tabheader(x, y, w, h, id, entries, sel, transparent, border)
return string.format("tabheader[%s]", table.concat(st, ";"))
end
+local function f_textlist(x, y, w, h, id, entries, sel, transparent)
+ local st = {string.format("%f,%f;%f,%f;%s;%s", x, y, w, h, id, make_list(entries))}
+ if sel then
+ st[#st+1] = tostring(sel)
+ st[#st+1] = tostring(transparent or false)
+ end
+ return string.format("textlist[%s]", table.concat(st, ";"))
+end
+
return {
button = f_button,
S_button = S_button,
button_exit = f_button_exit,
S_button_exit = S_button_exit,
dropdown = f_dropdown,
+ image_button = f_image_button,
+ image_button_exit = f_image_button_exit,
label = f_label,
S_label = S_label,
tabheader = f_tabheader,
+ textlist = f_textlist,
}