virtual void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
	{
		switch (event)
		{
		case eFE_Initialize:
			pActInfo->pGraph->SetRegularlyUpdated( pActInfo->myID, true );
			break;
		case eFE_Update:
			{
				ISystem *pSystem = GetISystem();
				IRenderer *pRenderer = gEnv->pRenderer;

				int sysMem = pSystem->GetUsedMemory();
				size_t vidMemThisFrame( 0 );
				size_t vidMemRecently( 0 );
				pRenderer->GetVideoMemoryUsageStats( vidMemThisFrame, vidMemRecently );
				int meshMem = 0;
				pRenderer->EF_Query(EFQ_Alloc_APIMesh, meshMem);
				
				ActivateOutput(pActInfo, OUT_SYSMEM, sysMem);
				// potentially unsafe if we start using >2gb of video memory...?
				ActivateOutput(pActInfo, OUT_VIDEOMEM_THISFRAME, int(vidMemThisFrame));
				ActivateOutput(pActInfo, OUT_VIDEOMEM_RECENTLY, int(vidMemRecently));
				ActivateOutput(pActInfo, OUT_MESHMEM, meshMem);
			}
			break;
		}
	}
	void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
	{
		switch (event)
		{
		case eFE_Activate:
			if (IsPortActive(pActInfo,eIP_Get))
			{
				ITimeOfDay* pTOD = gEnv->p3DEngine->GetTimeOfDay();
				if (pTOD)
				{
					ActivateOutput(pActInfo, eOP_Latitude, pTOD->GetSunLatitude());
					ActivateOutput(pActInfo, eOP_Longitude, pTOD->GetSunLongitude());
				}
			}
			if (IsPortActive(pActInfo, eIP_Set))
			{
				ITimeOfDay* pTOD = gEnv->p3DEngine->GetTimeOfDay();
				if (pTOD)
				{
					float latitude = GetPortFloat(pActInfo, eIP_Latitude);
					float longitude = GetPortFloat(pActInfo, eIP_Longitude);

					pTOD->SetSunPos( longitude, latitude );
					bool forceUpdate = GetPortBool( pActInfo, eIP_ForceUpdate );
					pTOD->Update(true, forceUpdate);
					
					ActivateOutput(pActInfo, eOP_Latitude, latitude);
					ActivateOutput(pActInfo, eOP_Longitude, longitude);
				}
			}
			break;
		}
	}
Ejemplo n.º 3
0
	void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
	{
		if(eFE_Activate == event)
		{
			const bool bAttach = IsPortActive(pActInfo, EIP_ATTACH);
			const bool bDetach = IsPortActive(pActInfo, EIP_DETACH);
			if (!bAttach && !bDetach)
				return;

			IActor* pActor = GetActor(pActInfo);
			if (pActor == 0)
				return;

			const string& className = GetPortString(pActInfo, EIP_WEAPON);

			CWeapon* pWeapon = static_cast<CWeapon*> ( className.empty() ? GetWeapon(pActor) : GetWeapon(pActor, className.c_str()) );
			if (pWeapon != 0)
			{
				ItemString acc = ItemString(GetPortString(pActInfo, EIP_ACCESSORY));
				if (bAttach && pWeapon->GetAccessory(acc) == 0)
				{
					pWeapon->SwitchAccessory(acc);
					ActivateOutput(pActInfo, EOP_ATTACHED, true);
				}
				else if (bDetach && pWeapon->GetAccessory(acc) != 0)
				{
					pWeapon->SwitchAccessory(acc);
					ActivateOutput(pActInfo, EOP_DETACHED, true);
				}
			}
		}
	}
Ejemplo n.º 4
0
	virtual void ProcessEvent( EFlowEvent event,SActivationInfo *pActInfo )
	{
		switch (event)
		{
		case eFE_Initialize:
			{
				m_bResult = 2;
				break;
			}

		case eFE_Activate:
			{
				bool a = GetPortBool(pActInfo,INP_A);
				bool b = GetPortBool(pActInfo,INP_B);
				int result = Execute(a,b)? 1 : 0;
				bool activateOutputs = GetPortBool( pActInfo, INP_Always ) || m_bResult!=result;
				m_bResult = result;
				if (activateOutputs)
				{
					ActivateOutput( pActInfo,0,result );
					if(result)
						ActivateOutput( pActInfo,1,true );
					else
						ActivateOutput( pActInfo,2,true );
				}
			}
		};
	};
Ejemplo n.º 5
0
void CFlashUIFromArrayNode::ProcessEvent( EFlowEvent event,SActivationInfo* pActInfo )
{
	if (event == eFE_Activate && IsPortActive( pActInfo, eI_Array ))
	{
		SUIArguments args( GetPortString( pActInfo, eI_Array ).c_str());
		ActivateOutput( pActInfo, eO_Count, args.GetArgCount());

		SUIArguments leftOver;
		int          port = eO_Val1;

		for (int i = 0; i < args.GetArgCount(); ++i)
		{
			string arg;
			args.GetArg( i, arg );
			if (port + i < eO_LeftOver)
			{
				ActivateOutput( pActInfo, port + i, arg );
			}
			else
			{
				leftOver.AddArgument( arg );
			}
		}
		if (leftOver.GetArgCount() > 0)
		{
			ActivateOutput( pActInfo, eO_LeftOver, string( leftOver.GetAsString()));
		}
	}
}
Ejemplo n.º 6
0
	virtual void ProcessEvent(EFlowEvent event, SActivationInfo *pActInfo)
	{
		switch(event)
		{
		case eFE_Activate:
			CGameRules *pGR = g_pGame->GetGameRules();

			if(!pGR)
				return;

			if(!pActInfo->pEntity)
				return;

			const bool bUseVapor = GetPortBool(pActInfo, EIP_Vapor);

			if(IsPortActive(pActInfo, EIP_Freeze))
			{
				pGR->FreezeEntity(pActInfo->pEntity->GetId(), true, bUseVapor, true);
				ActivateOutput(pActInfo, EOP_Frozen, true);
			}
			else if(IsPortActive(pActInfo, EIP_UnFreeze))
			{
				pGR->FreezeEntity(pActInfo->pEntity->GetId(), false, bUseVapor);
				ActivateOutput(pActInfo, EOP_UnFrozen, true);
			}

			break;
		}
	}
Ejemplo n.º 7
0
	void OnHUDEvent(const SHUDEvent& event)
	{
		switch(event.eventType)
		{
		case eHUDEvent_OnScanningComplete:
			{
				if(m_enabled)
				{
					EntityId scannedEntityId = static_cast<EntityId>(event.GetData(0).m_int);

					if (scannedEntityId != m_entityId) // Only selected entity
						break;

					IEntity* pScannedEntity = gEnv->pEntitySystem->GetEntity(scannedEntityId);
					if(!pScannedEntity)
					{
						SetEnabled(false);
						break;
					}
						
					if (m_delayResult)
					{
						SHUDEvent _event(eHUDEvent_OnControlCurrentTacticalScan);
						_event.AddData(SHUDEventData(true)); // Delay result
						CHUDEventDispatcher::CallEvent(_event);
					}

					ActivateOutput(&m_actInfo, EOP_OnEvent, true);
					ActivateOutput(&m_actInfo, EOP_EntityID, m_entityId);
				}
				break;
			}
		}
	}
Ejemplo n.º 8
0
	virtual void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
	{
		switch (event)
		{
		case eFE_Initialize:
			{
			}
			break;
		case eFE_Activate:
#if CRY_PLATFORM_DURANGO

			if(IsPortActive(pActInfo, EIP_Poll))
			{

				std::shared_ptr<Live::State::User> cur_user = MatchmakingUtils::GetCurrentUser();
				size_t memberCountSession = cur_user->GetSessionMembers().size();

				CryLogAlways("SessionMembers: %d", memberCountSession);

				static MatchmakingUtils::INetworkingUser_impl s_networkingUser;
				bool isHost = s_networkingUser.IsHost();
				if(isHost)
				{
					ActivateOutput(pActInfo, EOP_Host, 1);
				}
				else
				{
					ActivateOutput(pActInfo, EOP_Client, 1);
				}
	
			}
#endif
			break;
		}
	}
Ejemplo n.º 9
0
    // ~IInputEventListener
    virtual bool OnInputEvent( const SInputEvent &event )
    {
        if (true == m_bActive)
        {
#if defined(ORBIS)	// FIXME: Using PS3 inputs for ORBIS
            int nThisKey = event.keyId;
            int nKey = -1;
            int nInput = GetPortInt(&m_actInfo, EIP_Key);
            int tableSize = sizeof(PS3KeyTable)/sizeof(PS3KeyTable[0]);
            if ( nInput>=0 && nInput<tableSize )
                nKey = PS3KeyTable[nInput];
#else
            // Translate key, check value
            const int nThisKey = TranslateKey(event.keyId);
            const int nKey = GetPortInt(&m_actInfo, EIP_Key);
#endif
            if (nKey == nThisKey)
            {
                // Return based on state
                if (eIS_Pressed == event.state)
                    ActivateOutput(&m_actInfo, EOP_Pressed, true);
                else if (eIS_Released == event.state)
                    ActivateOutput(&m_actInfo, EOP_Released, true);
            }
        }

        // Let other listeners handle it
        return false;
    }
Ejemplo n.º 10
0
void CFlashUIScreenPosNode::ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
{
    if ( event == eFE_Initialize )
    {
        UpdateUIElement( GetPortString( pActInfo, eI_UIElement ), pActInfo );
    }
    else if ( event == eFE_Activate )
    {
        if ( IsPortActive( pActInfo, eI_UIElement ) )
        {
            UpdateUIElement( GetPortString( pActInfo, eI_UIElement ), pActInfo );
        }

        if ( IsPortActive( pActInfo, eI_Get ) )
        {
            const int instanceId = GetPortInt(pActInfo, eI_InstanceID);
            float px = GetPortFloat(pActInfo, eI_PX);
            float py = GetPortFloat(pActInfo, eI_PY);
            const bool scaleMode = GetPortBool(pActInfo, eI_ScaleMode);

            SPerInstanceCall3< float&, float&, bool > caller;
            if ( !caller.Execute(GetElement(), instanceId, functor(*this, &CFlashUIScreenPosNode::GetScreenPos), px, py, scaleMode, false) )
            {
                UIACTION_WARNING( "FG: UIElement \"%s\" called get screenpos for multiple instances! (passed instanceId %i), referenced at node \"%s\"", GetPortString(pActInfo, eI_UIElement).c_str(), instanceId, pActInfo->pGraph->GetNodeTypeName( pActInfo->myID ) );
            }

            ActivateOutput( pActInfo, eO_OnGet, true );
            ActivateOutput(pActInfo, eO_PX, px);
            ActivateOutput(pActInfo, eO_PY, py);
        }
    }
}
Ejemplo n.º 11
0
void CFlashUIWorldScreenPosNode::ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
{
    if ( event == eFE_Initialize )
    {
        UpdateUIElement( GetPortString( pActInfo, eI_UIElement ), pActInfo );
    }
    else if ( event == eFE_Activate )
    {
        if ( IsPortActive( pActInfo, eI_UIElement ) )
        {
            UpdateUIElement( GetPortString( pActInfo, eI_UIElement ), pActInfo );
        }

        if ( IsPortActive( pActInfo, eI_Get ) )
        {
            const int instanceId = GetPortInt(pActInfo, eI_InstanceID);
            Vec3 worldPos = GetPortVec3(pActInfo, eI_WorldPos);
            Vec3 offset = GetPortVec3(pActInfo, eI_Offset);
            const bool scaleMode = GetPortBool(pActInfo, eI_ScaleMode);

            SPerInstanceCall3< Vec3&, Vec3&, bool > caller;
            if ( !caller.Execute(GetElement(), instanceId, functor(*this, &CFlashUIWorldScreenPosNode::GetScreenPosFromWorld), worldPos, offset, scaleMode, false) )
            {
                UIACTION_WARNING( "FG: UIElement \"%s\" called get screenpos for multiple instances! (passed instanceId %i), referenced at node \"%s\"", GetPortString(pActInfo, eI_UIElement).c_str(), instanceId, pActInfo->pGraph->GetNodeTypeName( pActInfo->myID ) );
            }

            ActivateOutput( pActInfo, eO_ScreenPos, worldPos);
            ActivateOutput( pActInfo, eO_Scale, offset.z);
            ActivateOutput( pActInfo, eO_IsOnScreen, offset.x == 0 && offset.y == 0);
            offset.z = 0;
            ActivateOutput( pActInfo, eO_OverScanBorder, offset);
            ActivateOutput( pActInfo, eO_OnGet, true );
        }
    }
}
Ejemplo n.º 12
0
	virtual void Execute(SActivationInfo *pActInfo)
	{
		bool bResult = false;

		// did the socket connect okay?
		if (socketWorking) {
			if (ReceiveLine() != -1) {
				string r = recMessage;
				//string value = r.c_str();
				int indice = r.find("|",0);
				string cvar = r.substr(0,indice);//r.Left(r.find("|",0));
				string value = r.substr(indice+1,r.length()-(indice+1));
				CryLogAlways(r);
				ActivateOutput(pActInfo, EOP_CVAR, cvar);
				ActivateOutput(pActInfo, EOP_Value, value);

				bResult = true;
			}
		}
	
		// return false if socket error, or no message
		
		if (bResult) ActivateOutput(pActInfo, EOP_Received, true);
		return;
	}
Ejemplo n.º 13
0
	virtual void DialogCallback(uint32 dialogId, EDialogResponse response, const char* input)
	{
		assert(m_id == dialogId && m_bDisplayed);
		ActivateOutput(&m_ActInfo, eO_Param, string(input));
		ActivateOutput(&m_ActInfo, eO_Result, (int)response);
		m_bDisplayed = false;
	}
Ejemplo n.º 14
0
void CD6PlayerCreditRangeNode::ProcessEvent(EFlowEvent event, SActivationInfo *pActInfo)
{
    switch (event)
    {
    case eFE_Activate:
    {
        if (true == IsPortActive(pActInfo, EIP_Trigger))
        {
            // Get D6 Player
            CD6Player *pPlayer = GetD6Player((NULL != pActInfo->pEntity ? pActInfo->pEntity->GetId() : 0));
            if (NULL == pPlayer) break;

            // Get range
            unsigned int nMinRange = GetPortFloat(pActInfo, EIP_MinAmount);
            unsigned int nMaxRange = GetPortFloat(pActInfo, EIP_MaxAmount);

            // Get credits and test
            unsigned int nCredits = pPlayer->GetCredits();
            if (nCredits >= nMinRange && nCredits <= nMaxRange)
                ActivateOutput(pActInfo, EOP_Pass, true);
            else
                ActivateOutput(pActInfo, EOP_Fail, true);
        }
    }
    break;
    }
}
Ejemplo n.º 15
0
	virtual void ProcessEvent(EFlowEvent event, SActivationInfo *pActInfo)
	{
		switch (event)
		{
		case eFE_Activate:
			{
				if(IsPortActive(pActInfo, EIP_RecenterPose))
				{
					bool triggered = false;
					IHMDManager* pHmDManager = gEnv->pSystem->GetHMDManager();
					IHMDDevice* pDev = pHmDManager ? pHmDManager->GetHMDDevice() : NULL;
					if (pDev && pHmDManager->IsStereoSetupOk())
					{
						const HMDTrackingState& sensorState = pDev->GetTrackingState();
						if (sensorState.CheckStatusFlags(HS_IsUsable))
						{
							pDev->RecenterPose();
							triggered = true;
						}
					}

					ActivateOutput(pActInfo, triggered ? EOP_Triggered : EOP_Failed, true);
					ActivateOutput(pActInfo, EOP_Done, true);
				}
			}
			break;
		}
	}
Ejemplo n.º 16
0
    virtual void ProcessEvent(EFlowEvent event, SActivationInfo* pActInfo)
    {
        if (event == eFE_Activate)
        {
            if (!IsPortActive(pActInfo, Get))
                return;

            EControlScheme curControlScheme = g_pGame->GetUI()->GetCurControlScheme();

            switch (curControlScheme)
            {
            case eControlScheme_Keyboard:
                ActivateOutput(pActInfo, Keyboard, GetPortAny(pActInfo, Get));
                break;
            case eControlScheme_KeyboardMouse:
                ActivateOutput(pActInfo, KeyboardMouse, GetPortAny(pActInfo, Get));
                break;
            case eControlScheme_XBoxOneController:
                ActivateOutput(pActInfo, XBoxOneController, GetPortAny(pActInfo, Get));
                break;
            case eControlScheme_PS4Controller:
                ActivateOutput(pActInfo, PS4Controller, GetPortAny(pActInfo, Get));
                break;

            default:
                GameWarning("CFlowNode_InputControlScheme::ProcessEvent: Failed to activate output port, unhandled control scheme type");
            }
        }
    }
Ejemplo n.º 17
0
	virtual void ProcessEvent( EFlowEvent event, SActivationInfo* pActInfo )
	{
		switch (event)
		{
		case eFE_Activate:
			if (IsPortActive(pActInfo,IN_SEND))
			{
				const string &       key     = GetPortString(pActInfo,IN_MSG);
				const string &       value   = GetPortString(pActInfo,IN_VALUE);
				const int            iTarget = GetPortInt(pActInfo,IN_TARGET);
				SNetMsgData::ETarget target  = SNetMsgData::ConvertTargetIntToEnum(iTarget);
				CRY_ASSERT_MESSAGE(target != SNetMsgData::eT_Invalid, "CFlowNode_MsgSender: IN_TARGET input got converted to an invalid Enum");

				if (target != SNetMsgData::eT_Invalid)
				{
					if (CNetMessageDistpatcher* pNetMsgDispatcher = CCryAction::GetCryAction()->GetNetMessageDispatcher())
					{
						NET_MSG_DISPATCHER_LOG("CFlowNode_MsgSender: %s Send message [%s/%s]", CNetMessageDistpatcher::DbgTranslateLocationToString(), key.c_str(), value.c_str());
						pNetMsgDispatcher->SendMessage(SNetMsgData(CNetMessageDistpatcher::GetLocation(), target, key, value));
						ActivateOutput(pActInfo, OUT_DONE, true);
						return;
					}
				}

				ActivateOutput(pActInfo, OUT_ERROR, true);
			}
			break;
		}
	}
Ejemplo n.º 18
0
	void OnVehicleEvent(EVehicleEvent event, const SVehicleEventParams& params)
	{
		if ( (event == eVE_Destroyed) || 
				 (event == eVE_PreVehicleDeletion) ||
				 (event == eVE_Hide) ) // Safer to ensure the listener is removed at this point
		{
			SetActive(false);
		}
		else if (event == eVE_VehicleDeleted) // This shouldn't be called due to above but just in case
		{
			SetActive(false);
		}
		else if (event == eVE_Collision) // Currently disabled in C2 code
		{
			ActivateOutput(&m_actInfo, EOP_Collided, true);
		}
		else if (event == eVE_Hit) // Needed to detect collision in C2 code since above is disabled
		{
			IGameRules* pGameRules = gEnv->pGame->GetIGameFramework()->GetIGameRulesSystem()->GetCurrentGameRules();
			if (pGameRules)
			{
				const int collisionHitType = pGameRules->GetHitTypeId("collision");

				if (params.iParam == collisionHitType)
				{
					ActivateOutput(&m_actInfo, EOP_Collided, true);
				}
			}
		}
	}
Ejemplo n.º 19
0
	virtual void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
	{
		switch (event)
		{
		case eFE_Initialize:
			pActInfo->pGraph->SetRegularlyUpdated( pActInfo->myID, true );
			break;
		case eFE_Update:
			{
				if(!GetPortBool(pActInfo, 0))
					return;

				IEntity * pEntity = pActInfo->pEntity;
				if (pEntity)
				{
					IPhysicalEntity * pPhysEntity = pEntity->GetPhysics();
					if (pPhysEntity)
					{
						pe_status_dynamics dyn;
						pPhysEntity->GetStatus( &dyn );
						ActivateOutput(pActInfo, 0, dyn.v);
						ActivateOutput(pActInfo, 1, dyn.a);
						ActivateOutput(pActInfo, 2, dyn.w);
						ActivateOutput(pActInfo, 3, dyn.wa);
						ActivateOutput(pActInfo, 4, dyn.mass);
					}
				}
			}
		}
	}
Ejemplo n.º 20
0
	virtual void OnHUDEvent(const SHUDEvent& event)
	{
		int eventID = GetPortInt(&m_pActInfo, 0);
		if(event.eventType == eventID)
		{
			ActivateOutput(&m_pActInfo, eOP_EventFired, 1);
			for(unsigned int i = 0; i < event.GetDataSize(); i++)
			{
				switch(event.GetData(i).m_type)
				{
				case SHUDEventData::eSEDT_voidptr:
					break;
				case SHUDEventData::eSEDT_bool:				
					break;
				case SHUDEventData::eSEDT_int:
					break;
				case SHUDEventData::eSEDT_float:	
					{
						if(eventID == eHUDEvent_LeavingBattleArea)
						{
							float fDeathTimer = event.GetData(i).GetFloat();
							ActivateOutput(&m_pActInfo, eOP_DeathTimer, fDeathTimer);
						}
					}
					break;
				case SHUDEventData::eSEDT_undef:
				default:
					CryWarning(VALIDATOR_MODULE_FLOWGRAPH, VALIDATOR_WARNING, "[CFlowNode_BattleAreaListener] HudEvent data unknown.");
					break;
				}
			}
		}
	}
Ejemplo n.º 21
0
	virtual void ProcessEvent(EFlowEvent event, SActivationInfo *pActInfo)
	{
		switch (event)
		{
		case eFE_Activate:
			{
				if(IsPortActive(pActInfo, EIP_FailCurrentScan))
				{
					SHUDEvent _event(eHUDEvent_OnControlCurrentTacticalScan);
					_event.AddData(SHUDEventData(false)); // Delay result
					_event.AddData(SHUDEventData(false));
					CHUDEventDispatcher::CallEvent(_event);

					ActivateOutput(pActInfo, EOP_Failed, true);
				}
				else if(IsPortActive(pActInfo, EIP_SucceedCurrentScan))
				{
					SHUDEvent _event(eHUDEvent_OnControlCurrentTacticalScan);
					_event.AddData(SHUDEventData(false)); // Delay result
					_event.AddData(SHUDEventData(true));
					CHUDEventDispatcher::CallEvent(_event);

					ActivateOutput(pActInfo, EOP_Succeeded, true);
				}
				break;
			}
		}
	}
	void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
	{
		if (event == eFE_Activate && IsPortActive(pActInfo,0))
		{
			IGameFramework * pGameFramework = gEnv->pGame->GetIGameFramework();

			IActor* pActor = GetInputActor( pActInfo );
			if (!pActor || pActor!=gEnv->pGame->GetIGameFramework()->GetClientActor())  // to avoid some extra RMIs and object creation. Tho, this causes the node to not work properly if it is used with non players entities. (which was never intended anyway)
				return;
						
			IInventory *pInventory = pActor->GetInventory();
      if (!pInventory)
        return;

      const string& itemClass = GetPortString( pActInfo, 1 );
			IEntityClass* pClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass( itemClass.c_str() );
      EntityId id = pInventory->GetItemByClass( pClass );
      
      if (id!=0)
      {
        pInventory->RMIReqToServer_RemoveItem( itemClass.c_str() );
        // TODO: instant output activation, with delayed effective change in the inventory, it potentially could cause problems in rare situations
        ActivateOutput(pActInfo,0,true);
      }
      else
        ActivateOutput(pActInfo,0,true);
		}
	}
Ejemplo n.º 23
0
	void UpdateOutputs( int alertnessGlobal )
	{
		EFilterAI filterAI = (EFilterAI)(GetPortInt( &m_actInfo, IN_FILTERAI ));
		int alertness = 0;

		switch (filterAI)
		{
			case FAI_ALL:
				alertness = alertnessGlobal;
				break;

			case FAI_ENEMIES:
				alertness = g_pGame->GetGameAISystem()->GetAICounters().GetAlertnessCounter().GetAlertnessEnemies();
				break;

			case FAI_FRIENDS:
				alertness = g_pGame->GetGameAISystem()->GetAICounters().GetAlertnessCounter().GetAlertnessFriends();
				break;

			case FAI_FACTION:
			{
				if (m_faction!=IFactionMap::InvalidFactionID)
				{
					alertness = g_pGame->GetGameAISystem()->GetAICounters().GetAlertnessCounter().GetAlertnessFaction( m_faction );
				}
				break;
			}
		}

		ActivateOutput( &m_actInfo, OUT_ALERTNESS, alertness );
		uint32 colorPort = clamp_tpl( alertness+OUT_GREEN, (int)OUT_GREEN, (int)OUT_RED );
		ActivateOutput( &m_actInfo, colorPort, true );
	}
  void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
  {
    IGameFramework* pGF = gEnv->pGame->GetIGameFramework();
  
    if (event == eFE_Activate && IsPortActive(pActInfo,0))
    {
			IActor* pActor = GetInputActor( pActInfo );
			if (!pActor)
				return;

			IInventory *pInventory = pActor->GetInventory();
      if (!pInventory)
        return;

      const string& item = GetPortString(pActInfo, 1);

			IEntityClass* pClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass(item);
      if (0 == pInventory->GetItemByClass(pClass))
      {
        ActivateOutput(pActInfo, 0, false);
      }
      else
      {
        pGF->GetIItemSystem()->SetActorItem(pActor, item, true);
        ActivateOutput(pActInfo, 0, true);
      }
    }
  }
	void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
	{
		switch (event)
		{
		case eFE_Activate:
			if (IsPortActive(pActInfo,eIP_Get))
			{
				Vec3 v;
				gEnv->p3DEngine->GetGlobalParameter(E3DPARAM_SKY_MOONROTATION, v);
				ActivateOutput(pActInfo, eOP_Latitude, v.x);
				ActivateOutput(pActInfo, eOP_Longitude, v.y);
			}
			if (IsPortActive(pActInfo, eIP_Set))
			{
				Vec3 v(ZERO);
				v.x = GetPortFloat(pActInfo, eIP_Latitude);
				v.y = GetPortFloat(pActInfo, eIP_Longitude);
				gEnv->p3DEngine->SetGlobalParameter(E3DPARAM_SKY_MOONROTATION, v);
				ActivateOutput(pActInfo, eOP_Latitude, v.x);
				ActivateOutput(pActInfo, eOP_Longitude, v.y);
				bool forceUpdate = GetPortBool( pActInfo, eIP_ForceUpdate );
				ITimeOfDay* pTOD = gEnv->p3DEngine->GetTimeOfDay();
				if (forceUpdate && pTOD )
					pTOD->Update( true, true );
			}
		}
	}
Ejemplo n.º 26
0
	bool SendNext(SActivationInfo *pActInfo)
	{
		bool bResult = false;

		if (m_Count > 0)
		{
			if (m_Iter < m_Count)
			{
				const int limit = GetPortInt(pActInfo, EIP_Limit);
				if (limit == 0 || m_Iter <= limit)
				{
					OnIterNext(pActInfo);

					EntityId id = *m_ListIter;
					ActivateOutput(pActInfo, EOP_EntityId, id);
					ActivateOutput(pActInfo, EOP_Count, m_Iter);

					++m_Iter;
					++m_ListIter;

					bResult = true;
				}
			}
		}

		if (!bResult)
		{
			ActivateOutput(pActInfo, EOP_Done, m_Iter);
		}

		return bResult;
	}
 virtual void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
 {
     switch (event)
     {
     case eFE_Update:
     {
         bool bPaused = GetPortBool(pActInfo,IN_PAUSED);
         if (!bPaused)
         {
             float fSeconds = gEnv->pTimer->GetFrameStartTime().GetSeconds();
             ActivateOutput( pActInfo,OUT_SECONDS,fSeconds );
             ActivateOutput( pActInfo,OUT_TICK,0 );
         }
     }
     break;
     case eFE_Initialize:
     {
         bool bPaused = GetPortBool(pActInfo,IN_PAUSED);
         pActInfo->pGraph->SetRegularlyUpdated( pActInfo->myID, !bPaused );
         break;
     }
     case eFE_Activate:
         if (IsPortActive(pActInfo,IN_PAUSED))
         {
             bool bPaused = GetPortBool(pActInfo,IN_PAUSED);
             pActInfo->pGraph->SetRegularlyUpdated( pActInfo->myID, !bPaused );
         }
         break;
     }
 }
Ejemplo n.º 28
0
	virtual void Execute(SActivationInfo *pActInfo)
	{
		bool bResult = false;
		if (udpListener->IsWorking()) {
			if (udpListener->ReceiveLine() != -1) {
				string chaine = udpListener->GetRecMessage();
				string token0 = udpListener->GetToken(0);
				Quat gyro = udpListener->TokenToQuat(token0);
				string token1 = udpListener->GetToken(1);
				Vec3 accel = udpListener->TokenToVec3(token1);
				string token2 = udpListener->GetToken(2);
				float compass = udpListener->TokenToFloat(token2);
				
				//if(!gyro.IsValid()) CryLogAlways("NOT VALID");

				ActivateOutput(pActInfo, EOP_Gyro_xyz, Vec3(gyro.v.x,gyro.v.y,gyro.v.z));
				ActivateOutput(pActInfo, EOP_Gyro_w, gyro.w);
				
				ActivateOutput(pActInfo, EOP_Accel, accel);
				ActivateOutput(pActInfo, EOP_Compass, compass);
				
				bResult = true;
			}
		}
		return;
	}
Ejemplo n.º 29
0
		virtual void GameOver(int localWinner)
		{
			switch(localWinner)
			{
				case 1:
					if(g_pGame->GetCVars()->i_debug_mp_flowgraph != 0)
					{
						CryLog("--MP flowgraph: GameWon");
					}
					ActivateOutput(&m_actInfo, EOP_GameWon,true);
					break;
			
				case -1:
					if(g_pGame->GetCVars()->i_debug_mp_flowgraph != 0)
					{
						CryLog("--MP flowgraph: GameLost");
					}
					ActivateOutput(&m_actInfo, EOP_GameLost,true);
					break;

				default:
					if(g_pGame->GetCVars()->i_debug_mp_flowgraph != 0)
					{
						CryLog("--MP flowgraph: GameTied");
					}
					ActivateOutput(&m_actInfo, EOP_GameTied, true);
					break;
			}
		}
Ejemplo n.º 30
0
void CFlashUIFunctionNode::ProcessEvent( EFlowEvent event,SActivationInfo* pActInfo )
{
	if (event == eFE_Activate && IsPortActive(pActInfo, eI_Call))
	{
		int          port = GetDynStartPort();
		SUIArguments args;
		for (TUIParams::const_iterator iter = m_funcDesc.InputParams.Params.begin(); iter != m_funcDesc.InputParams.Params.end(); ++iter)
		{
			GetDynInput( args, *iter, pActInfo, port++ );
		}

		TUIData   res;
		const int instanceId = GetPortInt( pActInfo, eI_InstanceID );

		if (IsTemplate() && !UpdateTmplDesc( GetPortString(pActInfo, eI_TemplateInstanceName), pActInfo ))
			return;

		SPerInstanceCall2< const SUIArguments &, TUIData & > caller;
		caller.Execute(m_pElement, instanceId, functor(*this, &CFlashUIFunctionNode::CallFunction), args, res);

		string out;
		res.GetValueWithConversion( out );
		ActivateOutput( pActInfo, eO_RetVal, out  );

		ActivateOutput( pActInfo, eO_OnCall, true );
	}
}