Skip to content

Commit

Permalink
Merge pull request #4 from S-S-X/tptube
Browse files Browse the repository at this point in the history
Teleport tube implementation
  • Loading branch information
S-S-X committed May 10, 2020
2 parents 93970c9 + 536859b commit 8d747b9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dofile(basedir .. '/tool.lua')

-- nodes
dofile(basedir .. '/nodes/mese_tube.lua')
--dofile(basedir .. '/nodes/teleport_tube.lua')
dofile(basedir .. '/nodes/teleport_tube.lua')
--dofile(basedir .. '/nodes/sand_tube.lua')
--dofile(basedir .. '/nodes/injector.lua')

Expand Down
15 changes: 7 additions & 8 deletions nodes/teleport_tube.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,13 @@ local tooldef = {
end,

paste = function(node, pos, player, data)
local meta = minetest.get_meta(pos)

-- restore channel and receive setting
meta:set_string("channel", data.channel)
meta:set_int("can_receive", data.receive)

-- update tube
-- TODO: Requires updating teleport tube database, see pipeworks mod for how this is done
-- restore settings and update tube, no api available
local fields = {
channel = data.channel,
['cr' .. data.receive] = data.receive,
}
local nodedef = minetest.registered_nodes[node.name]
nodedef.on_receive_fields(pos, "", fields, player)
end,
}

Expand Down

0 comments on commit 8d747b9

Please sign in to comment.