Fix typos, don't insert Controller if it doesn't already exist in the

mount system so that Controller components are not added to entities
client side
This commit is contained in:
Imbris 2020-01-02 04:46:15 -05:00
parent 1acf08390a
commit f52aef224e
4 changed files with 11 additions and 11 deletions

View File

@ -14,7 +14,7 @@ pub enum ClientMsg {
},
/// Request `ClientState::Registered` from an ingame state
ExitIngame,
/// Request `ClientState::Specator` from a registered or ingame state
/// Request `ClientState::Spectator` from a registered or ingame state
Spectate,
ControllerInputs(comp::ControllerInputs),
ControlEvent(comp::ControlEvent),

View File

@ -341,7 +341,11 @@ impl<'a> System<'a> for Sys {
ControlEvent::Unmount => server_emitter.emit(ServerEvent::Unmount(entity)),
ControlEvent::InventoryManip(manip) => {
server_emitter.emit(ServerEvent::InventoryManip(entity, manip))
} //ControlEvent::Respawn => server_emitter.emit(ServerEvent::Unmount(entity)),
} /*ControlEvent::Respawn => {
if state.is_dead {
server_emitter.emit(ServerEvent::Respawn(entity)),
}
}*/
}
}
@ -422,7 +426,6 @@ impl<'a> System<'a> for Sys {
&& can_climb(body),
physics.on_wall,
) {
println!("here 1");
character.movement = Climb;
continue;
}
@ -553,7 +556,6 @@ impl<'a> System<'a> for Sys {
&& can_climb(body),
physics.on_wall,
) {
println!("here 2");
character.movement = Climb;
continue;
}
@ -671,7 +673,6 @@ impl<'a> System<'a> for Sys {
if !inputs.glide.is_pressed() {
character.movement = Fall;
} else if let (Some(_wall_dir), true) = (physics.on_wall, can_climb(body)) {
println!("here 3");
character.movement = Climb;
}

View File

@ -59,13 +59,12 @@ impl<'a> System<'a> for Sys {
let _ = orientations.insert(mounter, ori);
let _ = velocities.insert(mounter, vel);
}
let _ = controllers.insert(
entity,
Controller {
controllers.get_mut(entity).map(|controller| {
*controller = Controller {
inputs,
..Default::default()
},
);
}
});
} else {
*(mount_states.get_mut_unchecked()) = MountState::Unmounted;
}

View File

@ -755,7 +755,7 @@ impl Server {
}
ServerEvent::ExitIngame { entity } => {
// Create new entity with just `Clienti`, `Uid`, and `Player` components
// Create new entity with just `Client`, `Uid`, and `Player` components
// Easier than checking and removing all other known components
// Note: If other `ServerEvent`s are referring to this entity they will be
// disrupted