ACU's Being Counted as Naval Units

I have a script that is supposed to monitor if teams are building naval units, and spawn a response. For whatever reason, ACU's will begin being counted as naval units and trigger the response. This happens regardless if players are using vanilla ACUs or BlackOpsACUs.

An example is in this replay, which triggers the naval response 18 minutes into gameplay.
#22118629

I confirmed it was the ACUs by running a script that would log and ping all units that had been added to the naval response monitor.

I have since added exclusions for the ACUs, but they are still being counted as naval units. The script for the Naval Response is below.

function MonitoringFunctionSeven() --Navy Counter
  local circle = ForkThread(function(self)
  repeat
    WaitSeconds(60)
    local totalT1Navy = CalculateTotalEnemyUnitsOfCategory(self, categories.MOBILE * categories.TECH1 * categories.NAVAL - categories.COMMAND - categories.SUBCOMMANDER - categories.CONSTRUCTION) 
    local totalExpNavy = CalculateTotalEnemyUnitsOfCategory(self, categories.MOBILE * categories.EXPERIMENTAL * categories.NAVAL  - categories.COMMAND - categories.SUBCOMMANDER - categories.CONSTRUCTION) 
    if totalExpNavy >= 1 then
      totalExpNavy = totalExpNavy - 1
    end	
    local totalT2Navy = CalculateTotalEnemyUnitsOfCategory(self, categories.MOBILE * categories.TECH2 * categories.NAVAL - categories.COMMAND - categories.SUBCOMMANDER - categories.CONSTRUCTION)
    local totalT3Navy = CalculateTotalEnemyUnitsOfCategory(self, categories.MOBILE * categories.TECH3 * categories.NAVAL - categories.COMMAND - categories.SUBCOMMANDER - categories.CONSTRUCTION)
    NavalPowerAI = 0
    NavalPowerAI = math.floor((totalExpNavy * 180) + (totalT3Navy * 60) + (totalT2Navy * 15) + (totalT1Navy * 3) + 0.5)	
  until GetGameTimeSeconds() > 20000 or won == true
  end)
end

I'm not 100% convinced on the order of operations. Have you tried the following:

local totalT1Navy = CalculateTotalEnemyUnitsOfCategory(
    self,
    (categories.MOBILE * categories.TECH1 * categories.NAVAL) -
    (categories.COMMAND + categories.SUBCOMMANDER + categories.CONSTRUCTION)
)

A work of art is never finished, merely abandoned

Heh, I was just thinking of trying that. Will test it later. Any idea why ACUs would be counted as naval? Seems to occur after upgrading to T3.

@jip

So I screwed up my detection script, since I just reused some old code and missed changing a line. So ACUs were being falsely accused of the bug! Instead, it was the mobile SMD unit I added, and forgot to remove the naval tag.

I LOVE the CalculateTotalEnemyUnitsOfCategory! Wish I had known about it sooner. Very useful.