ADD armour value & PATCH freezing bug

This commit is contained in:
2025-04-27 01:29:41 +02:00
parent 7c63bc781c
commit efdaee6147
4 changed files with 7 additions and 4 deletions

View File

@@ -24,9 +24,9 @@ class Match:
if self.current_tick.empty:
return
# check if current tick has NaN values
if self.current_tick.isnull().values.any():
return
# # check if current tick has NaN values
# if self.current_tick.isnull().values.any():
# return
for player in self.get_players():
player.x = self.current_tick[self.current_tick["player_steamid"] == player.steam_id]["X"].values[0]
@@ -37,6 +37,7 @@ class Match:
player.dead = self.current_tick[self.current_tick["player_steamid"] == player.steam_id]["is_alive"].values[0] == 0
player.is_shooting = self.current_tick[self.current_tick["player_steamid"] == player.steam_id]["shots_fired"].values[0]
player.health = int(self.current_tick[self.current_tick["player_steamid"] == player.steam_id]["health"].values[0])
player.armour = int(self.current_tick[self.current_tick["player_steamid"] == player.steam_id]["armor_value"].values[0])
player.current_weapon = self.current_tick[self.current_tick["player_steamid"] == player.steam_id]["active_weapon_name"].values[0]
def _update_round(self) -> None:

View File

@@ -9,6 +9,7 @@ class Player:
self.yaw = yaw # Probably only need this if top-down
self.health = 100
self.armour = 0
self.dead = False
self.is_shooting = False
self.current_weapon = None

View File

@@ -20,6 +20,7 @@ class InfoRenderer:
player_info = f"Player: {self.selected_player.name}\n"
player_info += f"Active Weapon: {self.selected_player.current_weapon}\n"
player_info += f"Health: {self.selected_player.health}\n"
player_info += f"Armour: {self.selected_player.armour}\n"
text_surface = self.small_font.render(player_info, True, self.styling["text_colour"])
self.screen.blit(text_surface, (10, 100))

View File

@@ -83,7 +83,7 @@ class StartMenu(GameState):
demo_parser = demoparser2.DemoParser(demo_file)
game_info = demo_parser.parse_ticks(["X", "Y", "Z", "pitch", "yaw", "is_alive", "team", "player_steamid",
"team_rounds_total", "team_num", "total_rounds_played", "shots_fired",
"health", "active_weapon_name"])
"health", "armor_value", "active_weapon_name"])
header_info = demo_parser.parse_header()
map_name = header_info['map_name']
players = demo_parser.parse_player_info()