﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,resolution,keywords,cc,phab_field
4359,UnitAI and unpacked unit with a unit in los but not still in range,fatherbushido,,"We have an unpacked unit A waiting for attacking a target T.
Then a unit enter in los.
UnitAI does his job, push the correct attack order and process the fsm message.

Target T enter is in los of unit A.
The target T is still alive.
We are not still in range so the `CheckTargetAttackRange` fails.
And we are at L471 - L491:

{{{
		// For packable units out of attack range:
		// 1. If packed, we need to move to attack range and then unpack.
		// 2. If unpacked, we first need to pack, then follow case 1.
		var cmpPack = Engine.QueryInterface(this.entity, IID_Pack);
		if (cmpPack)
		{
			// Ignore unforced attacks
			// TODO: use special stances instead?
			if (!this.order.data.force)
			{
				this.FinishOrder();
				return;
			}

			if (this.CanPack())
			{
				// Case 2: pack
				this.PushOrderFront(""Pack"", { ""force"": true });
				return;
			}
		}
}}}

So it ends.

I guess we should had something here to put the unit A in a state where it will keep the attack order and wait for the target to be in his range or find new targets...

(And perhaps even cleanest, in the same move, implement that TODO about special stances).",defect,new,Should Have,Alpha 22,UI & Simulation,,,,
