Right click teleportation no longer requires standing on beacon
This commit is contained in:
parent
9b001161a9
commit
577202f5cc
14
init.lua
14
init.lua
@ -157,6 +157,8 @@ local function beacon_rightclick(pos, node, player, itemstack, pointed_thing)
|
|||||||
if C.right_click_teleport then
|
if C.right_click_teleport then
|
||||||
local pl = M.players[player:get_player_name()]
|
local pl = M.players[player:get_player_name()]
|
||||||
pl.right_clicked = true
|
pl.right_clicked = true
|
||||||
|
pl.clicked_pos = pointed_thing.under
|
||||||
|
pl.allow_teleport = true
|
||||||
|
|
||||||
-- normal place-item thing
|
-- normal place-item thing
|
||||||
elseif itemstack:get_definition().type == "node" then
|
elseif itemstack:get_definition().type == "node" then
|
||||||
@ -465,8 +467,12 @@ minetest.register_globalstep(function(dtime)
|
|||||||
local pos_hash = hash_pos(pos)
|
local pos_hash = hash_pos(pos)
|
||||||
-- from now on, pos is slightly *under* the player
|
-- from now on, pos is slightly *under* the player
|
||||||
pos.y = pos.y - 0.01
|
pos.y = pos.y - 0.01
|
||||||
local stand_node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
--print ("At position " .. pos_hash .. " standing on a " .. stand_node.name)
|
--print ("At position " .. pos_hash .. " standing on a " .. node.name)
|
||||||
|
if C.right_click_teleport and pl.clicked_pos ~= nil then
|
||||||
|
pos = pl.clicked_pos
|
||||||
|
node = minetest.get_node(pos)
|
||||||
|
end
|
||||||
if pos_hash ~= pl.last_pos then
|
if pos_hash ~= pl.last_pos then
|
||||||
--print("Moved to " .. pos_hash)
|
--print("Moved to " .. pos_hash)
|
||||||
pl.last_pos = pos_hash
|
pl.last_pos = pos_hash
|
||||||
@ -475,8 +481,8 @@ minetest.register_globalstep(function(dtime)
|
|||||||
pl.started_emerge = false
|
pl.started_emerge = false
|
||||||
pl.right_clicked = false
|
pl.right_clicked = false
|
||||||
|
|
||||||
elseif pl.allow_teleport and (stand_node.name == 'telemosaic:beacon' or stand_node.name == 'telemosaic:beacon_protected') then
|
elseif pl.allow_teleport and (node.name == 'telemosaic:beacon' or node.name == 'telemosaic:beacon_protected') then
|
||||||
if stand_node.name == 'telemosaic:beacon_protected' then
|
if node.name == 'telemosaic:beacon_protected' then
|
||||||
-- check protection on protected telemosaic
|
-- check protection on protected telemosaic
|
||||||
if minetest.is_protected(pos, name) then
|
if minetest.is_protected(pos, name) then
|
||||||
-- protected telemosaic, reset moved-flag and abort
|
-- protected telemosaic, reset moved-flag and abort
|
||||||
|
Loading…
x
Reference in New Issue
Block a user