1
0
Fork 0
mirror of https://codeberg.org/demostf/parser.git synced 2026-06-04 02:24:12 +02:00

split up gamestateanalyser

This commit is contained in:
Robin Appelman 2025-07-02 21:54:24 +02:00
commit b93390d1e4
7 changed files with 874 additions and 847 deletions

View file

@ -85,6 +85,7 @@ pub struct Player {
pub in_pvs: bool,
pub bounds: Box,
pub weapons: [Handle; 3],
pub handle: Handle,
pub(crate) conditions: [u8; 20],
}
@ -625,4 +626,16 @@ impl GameState {
pub fn remove_building(&mut self, entity_id: EntityId) {
self.buildings.remove(&entity_id);
}
pub fn get_player_by_weapon_handle(&mut self, handle: Handle) -> Option<&mut Player> {
self.players
.iter_mut()
.find(|player| player.weapons.contains(&handle))
}
pub fn get_player_by_handle(&mut self, handle: Handle) -> Option<&mut Player> {
self.players
.iter_mut()
.find(|player| player.handle == handle)
}
}