Skip to content

Commit

Permalink
Fix model glow not being removed when toggling off the master switch
Browse files Browse the repository at this point in the history
  • Loading branch information
danielkrupinski committed Dec 31, 2024
1 parent e123cb9 commit d434e40
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d434e40

Please sign in to comment.