
Mithy
By: a guest on
Nov 20th, 2010 | syntax:
Lua | size: 0.83 KB | hits: 36 | expires: Never
--AIBrain.lua hook - remove non-allied gold amounts from sync, except for observers
local prevClass = AIBrain
AIBrain = Class(prevClass) {
InternalGiveResources = function(self, type, amount)
prevClass.InternalGiveResources(self, type, amount)
if Sync.ArmyGold and Sync.ArmyGold[self:GetArmyIndex()] > 0
and GetFocusArmy() ~= -1 and not IsAlly(GetFocusArmy(), self:GetArmyIndex()) then
Sync.ArmyGold[self:GetArmyIndex()] = 0
end
end,
TakeResource = function(self, type, amount)
prevClass.TakeResource(self, type, amount)
if Sync.ArmyGold and Sync.ArmyGold[self:GetArmyIndex()] > 0
and GetFocusArmy() ~= -1 and not IsAlly(GetFocusArmy(), self:GetArmyIndex()) then
Sync.ArmyGold[self:GetArmyIndex()] = 0
end
end,
}