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: if self.current_tick.empty:
return return
# check if current tick has NaN values # # check if current tick has NaN values
if self.current_tick.isnull().values.any(): # if self.current_tick.isnull().values.any():
return # return
for player in self.get_players(): for player in self.get_players():
player.x = self.current_tick[self.current_tick["player_steamid"] == player.steam_id]["X"].values[0] 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.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.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.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] player.current_weapon = self.current_tick[self.current_tick["player_steamid"] == player.steam_id]["active_weapon_name"].values[0]
def _update_round(self) -> None: def _update_round(self) -> None:

View File

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

View File

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

View File

@@ -83,7 +83,7 @@ class StartMenu(GameState):
demo_parser = demoparser2.DemoParser(demo_file) demo_parser = demoparser2.DemoParser(demo_file)
game_info = demo_parser.parse_ticks(["X", "Y", "Z", "pitch", "yaw", "is_alive", "team", "player_steamid", 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", "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() header_info = demo_parser.parse_header()
map_name = header_info['map_name'] map_name = header_info['map_name']
players = demo_parser.parse_player_info() players = demo_parser.parse_player_info()