Wireless porter fix
This commit is contained in:
parent
875cbd7701
commit
1b9a5c63fb
@ -58,6 +58,7 @@ ele.register_tool("elepower_wireless:wireless_porter", {
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if not placer or placer:get_player_name() == "" then return itemstack end
|
||||
local player = placer:get_player_name()
|
||||
local pos = pointed_thing.under
|
||||
|
||||
if minetest.is_protected(pos, player) then
|
||||
minetest.chat_send_player(player, "You are not allowed to teleport here!")
|
||||
@ -65,21 +66,23 @@ ele.register_tool("elepower_wireless:wireless_porter", {
|
||||
end
|
||||
|
||||
local meta = itemstack:get_meta()
|
||||
local pos = pointed_thing.under
|
||||
local node = minetest.get_node_or_nil(pos)
|
||||
|
||||
if not node or not ele.helpers.get_item_group(node.name, "matter_receiver") then return itemstack end
|
||||
if not node or not ele.helpers.get_item_group(node.name, "matter_receiver") then
|
||||
minetest.chat_send_player(player, "Use on a Matter Receiver to bind teleport location!")
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local strpos = minetest.pos_to_string(pos)
|
||||
local curpos = minetest.string_to_pos(meta:get_string("receiver"))
|
||||
|
||||
if (curpos and curpos ~= "") and curpos == pos then
|
||||
if curpos and vector.equals(curpos, pos) then
|
||||
minetest.chat_send_player(player, "Wireless Porter is already bound to this location!")
|
||||
return itemstack
|
||||
end
|
||||
|
||||
meta:set_string("receiver", strpos)
|
||||
minetest.chat_send_player(player, ("Wireless Porter bound to %s!"):format(strpos))
|
||||
minetest.chat_send_player(player, ("Wireless Porter bound to receiver at %s!"):format(strpos))
|
||||
|
||||
return itemstack
|
||||
end,
|
||||
|
@ -1,11 +1,3 @@
|
||||
--[[
|
||||
Wireless Station:
|
||||
|
||||
Wireless Card -> Bind to node -> Add to station
|
||||
Name the station to keep track
|
||||
|
||||
]]
|
||||
|
||||
elewi.node_handlers = {}
|
||||
local desc_cache = {}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user