forked from MineClone5/MineClone5
Fix interact behavior to prevent hackers from get interact back through shields
This commit is contained in:
parent
e6bef67275
commit
33c7ce1610
|
@ -29,7 +29,7 @@ local psdef= {
|
|||
minpos = vector.new(-6,3,-6),
|
||||
maxpos = vector.new(6,15,6),
|
||||
minvel = vector.new(-vel,-falling_speed,-vel),
|
||||
maxvel = math.random(vel,-falling_speed+vel,vel),
|
||||
maxvel = vector.new(vel,-falling_speed+vel,vel),
|
||||
minacc = vector.new(0,0,0),
|
||||
maxacc = vector.new(0,-0.4,0),
|
||||
minexptime = 0.5,
|
||||
|
@ -46,7 +46,7 @@ local psdef_backsplash= {
|
|||
minpos = vector.new(-3,-1,-3),
|
||||
maxpos = vector.new(3,0,3),
|
||||
minvel = vector.new(-vel,falling_speed*2,-vel),
|
||||
maxvel = math.random(vel,falling_speed*2+vel,vel),
|
||||
maxvel = vector.new(vel,falling_speed*2+vel,vel),
|
||||
minacc = vector.new(0,0,0),
|
||||
maxacc = vector.new(0,0,0),
|
||||
minexptime = 0.1,
|
||||
|
|
|
@ -183,9 +183,12 @@ local function set_interact(player, interact)
|
|||
local player_name = player:get_player_name()
|
||||
local privs = minetest.get_player_privs(player_name)
|
||||
if privs.interact ~= interact then
|
||||
local meta = player:get_meta()
|
||||
if meta:get_int("ineract_revoked") ~= 1 then
|
||||
privs.interact = interact
|
||||
minetest.set_player_privs(player_name, privs)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local shield_hud = {}
|
||||
|
|
|
@ -20,12 +20,26 @@ end)
|
|||
|
||||
for _, action in pairs({"grant", "revoke"}) do
|
||||
minetest["register_on_priv_" .. action](function(name, _, priv)
|
||||
if priv == "fly" then
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if player then
|
||||
local meta = player:get_meta()
|
||||
|
||||
if priv == "fly" then
|
||||
meta:set_int("fly_changed", 1)
|
||||
end
|
||||
|
||||
--[[
|
||||
so e.g. hackers who have been revoked of the interact privilege
|
||||
will not automatically get the interact privilege through the mcl shields code back
|
||||
]]
|
||||
|
||||
if priv == "interact" then
|
||||
if action == "revoke" then
|
||||
meta:set_int("ineract_revoked", 1)
|
||||
else
|
||||
meta:set_int("ineract_revoked", 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
Loading…
Reference in New Issue