Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/Formation.js
Show First 20 Lines • Show All 893 Lines • ▼ Show 20 Lines | |||||
/** | /** | ||||
* Set formation controller's speed based on its current members. | * Set formation controller's speed based on its current members. | ||||
*/ | */ | ||||
Formation.prototype.ComputeMotionParameters = function() | Formation.prototype.ComputeMotionParameters = function() | ||||
{ | { | ||||
let maxRadius = 0; | let maxRadius = 0; | ||||
let minSpeed = Infinity; | let minSpeed = Infinity; | ||||
let minAcceleration = Infinity; | |||||
for (let ent of this.members) | for (let ent of this.members) | ||||
{ | { | ||||
let cmpUnitMotion = Engine.QueryInterface(ent, IID_UnitMotion); | let cmpUnitMotion = Engine.QueryInterface(ent, IID_UnitMotion); | ||||
if (cmpUnitMotion) | if (cmpUnitMotion) | ||||
{ | |||||
minSpeed = Math.min(minSpeed, cmpUnitMotion.GetWalkSpeed()); | minSpeed = Math.min(minSpeed, cmpUnitMotion.GetWalkSpeed()); | ||||
minAcceleration = Math.min(minAcceleration, cmpUnitMotion.GetAcceleration()) | |||||
Lint: ESLintBear (semi): `Missing semicolon.` | |||||
Lint: JSHintBear Missing semicolon. Lint: JSHintBear: `Missing semicolon.` | |||||
} | |||||
} | } | ||||
minSpeed *= this.GetSpeedMultiplier(); | minSpeed *= this.GetSpeedMultiplier(); | ||||
let cmpUnitMotion = Engine.QueryInterface(this.entity, IID_UnitMotion); | let cmpUnitMotion = Engine.QueryInterface(this.entity, IID_UnitMotion); | ||||
cmpUnitMotion.SetSpeedMultiplier(minSpeed / cmpUnitMotion.GetWalkSpeed()); | cmpUnitMotion.SetSpeedMultiplier(minSpeed / cmpUnitMotion.GetWalkSpeed()); | ||||
cmpUnitMotion.SetAcceleration(minAcceleration); | |||||
}; | }; | ||||
Formation.prototype.ShapeUpdate = function() | Formation.prototype.ShapeUpdate = function() | ||||
{ | { | ||||
if (!this.rearrange) | if (!this.rearrange) | ||||
return; | return; | ||||
// Check the distance to twin formations, and merge if | // Check the distance to twin formations, and merge if | ||||
▲ Show 20 Lines • Show All 140 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Missing semicolon.