Differential D3656 Diff 16526 ps/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js
Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js
Show First 20 Lines • Show All 1,851 Lines • ▼ Show 20 Lines | |||||
* | * | ||||
* Returns an object with the following fields: | * Returns an object with the following fields: | ||||
* - idle - true if the unit is considered idle by the filter, false otherwise. | * - idle - true if the unit is considered idle by the filter, false otherwise. | ||||
* - bucket - if idle, set to the index of the first matching idle class, undefined otherwise. | * - bucket - if idle, set to the index of the first matching idle class, undefined otherwise. | ||||
*/ | */ | ||||
GuiInterface.prototype.IdleUnitFilter = function(unit, idleClasses, excludeUnits) | GuiInterface.prototype.IdleUnitFilter = function(unit, idleClasses, excludeUnits) | ||||
{ | { | ||||
let cmpUnitAI = Engine.QueryInterface(unit, IID_UnitAI); | let cmpUnitAI = Engine.QueryInterface(unit, IID_UnitAI); | ||||
if (!cmpUnitAI || !cmpUnitAI.IsIdle() || cmpUnitAI.IsTurret()) | if (!cmpUnitAI || !cmpUnitAI.IsIdle()) | ||||
return { "idle": false }; | |||||
let cmpGarrisonable = Engine.QueryInterface(unit, IID_Garrisonable); | |||||
if (cmpGarrisonable && cmpGarrisonable.IsGarrisoned()) | |||||
return { "idle": false }; | return { "idle": false }; | ||||
let cmpIdentity = Engine.QueryInterface(unit, IID_Identity); | let cmpIdentity = Engine.QueryInterface(unit, IID_Identity); | ||||
if (!cmpIdentity) | if (!cmpIdentity) | ||||
return { "idle": false }; | return { "idle": false }; | ||||
let bucket = idleClasses.findIndex(elem => MatchesClassList(cmpIdentity.GetClassesList(), elem)); | let bucket = idleClasses.findIndex(elem => MatchesClassList(cmpIdentity.GetClassesList(), elem)); | ||||
if (bucket == -1 || excludeUnits.indexOf(unit) > -1) | if (bucket == -1 || excludeUnits.indexOf(unit) > -1) | ||||
▲ Show 20 Lines • Show All 236 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator