Design rambling, feel free to comment/ignore
Main issue with tanks is targeting, the AllowWeaponTarget will have to be implemented to decide on targets in an intelligent fashion:
- Did the player issue a manual target?
- What’s the current weapon priority? (HE, AP, or even MG if there’s no ammo)
- Is the target close to the turret heading? (For instance, a lower priority weapon should always target whatever is closest to the turret)
- Can we deal damage to this target?
- Can this target deal damage to us?
The callin will then store the chosen target for each weapon for later use by the script.
In the script there’s going to be a main function analysing the current targets and state to decide on the desired bodyHeading and turretHeading, which will be called every time one of them changes, every reaim etc.
This function may be generic for units with and without turrets.
Aim functions should return true if the turret is pointing to the general direction of the target and if the ammo isn’t locked at the moment (we don’t want a reload if we’re actually aiming at something else).
Firing should halt turret spinning (mostly relevant to MG)
Nice to haves:
- In order to fire a shell faster a tank will rotate both body and turret.
- If there’s no target in range, rotate the turret/body to a target outside range
- Make drive by shooting less micro-ey (tank will be able to intelligently aim beforehand)