Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/components/Formation.js
Show First 20 Lines • Show All 336 Lines • ▼ Show 20 Lines | Formation.prototype.RemoveMembers = function(ents) | ||||
// If there's nobody left, destroy the formation | // If there's nobody left, destroy the formation | ||||
if (this.members.length == 0) | if (this.members.length == 0) | ||||
{ | { | ||||
Engine.DestroyEntity(this.entity); | Engine.DestroyEntity(this.entity); | ||||
return; | return; | ||||
} | } | ||||
this.ComputeMotionParameters(); | |||||
if (!this.rearrange) | if (!this.rearrange) | ||||
return; | return; | ||||
this.ComputeMotionParameters(); | |||||
// Rearrange the remaining members | // Rearrange the remaining members | ||||
this.MoveMembersIntoFormation(true, true); | this.MoveMembersIntoFormation(true, true); | ||||
}; | }; | ||||
Formation.prototype.AddMembers = function(ents) | Formation.prototype.AddMembers = function(ents) | ||||
{ | { | ||||
this.offsets = undefined; | this.offsets = undefined; | ||||
this.inPosition = []; | this.inPosition = []; | ||||
Show All 14 Lines | for (let ent of ents) | ||||
let cmpAuras = Engine.QueryInterface(ent, IID_Auras); | let cmpAuras = Engine.QueryInterface(ent, IID_Auras); | ||||
if (cmpAuras && cmpAuras.HasFormationAura()) | if (cmpAuras && cmpAuras.HasFormationAura()) | ||||
{ | { | ||||
this.formationMembersWithAura.push(ent); | this.formationMembersWithAura.push(ent); | ||||
cmpAuras.ApplyFormationAura(this.members); | cmpAuras.ApplyFormationAura(this.members); | ||||
} | } | ||||
} | } | ||||
this.ComputeMotionParameters(); | |||||
this.MoveMembersIntoFormation(true, true); | this.MoveMembersIntoFormation(true, true); | ||||
}; | }; | ||||
/** | /** | ||||
* Called when the formation stops moving in order to detect | * Called when the formation stops moving in order to detect | ||||
* units that have already reached their final positions. | * units that have already reached their final positions. | ||||
*/ | */ | ||||
Formation.prototype.FindInPosition = function() | Formation.prototype.FindInPosition = function() | ||||
▲ Show 20 Lines • Show All 608 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator