disable node placement on rightclick beacon
parent
477bdd574f
commit
2005611d5c
30
api.lua
30
api.lua
|
@ -73,7 +73,7 @@ function telemosaic.effect_arrival(pos)
|
|||
max_hear_distance = 8,
|
||||
gain = 1
|
||||
})
|
||||
|
||||
|
||||
if not enable_particles then return end
|
||||
|
||||
minetest.add_particlespawner({
|
||||
|
@ -132,7 +132,7 @@ function telemosaic.from_queue()
|
|||
end
|
||||
|
||||
local time = minetest.get_us_time()
|
||||
|
||||
|
||||
for k, v in pairs(telemosaic.teleport_queue) do
|
||||
if v.player:getpos() then
|
||||
if vector.equals(v.player:getpos(), v.ppos) then
|
||||
|
@ -151,7 +151,7 @@ function telemosaic.from_queue()
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if telemosaic.get_table_length(telemosaic.teleport_queue) == 0 then
|
||||
return
|
||||
end
|
||||
|
@ -175,7 +175,7 @@ function telemosaic.get_formspec(pos, table)
|
|||
if not bname or bname == "" then
|
||||
bname = "beacon at: "..minetest.pos_to_string(pos)
|
||||
end
|
||||
|
||||
|
||||
local textlist = ""
|
||||
for ipos, ival in pairs(arrivals_tbl) do
|
||||
textlist = textlist..minetest.formspec_escape(ipos)..": "..minetest.formspec_escape(ival)..","
|
||||
|
@ -226,7 +226,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||
local bname = fields.bname
|
||||
local meta = minetest.get_meta(pos)
|
||||
local pos2 = minetest.string_to_pos(mod_pos_pos2[3])
|
||||
|
||||
|
||||
meta:set_string("bname", bname)
|
||||
|
||||
if pos2 then
|
||||
|
@ -265,9 +265,9 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||
end
|
||||
end)
|
||||
|
||||
--
|
||||
--
|
||||
-- extenders
|
||||
--
|
||||
--
|
||||
|
||||
--- Minetest "after_place_node" function
|
||||
-- @see https://github.com/minetest/minetest/blob/master/doc/lua_api.txt
|
||||
|
@ -337,9 +337,9 @@ function telemosaic.extender_on_destruct(pos)
|
|||
end
|
||||
end
|
||||
|
||||
--
|
||||
--
|
||||
-- beacons
|
||||
--
|
||||
--
|
||||
|
||||
--- Finds extenders in the area under air, counts the range based on the found extenders power/strength
|
||||
-- @param {table} be_pos - beacon position as a center point from where extenders will be searched
|
||||
|
@ -380,7 +380,7 @@ function telemosaic.set_status(pos)
|
|||
state ~= "err" then
|
||||
minetest.swap_node(pos, { name = "telemosaic:beacon_err" })
|
||||
meta:set_string("state", "err")
|
||||
|
||||
|
||||
-- configured beacon (off)
|
||||
elseif range > 0 and
|
||||
pos2 == "not configured" and
|
||||
|
@ -418,7 +418,7 @@ function telemosaic.beacon_after_place(pos, placer, itemstack, pointed_thing)
|
|||
meta:set_string("dest_pos", "not configured")
|
||||
meta:set_string("arrivals_tbl", "{}")
|
||||
meta:set_string("infotext", description.."\nowner: "..playername.."\nrange: "..range.." blocks\nright-click for more info")
|
||||
|
||||
|
||||
telemosaic.set_status(pos)
|
||||
end
|
||||
|
||||
|
@ -511,8 +511,8 @@ function telemosaic.beacon_rightclick(pos, node, clicker, itemstack, pointed_thi
|
|||
telemosaic.set_status(pos_stack)
|
||||
|
||||
-- default place_node callback
|
||||
elseif itemstack:get_definition().type == "node" then
|
||||
itemstack = minetest.item_place_node(itemstack, clicker, pointed_thing)
|
||||
-- elseif itemstack:get_definition().type == "node" then
|
||||
-- itemstack = minetest.item_place_node(itemstack, clicker, pointed_thing)
|
||||
else
|
||||
-- mod : pos : pos2
|
||||
-- - pos2 is from itemstack so not always set, else "not configured"
|
||||
|
@ -543,13 +543,13 @@ function telemosaic.beacon_on_destruct(pos)
|
|||
local arrivals_tbl2 = meta2:get_string("arrivals_tbl")
|
||||
arrivals_tbl2 = minetest.deserialize(arrivals_tbl2)
|
||||
if not arrivals_tbl2 then arrivals_tbl2 = {} end
|
||||
|
||||
|
||||
if arrivals_tbl2[minetest.pos_to_string(pos)] then
|
||||
arrivals_tbl2[minetest.pos_to_string(pos)] = nil
|
||||
arrivals_tbl2 = minetest.serialize(arrivals_tbl2)
|
||||
meta2:set_string("arrivals_tbl", arrivals_tbl2)
|
||||
end
|
||||
|
||||
|
||||
meta2:set_string("dest_pos", "not configured")
|
||||
telemosaic.set_status(pos2)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue