From a89523283a9c9b722a60bf2dcaf564cbfc7e7607 Mon Sep 17 00:00:00 2001 From: Franklin Date: Sat, 25 Nov 2023 21:10:47 -0400 Subject: [PATCH] Removed all Hardcoded keybinds and changed them for customizable resources --- Design.md | 5 +- assets/character/main_character.glb | Bin 49370308 -> 49370324 bytes src/comps/core/controller.rs | 41 ++++---- src/logic/core/guns/inspect.rs | 14 +-- src/logic/core/player/camera_player_sync.rs | 9 +- src/logic/core/player/hands.rs | 18 ++-- src/ui/editor/plugin.rs | 3 +- src/ui/game/inventory/controls.rs | 3 +- src/ui/game/settings/mod.rs | 1 + src/ui/game/settings/player_controls.rs | 105 ++++++++++++++++++++ src/ui/game/settings/plugin.rs | 4 +- 11 files changed, 159 insertions(+), 44 deletions(-) create mode 100644 src/ui/game/settings/player_controls.rs diff --git a/Design.md b/Design.md index a4cfc99..34009b1 100644 --- a/Design.md +++ b/Design.md @@ -38,7 +38,10 @@ Multiplayer - [x] Optics - [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 -- [ ] 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 - [ ] Gun Bob on run - [ ] Gun Bob on walk diff --git a/assets/character/main_character.glb b/assets/character/main_character.glb index 50445edb695df4d570c39ec82469e52bca3cba90..6ad061fc7181a36ce5ad855c6eaab48c7089f8ff 100644 GIT binary patch delta 3584 zcmWmEXIu;b9L8}Sl94FM-h1Tkx~|Kf3E7$1B9gtbM+hNg@658Zvcr|VW$#V)-sAbb z_Y}=;ZmPQqRy|Zt z6{32n-YQh}QDLgD>Zkgv0cxNcqz0=YYN#5fhO2NjLXA|T)MzzEjaB2+cr`&yR1s>D znyjX%NHtYWQ`1$HnxST@St?r1R&&%`6{F^<`D%e$s1~WkYKdB^mZ{}xg<7drsaUmI ztx;>$I<;PHP;n|=ZB(1oX0=6a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player_values_state: Res, + player_controls: Res ) { // Don't allocate on each frame. Instead Check if any of the inputs are being pressed and then allocate. if keyboard_input.any_pressed([ - KeyCode::A, - KeyCode::S, - KeyCode::D, - KeyCode::W, - KeyCode::C, - KeyCode::Space, + player_controls.move_left, + player_controls.move_backward, + player_controls.move_right, + player_controls.move_forward, + player_controls.crouch, + player_controls.jump, ]) || keyboard_input.any_just_released([ - KeyCode::A, - KeyCode::S, - KeyCode::D, - KeyCode::W, - KeyCode::C, - KeyCode::Space, + player_controls.move_left, + player_controls.move_backward, + player_controls.move_right, + player_controls.move_forward, + player_controls.crouch, + player_controls.jump, ]) { let player_movement_input = PlayerMovementInput { - up: keyboard_input.just_pressed(KeyCode::Space), - down: keyboard_input.just_pressed(KeyCode::C), - left: keyboard_input.pressed(KeyCode::A), - right: keyboard_input.pressed(KeyCode::D), - front: keyboard_input.pressed(KeyCode::W), - back: keyboard_input.pressed(KeyCode::S), - sprint: keyboard_input.pressed(KeyCode::ShiftLeft), + up: keyboard_input.just_pressed(player_controls.jump), + down: keyboard_input.just_pressed(player_controls.crouch), + left: keyboard_input.pressed(player_controls.move_left), + right: keyboard_input.pressed(player_controls.move_right), + front: keyboard_input.pressed(player_controls.move_forward), + back: keyboard_input.pressed(player_controls.move_backward), + sprint: keyboard_input.pressed(player_controls.sprint), }; if game_ui_state.any_window() { move_player( diff --git a/src/logic/core/guns/inspect.rs b/src/logic/core/guns/inspect.rs index 706cd4e..c4ee6a1 100644 --- a/src/logic/core/guns/inspect.rs +++ b/src/logic/core/guns/inspect.rs @@ -1,6 +1,6 @@ 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; @@ -22,6 +22,7 @@ pub fn inspect_firearm( time: Res