Browse Source

Get rid of unused physics systems

Getty Ritter 4 years ago
parent
commit
166582f034
2 changed files with 0 additions and 41 deletions
  1. 0 2
      Cargo.toml
  2. 0 39
      src/sys/physics.rs

+ 0 - 2
Cargo.toml

@@ -10,9 +10,7 @@ tiled = "0.8"
 itertools = "0.8"
 specs = "0.15"
 specs-derive = "0.4.0"
-# sdl2 = "*"
 ncollide2d = "0.20"
 nalgebra = "0.18"
-# specs-physics = "*"
 winit = "0.19"
 mint = "0.5"

+ 0 - 39
src/sys/physics.rs

@@ -52,31 +52,6 @@ impl<'a> specs::System<'a> for Collide {
     }
 }
 
-struct Intersection;
-
-impl<'a> specs::System<'a> for Intersection {
-    type SystemData = (
-        specs::Entities<'a>,
-        specs::ReadStorage<'a, Position>,
-        specs::ReadStorage<'a, Velocity>,
-        specs::ReadStorage<'a, Blocking>,
-        specs::WriteStorage<'a, Collision>,
-    );
-
-    fn run(&mut self, (entity, position, velocity, blocking, mut collision): Self::SystemData) {
-        let mut spacemap = std::collections::HashMap::new();
-        for (e, pos, _) in (&entity, &position, &blocking).join() {
-            spacemap.insert(pos.to_grid(), e);
-        }
-
-        for (pos, vel, col) in (&position, &velocity, &mut collision).join() {
-            if let Some(_) = spacemap.get(&pos.moved(vel).to_grid()) {
-                col.has_collision = true;
-            }
-        }
-    }
-}
-
 struct Physics;
 
 impl<'a> specs::System<'a> for Physics {
@@ -96,21 +71,7 @@ impl<'a> specs::System<'a> for Physics {
     }
 }
 
-struct ResetCollision;
-
-impl<'a> specs::System<'a> for ResetCollision {
-    type SystemData = specs::WriteStorage<'a, Collision>;
-
-    fn run(&mut self, mut collision: Self::SystemData) {
-        for mut e in (&mut collision).join() {
-            e.has_collision = false;
-        }
-    }
-}
-
 pub fn systems(game: &mut MyGame) {
     Collide.run_now(&game.world);
-    // Intersection.run_now(&game.world.res);
     Physics.run_now(&game.world);
-    // ResetCollision.run_now(&game.world);
 }