Log to see the latest actions in game (kills, suicides, ball, touchdowns)
This commit is contained in:
parent
dd72ab86bd
commit
a48ad037bc
189
bl_HUD/hud_log.lua
Normal file
189
bl_HUD/hud_log.lua
Normal file
@ -0,0 +1,189 @@
|
||||
local function calc_action_offset(receiver) end
|
||||
|
||||
local row1_height_txt = 24
|
||||
local row2_height_txt = 76
|
||||
local row3_height_txt = 128
|
||||
|
||||
local row1_height_img = row1_height_txt -14
|
||||
local row2_height_img = row2_height_txt -14
|
||||
local row3_height_img = row3_height_txt -14
|
||||
|
||||
|
||||
function block_league.hud_log_create(p_name)
|
||||
|
||||
local icon_scale = { x = 3, y = 3}
|
||||
|
||||
Panel:new("bl_log", {
|
||||
player = p_name,
|
||||
bg = "",
|
||||
position = { x = 1, y = 0 },
|
||||
alignment = { x = -1, y = 1 },
|
||||
|
||||
sub_img_elems = {
|
||||
action_1 = {
|
||||
alignment = {x = -1, y = 1},
|
||||
scale = icon_scale
|
||||
},
|
||||
action_2 = {
|
||||
alignment = {x = -1, y = 1},
|
||||
scale = icon_scale
|
||||
},
|
||||
action_3 = {
|
||||
alignment = {x = -1, y = 1},
|
||||
scale = icon_scale
|
||||
},
|
||||
},
|
||||
sub_txt_elems = {
|
||||
executor_1 = {
|
||||
alignment = {x = -1, y = 1},
|
||||
},
|
||||
executor_2 = {
|
||||
alignment = {x = -1, y = 1},
|
||||
},
|
||||
executor_3 = {
|
||||
alignment = {x = -1, y = 1},
|
||||
},
|
||||
receiver_1 = {
|
||||
alignment = {x = -1, y = 1},
|
||||
offset = { x = -20, y = row1_height_txt }
|
||||
},
|
||||
receiver_2 = {
|
||||
alignment = {x = -1, y = 1},
|
||||
offset = { x = -20, y = row2_height_txt }
|
||||
},
|
||||
receiver_3 = {
|
||||
alignment = {x = -1, y = 1},
|
||||
offset = { x = -20, y = row3_height_txt }
|
||||
},
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
|
||||
function block_league.hud_log_update(arena, action, executor, receiver)
|
||||
|
||||
for pl_name, pl_stats in pairs(arena.players) do
|
||||
|
||||
local panel = panel_lib.get_panel(pl_name, "bl_log")
|
||||
|
||||
local executor_color
|
||||
local receiver_color
|
||||
|
||||
if arena.players[executor].teamID == pl_stats.teamID then
|
||||
executor_color = "0xabf877"
|
||||
receiver_color = "0xff8e8e"
|
||||
else
|
||||
executor_color = "0xff8e8e"
|
||||
receiver_color = "0xabf877"
|
||||
end
|
||||
|
||||
panel:update(_,
|
||||
|
||||
-- icone
|
||||
{
|
||||
action_1 = {
|
||||
offset = { x = calc_action_offset(panel.receiver_2.text), y = row1_height_img },
|
||||
text = panel.action_2.text
|
||||
},
|
||||
action_2 = {
|
||||
offset = { x = calc_action_offset(panel.receiver_3.text), y = row2_height_img },
|
||||
text = panel.action_3.text
|
||||
},
|
||||
action_3 = {
|
||||
offset = { x = calc_action_offset(receiver), y = row3_height_img },
|
||||
text = action
|
||||
}
|
||||
},
|
||||
|
||||
-- testo
|
||||
{
|
||||
executor_1 = {
|
||||
offset = { x = calc_action_offset(panel.receiver_2.text) - 60, y = row1_height_txt },
|
||||
number = panel.executor_2.number,
|
||||
text = panel.executor_2.text
|
||||
},
|
||||
executor_2 = {
|
||||
offset = { x = calc_action_offset(panel.receiver_3.text) - 60, y = row2_height_txt },
|
||||
number = panel.executor_3.number,
|
||||
text = panel.executor_3.text
|
||||
},
|
||||
executor_3 = {
|
||||
offset = { x = calc_action_offset(receiver) - 60, y = row3_height_txt },
|
||||
number = executor_color,
|
||||
text = executor
|
||||
},
|
||||
receiver_1 = {
|
||||
number = panel.receiver_2.number,
|
||||
text = panel.receiver_2.text
|
||||
},
|
||||
receiver_2 = {
|
||||
number = panel.receiver_3.number,
|
||||
text = panel.receiver_3.text
|
||||
},
|
||||
receiver_3 = {
|
||||
number = receiver_color,
|
||||
text = receiver
|
||||
}
|
||||
})
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function block_league.hud_log_clear(arena)
|
||||
|
||||
for pl_name, _ in pairs(arena.players) do
|
||||
local panel = panel_lib.get_panel(pl_name, "bl_log")
|
||||
|
||||
panel:update(_,
|
||||
|
||||
-- icone
|
||||
{
|
||||
action_1 = {
|
||||
text = ""
|
||||
},
|
||||
action_2 = {
|
||||
text = ""
|
||||
},
|
||||
action_3 = {
|
||||
text = ""
|
||||
}
|
||||
},
|
||||
|
||||
-- testo
|
||||
{
|
||||
executor_1 = {
|
||||
text = ""
|
||||
},
|
||||
executor_2 = {
|
||||
text = ""
|
||||
},
|
||||
executor_3 = {
|
||||
text = ""
|
||||
},
|
||||
receiver_1 = {
|
||||
text = ""
|
||||
},
|
||||
receiver_2 = {
|
||||
text = ""
|
||||
},
|
||||
receiver_3 = {
|
||||
text = ""
|
||||
}
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----------------------------------------------
|
||||
---------------FUNZIONI LOCALI----------------
|
||||
----------------------------------------------
|
||||
|
||||
function calc_action_offset(receiver)
|
||||
return -20 - (8 * string.len(receiver))
|
||||
end
|
@ -151,6 +151,7 @@ function create_and_show_HUD(arena, p_name)
|
||||
block_league.scoreboard_create(arena, p_name)
|
||||
block_league.energy_create(arena, p_name)
|
||||
block_league.bullets_hud_create(p_name)
|
||||
block_league.hud_log_create(p_name)
|
||||
end
|
||||
|
||||
|
||||
@ -162,6 +163,7 @@ function remove_HUD(p_name)
|
||||
panel_lib.get_panel(p_name, "bl_bullets"):remove()
|
||||
panel_lib.get_panel(p_name, "bl_energy"):remove()
|
||||
panel_lib.get_panel(p_name, "bl_broadcast"):remove()
|
||||
panel_lib.get_panel(p_name, "bl_log"):remove()
|
||||
end
|
||||
|
||||
|
||||
|
@ -22,6 +22,7 @@ function block_league.energy_refill_loop(arena)
|
||||
if player:get_pos().y < arena.min_y then
|
||||
player:set_hp(0)
|
||||
player:get_meta():set_int("bl_has_ball", 0)
|
||||
block_league.hud_log_update(arena, "bl_log_suicide.png", pl_name, "")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -283,6 +283,8 @@ function check_for_touchdown(id, arena, ball, wielder, w_pos, goal)
|
||||
local w_name = wielder:get_player_name()
|
||||
local teamID = arena.players[w_name].teamID
|
||||
|
||||
block_league.hud_log_update(arena, "bl_log_TD.png", w_name, "")
|
||||
|
||||
add_point(teamID, arena)
|
||||
after_point(w_name, teamID, arena)
|
||||
|
||||
@ -341,6 +343,8 @@ function announce_ball_possession_change(arena, w_name, is_ball_lost)
|
||||
local team = arena_lib.get_players_in_team(arena, teamID)
|
||||
local enemy_team = arena_lib.get_players_in_team(arena, enemy_teamID)
|
||||
|
||||
block_league.hud_log_update(arena, "bl_log_ball.png", w_name, "")
|
||||
|
||||
if is_ball_lost then
|
||||
for _, pl_name in pairs(team) do
|
||||
minetest.sound_play("bl_crowd_ohno", {to_player = pl_name})
|
||||
|
@ -52,26 +52,29 @@ end
|
||||
|
||||
|
||||
function round_start(arena)
|
||||
for p_name, stats in pairs(arena.players) do
|
||||
|
||||
local player = minetest.get_player_by_name(p_name)
|
||||
for p_name, stats in pairs(arena.players) do
|
||||
|
||||
if player:get_hp() > 0 then
|
||||
player:set_hp(20)
|
||||
arena.players[p_name].energy = 100
|
||||
block_league.energy_update(arena, p_name)
|
||||
end
|
||||
local player = minetest.get_player_by_name(p_name)
|
||||
|
||||
block_league.refill_weapons(arena, p_name)
|
||||
player:get_meta():set_int("bl_reloading", 0)
|
||||
player:get_meta():set_int("bl_death_delay", 0)
|
||||
|
||||
player:set_physics_override({ speed = block_league.SPEED })
|
||||
player:set_pos(arena_lib.get_random_spawner(arena, stats.teamID))
|
||||
|
||||
minetest.sound_play("bl_voice_fight", {to_player = p_name})
|
||||
if player:get_hp() > 0 then
|
||||
player:set_hp(20)
|
||||
arena.players[p_name].energy = 100
|
||||
block_league.energy_update(arena, p_name)
|
||||
end
|
||||
|
||||
block_league.refill_weapons(arena, p_name)
|
||||
player:get_meta():set_int("bl_reloading", 0)
|
||||
player:get_meta():set_int("bl_death_delay", 0)
|
||||
|
||||
player:set_physics_override({ speed = block_league.SPEED })
|
||||
player:set_pos(arena_lib.get_random_spawner(arena, stats.teamID))
|
||||
|
||||
minetest.sound_play("bl_voice_fight", {to_player = p_name})
|
||||
end
|
||||
|
||||
block_league.hud_log_clear(arena)
|
||||
|
||||
if arena.mode == 1 then
|
||||
load_ball(arena)
|
||||
end
|
||||
|
@ -3,7 +3,7 @@
|
||||
local bullet_entity = bullet_set_entity(bullet.name, bullet, damage, bullet_trail)
|
||||
|
||||
minetest.register_entity("block_league:" .. bullet.name .. "_entity", bullet_entity)
|
||||
|
||||
|
||||
return bullet_entity
|
||||
end
|
||||
|
||||
@ -125,6 +125,7 @@ function bullet_set_entity(name, def, dmg, trail)
|
||||
if collision.object:is_player() then
|
||||
|
||||
if collision.object:get_player_name() ~= self.p_name then
|
||||
-- TODO: non funziona, la funzione è stata cambiata. Bisogna far passare l'arma
|
||||
block_league.apply_damage(minetest.get_player_by_name(self.p_name), collision.object, self.initial_properties.bullet_damage, 0, false)
|
||||
buffer_boolean = true
|
||||
elseif collision.object:get_player_name() == self.p_name then
|
||||
|
@ -67,7 +67,7 @@ block_league.register_weapon("block_league:sword", {
|
||||
end)
|
||||
|
||||
if not pointed_players then return end
|
||||
block_league.apply_damage(user, pointed_players, weapon.damage, weapon.knockback, false)
|
||||
block_league.apply_damage(user, pointed_players, weapon, false)
|
||||
|
||||
end,
|
||||
})
|
||||
|
@ -99,7 +99,7 @@ function block_league.shoot_hitscan(user, weapon, pointed_thing)
|
||||
local pointed_players = block_league.get_pointed_players(pos_head, dir, weapon.weapon_range, user, weapon.bullet_trail, weapon.pierce)
|
||||
|
||||
if pointed_players then
|
||||
block_league.apply_damage(user, pointed_players, weapon.damage, weapon.knockback, weapon.decrease_damage_with_distance)
|
||||
block_league.apply_damage(user, pointed_players, weapon, weapon.decrease_damage_with_distance)
|
||||
end
|
||||
end
|
||||
|
||||
@ -235,9 +235,12 @@ end
|
||||
|
||||
|
||||
|
||||
-- block_league.apply_damage(user, pointed_players, bullet_definition.bullet_damage, bullet_definition.knockback, bullet_definition.decrease_damage_with_distance)
|
||||
-- può avere uno o più target: formato ObjectRef
|
||||
function block_league.apply_damage(user, targets, damage, knockback, decrease_damage_with_distance, knockback_dir)
|
||||
function block_league.apply_damage(user, targets, weapon, decrease_damage_with_distance, knockback_dir)
|
||||
|
||||
local damage = weapon.damage
|
||||
local knockback = weapon.knockback
|
||||
|
||||
local p_name = user:get_player_name()
|
||||
local arena = arena_lib.get_arena_by_player(p_name)
|
||||
local killed_players = 0
|
||||
@ -278,7 +281,7 @@ function block_league.apply_damage(user, targets, damage, knockback, decrease_da
|
||||
})
|
||||
-- sennò kaputt
|
||||
else
|
||||
kill(arena, p_name, target)
|
||||
kill(arena, weapon, p_name, target)
|
||||
if t_name ~= p_name then
|
||||
killed_players = killed_players +1
|
||||
end
|
||||
@ -520,7 +523,7 @@ function check_weapon_type_and_attack(player, weapon, pointed_thing)
|
||||
else
|
||||
if pointed_thing.type ~= "object" or not pointed_thing.ref:is_player() then return end
|
||||
|
||||
block_league.apply_damage(player, pointed_thing.ref, weapon.damage, weapon.knockback, false, player:get_look_dir())
|
||||
block_league.apply_damage(player, pointed_thing.ref, weapon, false, player:get_look_dir())
|
||||
end
|
||||
end
|
||||
|
||||
@ -544,7 +547,7 @@ end
|
||||
|
||||
|
||||
|
||||
function kill(arena, p_name, target)
|
||||
function kill(arena, weapon, p_name, target)
|
||||
|
||||
-- riproduco suono morte
|
||||
minetest.sound_play("bl_kill", {to_player = p_name})
|
||||
@ -566,6 +569,7 @@ function kill(arena, p_name, target)
|
||||
|
||||
-- aggiorno HUD
|
||||
block_league.info_panel_update(arena)
|
||||
block_league.hud_log_update(arena, weapon.inventory_image, p_name, t_name)
|
||||
|
||||
-- se è DM e il cap è raggiunto, finisce match
|
||||
if arena.mode == 2 then
|
||||
@ -577,6 +581,7 @@ function kill(arena, p_name, target)
|
||||
end
|
||||
else
|
||||
block_league.HUD_kill_update(t_name, S("You've killed yourself"))
|
||||
block_league.hud_log_update(arena, "bl_log_suicide.png", p_name, t_name)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -29,6 +29,7 @@ block_league.explode = function(self)
|
||||
|
||||
-- Se colpisco me stesso, prendo 1/5 di danno
|
||||
if (target_name ~= p_name) then
|
||||
-- TODO: non funziona, la funzione è stata cambiata. Bisogna far passare l'arma
|
||||
block_league.apply_damage(minetest.get_player_by_name(p_name), obj, damage, 0, false)
|
||||
else
|
||||
block_league.apply_damage(minetest.get_player_by_name(p_name), obj, (damage/5), 0, false)
|
||||
@ -86,6 +87,7 @@ block_league.grenade_explode = function(self)
|
||||
p_name = self.old_p_name
|
||||
end
|
||||
|
||||
-- TODO: non funziona, la funzione è stata cambiata. Bisogna far passare l'arma
|
||||
block_league.apply_damage(minetest.get_player_by_name(p_name), obj, damage, 0, false)
|
||||
|
||||
elseif obj ~= self.object and obj:get_luaentity() then
|
||||
|
1
init.lua
1
init.lua
@ -86,6 +86,7 @@ dofile(modpath .. "/bl_HUD/hud_bullets.lua")
|
||||
dofile(modpath .. "/bl_HUD/hud_energy.lua")
|
||||
dofile(modpath .. "/bl_HUD/hud_info_panel.lua")
|
||||
dofile(modpath .. "/bl_HUD/hud_inputs.lua")
|
||||
dofile(modpath .. "/bl_HUD/hud_log.lua")
|
||||
dofile(modpath .. "/bl_HUD/hud_scoreboard.lua")
|
||||
-- abstract weapons
|
||||
dofile(modpath .. "/bl_weapons/bullets.lua")
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 205 B |
BIN
textures/bl_log_TD.png
Normal file
BIN
textures/bl_log_TD.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 189 B |
BIN
textures/bl_log_ball.png
Normal file
BIN
textures/bl_log_ball.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 192 B |
BIN
textures/bl_log_suicide.png
Normal file
BIN
textures/bl_log_suicide.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 195 B |
Loading…
x
Reference in New Issue
Block a user