This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Mithy

By: a guest on Nov 20th, 2010  |  syntax: Lua  |  size: 0.83 KB  |  views: 37  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }
clone this paste RAW Paste Data