Skip to content

Commit

Permalink
Remove integrated code. Fixes most of #214
Browse files Browse the repository at this point in the history
  • Loading branch information
aeoncleanse committed Jul 4, 2017
1 parent f3a04b9 commit f2a5cee
Showing 1 changed file with 4 additions and 44 deletions.
48 changes: 4 additions & 44 deletions BlackOpsFAF-ACUs/hook/lua/defaultunits.lua
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -67,7 +28,7 @@ ACUUnit = Class(oldACUUnit) {

local aiBrain = self:GetAIBrain()

--Sanity check.
-- Sanity check.
if not faction then
return
end
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f2a5cee

Please sign in to comment.