Advertisement
Guest User

Mithy

a guest
Nov 20th, 2010
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.83 KB | None | 0 0
  1. --AIBrain.lua hook - remove non-allied gold amounts from sync, except for observers
  2.  
  3. local prevClass = AIBrain
  4.  
  5. AIBrain = Class(prevClass) {
  6.  
  7.     InternalGiveResources = function(self, type, amount)
  8.         prevClass.InternalGiveResources(self, type, amount)
  9.         if Sync.ArmyGold and Sync.ArmyGold[self:GetArmyIndex()] > 0
  10.         and GetFocusArmy() ~= -1 and not IsAlly(GetFocusArmy(), self:GetArmyIndex()) then
  11.             Sync.ArmyGold[self:GetArmyIndex()] = 0
  12.  
  13.         end
  14.     end,
  15.  
  16.     TakeResource = function(self, type, amount)
  17.         prevClass.TakeResource(self, type, amount)
  18.         if Sync.ArmyGold and Sync.ArmyGold[self:GetArmyIndex()] > 0
  19.         and GetFocusArmy() ~= -1 and not IsAlly(GetFocusArmy(), self:GetArmyIndex()) then
  20.             Sync.ArmyGold[self:GetArmyIndex()] = 0
  21.         end
  22.     end,
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement