Code: Select all
--Add reclaimer to the register
function widget:UnitIdle(unitID, unitDefID, unitTeam)
if (myTeamID==getUnitTeam(unitID)) then --check if unit is mine
if (UnitDefs[unitDefID]["canReclaim"]) then --check if unit can reclaim
idleReclaimers[unitID]=true --add unit to register
lastRegiInSecs=gameInSecs
--echo("Registering unit "..unitID.." as idle")
end
end
end
Would be useful in more situations than this. Just pointing out a mild example.
I guess you could use a canmove check, but isbuilding seems cleaner.