Index: binaries/data/mods/public/simulation/components/UnitMotionFlying.js =================================================================== --- binaries/data/mods/public/simulation/components/UnitMotionFlying.js +++ binaries/data/mods/public/simulation/components/UnitMotionFlying.js @@ -203,7 +203,7 @@ if (!this.reachedTarget && this.targetMinRange <= distFromTarget && distFromTarget <= this.targetMaxRange) { this.reachedTarget = true; - Engine.PostMessage(this.entity, MT_MotionChanged, { "starting": false, "error": false }); + Engine.PostMessage(this.entity, MT_MotionUpdate, { "updateString": "likelySuccess" }); } // If we're facing away from the target, and are still fairly close to it, @@ -291,6 +291,11 @@ return 1; }; +UnitMotionFlying.prototype.IsMoveRequested = function() +{ + return this.hasTarget; +} + UnitMotionFlying.prototype.GetCurrentSpeed = function() { return this.speed; Index: source/simulation2/scripting/MessageTypeConversions.cpp =================================================================== --- source/simulation2/scripting/MessageTypeConversions.cpp +++ source/simulation2/scripting/MessageTypeConversions.cpp @@ -281,9 +281,19 @@ return JS::ObjectValue(*obj); } -CMessage* CMessageMotionUpdate::FromJSVal(const ScriptInterface&, JS::HandleValue) +CMessage* CMessageMotionUpdate::FromJSVal(const ScriptInterface& scriptInterface, JS::HandleValue val) { - LOGWARNING("CMessageMotionUpdate::FromJSVal not implemented"); + FROMJSVAL_SETUP(); + GET_MSG_PROPERTY(std::wstring, updateString); + + if (updateString == L"likelySuccess") + return new CMessageMotionUpdate(CMessageMotionUpdate::LIKELY_SUCCESS); + if (updateString == L"likelyFailure") + return new CMessageMotionUpdate(CMessageMotionUpdate::LIKELY_FAILURE); + if (updateString == L"obstructed") + return new CMessageMotionUpdate(CMessageMotionUpdate::OBSTRUCTED); + + LOGWARNING("CMessageMotionUpdate::FromJSVal passed wrong updateString"); return NULL; }