Minor fixes

master
Mark 2024-01-01 15:51:57 -08:00
parent d5f0cbd678
commit fa992d3fb5
Signed by: Mark
GPG Key ID: C6D63995FE72FD80
3 changed files with 8 additions and 6 deletions

View File

@ -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);

View File

@ -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

View File

@ -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,
);