batter loadout swap logic

This commit is contained in:
AdamWhitehurst 2020-03-25 07:58:26 -07:00
parent 857652ee23
commit 964256541e

View File

@ -128,11 +128,13 @@ pub fn handle_climb(data: &JoinData, update: &mut StateUpdate) {
}
/// Checks that player can Swap Weapons and updates `Loadout` if so
pub fn attempt_swap_loadout(data: &JoinData, update: &mut StateUpdate) {
let mut new_loadout = data.loadout.clone();
new_loadout.active_item = data.loadout.second_item.clone();
new_loadout.second_item = data.loadout.active_item.clone();
update.loadout = new_loadout;
pub fn attempt_swap_loadout(_data: &JoinData, update: &mut StateUpdate) {
if update.loadout.second_item.is_some() {
std::mem::swap(
&mut update.loadout.active_item,
&mut update.loadout.second_item,
);
}
}
/// Checks that player can glide and updates `CharacterState` if so