[5.6][armor] fix unsafe entity handling (unsure)

i'm not sure about this one, can't fnd a suitable test for it.
This commit is contained in:
iliekprogrammar 2022-08-07 12:43:24 +08:00
parent bf80074d98
commit 4f2789c498
No known key found for this signature in database
GPG Key ID: 8E7B20514DBCFBFA
1 changed files with 2 additions and 1 deletions

View File

@ -89,8 +89,9 @@ mcl_damage.register_modifier(function(obj, damage, reason)
local thorns_damage = thorns_damage_regular + thorns_damage_irregular
if thorns_damage > 0 and reason.type ~= "thorns" and reason.source ~= obj then
-- ERROR: [#2523] THIS WILL CAUSE INVALID OBJECTREFS
mcl_util.deal_damage(reason.source, thorns_damage, {type = "thorns", direct = obj})
-- mcl_util.deal_damage may remove object immediately
if not reason.source:get_pos() then return end
local thorns_item = thorns_pieces[math.random(#thorns_pieces)]