forked from VoxeLibre/VoxeLibre
Compare commits
1 Commits
Author | SHA1 | Date |
---|---|---|
𝕵𝖔𝖍𝖆𝖓𝖓𝖊𝖘 𝕱𝖗𝖎𝖙𝖟 | 100a97aa41 |
|
@ -545,28 +545,21 @@ function mcl_util.deal_damage(target, damage, mcl_reason)
|
||||||
if luaentity then
|
if luaentity then
|
||||||
if luaentity.deal_damage then
|
if luaentity.deal_damage then
|
||||||
luaentity:deal_damage(damage, mcl_reason or {type = "generic"})
|
luaentity:deal_damage(damage, mcl_reason or {type = "generic"})
|
||||||
return
|
else
|
||||||
elseif luaentity.is_mob then
|
local puncher = mcl_reason and mcl_reason.direct or target
|
||||||
-- local puncher = mcl_reason and mcl_reason.direct or target
|
local puncher_pos = puncher:get_pos()
|
||||||
-- target:punch(puncher, 1.0, {full_punch_interval = 1.0, damage_groups = {fleshy = damage}}, vector.direction(puncher:get_pos(), target:get_pos()), damage)
|
local target_pos = target:get_pos()
|
||||||
if luaentity.health > 0 then
|
if not puncher_pos or not target_pos then return end
|
||||||
luaentity.health = luaentity.health - damage
|
target:punch(puncher, 1.0, {full_punch_interval = 1.0, damage_groups = {fleshy = damage}}, vector.direction(puncher_pos, target_pos), damage)
|
||||||
end
|
end
|
||||||
return
|
else -- Player
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local is_immortal = target:get_armor_groups().immortal or 0
|
|
||||||
if is_immortal>0 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local hp = target:get_hp()
|
local hp = target:get_hp()
|
||||||
|
|
||||||
if hp > 0 then
|
if hp > 0 then
|
||||||
target:set_hp(hp - damage, {_mcl_reason = mcl_reason})
|
target:set_hp(hp - damage, {_mcl_reason = mcl_reason})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function mcl_util.get_hp(obj)
|
function mcl_util.get_hp(obj)
|
||||||
local luaentity = obj:get_luaentity()
|
local luaentity = obj:get_luaentity()
|
||||||
|
|
Loading…
Reference in New Issue