Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/UnitMotionFlying.js
Show First 20 Lines • Show All 305 Lines • ▼ Show 20 Lines | UnitMotionFlying.prototype.SetSpeedMultiplier = function(multiplier) | |||||||||||
// Ignore this, the speed is always the walk speed. | // Ignore this, the speed is always the walk speed. | |||||||||||
}; | }; | |||||||||||
UnitMotionFlying.prototype.GetRunMultiplier = function() | UnitMotionFlying.prototype.GetRunMultiplier = function() | |||||||||||
{ | { | |||||||||||
return 1; | return 1; | |||||||||||
}; | }; | |||||||||||
/** | ||||||||||||
* Estimate the next position of the unit. Just linearly extrapolate. | ||||||||||||
* TODO: Reuse the movement code for a better estimate. | ||||||||||||
*/ | ||||||||||||
UnitMotionFlying.prototype.EstimateNextPosition = function(dt) | ||||||||||||
{ | ||||||||||||
let cmpPosition = Engine.QueryInterface(this.entity, IID_Position); | ||||||||||||
if (!cmpPosition || !cmpPosition.IsInWorld()) | ||||||||||||
return Vector2D(); | ||||||||||||
let position = cmpPosition.GetPosition2D(); | ||||||||||||
return Vector2D.add(position, Vector2D.sub(position, cmpPosition.GetPreviousPosition2D()).mult(dt/Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer).GetLatestTurnLength())); | ||||||||||||
Stan: Is this possible for the previous position to be equal to the new one? | ||||||||||||
StanUnsubmitted Not Done Inline Actions
Stan: | ||||||||||||
wraitiiUnsubmitted Not Done Inline Actionshm, I think so, what's your point? wraitii: hm, I think so, what's your point? | ||||||||||||
StanUnsubmitted Not Done Inline ActionsShould we early return in that case? Stan: Should we early return in that case? | ||||||||||||
wraitiiUnsubmitted Not Done Inline ActionsMeh, this is uNitMotionflying wraitii: Meh, this is uNitMotionflying | ||||||||||||
}; | ||||||||||||
UnitMotionFlying.prototype.IsMoveRequested = function() | UnitMotionFlying.prototype.IsMoveRequested = function() | |||||||||||
{ | { | |||||||||||
return this.hasTarget; | return this.hasTarget; | |||||||||||
}; | }; | |||||||||||
UnitMotionFlying.prototype.GetCurrentSpeed = function() | UnitMotionFlying.prototype.GetCurrentSpeed = function() | |||||||||||
{ | { | |||||||||||
return this.speed; | return this.speed; | |||||||||||
Show All 40 Lines |
Wildfire Games · Phabricator
Is this possible for the previous position to be equal to the new one?