Update player health from state in replays
This commit is contained in:
parent
def6539bbc
commit
1a0a11cccc
@ -326,6 +326,11 @@ impl RemotePlayer {
|
|||||||
double_health_bar.set_value(double_value);
|
double_health_bar.set_value(double_value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn set_hp(&mut self, health: i32) {
|
||||||
|
self.health = health;
|
||||||
|
self.update_health_bar();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[godot_dyn]
|
#[godot_dyn]
|
||||||
|
|||||||
@ -308,6 +308,7 @@ impl INode for ReplayPlayback {
|
|||||||
character
|
character
|
||||||
.bind_mut()
|
.bind_mut()
|
||||||
.set_movement_dir(state.movement_dir.into());
|
.set_movement_dir(state.movement_dir.into());
|
||||||
|
character.bind_mut().set_hp(state.health);
|
||||||
let weapon = character.bind().get_weapon().clone();
|
let weapon = character.bind().get_weapon().clone();
|
||||||
if let Some(weapon) = weapon
|
if let Some(weapon) = weapon
|
||||||
&& weapon.dyn_bind().get_type() != state.current_weapon
|
&& weapon.dyn_bind().get_type() != state.current_weapon
|
||||||
@ -593,6 +594,7 @@ pub struct ReplayPlayerState {
|
|||||||
pub is_dead: bool,
|
pub is_dead: bool,
|
||||||
pub kills: u16,
|
pub kills: u16,
|
||||||
pub deaths: u16,
|
pub deaths: u16,
|
||||||
|
pub health: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Player {
|
impl Player {
|
||||||
@ -610,6 +612,7 @@ impl Player {
|
|||||||
is_dead: character.dyn_bind().is_dead(),
|
is_dead: character.dyn_bind().is_dead(),
|
||||||
kills: player.data.kills,
|
kills: player.data.kills,
|
||||||
deaths: player.data.deaths,
|
deaths: player.data.deaths,
|
||||||
|
health: character.dyn_bind().get_health(),
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user