1
0
Fork 0

Merge pull request 'Fix mcl_shields is_blocking crash when object not found under player' (#4134) from Impulse/MineClone2:mcl-shields-crash-fix into master

Reviewed-on: MineClone2/MineClone2#4134
Reviewed-by: the-real-herowl <the-real-herowl@noreply.git.minetest.land>
This commit is contained in:
the-real-herowl 2024-01-15 14:22:33 +00:00
commit 59ad110e6b
1 changed files with 10 additions and 8 deletions

View File

@ -112,6 +112,7 @@ end
function mcl_shields.is_blocking(obj) function mcl_shields.is_blocking(obj)
if not obj:is_player() then return end if not obj:is_player() then return end
if mcl_shields.players[obj] then
local blocking = mcl_shields.players[obj].blocking local blocking = mcl_shields.players[obj].blocking
if blocking <= 0 then if blocking <= 0 then
return return
@ -122,6 +123,7 @@ function mcl_shields.is_blocking(obj)
shieldstack = obj:get_inventory():get_stack("offhand", 1) shieldstack = obj:get_inventory():get_stack("offhand", 1)
end end
return blocking, shieldstack return blocking, shieldstack
end
end end
mcl_damage.register_modifier(function(obj, damage, reason) mcl_damage.register_modifier(function(obj, damage, reason)