Fix fromations gathering treasures.
Introduced in ea96e81098
.
The formation ignored the order to collect a treasure, but got into a
individual state (which should not happen).
Subsequent orders may fail due to unimplemented components/functions.
Reported by: @wowgetoffyourcellphone in
https://wildfiregames.com/forum/topic/39973-a25-feedbacks-from-testing/page/15/?tab=comments#comment-444979.
Differential revision: https://code.wildfiregames.com/D4207
Tested by: @wowgetoffyourcellphone
Comments by: @Stan, @wraitii
Fixes: #6266
This was SVN commit r25846.
This commit is contained in:
parent
8b0d82be33
commit
c48d0c562f
@ -872,6 +872,36 @@ UnitAI.prototype.UnitFsmSpec = {
|
|||||||
return ACCEPT_ORDER;
|
return ACCEPT_ORDER;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"Order.CollectTreasure": function(msg) {
|
||||||
|
// TODO: on what should we base this range?
|
||||||
|
if (this.CheckTargetRangeExplicit(msg.data.target, 0, 20))
|
||||||
|
{
|
||||||
|
this.CallMemberFunction("CollectTreasure", [msg.data.target, false, false]);
|
||||||
|
this.SetNextState("MEMBER");
|
||||||
|
|
||||||
|
return ACCEPT_ORDER;
|
||||||
|
}
|
||||||
|
if (msg.data.secondTry || !this.CheckTargetVisible(msg.data.target))
|
||||||
|
return this.FinishOrder();
|
||||||
|
|
||||||
|
msg.data.secondTry = true;
|
||||||
|
this.PushOrderFront("WalkToTargetRange", { "target": msg.data.target, "min": 0, "max": 20 });
|
||||||
|
return ACCEPT_ORDER;
|
||||||
|
},
|
||||||
|
|
||||||
|
"Order.CollectTreasureNearPosition": function(msg) {
|
||||||
|
// TODO: on what should we base this range?
|
||||||
|
if (!this.CheckPointRangeExplicit(msg.data.x, msg.data.z, 0, 20))
|
||||||
|
{
|
||||||
|
this.PushOrderFront("WalkToPointRange", { "x": msg.data.x, "z": msg.data.z, "min": 0, "max": 20 });
|
||||||
|
return ACCEPT_ORDER;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.CallMemberFunction("CollectTreasureNearPosition", [msg.data.x, msg.data.z, false, false]);
|
||||||
|
this.SetNextState("MEMBER");
|
||||||
|
return ACCEPT_ORDER;
|
||||||
|
},
|
||||||
|
|
||||||
"Order.Repair": function(msg) {
|
"Order.Repair": function(msg) {
|
||||||
// TODO: on what should we base this range?
|
// TODO: on what should we base this range?
|
||||||
if (!this.CheckTargetRangeExplicit(msg.data.target, 0, 10))
|
if (!this.CheckTargetRangeExplicit(msg.data.target, 0, 10))
|
||||||
@ -5193,6 +5223,7 @@ UnitAI.prototype.GetTargetPositions = function()
|
|||||||
case "ReturnResource":
|
case "ReturnResource":
|
||||||
case "Repair":
|
case "Repair":
|
||||||
case "Garrison":
|
case "Garrison":
|
||||||
|
case "CollectTreasure":
|
||||||
var cmpTargetPosition = Engine.QueryInterface(order.data.target, IID_Position);
|
var cmpTargetPosition = Engine.QueryInterface(order.data.target, IID_Position);
|
||||||
if (!cmpTargetPosition || !cmpTargetPosition.IsInWorld())
|
if (!cmpTargetPosition || !cmpTargetPosition.IsInWorld())
|
||||||
return targetPositions;
|
return targetPositions;
|
||||||
|
Loading…
Reference in New Issue
Block a user