Add intermediate button state for sorttube enabler

Image supplied by VanessaE.
This commit is contained in:
est31 2015-01-27 23:14:05 +01:00
parent 8b22593f55
commit 52cfe9f277
3 changed files with 4 additions and 2 deletions

View File

@ -129,15 +129,17 @@ function fs_helpers.cycling_button(meta, base, meta_name, values)
local val = values[current_value + 1] local val = values[current_value + 1]
local text local text
local texture_name = nil local texture_name = nil
local addopts = nil
--when we get a table, we know the caller wants an image_button --when we get a table, we know the caller wants an image_button
if type(val) == "table" then if type(val) == "table" then
text = val["text"] text = val["text"]
texture_name = val["texture"] texture_name = val["texture"]
addopts = val["addopts"]
else else
text = val text = val
end end
local field = "fs_helpers_cycling:"..new_value..":"..meta_name 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 end
--------- ---------

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@ -253,7 +253,7 @@ if pipeworks.enable_mese_tube then
for i = 0, 5 do for i = 0, 5 do
buttons_formspec = buttons_formspec .. fs_helpers.cycling_button(meta, buttons_formspec = buttons_formspec .. fs_helpers.cycling_button(meta,
"image_button[7,"..(i)..";1,1", "l"..(i+1).."s", "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 end
meta:set_string("formspec", meta:set_string("formspec",
"size[8,11]".. "size[8,11]"..