Preface: I've honestly attempted to make a proof-of-concept PR around this idea, but after a few hours of bumbling around sources, I have to admit defeat: I'm not nearly enough of a C++ programmer to piece all the parts (rules' adjustments, script bindings, logic) together.
The rationale of this idea surfaced in a talk about driveable tanks (tanks as "armor"): one can make a custom damageUnit script for such a tank providing a "meatshield" - extra invisible HP on top of normal HP to simulate a concept of tank's bulk protecting the driver up to a point; but there is no good way to display the inner workings of the script to user and, for example, tell how much of the "meatshield" still remains.
So, I thought that it would be nice to have a way to display some sprites and/or text over the unit, driven by Yankes' script system. It could be something like this:
1) A new field inside armor definition, something like -
overlays:
- type: SPRITE (or TEXT)
x: <number>
y: <number>
spriteSheet: <spritesheet name, only for SPRITE type>
2) When drawing unit sprite, if unit's armor have any overlays defined, an 'overlaySpriteUnit' or 'overlayTextUnit' script will be called for every overlay, with layer_index as argument (and obviously the script could get all the additional data via tags system as usual). If the script returns any valid sprite index, then a sprite with this index is taken from the spritesheet and drawn over the unit at given x/y offsets relative to unit. If the script returns invalid sprite index (e.g. <0), then nothing is drawn. Default script implementation always returns -1, not drawing anything anywhere.
Drawing text is probably out of question for the moment as Yankes' scripts don't support string type variables; although drawing numbers might be possible, by returning a number from a script. Although I'm totally not sure how to define a "no need to draw anything" return value in this case.
Potential uses:
1) Draw additional icons reflecting inner workings of other scripts/tags: if a unit has a buff or debuff given to it by scripts; if a unit has a shield remaining and approximately how much of it (in, say, XCOM: EU-styled 'pips' display)
2) Draw some flavor graphics over units! Like a "thought bubble" with curses for a unit that was hit by something invisible, or a "rape" "rage" icon for a chryssalid seeing an enemy.
3) (if displaying text) Draw any specific value from tags - exact value of shields remaining, etc. Even Jagged Alliance-style "floating damage numbers" would be possible with enough inter-script work between damageUnit script and overlays (although that would also require a way to change x/y offsets by script).
Anyways, text overlays might be too much at the moment as scripts currently can handle only numbers. But sprite overlays should be very doable.
Also, I'm not a modder and I have absolutely no idea if actual modmakers will find this worthy of use and take their time to write scripts for it (as by design it won't do anything without a custom script). So I'd very much like to hear any feedback from modmakers.