diff --git a/binaries/data/mods/official/scripts/entity_functions.js b/binaries/data/mods/official/scripts/entity_functions.js index 24c981f9fd..af7ecf8bc8 100644 --- a/binaries/data/mods/official/scripts/entity_functions.js +++ b/binaries/data/mods/official/scripts/entity_functions.js @@ -982,7 +982,7 @@ function damage( dmg, inflictor ) this.requestNotification( inflictor, NOTIFY_ORDER_CHANGE, false, true ); this.registerDamage( inflictor ); if( this.isIdle() ) - this.order( ORDER_GENERIC, inflictor, this.getAttackAction( inflictor ) ); + this.order( ORDER_GENERIC, inflictor, this.getAttackAction( inflictor ), false ); }*/ this.onDamaged( inflictor ); @@ -1036,13 +1036,13 @@ function entityEventNotification( evt ) break; case NOTIFY_ATTACK: case NOTIFY_DAMAGE: - this.order( ORDER_GENERIC, evt.target, ACTION_ATTACK ); + this.order( ORDER_GENERIC, evt.target, ACTION_ATTACK, false ); break; case NOTIFY_HEAL: - this.order( ORDER_GENERIC, evt.target, ACTION_HEAL ); + this.order( ORDER_GENERIC, evt.target, ACTION_HEAL, false ); break; case NOTIFY_GATHER: - this.order( ORDER_GENERIC, evt.target, ACTION_GATHER ); + this.order( ORDER_GENERIC, evt.target, ACTION_GATHER, false ); break; case NOTIFY_IDLE: //target is the unit that has become idle. Eventually...do something here. @@ -1099,7 +1099,7 @@ function entityEventTargetExhausted( evt ) // If the target was gatherable, try to gather it. if( canGather(this, evt.target) ) { - this.order( ORDER_GENERIC, evt.target, ACTION_GATHER ); + this.order( ORDER_GENERIC, evt.target, ACTION_GATHER, false ); return; } @@ -1122,7 +1122,7 @@ function entityEventTargetExhausted( evt ) } if( bestTarget != null ) { - this.order( ORDER_GENERIC, bestTarget, ACTION_BUILD ); + this.order( ORDER_GENERIC, bestTarget, ACTION_BUILD, false ); return; } @@ -1156,7 +1156,7 @@ function chooseGatherTarget( resourceSubType, targetList ) } if( bestTarget != null ) { - this.order( ORDER_GENERIC, bestTarget, ACTION_GATHER ); + this.order( ORDER_GENERIC, bestTarget, ACTION_GATHER, false ); return true; } return false; @@ -1399,7 +1399,7 @@ function entityEventPrepareOrder( evt ) function entityStartConstruction( evt ) { - this.order( ORDER_GENERIC, evt.target, ACTION_BUILD ); + this.order( ORDER_GENERIC, evt.target, ACTION_BUILD, false ); } // ==================================================================== diff --git a/source/simulation/EntityScriptInterface.cpp b/source/simulation/EntityScriptInterface.cpp index b7f05a8df2..461a2269d7 100644 --- a/source/simulation/EntityScriptInterface.cpp +++ b/source/simulation/EntityScriptInterface.cpp @@ -290,8 +290,6 @@ bool CEntity::Order( JSContext* cx, uintN argc, jsval* argv, CEntityOrder::EOrde JS_ReportError( cx, "Invalid location" ); return( false ); } - if ( orderCode == CEntityOrder::ORDER_RUN ) - entf_set(ENTF_TRIGGER_RUN); //It's not a notification order if ( argc == 3 ) { @@ -303,7 +301,7 @@ bool CEntity::Order( JSContext* cx, uintN argc, jsval* argv, CEntityOrder::EOrde } break; case CEntityOrder::ORDER_GENERIC: - JSU_REQUIRE_PARAMS_CPP(3); + JSU_REQUIRE_PARAMS_CPP(4); target = ToNative( argv[1] ); if( !target ) { @@ -317,11 +315,20 @@ bool CEntity::Order( JSContext* cx, uintN argc, jsval* argv, CEntityOrder::EOrde } catch( PSERROR_Scripting_ConversionFailed ) { - JS_ReportError( cx, "Invalid generic order type" ); + JS_ReportError( cx, "Invalid generic order type parameter - expected int" ); + return( false ); + } + try + { + newOrder.m_run = ToPrimitive( argv[3] ); + } + catch( PSERROR_Scripting_ConversionFailed ) + { + JS_ReportError( cx, "Invalid generic order run parameter - expected bool" ); return( false ); } //It's not a notification order - if ( argc == 3 ) + if ( argc == 4 ) { if ( entf_get(ENTF_DESTROY_NOTIFIERS) ) { @@ -402,8 +409,8 @@ jsval_t CEntity::GetSpawnPoint( JSContext* UNUSED(cx), uintN argc, jsval* argv ) int edge = g_Game->GetSimulation()->RandInt( 4 ); int point; - double max_w = oabb->m_w + spawn_clearance + 1.0; - double max_d = oabb->m_d + spawn_clearance + 1.0; + double max_w = oabb->m_w + spawn_clearance + 2.0; + double max_d = oabb->m_d + spawn_clearance + 2.0; int w_count = (int)( max_w * 2 ); int d_count = (int)( max_d * 2 );