Fix problem with weapon swapping in replays
This commit is contained in:
parent
91f76b3836
commit
6badb845b5
@ -51,7 +51,7 @@ impl INode for ReplayPlayback {
|
||||
if !self.fast_forwarding {
|
||||
if let Some(map) = &mut self.current_map {
|
||||
for (id, data) in &frame.player_data {
|
||||
if !self.player_characters.contains_key(id) {
|
||||
if !self.player_characters.contains_key(id) && !data.is_dead {
|
||||
if let Some(player) =
|
||||
map.bind_mut().spawn_replay_player(*id, data.clone())
|
||||
{
|
||||
@ -97,9 +97,14 @@ impl INode for ReplayPlayback {
|
||||
character
|
||||
.bind_mut()
|
||||
.set_movement_dir(state.movement_dir.into());
|
||||
let weapon = character.bind().get_weapon().clone();
|
||||
if let Some(weapon) = weapon
|
||||
&& weapon.dyn_bind().get_type() != state.current_weapon
|
||||
{
|
||||
character
|
||||
.bind_mut()
|
||||
.swap_weapon(state.current_weapon, false);
|
||||
}
|
||||
} else {
|
||||
character.queue_free();
|
||||
self.player_characters.remove(&id);
|
||||
@ -238,6 +243,7 @@ pub struct ReplayPlayerState {
|
||||
pub movement_dir: NetVector3,
|
||||
pub look_up: f32,
|
||||
pub current_weapon: WeaponType,
|
||||
pub is_dead: bool,
|
||||
}
|
||||
|
||||
impl Player {
|
||||
@ -252,6 +258,7 @@ impl Player {
|
||||
.get_weapon()
|
||||
.map(|w| w.dyn_bind().get_type())
|
||||
.unwrap_or(WeaponType::Raygun),
|
||||
is_dead: character.dyn_bind().is_dead(),
|
||||
})
|
||||
} else {
|
||||
None
|
||||
|
||||
Loading…
Reference in New Issue
Block a user