Page 1 of 1

Problem with OnlyTargetCategory and current svn Spring

Posted: 13 Oct 2007, 08:31
by yuritch
Looks like svn revision 4517 brought a new problem to Spring. That change was to make units unable to fire at their target move sideways (so they may find a clean line of fire).
However, it doesn't take into account the reasons one unit cannot fire at the other. That's not always caused by blocked line of fire! For example, now units will orbit things they cannot shoot because of OnlyTargetCategory or script-blocked weapons.
My example: I have a unit with 2 weapons, an autocannon and a missile launcher. Missile launcher has a deploying animation (hatches opening, missile loading and such) that takes some time (3 seconds) during which it is jammed by AimWeapon2. Weapons are set up so that autocannon will only fire at light units and the missile will only target heavy units. Now if there is a heavy unit in range, my unit will start to go sideways until the missile deployment anim finishes (since both weapons are considered blocked during that time - OnlyTargetCategory prevents autocannon from firing at heavy things and the missile isn't ready to fire yet). That is not the intended behaviour, the unit can lose line of fire because of that.
This is probably not noticeable in TA-based mods (not many units with different OnlyTargetCategory per-weapon there), but it can affect other mods greatly.

Posted: 13 Oct 2007, 11:54
by ILMTitan
Thank you for brining this to my attention. Can you send me the mod that is breaking so I can fix it?

Posted: 13 Oct 2007, 12:01
by KDR_11k
Ah, that explains why my lolis kept turning to the side... In Lolimod I wont let a weapon fire if the unit is moving.

Posted: 13 Oct 2007, 16:04
by yuritch
ILMTitan wrote:Thank you for brining this to my attention. Can you send me the mod that is breaking so I can fix it?
Check your PM for a link.

Posted: 14 Oct 2007, 22:02
by ILMTitan
I can't seem to recreate the problem with the script-blocked weapons. Additionally, I can't see how script blocked weapons could cause a problem. TryTarget(...) does not seem to have any calls to the scripts, and only checks if the weapon can hit the target, not if it can fire (unless it has no stockpile).

I do however, see the problem with the OnlyTargetCategory, and am writing code that fixes that now.

Posted: 15 Oct 2007, 09:20
by yuritch
Ok, script-blocked weapons causing the problem might have been my imagination, I'll recheck that when the OnlyTargetCategory fix is in.