Removed vehicle riders, for now

This commit is contained in:
Joshua Barretto 2023-04-10 20:58:08 +01:00
parent 00559187d6
commit 92ead1cf38
5 changed files with 1 additions and 16 deletions

View File

@ -230,7 +230,6 @@ pub enum ServerEvent {
ship: comp::ship::Body, ship: comp::ship::Body,
rtsim_entity: Option<RtSimVehicle>, rtsim_entity: Option<RtSimVehicle>,
driver: Option<NpcBuilder>, driver: Option<NpcBuilder>,
passangers: Vec<NpcBuilder>,
}, },
CreateWaypoint(Vec3<f32>), CreateWaypoint(Vec3<f32>),
ClientDisconnect(EcsEntity, DisconnectReason), ClientDisconnect(EcsEntity, DisconnectReason),

View File

@ -266,10 +266,6 @@ pub struct Vehicle {
#[serde(skip)] #[serde(skip)]
pub driver: Option<Actor>, pub driver: Option<Actor>,
#[serde(skip)]
// TODO: Find a way to detect riders when the vehicle is loaded
pub riders: Vec<Actor>,
/// Whether the Vehicle is in simulated or loaded mode (when rtsim is run on /// Whether the Vehicle is in simulated or loaded mode (when rtsim is run on
/// the server, loaded corresponds to being within a loaded chunk). When /// the server, loaded corresponds to being within a loaded chunk). When
/// in loaded mode, the interactions of the Vehicle should not be /// in loaded mode, the interactions of the Vehicle should not be
@ -285,7 +281,6 @@ impl Vehicle {
body, body,
chunk_pos: None, chunk_pos: None,
driver: None, driver: None,
riders: Vec::new(),
mode: SimulationMode::Simulated, mode: SimulationMode::Simulated,
} }
} }

View File

@ -34,7 +34,6 @@ fn on_setup(ctx: EventCtx<SimulateNpcs, OnSetup>) {
if let Some(ride) = &npc.riding { if let Some(ride) = &npc.riding {
if let Some(vehicle) = data.npcs.vehicles.get_mut(ride.vehicle) { if let Some(vehicle) = data.npcs.vehicles.get_mut(ride.vehicle) {
let actor = Actor::Npc(npc_id); let actor = Actor::Npc(npc_id);
vehicle.riders.push(actor);
if ride.steering && vehicle.driver.replace(actor).is_some() { if ride.steering && vehicle.driver.replace(actor).is_some() {
error!("Replaced driver"); error!("Replaced driver");
} }

View File

@ -196,8 +196,7 @@ impl Server {
ship, ship,
rtsim_entity, rtsim_entity,
driver, driver,
passangers, } => handle_create_ship(self, pos, ship, rtsim_entity, driver, Vec::new()),
} => handle_create_ship(self, pos, ship, rtsim_entity, driver, passangers),
ServerEvent::CreateWaypoint(pos) => handle_create_waypoint(self, pos), ServerEvent::CreateWaypoint(pos) => handle_create_waypoint(self, pos),
ServerEvent::ClientDisconnect(entity, reason) => { ServerEvent::ClientDisconnect(entity, reason) => {
frontend_events.push(handle_client_disconnect(self, entity, reason, false)) frontend_events.push(handle_client_disconnect(self, entity, reason, false))

View File

@ -326,13 +326,6 @@ impl<'a> System<'a> for Sys {
// agent: None,//Some(Agent::from_body(&Body::Ship(ship))), // agent: None,//Some(Agent::from_body(&Body::Ship(ship))),
rtsim_entity: Some(RtSimVehicle(vehicle_id)), rtsim_entity: Some(RtSimVehicle(vehicle_id)),
driver: vehicle.driver.and_then(&mut actor_info), driver: vehicle.driver.and_then(&mut actor_info),
passangers: vehicle
.riders
.iter()
.copied()
.filter(|actor| vehicle.driver != Some(*actor))
.filter_map(actor_info)
.collect(),
}); });
} }
} }