|
@ -162,7 +162,7 @@ where |
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
pub fn update_player_position(id: ClientId,
|
|
|
pub fn update_player_position(id: ClientId,
|
|
|
message: &GameMessage,
|
|
|
|
|
|
|
|
|
message: &Message,
|
|
|
clients: &mut Clients,
|
|
|
clients: &mut Clients,
|
|
|
client_location: &ClientLocation,
|
|
|
client_location: &ClientLocation,
|
|
|
rooms: &Rooms)
|
|
|
rooms: &Rooms)
|
|
@ -174,7 +174,7 @@ pub fn update_player_position(id: ClientId, |
|
|
.as_ref()
|
|
|
.as_ref()
|
|
|
.ok_or_else(|| ShipError::InvalidRoom(room_id.0 as u32))?;
|
|
|
.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::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::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();},
|
|
|
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 {}
|
|
|
} 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,
|
|
|
pub async fn charge_attack<EG>(id: ClientId,
|
|
|