Bugfix: (regression) prevent pushing your teammates with the sword

This commit is contained in:
marco_a 2024-03-24 11:59:31 +01:00
parent edf453f5fa
commit ce2e4356b9
4 changed files with 11 additions and 9 deletions

View File

@ -59,8 +59,8 @@ weapons_lib.register_weapon("block_league:pixelgun", {
block_league.util_update_mag_hud(player:get_player_name(), weapon.name)
end,
on_hit = function(hitter, target, weapon, action, damage, hit_ppint)
return block_league.util_on_hit(hitter, target, weapon, action, damage, hit_ppint)
on_hit = function(hitter, target, weapon, action, hit_point, damage)
return block_league.util_on_hit(hitter, target, weapon, action, hit_point, damage)
end,
},

View File

@ -61,8 +61,8 @@ weapons_lib.register_weapon("block_league:smg", {
block_league.util_update_mag_hud(player:get_player_name(), weapon.name)
end,
on_hit = function(hitter, target, weapon, action, damage, hit_ppint)
return block_league.util_on_hit(hitter, target, weapon, action, damage, hit_ppint)
on_hit = function(hitter, target, weapon, action, hit_point, damage)
return block_league.util_on_hit(hitter, target, weapon, action, hit_point, damage)
end,
},

View File

@ -51,8 +51,8 @@ weapons_lib.register_weapon("block_league:sword", {
delay = 1.2,
sound = "bl_sword_hit",
on_hit = function(hitter, target, weapon, action, damage, hit_point)
return block_league.util_on_hit(hitter, target, weapon, action, damage, hit_point)
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)
end,
on_end = function(player, weapon, action)

View File

@ -37,12 +37,14 @@ end
function block_league.util_on_hit(hitter, target, weapon, action, damage, hit_point)
function block_league.util_on_hit(hitter, target, weapon, action, hit_point, damage, knockback)
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
if not arena_lib.is_player_playing(p_name, "block_league") or (is_target_player and not arena_lib.is_player_playing(t_name, "block_league")) then return 0 end
if not arena_lib.is_player_playing(p_name, "block_league")
or (is_target_player and not arena_lib.is_player_playing(t_name, "block_league"))
then return 0 end
local arena = arena_lib.get_arena_by_player(p_name)
@ -66,7 +68,7 @@ function block_league.util_on_hit(hitter, target, weapon, action, damage, hit_po
}
end
return damage
return damage, knockback
end