From 5114114f9a853298765b675a4a13558eba91c84d Mon Sep 17 00:00:00 2001 From: Franklin Date: Wed, 29 Nov 2023 13:59:18 -0400 Subject: [PATCH] Adjustable reticle iteration done --- Design.md | 1 + src/comps/core/weapons/attachments/optic.rs | 2 +- src/logic/core/guns/reticle.rs | 2 +- src/logic/core/player/hands.rs | 6 ++---- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Design.md b/Design.md index 5ccdec7..781d496 100644 --- a/Design.md +++ b/Design.md @@ -40,6 +40,7 @@ Multiplayer - [x] Find some way to implement a shader for the optics (AFTER IMPLEMENTING NEW BULLET SYSTEM) - [x] Optic glass material - [x] Reticle render + - [x] Reticle adjustment while on the field - [ ] Parallax effect on reticle - [ ] Weapon Clipping - [x] Make the player's collider bigger towards the front diff --git a/src/comps/core/weapons/attachments/optic.rs b/src/comps/core/weapons/attachments/optic.rs index 6f4dd35..2a159be 100644 --- a/src/comps/core/weapons/attachments/optic.rs +++ b/src/comps/core/weapons/attachments/optic.rs @@ -20,7 +20,7 @@ impl Optic { } } - /// Goes from 1-300 + /// Goes from 5-500 pub fn default_reticle_brightness(&self) -> f32 { 200.0 } diff --git a/src/logic/core/guns/reticle.rs b/src/logic/core/guns/reticle.rs index df1a591..56307bb 100644 --- a/src/logic/core/guns/reticle.rs +++ b/src/logic/core/guns/reticle.rs @@ -30,7 +30,7 @@ pub fn update_reticle( for firearm_state in firearm_state.iter() { if let Some(ref optic_data) = firearm_state.optic_data { if let Some(mat) = materials.get_mut(reticle_material) { - mat.emissive = optic_sight_glass.0.reticle().get_color() * optic_data.reticle_brightness.clamp(1.0, 500.0); + mat.emissive = optic_sight_glass.0.reticle().get_color() * optic_data.reticle_brightness; } } } diff --git a/src/logic/core/player/hands.rs b/src/logic/core/player/hands.rs index 9deb40d..36401e0 100644 --- a/src/logic/core/player/hands.rs +++ b/src/logic/core/player/hands.rs @@ -50,6 +50,7 @@ pub struct CaptureHandUsageQueryParams<'w, 's> { children: Query<'w, 's, &'static Children>, } +#[allow(unused)] #[allow(irrefutable_let_patterns)] pub fn capture_hand_usage( mut resources: CaptureHandUsageResourcesParams, @@ -220,10 +221,7 @@ pub fn capture_hand_usage( if let Some(ref mut optic_data) = firearm_state.optic_data { for mouse_wheel_event in scroll_events.iter() { let add_to_brightness = mouse_wheel_event.y * resources.time.delta_seconds() * 200.0; - println!("Changed reticle bright by {}", add_to_brightness); - // TODO: Clamp values correctly - optic_data.reticle_brightness = (optic_data.reticle_brightness + add_to_brightness).clamp(1.0, 500.0); - //println!("Changed reticle bright by {}", add_to_brightness); + optic_data.reticle_brightness = (optic_data.reticle_brightness + add_to_brightness).clamp(5.0, 500.0); // TODO: Clamp values correctly (introduce variables in optic or firearmstate stating min. and max. values) } } }