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; } } } }
virtual void OnHUDEvent(const SHUDEvent& event) { // Only add/remove entity is handled here, so we only care about the int param EntityId entityId = 0; if(event.eventType == eHUDEvent_AddEntity || event.eventType == eHUDEvent_RemoveEntity) { 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: entityId = event.GetData(i).GetInt(); break; case SHUDEventData::eSEDT_float: break; case SHUDEventData::eSEDT_undef: default: CryWarning(VALIDATOR_MODULE_FLOWGRAPH, VALIDATOR_WARNING, "[CFlowNode_EntityTrackedListener] HudEvent data unknown."); break; } } if(entityId != 0) { CHUDMissionObjective* pMO = NULL; pMO = g_pGame->GetMOSystem()->GetMissionObjectiveByEntityId(entityId); string entityClassName = gEnv->pEntitySystem->GetEntity(entityId)->GetClass()->GetName(); bool bMissionOnly = GetPortBool(&m_pActInfo, eIP_MissionOnly); bool bTrigger = false; if(bMissionOnly) { bTrigger = IsClassAllowed(entityClassName) && pMO; } else { bTrigger = IsClassAllowed(entityClassName); } if(bTrigger) { // activate outputport if(event.eventType == eHUDEvent_AddEntity) ActivateOutput(&m_pActInfo, eOP_EntityAdded, 1); else ActivateOutput(&m_pActInfo, eOP_EntityRemoved, 1); ActivateOutput<EntityId>(&m_pActInfo, eOP_EntityId, entityId); } } } }
bool CGodMode::RespawnPlayerIfDead() const { CActor* player = static_cast<CActor*>(g_pGame->GetIGameFramework()->GetClientActor()); bool result = RespawnIfDead(player); if (result) { SHUDEvent event; event.eventType = eHUDEvent_OnHUDReload; event.AddData(SHUDEventData(true)); event.AddData( SHUDEventData(false)); // Dynamically loaded CHUDEventDispatcher::CallEvent(event); } return result; }
void CHUDMissionObjective::SendRadarEvent() { EntityId trackedEntityId = GetTrackedEntity(); if (trackedEntityId) { SHUDEvent radarEvent; if(m_eStatus == ACTIVATED) radarEvent.eventType = eHUDEvent_AddEntity; else radarEvent.eventType = eHUDEvent_RemoveEntity; radarEvent.AddData(SHUDEventData((int)trackedEntityId)); CHUDEventDispatcher::CallEvent(radarEvent); } }
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; } } }
void CPlayerPlugin_CurrentlyTargetting::NetSerialize(TSerialize ser, EEntityAspects aspect, uint8 profile, int flags) { if(aspect == CPlayer::ASPECT_CURRENTLYTARGETTING_CLIENT) { NET_PROFILE_SCOPE("CurrentlyTargeting", ser.IsReading()); EntityId previousTarget = m_currentTarget; ser.Value("curTargetId", m_currentTarget, 'eid'); if(ser.IsReading()) { if(m_currentTarget != previousTarget) { CCCPOINT_IF(m_currentTarget, PlayerState_RemotePlayerNowTargettingSomebody); CCCPOINT_IF(!m_currentTarget, PlayerState_RemotePlayerNowTargettingNobody); m_currentTargetTime = 0.0f; CGameRules *pGameRules = g_pGame->GetGameRules(); const EntityId clientActorId = g_pGame->GetClientActorId(); if (m_bTargetingLocalPlayer) { SHUDEvent event (eHUDEvent_LocalPlayerTargeted); event.AddData(false); CHUDEventDispatcher::CallEvent(event); m_bTargetingLocalPlayer = false; //m_targetedSignal.Stop(clientActorId); } } } } }
virtual void OnHUDEvent(const SHUDEvent& event) { // Since I only handle OnObjectiveChanged I only expect a void pointer and a boolean, fail in other cases. CHUDMissionObjective* pMissionObjective = NULL; bool bIsSilent = false; if(event.eventType == eHUDEvent_OnObjectiveChanged) { for(unsigned int i = 0; i < event.GetDataSize(); i++) { switch(event.GetData(i).m_type) { case SHUDEventData::eSEDT_voidptr: pMissionObjective = (CHUDMissionObjective*)event.GetData(i).GetPtr(); break; case SHUDEventData::eSEDT_bool: bIsSilent = event.GetData(i).GetBool(); break; case SHUDEventData::eSEDT_int: // not necessary now break; case SHUDEventData::eSEDT_float: // not necessary now break; case SHUDEventData::eSEDT_undef: default: CryWarning(VALIDATOR_MODULE_FLOWGRAPH, VALIDATOR_WARNING, "[CFlowNode_MissionStateListener] HudEvent data unknown."); break; } } if(pMissionObjective && !bIsSilent) { // activate outputport ActivateOutput(&m_pActInfo, eOP_StateChanged, 1); ActivateOutput<string>(&m_pActInfo, !pMissionObjective->IsSecondary() ? eOP_NamePrimary : eOP_NameSecondary, string(pMissionObjective->GetShortDescription())); ActivateOutput<string>(&m_pActInfo, !pMissionObjective->IsSecondary() ? eOP_DescPrimary : eOP_DescSecondary, string(pMissionObjective->GetMessage())); ActivateOutput<int>(&m_pActInfo, eOP_State, pMissionObjective->GetStatus()); ActivateOutput<bool>(&m_pActInfo, eOP_IsSecondary, pMissionObjective->IsSecondary()); } } }
void CPlayerPlugin_CurrentlyTargetting::Leave() { m_currentTarget = 0; m_currentTargetTime = 0.0f; if(m_bTargetingLocalPlayer) { SHUDEvent event (eHUDEvent_LocalPlayerTargeted); event.AddData(false); CHUDEventDispatcher::CallEvent(event); REINST("needs verification!"); /*EntityId clientId = g_pGame->GetClientActorId(); if(clientId && m_targetedSignal.IsPlaying(clientId)) { m_targetedSignal.Stop(clientId); }*/ } CPlayerPlugin::Leave(); }
void OnHUDEvent(const SHUDEvent& event) { switch(event.eventType) { case eHUDEvent_OnEntityScanned: { EntityId id = static_cast<EntityId>(event.GetData(0).m_int); IEntity* pEntity = gEnv->pEntitySystem->GetEntity(id); if(!pEntity) break; m_entityId = id; if(m_enabled) ActivateOutput(&m_actInfo, EOP_EntityID, m_entityId); break; } } }