BUG FIX on the Cybran ACU OverCharge Ability Hook.
http://pastebin.com/raw.php?i=GSuvC0Salocal prevOnAbility = OnAbility
Code:
OnAbility = function(unit, abilityBp, state)
prevOnAbility(unit, abilityBp, state)
if EntityCategoryContains(categories.CYBRAN, unit) then
if state == "activate" then
local subMainWeapon = unit:GetSecondaryWeaponLabel()
if unit.SecondaryWeaponLabel then
unit:SetWeaponEnabledByLabel( subMainWeapon, false)
end
elseif state == "deactivate" or state == "interrupt" then
local subMainWeapon = unit:GetSecondaryWeaponLabel() -- pulls the weapon so that it can be turned back on.
if unit.SecondaryWeaponLabel then
unit:SetWeaponEnabledByLabel(subMainWeapon, true)
end
end
end
end
Would the following work as well or do I need to call it each time I flip it's on/off switch?
Code:
OnAbility = function(unit, abilityBp, state)
local subMainWeapon = unit:GetSecondaryWeaponLabel() -- pulls the weapon so that it can be turned back on.
prevOnAbility(unit, abilityBp, state)
if EntityCategoryContains(categories.CYBRAN, unit) then
if state == "activate" then
if unit.SecondaryWeaponLabel then
unit:SetWeaponEnabledByLabel( subMainWeapon, false)
end
elseif state == "deactivate" or state == "interrupt" then
if unit.SecondaryWeaponLabel then
unit:SetWeaponEnabledByLabel(subMainWeapon, true)
end
end
end
end
Thanks Hollow for doing the play testing that found this.