Stop playback on local player respawn
This commit is contained in:
parent
5c51e25a11
commit
5748a0af7b
@ -785,6 +785,10 @@ impl Game {
|
||||
}
|
||||
|
||||
pub fn spawn_player_server(&mut self, id: u16) -> Option<DynGd<CharacterBody3D, dyn IPlayer>> {
|
||||
if id == self.self_id.unwrap_or(0) {
|
||||
self.stop_playback();
|
||||
}
|
||||
|
||||
if let Some(player) = self.find_player_mut(id)
|
||||
&& let Some(character) = &mut player.character
|
||||
{
|
||||
@ -854,6 +858,10 @@ impl Game {
|
||||
|
||||
// Method called on the client-side whenever a player has spawned
|
||||
pub fn spawn_player_client(&mut self, id: u16, transform: NetTransform) {
|
||||
if id == self.self_id.unwrap_or(0) {
|
||||
self.stop_playback();
|
||||
}
|
||||
|
||||
if let Some(map) = &mut self.current_map {
|
||||
if let Some(player) = self.players.iter_mut().find(|p| p.id() == id) {
|
||||
if let Some(character) = &mut player.character {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user