Skip to content

Commit

Permalink
Set weapon range to 0 when disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
lL1l1 committed Jan 26, 2024
1 parent 60a314b commit e632ab2
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 e632ab2

Please sign in to comment.