Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
Show First 20 Lines • Show All 677 Lines • ▼ Show 20 Lines | if (this.CanPack()) | ||||
this.SetNextState("INDIVIDUAL.PACKING"); | this.SetNextState("INDIVIDUAL.PACKING"); | ||||
}, | }, | ||||
"Order.Unpack": function(msg) { | "Order.Unpack": function(msg) { | ||||
if (this.CanUnpack()) | if (this.CanUnpack()) | ||||
this.SetNextState("INDIVIDUAL.UNPACKING"); | this.SetNextState("INDIVIDUAL.UNPACKING"); | ||||
}, | }, | ||||
"Order.CancelPack": function(msg) { | |||||
var cmpPack = Engine.QueryInterface(this.entity, IID_Pack); | |||||
if (cmpPack && cmpPack.IsPacking() && !cmpPack.IsPacked()) | |||||
cmpPack.CancelPack(); | |||||
this.FinishOrder(); | |||||
}, | |||||
"Order.CancelUnpack": function(msg) { | |||||
var cmpPack = Engine.QueryInterface(this.entity, IID_Pack); | |||||
if (cmpPack && cmpPack.IsPacking() && cmpPack.IsPacked()) | |||||
cmpPack.CancelPack(); | |||||
this.FinishOrder(); | |||||
}, | |||||
"Order.MoveToChasingPoint": function(msg) { | "Order.MoveToChasingPoint": function(msg) { | ||||
// Overriden by the CHASING state. | // Overriden by the CHASING state. | ||||
// Can however happen outside of it when renaming... | // Can however happen outside of it when renaming... | ||||
// TODO: don't use an order for that behaviour. | // TODO: don't use an order for that behaviour. | ||||
return { "discardOrder": true }; | return { "discardOrder": true }; | ||||
}, | }, | ||||
// States for the special entity representing a group of units moving in formation: | // States for the special entity representing a group of units moving in formation: | ||||
▲ Show 20 Lines • Show All 2,604 Lines • ▼ Show 20 Lines | |||||
"PACKING": { | "PACKING": { | ||||
"enter": function() { | "enter": function() { | ||||
let cmpPack = Engine.QueryInterface(this.entity, IID_Pack); | let cmpPack = Engine.QueryInterface(this.entity, IID_Pack); | ||||
cmpPack.Pack(); | cmpPack.Pack(); | ||||
return false; | return false; | ||||
}, | }, | ||||
"Order.CancelPack": function(msg) { | |||||
this.FinishOrder(); | |||||
}, | |||||
"PackFinished": function(msg) { | "PackFinished": function(msg) { | ||||
this.FinishOrder(); | this.FinishOrder(); | ||||
}, | }, | ||||
"leave": function() { | "leave": function() { | ||||
let cmpPack = Engine.QueryInterface(this.entity, IID_Pack); | let cmpPack = Engine.QueryInterface(this.entity, IID_Pack); | ||||
cmpPack.CancelPack(); | cmpPack.CancelPack(); | ||||
}, | }, | ||||
"Attacked": function(msg) { | "Attacked": function(msg) { | ||||
// Ignore attacks while packing | // Ignore attacks while packing | ||||
}, | }, | ||||
}, | }, | ||||
"UNPACKING": { | "UNPACKING": { | ||||
"enter": function() { | "enter": function() { | ||||
let cmpPack = Engine.QueryInterface(this.entity, IID_Pack); | let cmpPack = Engine.QueryInterface(this.entity, IID_Pack); | ||||
cmpPack.Unpack(); | cmpPack.Unpack(); | ||||
return false; | return false; | ||||
}, | }, | ||||
"Order.CancelUnpack": function(msg) { | |||||
this.FinishOrder(); | |||||
}, | |||||
"PackFinished": function(msg) { | "PackFinished": function(msg) { | ||||
this.FinishOrder(); | this.FinishOrder(); | ||||
}, | }, | ||||
"leave": function() { | "leave": function() { | ||||
let cmpPack = Engine.QueryInterface(this.entity, IID_Pack); | let cmpPack = Engine.QueryInterface(this.entity, IID_Pack); | ||||
cmpPack.CancelPack(); | cmpPack.CancelPack(); | ||||
}, | }, | ||||
▲ Show 20 Lines • Show All 3,210 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator