mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-19 01:21:05 +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,
|
||||
})
|
||||
|
||||
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, {
|
||||
description = desc,
|
||||
_tt_help = tt_help,
|
||||
|
@ -483,10 +492,7 @@ minetest.register_node(small_name, {
|
|||
end,
|
||||
|
||||
on_destruct = function(pos)
|
||||
local players = minetest.get_connected_players()
|
||||
for p=1, #players do
|
||||
minetest.close_formspec(players[p]:get_player_name(), "mcl_chests:"..canonical_basename.."_"..pos.x.."_"..pos.y.."_"..pos.z)
|
||||
end
|
||||
close_forms(canonical_basename, pos)
|
||||
end,
|
||||
mesecons = mesecons,
|
||||
on_rotate = simple_rotate,
|
||||
|
@ -527,19 +533,15 @@ minetest.register_node(left_name, {
|
|||
return
|
||||
end
|
||||
|
||||
local players = minetest.get_connected_players()
|
||||
for p=1, #players do
|
||||
minetest.close_formspec(players[p]:get_player_name(), "mcl_chests:"..canonical_basename.."_"..pos.x.."_"..pos.y.."_"..pos.z)
|
||||
end
|
||||
close_forms(canonical_basename, pos)
|
||||
|
||||
local param2 = n.param2
|
||||
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
|
||||
return
|
||||
end
|
||||
for pl=1, #players do
|
||||
minetest.close_formspec(players[pl]:get_player_name(), "mcl_chests:"..canonical_basename.."_"..p.x.."_"..p.y.."_"..p.z)
|
||||
end
|
||||
close_forms(canonical_basename, p)
|
||||
|
||||
minetest.swap_node(p, { name = small_name, param2 = param2 })
|
||||
create_entity(p, small_name, small_textures, param2, false, "default_chest", "mcl_chests_chest")
|
||||
end,
|
||||
|
@ -678,19 +680,15 @@ minetest.register_node("mcl_chests:"..basename.."_right", {
|
|||
return
|
||||
end
|
||||
|
||||
local players = minetest.get_connected_players()
|
||||
for p=1, #players do
|
||||
minetest.close_formspec(players[p]:get_player_name(), "mcl_chests:"..canonical_basename.."_"..pos.x.."_"..pos.y.."_"..pos.z)
|
||||
end
|
||||
close_forms(canonical_basename, pos)
|
||||
|
||||
local param2 = n.param2
|
||||
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
|
||||
return
|
||||
end
|
||||
for pl=1, #players do
|
||||
minetest.close_formspec(players[pl]:get_player_name(), "mcl_chests:"..canonical_basename.."_"..p.x.."_"..p.y.."_"..p.z)
|
||||
end
|
||||
close_forms(canonical_basename, p)
|
||||
|
||||
minetest.swap_node(p, { name = small_name, param2 = param2 })
|
||||
create_entity(p, small_name, small_textures, param2, false, "default_chest", "mcl_chests_chest")
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
|
|
@ -197,7 +197,9 @@ local destruct_sign = function(pos)
|
|||
end
|
||||
local players = minetest.get_connected_players()
|
||||
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
|
||||
|
||||
|
|
Loading…
Reference in a new issue