diff options
Diffstat (limited to 'pixel-client')
-rw-r--r-- | pixel-client/src/game.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/pixel-client/src/game.rs b/pixel-client/src/game.rs index 7e43bdc9..57f419e2 100644 --- a/pixel-client/src/game.rs +++ b/pixel-client/src/game.rs @@ -45,6 +45,7 @@ pub struct Game { tilemap: Tilemap, collision_map: HashSet<IVec2>, players: HashMap<PlayerID, Player>, + player_ids: HashSet<PlayerID>, items_removed: Vec<Item>, my_id: PlayerID, @@ -107,6 +108,7 @@ impl Game { items_removed: Vec::new(), interacting: false, score: Score::default(), + player_ids: HashSet::new(), camera_center: Vec2::ZERO, } } @@ -255,9 +257,11 @@ impl Game { }, }, ); + self.player_ids.insert(id); } PacketC::RemovePlayer { id } => { info!("remove player {}", id.0); + self.player_ids.remove(&id); self.players.remove(&id); } PacketC::Position { @@ -355,6 +359,8 @@ impl Game { self.tilemap.draw(ctx); + + if let Some(me) = self.players.get(&self.my_id) { let t = me.movement.get_interact_target(); ctx.draw_world( |