Skip to content

Commit

Permalink
Hide disabled weapons on range overlay
Browse files Browse the repository at this point in the history
Revert "Hide disabled weapons on range overlay"

This reverts commit fa3d501.

Set weapon range to 0 when disabled
  • Loading branch information
lL1l1 committed Jan 28, 2024
1 parent 384edd8 commit a1411fc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lua/sim/weapon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -682,15 +682,20 @@ Weapon = ClassWeapon(WeaponMethods) {
SetWeaponEnabled = function(self, enable)
if not IsDestroyed(self) then
if not enable then
WeaponMethods.ChangeMaxRadius(self, 0)
WeaponMethods.ChangeMinRadius(self, 0)
self:SetEnabled(enable)
return
end

local enabledByEnh = self.Blueprint.EnabledByEnhancement
if enabledByEnh then
local enhancements = SimUnitEnhancements[self.unit.EntityId]
if enhancements then
for _, enh in enhancements do
if enh == enabledByEnh then
WeaponMethods.ChangeMaxRadius(self, self:GetMaxRadius())
WeaponMethods.ChangeMinRadius(self, self:GetMinRadius())
self:SetEnabled(enable)
return
end
Expand All @@ -699,6 +704,8 @@ Weapon = ClassWeapon(WeaponMethods) {
-- enhancement needed, but doesn't have it; don't allow weapon to be enabled
return
end
WeaponMethods.ChangeMaxRadius(self, self:GetMaxRadius())
WeaponMethods.ChangeMinRadius(self, self:GetMinRadius())
self:SetEnabled(enable)
end
end,
Expand Down

0 comments on commit a1411fc

Please sign in to comment.