Skip to content

Commit

Permalink
Clean up DisableBuff and ReEnableBuff
Browse files Browse the repository at this point in the history
- clear damage table cache only when the buff is successfully enabled (error would stop it anyway though)
- remove irrelevant comments
- remove `ERROR:` since the log will already make it apparent
  • Loading branch information
lL1l1 committed Jan 29, 2025
1 parent c63e785 commit e7f5e9a
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lua/sim/weapon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -684,23 +684,21 @@ Weapon = ClassWeapon(WeaponMethods, DebugWeaponComponent) {
DisableBuff = function(self, buffname)
if buffname then
self.DisabledBuffs[buffname] = true
self.damageTableCache = false
else
-- Error
error('ERROR: DisableBuff in weapon.lua does not have a buffname')
error('DisableBuff in weapon.lua does not have a buffname')
end
self.damageTableCache = false
end,

---@param self Weapon
---@param buffname string
ReEnableBuff = function(self, buffname)
if buffname then
self.DisabledBuffs[buffname] = nil
self.damageTableCache = false
else
-- Error
error('ERROR: ReEnableBuff in weapon.lua does not have a buffname')
error('ReEnableBuff in weapon.lua does not have a buffname')
end
self.damageTableCache = false
end,

--- Method to mark weapon when parent unit gets loaded on to a transport unit
Expand Down

0 comments on commit e7f5e9a

Please sign in to comment.