Fixed firearm frozen bug
This commit is contained in:
parent
9538f73075
commit
8c30ba6d9f
|
@ -73,7 +73,7 @@ pub fn capture_hand_usage(
|
|||
for (player, mut player_inventory, _player_entity, player_transform, mut player_firing_info) in player_query.iter_mut() {
|
||||
// Equipping gun
|
||||
// Validate player has primary item, and secondary item in inventory
|
||||
if !resources.game_ui_state.any_window() {
|
||||
if !resources.game_ui_state.any_window() && !player_firing_info.is_reloading {
|
||||
if resources.keyboard_input.just_pressed(KeyCode::Key1) {
|
||||
if let Some(primary_item) = player_inventory.get_primary() {
|
||||
if let Some(primary_firearm) = primary_item.get_firearm() {
|
||||
|
@ -108,14 +108,13 @@ pub fn capture_hand_usage(
|
|||
Some(current_slot) => {
|
||||
player_inventory::drop_slot_in_game_world(&mut commands, player_transform, &mut inventory_changed_events, &mut player_inventory, &resources.assets_gltf, &resources.loaded_gltf_assets, current_slot);
|
||||
equipment_change_event_writer.send(EquipmentChangeEvent(Equipment::Nothing));
|
||||
player_inventory.current_slot = None;
|
||||
},
|
||||
None => {},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Firearm stuff
|
||||
if let Equipment::Firearm(player_firearm) = player.0.equipment.clone() {
|
||||
player_firing_info
|
||||
|
|
|
@ -38,6 +38,7 @@ pub fn change_equipment(
|
|||
let Ok((mut player, player_firing_info)) = player_query.get_single_mut() else {
|
||||
return;
|
||||
};
|
||||
//if player_firing_info.is_reloading { return; }
|
||||
// Primary firearm change
|
||||
let player_hands = player_hands_query.single_mut();
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ pub fn setup_inventory_screen(mut commands: Commands) {
|
|||
flex_direction: FlexDirection::Column,
|
||||
..Default::default()
|
||||
},
|
||||
background_color: BackgroundColor(Color::RED),
|
||||
..Default::default()
|
||||
})
|
||||
.set_parent(background_id)
|
||||
|
@ -65,10 +66,11 @@ pub fn setup_inventory_screen(mut commands: Commands) {
|
|||
})
|
||||
.set_parent(background_id)
|
||||
.id();
|
||||
|
||||
}
|
||||
|
||||
pub fn update_inventory_screen(
|
||||
mut commands: Commands,
|
||||
//mut commands: Commands,
|
||||
game_ui_state: Res<GameUiState>,
|
||||
mut inventory_screen_query: Query<&mut Visibility, With<InventoryScreenUiMarker>>,
|
||||
) {
|
||||
|
|
Loading…
Reference in New Issue