mirror of
https://github.com/mt-mods/pipeworks.git
synced 2024-12-29 17:17:29 +01:00
Fix vacuum tube formspec and make radius parsing smarter
This commit is contained in:
parent
9e99d2e65f
commit
f499f6a8c7
@ -50,7 +50,7 @@ if pipeworks.enable_mese_sand_tube then
|
|||||||
meta:set_int("dist", 0)
|
meta:set_int("dist", 0)
|
||||||
meta:set_string("formspec", "size[2.1,0.8]"..
|
meta:set_string("formspec", "size[2.1,0.8]"..
|
||||||
"image[0,0;1,1;pipeworks_mese_sand_tube_inv.png]"..
|
"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..
|
||||||
default.gui_bg_img)
|
default.gui_bg_img)
|
||||||
meta:set_string("infotext", "Adjustable Vacuuming Pneumatic Tube Segment")
|
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)
|
on_receive_fields = function(pos,formname,fields,sender)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local dist = tonumber(fields.dist)
|
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_int("dist", dist)
|
||||||
meta:set_string("infotext", ("Adjustable Vacuuming Pneumatic Tube Segment (%dm)"):format(dist))
|
meta:set_string("infotext", ("Adjustable Vacuuming Pneumatic Tube Segment (%dm)"):format(dist))
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user