From d434e40bb7ec860818e2c92b9ca92ea9df6635b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Krupi=C5=84ski?= Date: Tue, 31 Dec 2024 19:44:29 +0100 Subject: [PATCH] Fix model glow not being removed when toggling off the master switch --- .../Visuals/ModelGlow/DefuseKitModelGlow/DefuseKitModelGlow.h | 2 +- .../ModelGlow/DroppedBombModelGlow/DroppedBombModelGlow.h | 2 +- .../GrenadeProjectileModelGlow/GrenadeProjectileModelGlow.h | 2 +- .../Visuals/ModelGlow/PlayerModelGlow/PlayerModelGlow.h | 3 ++- .../ModelGlow/TickingBombModelGlow/TickingBombModelGlow.h | 2 +- .../Visuals/ModelGlow/WeaponModelGlow/WeaponModelGlow.h | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Source/Features/Visuals/ModelGlow/DefuseKitModelGlow/DefuseKitModelGlow.h b/Source/Features/Visuals/ModelGlow/DefuseKitModelGlow/DefuseKitModelGlow.h index a6c3e16d097..b4d68bc4021 100644 --- a/Source/Features/Visuals/ModelGlow/DefuseKitModelGlow/DefuseKitModelGlow.h +++ b/Source/Features/Visuals/ModelGlow/DefuseKitModelGlow/DefuseKitModelGlow.h @@ -43,7 +43,7 @@ class DefuseKitModelGlow { [[nodiscard]] bool isEnabled() const noexcept { - return state().defuseKitModelGlow == ModelGlowState::State::Enabled; + return state().masterSwitch == ModelGlowState::State::Enabled && state().defuseKitModelGlow == ModelGlowState::State::Enabled; } [[nodiscard]] auto& state() const noexcept diff --git a/Source/Features/Visuals/ModelGlow/DroppedBombModelGlow/DroppedBombModelGlow.h b/Source/Features/Visuals/ModelGlow/DroppedBombModelGlow/DroppedBombModelGlow.h index 68e4e988e6c..a42fd29aa87 100644 --- a/Source/Features/Visuals/ModelGlow/DroppedBombModelGlow/DroppedBombModelGlow.h +++ b/Source/Features/Visuals/ModelGlow/DroppedBombModelGlow/DroppedBombModelGlow.h @@ -85,7 +85,7 @@ class DroppedBombModelGlow { [[nodiscard]] bool shouldGlowBombModel(auto&& bomb) const noexcept { - return !bomb.baseWeapon().baseEntity().hasOwner().valueOr(true); + return state().masterSwitch == ModelGlowState::State::Enabled && !bomb.baseWeapon().baseEntity().hasOwner().valueOr(true); } [[nodiscard]] auto& state() const noexcept diff --git a/Source/Features/Visuals/ModelGlow/GrenadeProjectileModelGlow/GrenadeProjectileModelGlow.h b/Source/Features/Visuals/ModelGlow/GrenadeProjectileModelGlow/GrenadeProjectileModelGlow.h index da43df2266c..b531426d7fc 100644 --- a/Source/Features/Visuals/ModelGlow/GrenadeProjectileModelGlow/GrenadeProjectileModelGlow.h +++ b/Source/Features/Visuals/ModelGlow/GrenadeProjectileModelGlow/GrenadeProjectileModelGlow.h @@ -43,7 +43,7 @@ class GrenadeProjectileModelGlow { [[nodiscard]] bool isEnabled() const noexcept { - return state().grenadeProjectileModelGlow == ModelGlowState::State::Enabled; + return state().masterSwitch == ModelGlowState::State::Enabled && state().grenadeProjectileModelGlow == ModelGlowState::State::Enabled; } [[nodiscard]] auto& state() const noexcept diff --git a/Source/Features/Visuals/ModelGlow/PlayerModelGlow/PlayerModelGlow.h b/Source/Features/Visuals/ModelGlow/PlayerModelGlow/PlayerModelGlow.h index af5831761dc..a8dc394b052 100644 --- a/Source/Features/Visuals/ModelGlow/PlayerModelGlow/PlayerModelGlow.h +++ b/Source/Features/Visuals/ModelGlow/PlayerModelGlow/PlayerModelGlow.h @@ -84,7 +84,8 @@ class PlayerModelGlow { [[nodiscard]] bool shouldGlowPlayerModel(auto&& playerPawn) const noexcept { - return playerPawn.isAlive().value_or(true) + return state().masterSwitch == ModelGlowState::State::Enabled + && playerPawn.isAlive().value_or(true) && playerPawn.health().greaterThan(0).valueOr(true) && !playerPawn.isControlledByLocalPlayer() && playerPawn.isTTorCT() diff --git a/Source/Features/Visuals/ModelGlow/TickingBombModelGlow/TickingBombModelGlow.h b/Source/Features/Visuals/ModelGlow/TickingBombModelGlow/TickingBombModelGlow.h index 5ff58789a2a..89f37aa7161 100644 --- a/Source/Features/Visuals/ModelGlow/TickingBombModelGlow/TickingBombModelGlow.h +++ b/Source/Features/Visuals/ModelGlow/TickingBombModelGlow/TickingBombModelGlow.h @@ -42,7 +42,7 @@ class TickingBombModelGlow { [[nodiscard]] bool isEnabled() const noexcept { - return state().tickingBombModelGlow == ModelGlowState::State::Enabled; + return state().masterSwitch == ModelGlowState::State::Enabled && state().tickingBombModelGlow == ModelGlowState::State::Enabled; } [[nodiscard]] bool shouldGlowPlantedBombModel(auto&& plantedBomb) const noexcept diff --git a/Source/Features/Visuals/ModelGlow/WeaponModelGlow/WeaponModelGlow.h b/Source/Features/Visuals/ModelGlow/WeaponModelGlow/WeaponModelGlow.h index 9b3b5685ef7..5848a3474d4 100644 --- a/Source/Features/Visuals/ModelGlow/WeaponModelGlow/WeaponModelGlow.h +++ b/Source/Features/Visuals/ModelGlow/WeaponModelGlow/WeaponModelGlow.h @@ -85,7 +85,7 @@ class WeaponModelGlow { [[nodiscard]] bool shouldGlowWeaponModel(auto&& weapon) const noexcept { - return !weapon.baseEntity().hasOwner().valueOr(true); + return state().masterSwitch == ModelGlowState::State::Enabled && !weapon.baseEntity().hasOwner().valueOr(true); } [[nodiscard]] auto& state() const noexcept