Bomb: add critical

This commit is contained in:
marco_a 2024-12-25 15:52:53 +01:00
parent 23dbc23e31
commit d909accb17
2 changed files with 11 additions and 5 deletions

View File

@ -1,5 +1,5 @@
local S = minetest.get_translator("block_league")
local dmg = 35
local dmg = 20
local function ignite_sound_and_animation() end
@ -134,8 +134,8 @@ weapons_lib.register_weapon("block_league:bomb", {
block_league.util_update_mag_hud(player:get_player_name(), weapon.name)
end,
on_hit = function(hitter, target, weapon, action, hit_point, damage, knockback)
return block_league.util_on_hit(hitter, target, weapon, action, hit_point, damage, knockback)
on_hit = function(hitter, target, weapon, action, hit_point, damage, knockback, proxy_obj)
return block_league.util_on_hit(hitter, target, weapon, action, hit_point, damage, knockback, proxy_obj)
end,
}
})

View File

@ -37,7 +37,7 @@ end
function block_league.util_on_hit(hitter, target, weapon, action, hit_point, damage, knockback)
function block_league.util_on_hit(hitter, target, weapon, action, hit_point, damage, knockback, proxy_obj)
local p_name = hitter:get_player_name()
local is_target_player = target:is_player()
local t_name = is_target_player and target:get_player_name() or target:get_luaentity().name
@ -71,7 +71,13 @@ function block_league.util_on_hit(hitter, target, weapon, action, hit_point, dam
end
end
local is_critical = hit_point and hit_point.y - target:get_pos().y > 1.275 -- TODO: la spada non lo passa
local is_critical
if action.bullet and action.bullet.explosion then -- TODO: in futuro explosion sarà fuori da bullet
is_critical = vector.distance(proxy_obj:get_pos(), target:get_pos()) <= 2
else
is_critical = hit_point and hit_point.y - target:get_pos().y > 1.275 -- TODO: la spada non lo passa
end
if is_critical then
damage = damage * 1.5