summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNovatux <nathanael.courant@laposte.net>2013-01-19 13:40:19 +0100
committerNovatux <nathanael.courant@laposte.net>2013-01-19 13:40:19 +0100
commit4ecb7475703ccfd82caf0612c2d2189b6ad320ce (patch)
treef6538b11292020e2ff82507ce02d6f24e10793ff
parentcfd59ab9a7d6396a1a3d966a364969b262e23f25 (diff)
downloadpipeworks-4ecb7475703ccfd82caf0612c2d2189b6ad320ce.tar
pipeworks-4ecb7475703ccfd82caf0612c2d2189b6ad320ce.tar.gz
pipeworks-4ecb7475703ccfd82caf0612c2d2189b6ad320ce.tar.bz2
pipeworks-4ecb7475703ccfd82caf0612c2d2189b6ad320ce.tar.xz
pipeworks-4ecb7475703ccfd82caf0612c2d2189b6ad320ce.zip
Added channel formspec for teleport tube
-rw-r--r--teleport_tube.lua13
1 files changed, 10 insertions, 3 deletions
diff --git a/teleport_tube.lua b/teleport_tube.lua
index e4d759a..eda3912 100644
--- a/teleport_tube.lua
+++ b/teleport_tube.lua
@@ -57,7 +57,7 @@ register_tube("pipeworks:teleport_tube","Teleporter pneumatic tube segment",plai
velocity.y=0
velocity.z=0
local meta = minetest.env:get_meta(pos)
- channel=meta:get_int("channel")
+ channel=meta:get_string("channel")
goto=get_tubes_in_file(pos,channel)
if goto[1]==nil then return {} end
pos.x=goto[1].x
@@ -67,8 +67,15 @@ register_tube("pipeworks:teleport_tube","Teleporter pneumatic tube segment",plai
end},
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
- meta:set_int("channel",0)
- add_tube_in_file(pos,0)
+ meta:set_string("channel","0")
+ meta:set_string("formspec","size[9,1;]field[0,0.5;9,1;channel;Channel:;${channel}]")
+ add_tube_in_file(pos,"0")
+ end,
+ on_receive_fields = function(pos,formname,fields,sender)
+ local meta = minetest.env:get_meta(pos)
+ meta:set_string("channel",fields.channel)
+ remove_tube_in_file(pos)
+ add_tube_in_file(pos,fields.channel)
end,
after_dig_node = function(pos)
remove_tube_in_file(pos)