I did it in postdefs since the in-game performance cost is probably a bit lower
No, it gets read at the start of the game, just like everything else does.
And yeah, it was written before UnitPreDamaged was available, but that just makes it cleaner. But it does other stuff.
The armor-pen system looks cool- definitely an improvement on Spring's native handling of same.
You should put in random damage effects and things, though, and maybe include some rules for spalling. Real-life effects of penetration are rather random, and spalling can kill a tank crew even if the the armor's technically intact. Stuff like an 88 should kill most tanks in one hit, but freak stuff happens all the time in war, and due to Spring's weapon behaviors, it's best to simulate "near misses" and "glancing blows" through a Lua system, imo. But at the very least, include results like "lost treadplate" or "lost track / wheel". Make it so that vehicles are functionally disabled more often than totally destroyed... that's real life.
Then one cool little "bail the crew" function, setting the disabled tank / vehicle to Neutral / Gaia later, and you'd have a pretty awesome simulation of real-world armored combat, imo.
But that's just details. The only thing I can actually quibble with in terms of the basic logic is that small arms do full damage, whereas they should do zero, because with the exception of heavy machineguns, most of them can't penetrate any armor worth spending the CPU to simulate this way (imo), and heavy machineguns should indeed have an armor penetration value, so they can kill the stuff they could IRL.
Suggested logic:
Code: Select all
if not unitInfo then return damage end --not armored, don't bother simulating
if unitInfo and not weaponInfo then return 0 end --no penetration, gg