Feature: Add Validation Function for Unit Blueprints
We should have logic in Bluepints.lua that would very quick analyze (something like the existing Auto-Abilities feature is doing at run-time) all loaded unit blueprints and correct bp.Categories table based on other values in blueprints.
Some unit blueprints are missing categories that would help with identifying them while trying to restrict units by the type of weapon they have or what kind of abilities they have.
For example, the following units have stealth/cloak generators so they should have COUNTERINTELLIGENCE category:
urs0304 - CYBRAN T3 Strategic Missile Submarine
url0306 - CYBRAN T2 Mobile Stealth Field System
xrs0204 - CYBRAN T2 Submarine Killer
url0101 - CYBRAN T1 Land Scout
ura0304 - CYBRAN T3 Strategic Bomber
ura0303 - CYBRAN T3 Air Superiority Fighter
url0301_Stealth - CYBRAN T3 SCU Enhanced with the Personal Stealth Generator
url0301_Cloak - CYBRAN T3 SCU Enhanced with the Personal Cloaking Generator
Because other units with stealth/cloak generators already have COUNTERINTELLIGENCE category:
uab4203 - AEON T2 Stealth Field Generator
ueb4203 - UEF T2 Stealth Field Generator
xsl0101 - SERAPHIM T1 Combat Scout
xsb4202 - SERAPHIM T2 Shield Generator
urb4203 - CYBRAN T2 Stealth Field Generator
ura0302 - CYBRAN T3 Spy Plane
url0402 - CYBRAN T4 Experimental Spiderbot
Some units have the COUNTERINTELLIGENCE category but they should not have it since they do not have stealth/cloak generators:
url0202 - CYBRAN T2 Heavy Tank
url0303 - CYBRAN T3 Siege Assault Bot
xrl0305 - CYBRAN T3 Armored Assault Bot
urs0103 - CYBRAN T1 Frigate
~~ues0103 UEF T1 Frigate~~
Also, we could log warning messages for unit blueprints that do not have correct Categories based on rest of their values in blueprints. e.g. missing CYBRAN category for unit with bp.General.FactionName = 'Cybran'
ues0103 - UEF T1 Frigate it has jammimg which should count to COUNTERINTELLIGENCE, no?
We should be trying to do as little as possible in blueprints.lua to alter the bps loaded into the game. This tool would be better as an external device to analyse the codebase so we can make the correct, permanent changes in the actual bps.
I'm alright with not making alterations to loaded blueprints but this tool should at least log warnings to help us detect problems with FAF units and also help modders with identifying problems with modded units. Also, these of log warnings should help debug issues when the game crashes when units with invalid blueprints are spawned during the game.
A unit with a bp invalid enough to crash the game either won't load at all, or will crash with a good enough traceback already. This is more for convenience than necessity. A tool that just logs crappy configs could be cool though, yeah.
Times have changed - I am a fan of adding such validation, if it can help people discover issues early on the better.