mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-21 02:23:47 +00:00
Make hunting units disband earlier.
Fix formation disbanding. This was SVN commit r12921.
This commit is contained in:
@@ -680,6 +680,12 @@ var UnitFsmSpec = {
|
||||
},
|
||||
|
||||
"Order.Gather": function(msg) {
|
||||
if (this.MustKillGatherTarget(msg.data.target))
|
||||
{
|
||||
this.PushOrderFront("Attack", { "target": msg.data.target, "hunting": true });
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: on what should we base this range?
|
||||
// Check if we are already in range, otherwise walk there
|
||||
if (!this.CheckTargetRangeExplicit(msg.data.target, 0, 10))
|
||||
@@ -831,8 +837,8 @@ var UnitFsmSpec = {
|
||||
return;
|
||||
}
|
||||
|
||||
// If this was the last order, attempt to disband the formation.
|
||||
cmpFormation.FindInPosition();
|
||||
// No more orders left.
|
||||
cmpFormation.Disband();
|
||||
},
|
||||
},
|
||||
|
||||
@@ -863,6 +869,20 @@ var UnitFsmSpec = {
|
||||
this.StartTimer(1000, 1000);
|
||||
},
|
||||
|
||||
"EntityRenamed": function(msg) {
|
||||
if (this.order.data.target == msg.entity)
|
||||
{
|
||||
this.order.data.target = msg.newentity;
|
||||
|
||||
// If we're hunting, that means we have a queued gather
|
||||
// order whose target also needs to be updated.
|
||||
if (this.order.data.hunting && this.orderQueue[1] &&
|
||||
this.orderQueue[1].type == "Gather")
|
||||
this.orderQueue[1].data.target = msg.newentity;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
"Timer": function(msg) {
|
||||
var cmpFormation = Engine.QueryInterface(this.entity, IID_Formation);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user