pub(crate) fn yank(
    &mut self,
    player_id: &crate::PlayerKey,
    links: &mut std::collections::HashMap<crate::PlayerKey, puzzleverse_core::asset::rules::RealmLink>,
  ) {
    if let Some((point, _)) = self.active_players.remove(player_id) {
      let time = chrono::Utc::now();
      self.committed_movements.retain(|m| m.player != *player_id || m.movement.time() < &time);
      self.committed_movements.push(crate::realm::PlayerMovement {
        player: player_id.clone(),
        movement: puzzleverse_core::CharacterMotion::Leave { from: point.clone(), start: time },
        leave_pieces: self.manifold.active_proximity(&point).collect(),
        enter_pieces: vec![],
      });
      let mut output_events = Vec::new();
      for target in self.manifold.active_proximity(&point) {
        match self.pieces.get_mut(target) {
          Some(piece) => output_events.extend(
            piece
              .walk(player_id, crate::realm::navigation::PlayerNavigationEvent::Leave)
              .into_iter()
              .map(|(event_name, value)| crate::puzzle::Event { sender: target, name: event_name, value }),
          ),
          None => (),
        }
      }

      crate::puzzle::process(&mut *self, links, output_events.into_iter());
    }
  }
/// Forcibly extract a player from this realm
Forcibly extract a player from this realm
Forcibly extract a player from this realm
pub(crate) fn yank(
    &mut self,
    player_id: &crate::PlayerKey,
    links: &mut std::collections::HashMap<crate::PlayerKey, puzzleverse_core::asset::rules::RealmLink>,
  ) {
    if let Some((point, _)) = self.active_players.remove(player_id) {
      let time = chrono::Utc::now();
      self.committed_movements.retain(|m| m.player != *player_id || m.movement.time() < &time);
      self.committed_movements.push(crate::realm::PlayerMovement {
        player: player_id.clone(),
        movement: puzzleverse_core::CharacterMotion::Leave { from: point.clone(), start: time },
        leave_pieces: self.manifold.active_proximity(&point).collect(),
        enter_pieces: vec![],
      });
      let mut output_events = Vec::new();
      for target in self.manifold.active_proximity(&point) {
        match self.pieces.get_mut(target) {
          Some(piece) => output_events.extend(
            piece
              .walk(player_id, crate::realm::navigation::PlayerNavigationEvent::Leave)
              .into_iter()
              .map(|(event_name, value)| crate::puzzle::Event { sender: target, name: event_name, value }),
          ),
          None => (),
        }
      }
      crate::puzzle::process(&mut *self, links, output_events.into_iter());
    }
  }
pub ( crate ) fn yank ( & mut self , player_id : & crate :: PlayerKey , links : & mut std :: collections :: HashMap < crate :: PlayerKey , puzzleverse_core :: asset :: rules :: RealmLink > , ) { if let Some ( ( point , _ ) ) = self . active_players . remove ( player_id ) { let time = chrono :: Utc :: now ( ) ; self . committed_movements . retain ( | m | m . player != * player_id || m . movement . time ( ) < & time ) ; self . committed_movements . push ( crate :: realm :: PlayerMovement { player : player_id . clone ( ) , movement : puzzleverse_core :: CharacterMotion :: Leave { from : point . clone ( ) , start : time } , leave_pieces : self . manifold . active_proximity ( & point ) . collect ( ) , enter_pieces : vec ! [ ] , } ) ; let mut output_events = Vec :: new ( ) ; for target in self . manifold . active_proximity ( & point ) { match self . pieces . get_mut ( target ) { Some ( piece ) => output_events . extend ( piece . walk ( player_id , crate :: realm :: navigation :: PlayerNavigationEvent :: Leave ) . into_iter ( ) . map ( | ( event_name , value ) | crate :: puzzle :: Event { sender : target , name : event_name , value } ) , ) , None => ( ) , } } crate :: puzzle :: process ( & mut * self , links , output_events . into_iter ( ) ) ; } }
Forcibly extract a player from this realm
Forcibly extract a player from this realm
&mut self
player_id
&crate::PlayerKey
links
&mut std::collections::HashMap<crate::PlayerKey, puzzleverse_core::asset::rules::RealmLink>
&mut self
player_id
&crate::PlayerKey
links
&mut std::collections::HashMap<crate::PlayerKey, puzzleverse_core::asset::rules::RealmLink>