Merge pull request 'ITEMS/mcl_shields: fix runaway IO and unnecessary network traffic.' (#144) from fix-shield-io into master

Reviewed-on: MineClone5/MineClone5#144
This commit is contained in:
kay27 2022-01-30 02:25:39 +00:00
commit fb99cc5abe
1 changed files with 10 additions and 3 deletions

View File

@ -182,8 +182,10 @@ end
local function set_interact(player, interact)
local player_name = player:get_player_name()
local privs = minetest.get_player_privs(player_name)
privs.interact = interact
minetest.set_player_privs(player_name, privs)
if privs.interact ~= interact then
privs.interact = interact
minetest.set_player_privs(player_name, privs)
end
end
local shield_hud = {}
@ -195,7 +197,12 @@ local function remove_shield_hud(player)
set_shield(player, false, 1)
set_shield(player, false, 2)
end
player:hud_set_flags({wielditem = true})
local hf=player:hud_get_flags()
if not hf.wielditem then
player:hud_set_flags({wielditem = true})
end
playerphysics.remove_physics_factor(player, "speed", "shield_speed")
set_interact(player, true)
end