mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-16 16:11:06 +01:00
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: https://git.minetest.land/MineClone2/MineClone2/pulls/4134 Reviewed-by: the-real-herowl <the-real-herowl@noreply.git.minetest.land>
This commit is contained in:
commit
59ad110e6b
1 changed files with 10 additions and 8 deletions
|
@ -112,16 +112,18 @@ 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
|
||||||
local blocking = mcl_shields.players[obj].blocking
|
if mcl_shields.players[obj] then
|
||||||
if blocking <= 0 then
|
local blocking = mcl_shields.players[obj].blocking
|
||||||
return
|
if blocking <= 0 then
|
||||||
end
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local shieldstack = obj:get_wielded_item()
|
local shieldstack = obj:get_wielded_item()
|
||||||
if blocking == 1 then
|
if blocking == 1 then
|
||||||
shieldstack = obj:get_inventory():get_stack("offhand", 1)
|
shieldstack = obj:get_inventory():get_stack("offhand", 1)
|
||||||
|
end
|
||||||
|
return blocking, shieldstack
|
||||||
end
|
end
|
||||||
return blocking, shieldstack
|
|
||||||
end
|
end
|
||||||
|
|
||||||
mcl_damage.register_modifier(function(obj, damage, reason)
|
mcl_damage.register_modifier(function(obj, damage, reason)
|
||||||
|
|
Loading…
Reference in a new issue