From 52cfe9f2779df9c15a931fec33507ccc355964f3 Mon Sep 17 00:00:00 2001 From: est31 Date: Tue, 27 Jan 2015 23:14:05 +0100 Subject: Add intermediate button state for sorttube enabler Image supplied by VanessaE. --- common.lua | 4 +++- textures/pipeworks_button_interm.png | Bin 0 -> 5770 bytes tubes.lua | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 textures/pipeworks_button_interm.png diff --git a/common.lua b/common.lua index 9be13d0..1ee734f 100755 --- a/common.lua +++ b/common.lua @@ -129,15 +129,17 @@ function fs_helpers.cycling_button(meta, base, meta_name, values) local val = values[current_value + 1] local text local texture_name = nil + local addopts = nil --when we get a table, we know the caller wants an image_button if type(val) == "table" then text = val["text"] texture_name = val["texture"] + addopts = val["addopts"] else text = val end local field = "fs_helpers_cycling:"..new_value..":"..meta_name - return base..";"..(texture_name and texture_name..";" or "")..field..";"..minetest.formspec_escape(text).."]" + return base..";"..(texture_name and texture_name..";" or "")..field..";"..minetest.formspec_escape(text)..(addopts and ";"..addopts or "").."]" end --------- diff --git a/textures/pipeworks_button_interm.png b/textures/pipeworks_button_interm.png new file mode 100644 index 0000000..7541a2e Binary files /dev/null and b/textures/pipeworks_button_interm.png differ diff --git a/tubes.lua b/tubes.lua index 39323a2..1afe237 100755 --- a/tubes.lua +++ b/tubes.lua @@ -253,7 +253,7 @@ if pipeworks.enable_mese_tube then for i = 0, 5 do buttons_formspec = buttons_formspec .. fs_helpers.cycling_button(meta, "image_button[7,"..(i)..";1,1", "l"..(i+1).."s", - {{text="",texture="pipeworks_button_off.png"}, {text="",texture="pipeworks_button_on.png"}}) + {{text="",texture="pipeworks_button_off.png", addopts="false;false;pipeworks_button_interm.png"}, {text="",texture="pipeworks_button_on.png", addopts="false;false;pipeworks_button_interm.png"}}) end meta:set_string("formspec", "size[8,11]".. -- cgit v1.2.3