diff --git a/crates/server/src/head_drop.rs b/crates/server/src/head_drop.rs index f85c1b2..734abef 100644 --- a/crates/server/src/head_drop.rs +++ b/crates/server/src/head_drop.rs @@ -32,7 +32,9 @@ fn on_head_drop( let angle = rand::random::() * PI * 2.; let spawn_impulse = Quat::from_rotation_y(angle) * Vec3::new(0.5, 0.6, 0.).normalize() * 180.; - if drop.impulse { + let impulse = drop.impulse; + + if impulse { commands.server_trigger(ToClients { mode: SendMode::Broadcast, message: PlaySound::HeadDrop, @@ -49,7 +51,6 @@ fn on_head_drop( Collider::sphere(1.5), LockedAxes::ROTATION_LOCKED, RigidBody::Dynamic, - OneShotImpulse(spawn_impulse), CollisionLayers::new(GameLayer::CollectiblePhysics, GameLayer::Level), Restitution::new(0.6), Children::spawn(SpawnWith({ @@ -71,6 +72,7 @@ fn on_head_drop( })), Replicated, )) + .insert_if(OneShotImpulse(spawn_impulse), move || impulse) .with_child(( Billboard::All, SquishAnimation(2.6),