Minor fixes
parent
d5f0cbd678
commit
fa992d3fb5
|
@ -46,7 +46,7 @@ impl Ship {
|
||||||
pub fn fire_guns(&mut self) -> Vec<(Projectile, content::GunPoint)> {
|
pub fn fire_guns(&mut self) -> Vec<(Projectile, content::GunPoint)> {
|
||||||
self.outfits
|
self.outfits
|
||||||
.iter_guns_points()
|
.iter_guns_points()
|
||||||
.filter(|(g, _)| g.cooldown > 0.0)
|
.filter(|(g, _)| g.cooldown <= 0.0)
|
||||||
.map(|(g, p)| {
|
.map(|(g, p)| {
|
||||||
let mut rng = rand::thread_rng();
|
let mut rng = rand::thread_rng();
|
||||||
g.cooldown = g.kind.rate + &rng.gen_range(-g.kind.rate_rng..=g.kind.rate_rng);
|
g.cooldown = g.kind.rate + &rng.gen_range(-g.kind.rate_rng..=g.kind.rate_rng);
|
||||||
|
|
|
@ -35,10 +35,12 @@ impl ShipBehavior for Point {
|
||||||
// Iterate all possible targets
|
// Iterate all possible targets
|
||||||
let mut it = physics
|
let mut it = physics
|
||||||
.iter_ship_body()
|
.iter_ship_body()
|
||||||
.filter(|(s, _)| match my_faction.relationships[&s.ship.faction] {
|
.filter(
|
||||||
|
|(s, _)| match my_faction.relationships.get(&s.ship.faction).unwrap() {
|
||||||
content::Relationship::Hostile => true,
|
content::Relationship::Hostile => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
})
|
},
|
||||||
|
)
|
||||||
.map(|(_, r)| r);
|
.map(|(_, r)| r);
|
||||||
|
|
||||||
// Find the closest target
|
// Find the closest target
|
||||||
|
|
|
@ -116,7 +116,7 @@ impl Game {
|
||||||
let s = object::Ship::new(
|
let s = object::Ship::new(
|
||||||
&ct,
|
&ct,
|
||||||
content::ShipHandle { index: 0 },
|
content::ShipHandle { index: 0 },
|
||||||
content::FactionHandle { index: 0 },
|
content::FactionHandle { index: 1 },
|
||||||
o1,
|
o1,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue