Removed all Hardcoded keybinds and changed them for customizable resources

This commit is contained in:
Franklin 2023-11-25 21:10:47 -04:00
parent 235ca21895
commit a89523283a
11 changed files with 159 additions and 44 deletions

View File

@ -38,7 +38,10 @@ Multiplayer
- [x] Optics - [x] Optics
- [x] All optics implementing a fn/trait that gives a specific gun offset to use the optic correctly - [x] All optics implementing a fn/trait that gives a specific gun offset to use the optic correctly
- [ ] TODO: Find some way to implement a shader for the optics - [ ] TODO: Find some way to implement a shader for the optics
- [ ] Weapon Clipping () - [ ] Weapon Clipping
- [ ] Make the player's collider bigger towards the front
- [ ] Make the weapon's collider cover the firing point
- [ ] If possible, create a new gun pose, like pushed back
- [ ] Bobbing - [ ] Bobbing
- [ ] Gun Bob on run - [ ] Gun Bob on run
- [ ] Gun Bob on walk - [ ] Gun Bob on walk

Binary file not shown.

View File

@ -8,7 +8,7 @@ use crate::{
}, },
player_values_state::PlayerValuesState, player_values_state::PlayerValuesState,
}, guns::player_firing::PlayerFiringInfo}, }, guns::player_firing::PlayerFiringInfo},
ui::game::game_ui_state::GameUiState, ui::game::{game_ui_state::GameUiState, settings::player_controls::PlayerControls},
}; };
use super::markers::player::Player; use super::markers::player::Player;
@ -31,31 +31,32 @@ pub fn capture_input(
time: Res<Time>, time: Res<Time>,
game_ui_state: Res<GameUiState>, game_ui_state: Res<GameUiState>,
player_values_state: Res<PlayerValuesState>, player_values_state: Res<PlayerValuesState>,
player_controls: Res<PlayerControls>
) { ) {
// Don't allocate on each frame. Instead Check if any of the inputs are being pressed and then allocate. // Don't allocate on each frame. Instead Check if any of the inputs are being pressed and then allocate.
if keyboard_input.any_pressed([ if keyboard_input.any_pressed([
KeyCode::A, player_controls.move_left,
KeyCode::S, player_controls.move_backward,
KeyCode::D, player_controls.move_right,
KeyCode::W, player_controls.move_forward,
KeyCode::C, player_controls.crouch,
KeyCode::Space, player_controls.jump,
]) || keyboard_input.any_just_released([ ]) || keyboard_input.any_just_released([
KeyCode::A, player_controls.move_left,
KeyCode::S, player_controls.move_backward,
KeyCode::D, player_controls.move_right,
KeyCode::W, player_controls.move_forward,
KeyCode::C, player_controls.crouch,
KeyCode::Space, player_controls.jump,
]) { ]) {
let player_movement_input = PlayerMovementInput { let player_movement_input = PlayerMovementInput {
up: keyboard_input.just_pressed(KeyCode::Space), up: keyboard_input.just_pressed(player_controls.jump),
down: keyboard_input.just_pressed(KeyCode::C), down: keyboard_input.just_pressed(player_controls.crouch),
left: keyboard_input.pressed(KeyCode::A), left: keyboard_input.pressed(player_controls.move_left),
right: keyboard_input.pressed(KeyCode::D), right: keyboard_input.pressed(player_controls.move_right),
front: keyboard_input.pressed(KeyCode::W), front: keyboard_input.pressed(player_controls.move_forward),
back: keyboard_input.pressed(KeyCode::S), back: keyboard_input.pressed(player_controls.move_backward),
sprint: keyboard_input.pressed(KeyCode::ShiftLeft), sprint: keyboard_input.pressed(player_controls.sprint),
}; };
if game_ui_state.any_window() { if game_ui_state.any_window() {
move_player( move_player(

View File

@ -1,6 +1,6 @@
use bevy::{prelude::*, input::mouse::MouseWheel, ecs::system::SystemParam}; use bevy::{prelude::*, input::mouse::MouseWheel, ecs::system::SystemParam};
use crate::{comps::core::{markers::{proxy::{character::in_player_hands_parent::InPlayerHandsParent, physics::utils::TransformExt, weapons::sight_placement::{SightPlacementStart, SightPlacementEnd}}, player::Player, inspect_screen::InspectScreenSlotUiMarker}, weapons::{slot::slot::WeaponSlot, firearm_state::FirearmState, attachments::attachment::Position}}, ui::game::game_ui_state::GameUiState, utils::hierarchy::find_child_in_parent_children}; use crate::{comps::core::{markers::{proxy::{character::in_player_hands_parent::InPlayerHandsParent, physics::utils::TransformExt, weapons::sight_placement::{SightPlacementStart, SightPlacementEnd}}, player::Player, inspect_screen::InspectScreenSlotUiMarker}, weapons::{slot::slot::WeaponSlot, firearm_state::FirearmState, attachments::attachment::Position}}, ui::game::{game_ui_state::GameUiState, settings::player_controls::PlayerControls}, utils::hierarchy::find_child_in_parent_children};
use super::player_firing::PlayerFiringInfo; use super::player_firing::PlayerFiringInfo;
@ -22,6 +22,7 @@ pub fn inspect_firearm(
time: Res<Time>, time: Res<Time>,
keyboard_input: Res<Input<KeyCode>>, keyboard_input: Res<Input<KeyCode>>,
mut mouse_wheel_events: EventReader<MouseWheel>, mut mouse_wheel_events: EventReader<MouseWheel>,
player_controls: Res<PlayerControls>,
) { ) {
for mut player_firing_info in queries.player_firing_info_query.iter_mut() { for mut player_firing_info in queries.player_firing_info_query.iter_mut() {
for (mut in_player_hands_parent_transform, in_player_hands_entity) in queries.in_player_hands_parent_query.iter_mut() { for (mut in_player_hands_parent_transform, in_player_hands_entity) in queries.in_player_hands_parent_query.iter_mut() {
@ -33,7 +34,7 @@ pub fn inspect_firearm(
}; };
*in_player_hands_parent_transform = in_player_hands_parent_transform.lerp(inspect_hand_transform, time.delta_seconds() / 0.5); *in_player_hands_parent_transform = in_player_hands_parent_transform.lerp(inspect_hand_transform, time.delta_seconds() / 0.5);
if game_ui_state.any_window() { return; } if game_ui_state.any_window() { return; }
if keyboard_input.just_pressed(KeyCode::Return) { if keyboard_input.just_pressed(player_controls.inspect_finish) {
for mut inspectable_slot in queries.inspectable_slot_query.iter_mut() { for mut inspectable_slot in queries.inspectable_slot_query.iter_mut() {
inspectable_slot.selected = false; inspectable_slot.selected = false;
} }
@ -41,7 +42,7 @@ pub fn inspect_firearm(
return; return;
} }
let mut selected: Option<u32> = None; let mut selected: Option<u32> = None;
for (index, input) in [KeyCode::Key1, KeyCode::Key2, KeyCode::Key3, KeyCode::Key4, KeyCode::Key5, KeyCode::Key6].into_iter().enumerate() { for (index, input) in [player_controls.inspect_compensator, player_controls.inspect_utility, player_controls.inspect_foregrip, player_controls.inspect_magazine, player_controls.inspect_sight, player_controls.inspect_stock].into_iter().enumerate() {
if keyboard_input.just_pressed(input) { if keyboard_input.just_pressed(input) {
selected = Some(index as u32 + 1); selected = Some(index as u32 + 1);
break; break;
@ -56,7 +57,7 @@ pub fn inspect_firearm(
if !find_child_in_parent_children(&mut commands, in_player_hands_entity, slot_parent.get(), &queries.children) { if !find_child_in_parent_children(&mut commands, in_player_hands_entity, slot_parent.get(), &queries.children) {
continue; continue;
} }
match (keyboard_input.just_pressed(KeyCode::A) || keyboard_input.just_pressed(KeyCode::Left), keyboard_input.just_pressed(KeyCode::D) || keyboard_input.just_pressed(KeyCode::Right)) { match (keyboard_input.just_pressed(player_controls.inspect_previous), keyboard_input.just_pressed(player_controls.inspect_next)) {
(true, false) => { // -1 to index (true, false) => { // -1 to index
for (firearm_entity, mut firearm_state) in queries.firearm_query.iter_mut() { for (firearm_entity, mut firearm_state) in queries.firearm_query.iter_mut() {
if !find_child_in_parent_children(&mut commands, in_player_hands_entity, firearm_entity, &queries.children) { if !find_child_in_parent_children(&mut commands, in_player_hands_entity, firearm_entity, &queries.children) {
@ -75,7 +76,7 @@ pub fn inspect_firearm(
}, },
_ => {} // On no press or both pressed, do nothing _ => {} // On no press or both pressed, do nothing
}; };
if keyboard_input.just_pressed(KeyCode::Back) { if keyboard_input.just_pressed(player_controls.inspect_remove) {
for (firearm_entity, mut firearm_state) in queries.firearm_query.iter_mut() { for (firearm_entity, mut firearm_state) in queries.firearm_query.iter_mut() {
if !find_child_in_parent_children(&mut commands, in_player_hands_entity, firearm_entity, &queries.children) { if !find_child_in_parent_children(&mut commands, in_player_hands_entity, firearm_entity, &queries.children) {
continue; continue;
@ -98,7 +99,7 @@ pub fn inspect_firearm(
pos_2 = Some(sight_placement_transform.translation) pos_2 = Some(sight_placement_transform.translation)
} }
} }
for mouse_wheel_event in mouse_wheel_events.read() { // TODO: Specifically for optic, scroll wheel == position change for mouse_wheel_event in mouse_wheel_events.read() {
match (pos_1, pos_2) { match (pos_1, pos_2) {
(None, None) => break, (None, None) => break,
(None, Some(pos_2)) => { slot_transform.translation = pos_2 }, (None, Some(pos_2)) => { slot_transform.translation = pos_2 },
@ -114,7 +115,6 @@ pub fn inspect_firearm(
} }
}, },
}; };
// TODO: Translate SightSlot transform by mouse_wheel_event.y * time.delta_time_seconds() * sens_multiplier
} }
} }
} }

View File

@ -3,7 +3,7 @@ use bevy::{input::mouse::MouseMotion, prelude::*, window::CursorGrabMode, ecs::s
use crate::{ use crate::{
comps::core::markers::{camera::MainCamera, player::Player, proxy::character::{player_character::PlayerCharacter, player_eye::PlayerEye}, holdable::InPlayerHands}, comps::core::markers::{camera::MainCamera, player::Player, proxy::character::{player_character::PlayerCharacter, player_eye::PlayerEye}, holdable::InPlayerHands},
ui::game::game_ui_state::{GameUiState, GameUiWindow}, ui::game::{game_ui_state::{GameUiState, GameUiWindow}, settings::player_controls::PlayerControls},
}; };
use super::{player_movement::PlayerLinearXZState, player_values_state::PlayerValuesState}; use super::{player_movement::PlayerLinearXZState, player_values_state::PlayerValuesState};
@ -85,6 +85,7 @@ pub fn follow_cursor_with_camera(
mut game_ui_state: ResMut<GameUiState>, mut game_ui_state: ResMut<GameUiState>,
player_values_state: Res<PlayerValuesState>, player_values_state: Res<PlayerValuesState>,
mut query: FollowCursorWithCameraQueryParams, mut query: FollowCursorWithCameraQueryParams,
player_controls: Res<PlayerControls>,
) { ) {
if let Ok(mut window) = query.primary_window.get_single_mut() { if let Ok(mut window) = query.primary_window.get_single_mut() {
if keyboard_input.just_pressed(KeyCode::Escape) { if keyboard_input.just_pressed(KeyCode::Escape) {
@ -99,7 +100,7 @@ pub fn follow_cursor_with_camera(
window.cursor.grab_mode = CursorGrabMode::None; // Release cursor window.cursor.grab_mode = CursorGrabMode::None; // Release cursor
window.cursor.visible = true; // Show cursor window.cursor.visible = true; // Show cursor
} }
} else if keyboard_input.just_pressed(KeyCode::Tab) { } else if keyboard_input.just_pressed(player_controls.inventory) {
if game_ui_state.is_showing_window(GameUiWindow::InventoryMenu) { if game_ui_state.is_showing_window(GameUiWindow::InventoryMenu) {
// Hide the inventory screen only // Hide the inventory screen only
game_ui_state.current_ui_window_shown = None; game_ui_state.current_ui_window_shown = None;
@ -193,13 +194,13 @@ pub fn follow_cursor_with_camera(
player_transform.rotation = desired_rotation_quat_player; player_transform.rotation = desired_rotation_quat_player;
let player_model_default_rot = Quat::from_euler(EulerRot::XYZ, -180.0f32.to_radians(), 0.0, -180.0f32.to_radians()); let player_model_default_rot = Quat::from_euler(EulerRot::XYZ, -180.0f32.to_radians(), 0.0, -180.0f32.to_radians());
if keyboard_input.pressed(KeyCode::Q) { if keyboard_input.pressed(player_controls.lean_left) {
let player_model_final_rot = Quat::from_euler(EulerRot::XYZ, -180.0f32.to_radians(), 0.0, (-180.0 - player_values_state.player_lean_angle).to_radians()); let player_model_final_rot = Quat::from_euler(EulerRot::XYZ, -180.0f32.to_radians(), 0.0, (-180.0 - player_values_state.player_lean_angle).to_radians());
player_model_transform.rotation = player_model_transform.rotation.lerp( player_model_transform.rotation = player_model_transform.rotation.lerp(
player_model_final_rot, player_model_final_rot,
time.delta_seconds() / player_values_state.player_lean_time, time.delta_seconds() / player_values_state.player_lean_time,
) )
} else if keyboard_input.pressed(KeyCode::E) { } else if keyboard_input.pressed(player_controls.lean_right) {
let player_model_final_rot = Quat::from_euler(EulerRot::XYZ, -180.0f32.to_radians(), 0.0, (-180.0 + player_values_state.player_lean_angle).to_radians()); let player_model_final_rot = Quat::from_euler(EulerRot::XYZ, -180.0f32.to_radians(), 0.0, (-180.0 + player_values_state.player_lean_angle).to_radians());
player_model_transform.rotation = player_model_transform.rotation.lerp( player_model_transform.rotation = player_model_transform.rotation.lerp(
player_model_final_rot, player_model_final_rot,

View File

@ -17,7 +17,7 @@ use crate::{
equipment::{Equipment, EquipmentChangeEvent}, equipment::{Equipment, EquipmentChangeEvent},
load_state::GameLoadState, assets::GltfAssets, //animations::AllAnimations, load_state::GameLoadState, assets::GltfAssets, //animations::AllAnimations,
}, },
ui::game::{game_ui_state::GameUiState, hud::hud::HudState}, ui::game::{game_ui_state::GameUiState, hud::hud::HudState, settings::player_controls::PlayerControls},
utils::{rad_deg::radians_from_degrees, hierarchy::find_child_in_parent_children}, utils::{rad_deg::radians_from_degrees, hierarchy::find_child_in_parent_children},
}; };
@ -37,6 +37,7 @@ pub struct CaptureHandUsageResourcesParams<'w> {
time: Res<'w, Time>, time: Res<'w, Time>,
assets_gltf: Res<'w, GltfAssets>, assets_gltf: Res<'w, GltfAssets>,
loaded_gltf_assets: Res<'w, Assets<Gltf>>, loaded_gltf_assets: Res<'w, Assets<Gltf>>,
player_controls: Res<'w, PlayerControls>,
} }
#[derive(SystemParam)] #[derive(SystemParam)]
@ -93,7 +94,7 @@ pub fn capture_hand_usage(
} }
if !resources.game_ui_state.any_window() && !player_firing_info.is_reloading { if !resources.game_ui_state.any_window() && !player_firing_info.is_reloading {
if resources.keyboard_input.just_pressed(KeyCode::Key1) { if resources.keyboard_input.just_pressed(resources.player_controls.primary_weapon) {
if let Some(primary_item) = player_inventory.get_primary() { if let Some(primary_item) = player_inventory.get_primary() {
if let Some(primary_firearm) = primary_item.get_firearm() { if let Some(primary_firearm) = primary_item.get_firearm() {
if Equipment::Firearm(primary_firearm.clone(), primary_item.get_state().expect("No item state in an equipped Item.").as_firearm_state()) if Equipment::Firearm(primary_firearm.clone(), primary_item.get_state().expect("No item state in an equipped Item.").as_firearm_state())
@ -105,7 +106,7 @@ pub fn capture_hand_usage(
} }
} }
} }
} else if resources.keyboard_input.just_pressed(KeyCode::Key2) { } else if resources.keyboard_input.just_pressed(resources.player_controls.secondary_weapon) {
if let Some(secondary_item) = player_inventory.get_secondary() { if let Some(secondary_item) = player_inventory.get_secondary() {
if let Some(secondary_firearm) = secondary_item.get_firearm() { if let Some(secondary_firearm) = secondary_item.get_firearm() {
if Equipment::Firearm(secondary_firearm.clone(), secondary_item.get_state().expect("No item state in an equipped Item.").as_firearm_state()) if Equipment::Firearm(secondary_firearm.clone(), secondary_item.get_state().expect("No item state in an equipped Item.").as_firearm_state())
@ -117,12 +118,12 @@ pub fn capture_hand_usage(
} }
} }
} }
} else if resources.keyboard_input.just_pressed(KeyCode::Key3) { } else if resources.keyboard_input.just_pressed(resources.player_controls.hands) {
if Equipment::Nothing != player.0.equipment { if Equipment::Nothing != player.0.equipment {
equipment_change_event_writer.send(EquipmentChangeEvent(Equipment::Nothing, None)); equipment_change_event_writer.send(EquipmentChangeEvent(Equipment::Nothing, None));
player_inventory.current_slot = None; player_inventory.current_slot = None;
} }
} else if resources.keyboard_input.just_pressed(KeyCode::G) { } else if resources.keyboard_input.just_pressed(resources.player_controls.drop) {
match player_inventory.current_slot { match player_inventory.current_slot {
Some(current_slot) => { Some(current_slot) => {
for (_, in_player_hands_entity) in queries.hand_query.iter() { for (_, in_player_hands_entity) in queries.hand_query.iter() {
@ -137,7 +138,7 @@ pub fn capture_hand_usage(
}, },
None => {}, None => {},
} }
} else if resources.keyboard_input.just_pressed(KeyCode::I) { } else if resources.keyboard_input.just_pressed(resources.player_controls.inspect) {
if player.0.equipment.is_firearm() { if player.0.equipment.is_firearm() {
player_firing_info.is_inspecting = true; player_firing_info.is_inspecting = true;
} }
@ -175,7 +176,7 @@ pub fn capture_hand_usage(
} else { } else {
// Player is not currently reloading // Player is not currently reloading
// TODO: Add item check (make sure he has extra mags) // TODO: Add item check (make sure he has extra mags)
if resources.keyboard_input.just_pressed(KeyCode::R) if resources.keyboard_input.just_pressed(resources.player_controls.reload)
&& !resources.game_ui_state.any_window() && !resources.game_ui_state.any_window()
{ {
if let Some(magazine_data) = &mut firearm_state.magazine_data { if let Some(magazine_data) = &mut firearm_state.magazine_data {
@ -330,6 +331,7 @@ pub fn interact_action(
mut hud_state: ResMut<HudState>, mut hud_state: ResMut<HudState>,
mut pickup_item_event_writer: EventWriter<PickupItemEvent>, mut pickup_item_event_writer: EventWriter<PickupItemEvent>,
game_ui_state: Res<GameUiState>, game_ui_state: Res<GameUiState>,
player_controls: Res<PlayerControls>,
) { ) {
for player_entity in query.player_query.iter() { for player_entity in query.player_query.iter() {
for global_transform in query.camera_query.iter() { for global_transform in query.camera_query.iter() {
@ -350,7 +352,7 @@ pub fn interact_action(
if interactable_entity == entity || find_child_in_parent_children(&mut commands, interactable_entity, entity, &children) { if interactable_entity == entity || find_child_in_parent_children(&mut commands, interactable_entity, entity, &children) {
hud_state.interaction_clue_shown = true; hud_state.interaction_clue_shown = true;
hud_state.interaction_clue_text = interactable.to_string(); hud_state.interaction_clue_text = interactable.to_string();
if keyboard_input.just_pressed(KeyCode::F) && !game_ui_state.any_window() { if keyboard_input.just_pressed(player_controls.interact) && !game_ui_state.any_window() {
// TODO: Move this key to Controls state global // TODO: Move this key to Controls state global
match interactable.clone() { match interactable.clone() {
Interactable::Holdable => todo!(), Interactable::Holdable => todo!(),

View File

@ -21,7 +21,7 @@ use crate::{
assets::{GltfAssetType, GltfAssets}, assets::{GltfAssetType, GltfAssets},
equipment::Equipment, equipment::Equipment,
load_state::GameLoadState, load_state::GameLoadState,
}, }, ui::game::settings::player_controls::PlayerControls,
}; };
use super::inspector::{editor_controls, set_cam3d_controls}; use super::inspector::{editor_controls, set_cam3d_controls};
@ -55,6 +55,7 @@ impl Plugin for MainEditorUiPlugin {
.register_type::<FirearmState>() .register_type::<FirearmState>()
.register_type::<PlayerSettings>() .register_type::<PlayerSettings>()
.register_type::<InspectScreenSlotUiMarker>() .register_type::<InspectScreenSlotUiMarker>()
.register_type::<PlayerControls>()
//.register_type::<AllAnimations>() //.register_type::<AllAnimations>()
//.register_type::<FirearmAnimations>() //.register_type::<FirearmAnimations>()
.register_type::<GltfAssetType>() .register_type::<GltfAssetType>()

View File

@ -6,8 +6,9 @@ use bevy::prelude::*;
pub fn inventory_keybinds_system( pub fn inventory_keybinds_system(
mut commands: Commands, mut commands: Commands,
keyboard_input: Res<Input<KeyCode>>, keyboard_input: Res<Input<KeyCode>>,
player_controls: Res<PlayerControls>
) { ) {
if keyboard_input.just_pressed(KeyCode::G) { if keyboard_input.just_pressed(player_controls.drop) {
// TODO: Drop item hovered // TODO: Drop item hovered
} }
} }

View File

@ -1,2 +1,3 @@
pub mod menu; pub mod menu;
pub mod plugin; pub mod plugin;
pub mod player_controls;

View File

@ -0,0 +1,105 @@
use bevy::{ecs::{system::Resource, reflect::ReflectResource}, reflect::Reflect, input::{keyboard::KeyCode, mouse::MouseButton}};
#[derive(Reflect, Debug, Default)]
pub enum ScrollWheelInput {
#[default]
Up,
Down,
Click,
}
#[derive(Reflect, Debug)]
pub enum ControlsInput {
KeyCode(KeyCode),
ScrollWheel(ScrollWheelInput),
MouseButton(MouseButton),
}
#[derive(Resource, Reflect)]
#[reflect(Resource)]
pub struct PlayerControls {
pub move_forward: KeyCode,
pub move_left: KeyCode,
pub move_right: KeyCode,
pub move_backward: KeyCode,
pub jump: KeyCode,
pub crouch: KeyCode,
pub sprint: KeyCode,
pub lean_left: KeyCode,
pub lean_right: KeyCode,
pub primary_weapon: KeyCode,
pub secondary_weapon: KeyCode,
pub hands: KeyCode,
pub drop: KeyCode,
pub fire: MouseButton,
pub aim: MouseButton,
pub reload: KeyCode,
pub inspect: KeyCode,
pub inspect_remove: KeyCode,
pub inspect_previous: KeyCode,
pub inspect_next: KeyCode,
pub inspect_finish: KeyCode,
pub inspect_compensator: KeyCode,
pub inspect_utility: KeyCode,
pub inspect_foregrip: KeyCode,
pub inspect_magazine: KeyCode,
pub inspect_sight: KeyCode,
pub inspect_stock: KeyCode,
pub interact: KeyCode,
pub high_ready: ControlsInput,
pub low_ready: ControlsInput,
pub inventory: KeyCode,
}
impl Default for PlayerControls {
fn default() -> Self {
Self {
move_forward: KeyCode::W,
move_left: KeyCode::A,
move_right: KeyCode::D,
move_backward: KeyCode::S,
jump: KeyCode::Space,
crouch: KeyCode::C,
sprint: KeyCode::ShiftLeft,
lean_left: KeyCode::Q,
lean_right: KeyCode::E,
primary_weapon: KeyCode::Key1,
secondary_weapon: KeyCode::Key2,
hands: KeyCode::Key3,
drop: KeyCode::G,
fire: MouseButton::Left,
aim: MouseButton::Right,
reload: KeyCode::R,
inspect: KeyCode::I,
inspect_remove: KeyCode::Back,
inspect_previous: KeyCode::Left,
inspect_next: KeyCode::Right,
inspect_finish: KeyCode::Return,
inspect_compensator: KeyCode::Key1,
inspect_utility: KeyCode::Key2,
inspect_foregrip: KeyCode::Key3,
inspect_magazine: KeyCode::Key4,
inspect_sight: KeyCode::Key5,
inspect_stock: KeyCode::Key6,
interact: KeyCode::F,
high_ready: ControlsInput::ScrollWheel(ScrollWheelInput::Up),
low_ready: ControlsInput::ScrollWheel(ScrollWheelInput::Down),
inventory: KeyCode::Tab,
}
}
}

View File

@ -1,12 +1,12 @@
use bevy::app::{Plugin, Startup, Update}; use bevy::app::{Plugin, Startup, Update};
use super::menu; use super::{menu, player_controls::PlayerControls};
pub struct SettingsMenuPlugin; pub struct SettingsMenuPlugin;
impl Plugin for SettingsMenuPlugin { impl Plugin for SettingsMenuPlugin {
fn build(&self, app: &mut bevy::prelude::App) { fn build(&self, app: &mut bevy::prelude::App) {
app.insert_resource(PlayerControls::default());
app.add_systems(Startup, menu::setup_settings_screen); app.add_systems(Startup, menu::setup_settings_screen);
app.add_systems( app.add_systems(
Update, Update,