summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2017-04-11 18:52:39 -0400
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2017-04-11 18:52:39 -0400
commit5e26aa5f91dafb16f62a43daa688a33b6216e0b6 (patch)
tree8d7b53dc3ca0f08494b81e68475de376b3573dd9
parenta7c3908b6134b01e1447568d20e6801a373f1af8 (diff)
downloadpipeworks-5e26aa5f91dafb16f62a43daa688a33b6216e0b6.tar
pipeworks-5e26aa5f91dafb16f62a43daa688a33b6216e0b6.tar.gz
pipeworks-5e26aa5f91dafb16f62a43daa688a33b6216e0b6.tar.bz2
pipeworks-5e26aa5f91dafb16f62a43daa688a33b6216e0b6.tar.xz
pipeworks-5e26aa5f91dafb16f62a43daa688a33b6216e0b6.zip
cache on/off button image refs and commonly-used label for same
-rw-r--r--common.lua7
-rw-r--r--compat-chests.lua12
-rw-r--r--compat-furnaces.lua8
-rw-r--r--init.lua4
-rw-r--r--sorting_tubes.lua4
5 files changed, 23 insertions, 12 deletions
diff --git a/common.lua b/common.lua
index 5574bb2..4986de9 100644
--- a/common.lua
+++ b/common.lua
@@ -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
diff --git a/compat-chests.lua b/compat-chests.lua
index c018f75..65fb407 100644
--- a/compat-chests.lua
+++ b/compat-chests.lua
@@ -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
diff --git a/compat-furnaces.lua b/compat-furnaces.lua
index c2c5df4..492332a 100644
--- a/compat-furnaces.lua
+++ b/compat-furnaces.lua
@@ -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
diff --git a/init.lua b/init.lua
index 7b0efd3..c87bfe2 100644
--- a/init.lua
+++ b/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)
diff --git a/sorting_tubes.lua b/sorting_tubes.lua
index 18d27e4..e7e918d 100644
--- a/sorting_tubes.lua
+++ b/sorting_tubes.lua
@@ -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