blob: 8b550bc9c95bbd8d24bf832c151892e336cc392d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
use specs::{
ReadStorage,
Write,
Entities,
System,
Join
};
use super::super::components::Position;
use super::super::resources::{
Ground
};
pub struct MakeFloor;
impl <'a> System<'a> for MakeFloor {
type SystemData = (Entities<'a>, Write<'a, Ground>, ReadStorage<'a, Position>);
fn run(&mut self, (entities, mut ground, positions): Self::SystemData) {
ground.cells.clear();
for (ent, pos) in (&entities, &positions).join() {
ground.cells.entry(pos.pos).or_insert(Vec::new()).push(ent);
}
}
}
|