mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-29 14:01:07 +01:00
Fix https://git.minetest.land/Wuzzy/MineClone2/issues/996 Coordinate exploit in signs and chests, sent by @cora
This commit is contained in:
parent
2e898b3113
commit
c9294a4d8a
2 changed files with 19 additions and 19 deletions
|
@ -360,6 +360,15 @@ minetest.register_node("mcl_chests:"..basename, {
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
local function close_forms(canonical_basename, pos)
|
||||||
|
local players = minetest.get_connected_players()
|
||||||
|
for p=1, #players do
|
||||||
|
if vector.distance(players[p]:get_pos(), pos) <= 30 then
|
||||||
|
minetest.close_formspec(players[p]:get_player_name(), "mcl_chests:"..canonical_basename.."_"..pos.x.."_"..pos.y.."_"..pos.z)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_node(small_name, {
|
minetest.register_node(small_name, {
|
||||||
description = desc,
|
description = desc,
|
||||||
_tt_help = tt_help,
|
_tt_help = tt_help,
|
||||||
|
@ -483,10 +492,7 @@ minetest.register_node(small_name, {
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_destruct = function(pos)
|
on_destruct = function(pos)
|
||||||
local players = minetest.get_connected_players()
|
close_forms(canonical_basename, pos)
|
||||||
for p=1, #players do
|
|
||||||
minetest.close_formspec(players[p]:get_player_name(), "mcl_chests:"..canonical_basename.."_"..pos.x.."_"..pos.y.."_"..pos.z)
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
mesecons = mesecons,
|
mesecons = mesecons,
|
||||||
on_rotate = simple_rotate,
|
on_rotate = simple_rotate,
|
||||||
|
@ -527,19 +533,15 @@ minetest.register_node(left_name, {
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local players = minetest.get_connected_players()
|
close_forms(canonical_basename, pos)
|
||||||
for p=1, #players do
|
|
||||||
minetest.close_formspec(players[p]:get_player_name(), "mcl_chests:"..canonical_basename.."_"..pos.x.."_"..pos.y.."_"..pos.z)
|
|
||||||
end
|
|
||||||
|
|
||||||
local param2 = n.param2
|
local param2 = n.param2
|
||||||
local p = mcl_util.get_double_container_neighbor_pos(pos, param2, "left")
|
local p = mcl_util.get_double_container_neighbor_pos(pos, param2, "left")
|
||||||
if not p or minetest.get_node(p).name ~= "mcl_chests:"..basename.."_right" then
|
if not p or minetest.get_node(p).name ~= "mcl_chests:"..basename.."_right" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
for pl=1, #players do
|
close_forms(canonical_basename, p)
|
||||||
minetest.close_formspec(players[pl]:get_player_name(), "mcl_chests:"..canonical_basename.."_"..p.x.."_"..p.y.."_"..p.z)
|
|
||||||
end
|
|
||||||
minetest.swap_node(p, { name = small_name, param2 = param2 })
|
minetest.swap_node(p, { name = small_name, param2 = param2 })
|
||||||
create_entity(p, small_name, small_textures, param2, false, "default_chest", "mcl_chests_chest")
|
create_entity(p, small_name, small_textures, param2, false, "default_chest", "mcl_chests_chest")
|
||||||
end,
|
end,
|
||||||
|
@ -678,19 +680,15 @@ minetest.register_node("mcl_chests:"..basename.."_right", {
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local players = minetest.get_connected_players()
|
close_forms(canonical_basename, pos)
|
||||||
for p=1, #players do
|
|
||||||
minetest.close_formspec(players[p]:get_player_name(), "mcl_chests:"..canonical_basename.."_"..pos.x.."_"..pos.y.."_"..pos.z)
|
|
||||||
end
|
|
||||||
|
|
||||||
local param2 = n.param2
|
local param2 = n.param2
|
||||||
local p = mcl_util.get_double_container_neighbor_pos(pos, param2, "right")
|
local p = mcl_util.get_double_container_neighbor_pos(pos, param2, "right")
|
||||||
if not p or minetest.get_node(p).name ~= "mcl_chests:"..basename.."_left" then
|
if not p or minetest.get_node(p).name ~= "mcl_chests:"..basename.."_left" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
for pl=1, #players do
|
close_forms(canonical_basename, p)
|
||||||
minetest.close_formspec(players[pl]:get_player_name(), "mcl_chests:"..canonical_basename.."_"..p.x.."_"..p.y.."_"..p.z)
|
|
||||||
end
|
|
||||||
minetest.swap_node(p, { name = small_name, param2 = param2 })
|
minetest.swap_node(p, { name = small_name, param2 = param2 })
|
||||||
create_entity(p, small_name, small_textures, param2, false, "default_chest", "mcl_chests_chest")
|
create_entity(p, small_name, small_textures, param2, false, "default_chest", "mcl_chests_chest")
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
|
|
@ -197,7 +197,9 @@ local destruct_sign = function(pos)
|
||||||
end
|
end
|
||||||
local players = minetest.get_connected_players()
|
local players = minetest.get_connected_players()
|
||||||
for p=1, #players do
|
for p=1, #players do
|
||||||
minetest.close_formspec(players[p]:get_player_name(), "mcl_signs:set_text_"..pos.x.."_"..pos.y.."_"..pos.z)
|
if vector.distance(players[p]:get_pos(), pos) <= 30 then
|
||||||
|
minetest.close_formspec(players[p]:get_player_name(), "mcl_signs:set_text_"..pos.x.."_"..pos.y.."_"..pos.z)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue