mirror of
https://github.com/mt-mods/pipeworks.git
synced 2024-11-09 17:03:58 +01:00
cache on/off button image refs and commonly-used label for same
This commit is contained in:
parent
a7c3908b61
commit
5e26aa5f91
@ -141,6 +141,13 @@ function fs_helpers.cycling_button(meta, base, meta_name, values)
|
||||
text = val
|
||||
end
|
||||
local field = "fs_helpers_cycling:"..new_value..":"..meta_name
|
||||
|
||||
print("base"..dump(base))
|
||||
print("texture_name"..dump(texture_name))
|
||||
print("field"..dump(field))
|
||||
print("text"..dump(text))
|
||||
print("addopts"..dump(addopts))
|
||||
|
||||
return base..";"..(texture_name and texture_name..";" or "")..field..";"..minetest.formspec_escape(text)..(addopts and ";"..addopts or "").."]"
|
||||
end
|
||||
|
||||
|
@ -27,10 +27,10 @@ local function update_chest_formspec(pos)
|
||||
"image_button[0,4.3;1,0.6",
|
||||
"splitstacks",
|
||||
{
|
||||
{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"}
|
||||
pipeworks.button_off,
|
||||
pipeworks.button_on
|
||||
}
|
||||
).."label[0.9,4.31;Allow splitting incoming stacks from tubes]"
|
||||
)..pipeworks.button_label
|
||||
meta:set_string("formspec", formspec)
|
||||
end
|
||||
|
||||
@ -94,10 +94,10 @@ local function setup_locked_formspec(pos, meta)
|
||||
"image_button[0,4.3;1,0.6",
|
||||
"splitstacks",
|
||||
{
|
||||
{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"}
|
||||
pipeworks.button_off,
|
||||
pipeworks.button_on
|
||||
}
|
||||
).."label[0.9,4.31;Allow splitting incoming stacks from tubes]"
|
||||
)..pipeworks.button_label
|
||||
)
|
||||
end
|
||||
|
||||
|
@ -33,8 +33,8 @@ local function active_formspec(fuel_percent, item_percent, pos, meta)
|
||||
"image_button[0,3.5;1,0.6",
|
||||
"split_material_stacks",
|
||||
{
|
||||
{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"}
|
||||
pipeworks.button_off,
|
||||
pipeworks.button_on
|
||||
}
|
||||
).."label[0.9,3.51;Allow splitting incoming material (not fuel) stacks from tubes]"
|
||||
return formspec
|
||||
@ -64,8 +64,8 @@ local function inactive_formspec(pos, meta)
|
||||
"image_button[0,3.5;1,0.6",
|
||||
"split_material_stacks",
|
||||
{
|
||||
{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"}
|
||||
pipeworks.button_off,
|
||||
pipeworks.button_on
|
||||
}
|
||||
).."label[0.9,3.51;Allow splitting incoming material (not fuel) stacks from tubes]"
|
||||
return formspec
|
||||
|
4
init.lua
4
init.lua
@ -41,6 +41,10 @@ pipeworks.mesecons_rules={{x=0,y=0,z=1},{x=0,y=0,z=-1},{x=1,y=0,z=0},{x=-1,y=0,z
|
||||
|
||||
pipeworks.liquid_texture = "default_water.png"
|
||||
|
||||
pipeworks.button_off = {text="", texture="pipeworks_button_off.png", addopts="false;false;pipeworks_button_interm.png"}
|
||||
pipeworks.button_on = {text="", texture="pipeworks_button_on.png", addopts="false;false;pipeworks_button_interm.png"}
|
||||
pipeworks.button_label = "label[0.9,4.31;Allow splitting incoming stacks from tubes]"
|
||||
|
||||
-- Helper functions
|
||||
|
||||
function pipeworks.fix_image_names(table, replacement)
|
||||
|
@ -17,8 +17,8 @@ if pipeworks.enable_mese_tube then
|
||||
buttons_formspec = buttons_formspec .. fs_helpers.cycling_button(meta,
|
||||
"image_button[7,"..(i+0.2)..";1,0.6", "l"..(i+1).."s",
|
||||
{
|
||||
{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"}
|
||||
pipeworks.button_off,
|
||||
pipeworks.button_on
|
||||
}
|
||||
)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user