From 1b9a5c63fba77e6b94b41eb480059536f23af9ac Mon Sep 17 00:00:00 2001 From: Evert Prants Date: Mon, 25 May 2020 16:18:53 +0300 Subject: [PATCH] Wireless porter fix --- elepower_wireless/craftitems.lua | 11 +++++++---- elepower_wireless/machines/station.lua | 8 -------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/elepower_wireless/craftitems.lua b/elepower_wireless/craftitems.lua index 4435f70..1baf929 100644 --- a/elepower_wireless/craftitems.lua +++ b/elepower_wireless/craftitems.lua @@ -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, diff --git a/elepower_wireless/machines/station.lua b/elepower_wireless/machines/station.lua index 0bfea1e..fa2afff 100644 --- a/elepower_wireless/machines/station.lua +++ b/elepower_wireless/machines/station.lua @@ -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 = {}