diff --git a/BlackOpsFAF-ACUs/hook/lua/defaultunits.lua b/BlackOpsFAF-ACUs/hook/lua/defaultunits.lua index d064fde0..e85bf65f 100644 --- a/BlackOpsFAF-ACUs/hook/lua/defaultunits.lua +++ b/BlackOpsFAF-ACUs/hook/lua/defaultunits.lua @@ -1,51 +1,12 @@ local oldACUUnit = ACUUnit -ACUUnit = Class(oldACUUnit) { - BuildDisable = function(self) - while self:IsUnitState('Building') or self:IsUnitState('Enhancing') or self:IsUnitState('Upgrading') or - self:IsUnitState('Repairing') or self:IsUnitState('Reclaiming') do - WaitSeconds(0.5) - end - - for k, v in self.WeaponEnabled do - if v then - self:SetWeaponEnabledByLabel(k, true, true) - end - end - end, - - -- Store weapon status on upgrade. Ignore default and OC, which are dealt with elsewhere - SetWeaponEnabledByLabel = function(self, label, enable, lockOut) - oldACUUnit.SetWeaponEnabledByLabel(self, label, enable) - - if label ~= self.rightGunLabel and label ~= 'OverCharge' and label ~= 'AutoOverCharge' and not lockOut then - self.WeaponEnabled[label] = enable - end - end, - - OnStartBuild = function(self, unitBeingBuilt, order) - oldACUUnit.OnStartBuild(self, unitBeingBuilt, order) - - -- Disable any active upgrade weapons - local fork = false - for k, v in self.WeaponEnabled do - if v then - self:SetWeaponEnabledByLabel(k, false, true) - fork = true - end - end - - if fork then - self:ForkThread(self.BuildDisable) - end - end, - +ACUUnit = Class(oldACUUnit) { updateBuildRestrictions = function(self) local faction = nil local type = nil local techlevel = nil - --Defines the unit's faction + -- Defines the unit's faction if EntityCategoryContains(categories.AEON, self) then faction = categories.AEON elseif EntityCategoryContains(categories.UEF, self) then @@ -56,7 +17,7 @@ ACUUnit = Class(oldACUUnit) { faction = categories.SERAPHIM end - --Defines the unit's layer type + -- Defines the unit's layer type if EntityCategoryContains(categories.LAND, self) then type = categories.LAND elseif EntityCategoryContains(categories.AIR, self) then @@ -67,7 +28,7 @@ ACUUnit = Class(oldACUUnit) { local aiBrain = self:GetAIBrain() - --Sanity check. + -- Sanity check. if not faction then return end @@ -97,7 +58,6 @@ ACUUnit = Class(oldACUUnit) { break end end - for id, unit in aiBrain:GetListOfUnits(categories.RESEARCH * categories.TECH3 * faction * researchType, false, true) do if not unit.Dead and not unit:IsBeingBuilt() then -- Special case for the commander, since its engineering upgrades are implemented using build restrictions