summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2015-02-03 09:23:38 +0100
committerest31 <MTest31@outlook.com>2015-02-03 20:33:49 +0100
commitf499f6a8c7d330a6a3e2282d03b797fbb71eff5e (patch)
tree2e9d6c93ebaff0f7593edab3b9b3d7b73822a2dd
parent9e99d2e65f39b1d8c5d16bab5cf4f7fd635ee205 (diff)
downloadpipeworks-f499f6a8c7d330a6a3e2282d03b797fbb71eff5e.tar
pipeworks-f499f6a8c7d330a6a3e2282d03b797fbb71eff5e.tar.gz
pipeworks-f499f6a8c7d330a6a3e2282d03b797fbb71eff5e.tar.bz2
pipeworks-f499f6a8c7d330a6a3e2282d03b797fbb71eff5e.tar.xz
pipeworks-f499f6a8c7d330a6a3e2282d03b797fbb71eff5e.zip
Fix vacuum tube formspec and make radius parsing smarter
-rw-r--r--vacuum_tubes.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/vacuum_tubes.lua b/vacuum_tubes.lua
index ac36313..8e92e95 100644
--- a/vacuum_tubes.lua
+++ b/vacuum_tubes.lua
@@ -50,7 +50,7 @@ if pipeworks.enable_mese_sand_tube then
meta:set_int("dist", 0)
meta:set_string("formspec", "size[2.1,0.8]"..
"image[0,0;1,1;pipeworks_mese_sand_tube_inv.png]"..
- "field[1.3,0.4;1,1;dist;distance;${dist}]"..
+ "field[1.3,0.4;1,1;dist;radius;${dist}]"..
default.gui_bg..
default.gui_bg_img)
meta:set_string("infotext", "Adjustable Vacuuming Pneumatic Tube Segment")
@@ -58,7 +58,9 @@ if pipeworks.enable_mese_sand_tube then
on_receive_fields = function(pos,formname,fields,sender)
local meta = minetest.get_meta(pos)
local dist = tonumber(fields.dist)
- if dist and 0 <= dist and dist <= 8 then
+ if dist then
+ dist = math.max(0, dist)
+ dist = math.min(8, dist)
meta:set_int("dist", dist)
meta:set_string("infotext", ("Adjustable Vacuuming Pneumatic Tube Segment (%dm)"):format(dist))
end