It looks like TA/Spring has tried and abandoned several forms of classification over it's life and now most of it is legacy, conflicting, incomplete or confusing.
Off the top of my head there's TEDclass, moveclass, armor, and category. Category is the closest to what I want but it seems neither the engine or mods really use this now and it was only really used for targetting.
Supcom on the other hand has a very extensive class system that can be used for selecting and filtering units. The categories can be formed into sets using common set operations like union, subtraction and intersection.
To give an idea of how extensive the classes are here is a partial list:
Code: Select all
ABILITYBUTTON,
AEON,
AIR,
AIRSTAGINGPLATFORM,
ALLPROJECTILES,
ALLUNITS,
ANTIAIR,
ANTIMISSILE,
ANTINAVY,
ANTISUB,
ANTITORPEDO,
ARTILLERY,
BATTLESHIP,
BENIGN,
BOMBER,
BOT,
BUILTBYCOMMANDER,
BUILTBYEXPERIMENTALSUB,
BUILTBYLANDTIER2FACTORY,
BUILTBYLANDTIER3FACTORY,
BUILTBYQUANTUMGATE,
BUILTBYTIER1ENGINEER,
BUILTBYTIER1FACTORY,
BUILTBYTIER2COMMANDER,
BUILTBYTIER2ENGINEER,
BUILTBYTIER2FACTORY,
BUILTBYTIER3COMMANDER,
BUILTBYTIER3ENGINEER,
BUILTBYTIER3FACTORY,
CANNOTUSEAIRSTAGING,
CANTRANSPORTCOMMANDER,
CAPTURE,
CARRIER,
CIVILIAN,
CIVILLIAN,
COMMAND,
CONSTRUCTION,
CONSTRUCTIONSORTDOWN,
COUNTERINTELLIGENCE,
CRUISER,
CYBRAN,
DEFENSE,
DEFENSIVEBOAT,
DESTROYER,
DIRECTFIRE,
DRAGBUILD,
ECONOMIC,
ENERGYPRODUCTION,
ENERGYSTORAGE,
ENGINEER,
ENGINEERSTATION,
EXPERIMENTAL,
FACTORY,
FAVORSWATER,
FERRYBEACON,
FIELDENGINEER,
FRIGATE,
GATE,
GROUNDATTACK,
HIGHALTAIR,
HIGHPRIAIR,
HOVER,
HYDROCARBON,
INDIRECTFIRE,
INSIGNIFICANTUNIT,
INTEL,
INTELLIGENCE,
INVULNERABLE,
LAND,
LIGHTBOAT,
MASSEXTRACTION,
MASSFABRICATION,
MASSPRODUCTION,
MASSSTORAGE,
MISSILE,
MOBILE,
MOBILESONAR,
NAVAL,
NAVALCARRIER,
NEEDMOBILEBUILD,
NOFORMATION,
NOSPLASHDAMAGE,
NUKE,
NUKESUB,
OMNI,
OPERATION,
OPTICS,
ORBITALSYSTEM,
OVERLAYANTIAIR,
OVERLAYANTINAVY,
OVERLAYCOUNTERINTEL,
OVERLAYDEFENSE,
OVERLAYDIRECTFIRE,
OVERLAYINDIRECTFIRE,
OVERLAYMISC,
OVERLAYOMNI,
OVERLAYRADAR,
OVERLAYSONAR,
PATROLHELPER,
POD,
PODSTAGINGPLATFORM,
PRODUCTDL,
PRODUCTFA,
PRODUCTSC1,
PROJECTILE,
RADAR,
RALLYPOINT,
REBUILDER,
RECLAIM,
RECLAIMABLE,
RECLAIMFRIENDLY,
REPAIR,
SATELLITE,
SCOUT,
SELECTABLE,
SERAPHIM,
SHIELD,
SHOWATTACKRETICLE,
SHOWQUEUE,
SILO,
SIZE12,
SIZE16,
SIZE20,
SIZE4,
SIZE8,
SONAR,
SORTCONSTRUCTION,
SORTDEFENSE,
SORTECONOMY,
SORTINTEL,
SORTSTRATEGIC,
SPECIALHIGHPRI,
SPECIALLOWPRI,
STATIONASSISTPOD,
STRATEGIC,
STRUCTURE,
SUBCOMMANDER,
SUBMERSIBLE,
T1SUBMARINE,
T2SUBMARINE,
TACTICAL,
TACTICALMISSILEPLATFORM,
TANK,
TARGETCHASER,
TECH1,
TECH2,
TECH3,
TELEPORTBEACON,
TORPEDO,
TRANSPORTATION,
TRANSPORTBUILTBYTIER1FACTORY,
TRANSPORTBUILTBYTIER2FACTORY,
TRANSPORTBUILTBYTIER3FACTORY,
TRANSPORTFOCUS,
UEF,
UNSELECTABLE,
UNTARGETABLE,
VERIFYMISSILEUI,
VISIBLETORECON,
WALL,
Supcom also provides operators to handle categories. They are:
+ Add (union)
- Subtraction (difference)
* Intersection
() Grouping/Precedence
So complex sets are easily formed:
-- all tech level 2 air transports and construction bots
(TRANSPORTATION * AIR * TECH2) + (CONSTRUCTION * LAND)
-- All construction units except commanders and sea units (but include unit xeb0205)
CONSTRUCTION - COMMAND - SEA + xeb0205
The resulting sets can be passed to selection/filter functions and unit tests:
units = getUnitsInCircleByCat(x, y, r, set)
bool = hasCategory(unit, set)
selectUnitsByCat(set)
units = filterUnitsByCat(units, set)
I realise categories blur the lines between what the engine should define and what mods should but it would be nice to have both reserved and custom categories available (categories only seen by a mod or gadget for example that can still be added to a set with reserved engine categories).
Categories really come into their own with AI's. It would really be a blessing to be able to quickly filter down a list of units with the ANTI-AIR category instead of walking through weapon tables and comparing armor types and other such hassles.
No idea how best to implement categories though i'd probably go for a simple base type that can be used with math.bitops so and/or operations can be used in Lua. Eg:
Code: Select all
-- Engine defined constants
CAT_METAL = 2^1 -- metal
CAT_ENERGY = 2^2 -- energy
CAT_RADAR = 2^3 -- radar
CAT_SONAR = 2^4 -- sonar
CAT_TRANSPORT = 2^6 -- transport
CAT_ASSIST = 2^7 -- assist
CAT_BUILD = 2^8 -- build
...
-- Local gadget/widget defined category
local CAT_INTEL = CAT_RADAR + CAT_BUILD