diff --git a/crates/gameobject/src/ship.rs b/crates/gameobject/src/ship.rs index 510cb25..0dc9875 100644 --- a/crates/gameobject/src/ship.rs +++ b/crates/gameobject/src/ship.rs @@ -46,7 +46,7 @@ impl Ship { pub fn fire_guns(&mut self) -> Vec<(Projectile, content::GunPoint)> { self.outfits .iter_guns_points() - .filter(|(g, _)| g.cooldown > 0.0) + .filter(|(g, _)| g.cooldown <= 0.0) .map(|(g, p)| { let mut rng = rand::thread_rng(); g.cooldown = g.kind.rate + &rng.gen_range(-g.kind.rate_rng..=g.kind.rate_rng); diff --git a/crates/shipbehavior/src/behavior/point.rs b/crates/shipbehavior/src/behavior/point.rs index c27ef83..4888107 100644 --- a/crates/shipbehavior/src/behavior/point.rs +++ b/crates/shipbehavior/src/behavior/point.rs @@ -35,10 +35,12 @@ impl ShipBehavior for Point { // Iterate all possible targets let mut it = physics .iter_ship_body() - .filter(|(s, _)| match my_faction.relationships[&s.ship.faction] { - content::Relationship::Hostile => true, - _ => false, - }) + .filter( + |(s, _)| match my_faction.relationships.get(&s.ship.faction).unwrap() { + content::Relationship::Hostile => true, + _ => false, + }, + ) .map(|(_, r)| r); // Find the closest target diff --git a/src/game/game.rs b/src/game/game.rs index e7dd03f..89200c4 100644 --- a/src/game/game.rs +++ b/src/game/game.rs @@ -116,7 +116,7 @@ impl Game { let s = object::Ship::new( &ct, content::ShipHandle { index: 0 }, - content::FactionHandle { index: 0 }, + content::FactionHandle { index: 1 }, o1, );