Can fire directly with the mouse

This commit is contained in:
Pierre HUBERT 2022-10-16 18:38:22 +02:00
parent 1c08e2ec01
commit e97f4b593a

View File

@ -214,6 +214,16 @@ impl GameScreen {
coordinates_mapper.get(&Coordinates::new(mouse.column, mouse.row)) coordinates_mapper.get(&Coordinates::new(mouse.column, mouse.row))
{ {
self.curr_shoot_position = *c; self.curr_shoot_position = *c;
if self.can_fire()
&& self.game.can_fire_at_location(self.curr_shoot_position)
{
self.client
.send_message(&ClientMessage::Fire {
location: self.curr_shoot_position,
})
.await?;
}
} }
} }
} }