This patch changes the Upgrade.js component into an "Abilities.js" component, that can do a lot more. In fact, perhaps a little too much, but I don't really see how this could be updated to support an arbitrary number of different and custom abilities in another, saner way.
To show the flexibility of this new component, I have removed Upgrade entirely, and I have also removed the Gate panel in the Gui, replaced by abilities (no difference from the user POV).
In principle, this can be used to create mostly any stateless ability (key being stateless), though this can have a temporary state while active (e.g. for a timer). Exemples would include self-destruct, damage around yourself, all the current cheats, transforming entities into other entities, activating spells, locking/unlocking gates, choosing seeds for farms, mounting/dismounting units and really whatever.
Current features include:
-a charging time (taken from upgrade.js)
-a cool down time
-incompatible abilities (in two shapes)
-supports arbitrary code and is extensible (might be dangerous, need 2nd opinion)
-GUI support
Ultimately, it should be easy-ish to extend this to allow God Powers like in AoM, since an ability can remain "ready" eternally once charged, and we could add GUI elements to click an ability, then click an entity and trigger it there or whatever really.
It should also be reasonably easy to extend this to have a limited number of uses per ability, and to have more advanced conditions to trigger abilities.
I intend to use this to implement D266, by having technologies create a temporary entity with the required ability.
Combined with D274 and D270, this could be used to create temporary auras, temporary technologies, temporary modifiers, and basically pretty much anything.
Could probably include the Packing code in there too, though that might be a little annoying. Technically could include ProductionQueue I guess, but that doesn't seem worth it :P .
Known issues: had to take out the tooltip for entity limit on upgrade, since it's not convenient to get it from the GUI and I believe the tooltip helpers are GUI-only, need to change that.