|
|
@ -162,7 +162,7 @@ where |
|
|
|
}
|
|
|
|
|
|
|
|
pub fn update_player_position(id: ClientId,
|
|
|
|
message: &GameMessage,
|
|
|
|
message: &Message,
|
|
|
|
clients: &mut Clients,
|
|
|
|
client_location: &ClientLocation,
|
|
|
|
rooms: &Rooms)
|
|
|
@ -173,8 +173,8 @@ pub fn update_player_position(id: ClientId, |
|
|
|
.ok_or_else(|| ShipError::InvalidRoom(room_id.0 as u32))?
|
|
|
|
.as_ref()
|
|
|
|
.ok_or_else(|| ShipError::InvalidRoom(room_id.0 as u32))?;
|
|
|
|
|
|
|
|
match message {
|
|
|
|
|
|
|
|
match &message.msg {
|
|
|
|
GameMessage::PlayerChangedMap(p) => {client.x = p.x; client.y = p.y; client.z = p.z;},
|
|
|
|
GameMessage::PlayerChangedMap2(p) => {client.area = MapArea::from_value(&room.mode.episode(), p.map_area).ok();},
|
|
|
|
GameMessage::TellOtherPlayerMyLocation(p) => {client.x = p.x; client.y = p.y; client.z = p.z; client.area = MapArea::from_value(&room.mode.episode(), p.map_area).ok();},
|
|
|
@ -190,7 +190,11 @@ pub fn update_player_position(id: ClientId, |
|
|
|
_ => {},
|
|
|
|
}
|
|
|
|
} else {}
|
|
|
|
Ok(Box::new(None.into_iter()))
|
|
|
|
let m = message.clone();
|
|
|
|
Ok(Box::new(client_location.get_client_neighbors(id).unwrap().into_iter()
|
|
|
|
.map(move |client| {
|
|
|
|
(client.client, SendShipPacket::Message(m.clone()))
|
|
|
|
})))
|
|
|
|
}
|
|
|
|
|
|
|
|
pub async fn charge_attack<EG>(id: ClientId,
|
|
|
|