ForbodingAngel

Untitled

Mar 1st, 2014
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. -- Currently upgrades are units like any other. This is simply the easiest way to do them.
  2. -- If you want to do it any other way, just call GG.UpgradeComplete on your appropriate event.
  3. function gadget:UnitCreated(unitID, unitDefID, teamID, builderID)
  4. ApplyGroundWeaponUpgrades()
  5. end
  6.  
  7. -- Modularize upgrades
  8. function gadget:ApplyGroundWeaponUpgrades()
  9. local ud = UnitDefs[unitDefID];
  10. if ud.customParams then
  11. local tech = ud.customParams.upgradetech;
  12. local level = tonumber(ud.customParams.upgradelevel);
  13.  
  14. if tech and level then
  15. GG.UpgradeComplete(tech, level, teamID);
  16. end
  17. end
  18. end
Advertisement
Add Comment
Please, Sign In to add comment