Don't increase points when killing players/entities belonging to your team (bomb, closes #152)
This commit is contained in:
parent
b4059fdd93
commit
2b250bd844
@ -80,7 +80,7 @@ arena_lib.register_minigame("block_league", {
|
||||
--entering_time = 0, -- inutilizzato, servirà prob in futuro per calcolare exp
|
||||
current_weapon = "",
|
||||
dmg_received = {}, -- KEY: dmgr_name, VALUE: {timestamp, dmg, w_icon (questa solo x armi)}. Se è entità, p_name@ent_name -- TODO: in futuro usa UUID
|
||||
dmg_dealt = 0,
|
||||
dmg_dealt = 0, -- memorizza il danno inflitto ai nemici per il conteggio dei punti
|
||||
entities = {} -- KEY: _name, VALUE: ObjRef -- TEMP: in futuro usare UUID https://github.com/minetest/minetest/pull/14135
|
||||
},
|
||||
spectator_properties = {
|
||||
|
@ -116,24 +116,12 @@ function block_league.util_on_after_hit(hitter, weapon, objects_hit, total_damag
|
||||
|
||||
if arena.mode == 0 or arena.weapons_disabled then return end -- nessun prestigio nel tutorial; niente punti se uccido es. con bomba dopo aver fatto punto
|
||||
|
||||
-- aggiorno danno totale inflitto ed eventualmente aumento i punti
|
||||
local p_data = arena.players[p_name]
|
||||
local prev_dmg_dealt = p_data.dmg_dealt
|
||||
local dmg_dealt = prev_dmg_dealt + total_damage
|
||||
local dmg_points = math.floor(dmg_dealt/10) - math.floor(prev_dmg_dealt/10)
|
||||
|
||||
if dmg_points > 0 then
|
||||
p_data.points = p_data.points + dmg_points
|
||||
block_league.HUD_infopanel_update_points(arena, p_data.teamID)
|
||||
block_league.HUD_spectate_update(arena, p_name, "points")
|
||||
end
|
||||
|
||||
p_data.dmg_dealt = dmg_dealt
|
||||
|
||||
local killed_players = 0
|
||||
local killed_players_enemies = 0
|
||||
local killed_players_team = 0
|
||||
local enemies_damage = 0
|
||||
|
||||
-- calcolo informazioni
|
||||
for _, t_data in pairs(objects_hit) do
|
||||
local is_player = t_data.type == "player"
|
||||
local obj = t_data.ref
|
||||
@ -144,6 +132,10 @@ function block_league.util_on_after_hit(hitter, weapon, objects_hit, total_damag
|
||||
local in_same_team = is_player and arena_lib.is_player_in_same_team(arena, p_name, obj:get_player_name())
|
||||
or (entity_lua and block_league.is_entity_in_player_team(p_name, entity_lua))
|
||||
|
||||
if not in_same_team then
|
||||
enemies_damage = enemies_damage + t_data.damage
|
||||
end
|
||||
|
||||
if (is_player and obj:get_hp() <= 0) or (not is_player and entity_lua._is_dying) then
|
||||
if is_player then
|
||||
block_league.kill_player(arena, weapon.inventory_image, hitter, obj)
|
||||
@ -172,6 +164,20 @@ function block_league.util_on_after_hit(hitter, weapon, objects_hit, total_damag
|
||||
end
|
||||
end
|
||||
|
||||
-- aggiorno danno totale inflitto ed eventualmente aumento i punti
|
||||
local p_data = arena.players[p_name]
|
||||
local prev_dmg_dealt = p_data.dmg_dealt
|
||||
local dmg_dealt = prev_dmg_dealt + enemies_damage
|
||||
local dmg_points = math.floor(dmg_dealt/10) - math.floor(prev_dmg_dealt/10)
|
||||
|
||||
if dmg_points > 0 then
|
||||
p_data.points = p_data.points + dmg_points
|
||||
block_league.HUD_infopanel_update_points(arena, p_data.teamID)
|
||||
block_league.HUD_spectate_update(arena, p_name, "points")
|
||||
end
|
||||
|
||||
p_data.dmg_dealt = dmg_dealt
|
||||
|
||||
-- medaglie
|
||||
--
|
||||
-- eventuale medaglia doppia/tripla uccisione
|
||||
|
Loading…
x
Reference in New Issue
Block a user