Opened 7 years ago

Last modified 7 years ago

#4359 closed defect

UnitAI and unpacked unit with a unit in los but not still in range — at Initial Version

Reported by: fatherbushido Owned by:
Priority: Should Have Milestone:
Component: UI & Simulation Keywords:
Cc: Patch:

Description

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).

Change History (0)

Note: See TracTickets for help on using tickets.