Campfires can no longer be yeeted by arrows.

This commit is contained in:
Sam 2020-11-15 11:13:03 -06:00
parent 4872d285c3
commit 69bb54b4a2
2 changed files with 5 additions and 2 deletions

View File

@ -159,6 +159,6 @@ pub fn handle_create_waypoint(server: &mut Server, pos: Vec3<f32>) {
animated: true, animated: true,
}) })
.with(WaypointArea::default()) .with(WaypointArea::default())
.with(comp::Mass(100000.0)) .with(comp::Mass(10_f32.powi(10)))
.build(); .build();
} }

View File

@ -40,12 +40,15 @@ pub fn handle_knockback(server: &Server, entity: EcsEntity, impulse: Vec3<f32>)
if let Some(physics) = ecs.read_storage::<PhysicsState>().get(entity) { if let Some(physics) = ecs.read_storage::<PhysicsState>().get(entity) {
//Check if the entity is on a surface. If it is not, reduce knockback. //Check if the entity is on a surface. If it is not, reduce knockback.
let impulse = impulse let mut impulse = impulse
* if physics.on_surface().is_some() { * if physics.on_surface().is_some() {
1.0 1.0
} else { } else {
0.4 0.4
}; };
if let Some(mass) = ecs.read_storage::<comp::Mass>().get(entity) {
impulse /= mass.0;
}
let mut velocities = ecs.write_storage::<comp::Vel>(); let mut velocities = ecs.write_storage::<comp::Vel>();
if let Some(vel) = velocities.get_mut(entity) { if let Some(vel) = velocities.get_mut(entity) {
vel.0 = impulse; vel.0 = impulse;