Fix beam spawning in replays
This commit is contained in:
parent
8093ffb2be
commit
5b1f840e40
@ -11,6 +11,7 @@ use crate::{
|
||||
game_settings::{GameSettingsManager, VolumeSettings},
|
||||
net::util::{cast_ray, shotgun_ray},
|
||||
player::{DamageSource, shootable::Shootable},
|
||||
replay::StandaloneReplayManager,
|
||||
};
|
||||
|
||||
pub trait Weapon {
|
||||
@ -94,6 +95,8 @@ impl Weapon for Raygun {
|
||||
.map(|r| r.position)
|
||||
.unwrap_or(source.get_global_position() + dir * 100.);
|
||||
|
||||
godot_print!("from {} to {}", source.get_global_position(), beam_end);
|
||||
|
||||
if let Some(prefab) = &self.bullet_prefab {
|
||||
let mut bullet = prefab.instantiate_as::<Beam>();
|
||||
|
||||
@ -105,6 +108,11 @@ impl Weapon for Raygun {
|
||||
&& let Some(map) = &mut game.bind_mut().current_map
|
||||
{
|
||||
map.add_child(&bullet);
|
||||
} else if let Some(playback) =
|
||||
&mut StandaloneReplayManager::singleton().bind_mut().playback
|
||||
&& let Some(map) = &mut playback.bind_mut().current_map
|
||||
{
|
||||
map.add_child(&bullet);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user