Exemple #1
0
	virtual void ProcessEvent(EFlowEvent event, SActivationInfo *pActInfo)
	{
		CPersistantStats* pStats = g_pGame->GetPersistantStats();
		CRY_ASSERT(pStats != NULL);
		if (!pStats)
			return;

		switch (event)
		{
			case eFE_Activate:
			{	
				bool saveProfile = false;
				if (IsPortActive(pActInfo, EIP_FlagTutorialAsPlayed))
				{
					int val = pStats->GetStat( EIPS_TutorialAlreadyPlayed );
					pStats->SetClientStat( EIPS_TutorialAlreadyPlayed, val + 1 );
					saveProfile = true;
				}
				if (IsPortActive(pActInfo, EIP_FlagTutorialAsNOTPlayed))
				{
					pStats->SetClientStat( EIPS_TutorialAlreadyPlayed, 0 );
					saveProfile = true;
				}
				if (IsPortActive(pActInfo, EIP_GetFlagState))
				{
					int val = pStats->GetStat( EIPS_TutorialAlreadyPlayed );
					ActivateOutput( pActInfo, OUT_HasBeenPlayed, val!=0 );
				}
				if (saveProfile)
					g_pGame->GetProfileOptions()->SaveProfile(ePR_All);
			}
			break;
		}
	}
void CHeavyMountedWeapon::FinishRipOff()
{
	m_rippingOff = false;
	m_rippedOff = true;
	
	RemoveViewLimits();

	if(IsClient() && gEnv->pGame->GetIGameFramework()->GetClientActorId()==GetOwnerId())
	{
		if(IEntity* pEntity = GetEntity())
		{
			const char* collectibleId = pEntity->GetClass()->GetName();
			CPersistantStats* pStats = g_pGame->GetPersistantStats();
			if(pStats && pStats->GetStat(collectibleId, EMPS_SPWeaponByName) == 0)
			{
				pStats->SetMapStat(EMPS_SPWeaponByName, collectibleId, eDatabaseStatValueFlag_Available);

				if(!gEnv->bMultiplayer)
				{
					// Show hud unlock msg
					SHUDEventWrapper::DisplayWeaponUnlockMsg(collectibleId);
				}
			}
		}
	}

	CActor* pOwner = GetOwnerActor();
	IActionController* pController = pOwner ? pOwner->GetAnimatedCharacter()->GetActionController() : NULL;
	if(pController)
	{
		CMannequinUserParamsManager& mannequinUserParams = g_pGame->GetIGameFramework()->GetMannequinInterface().GetMannequinUserParamsManager();
		const SMannequinItemParams* pParams = mannequinUserParams.FindOrCreateParams<SMannequinItemParams>(pController);

		UpdateMountedTags(pParams, pController->GetContext().state, true);
	}
}
Exemple #3
0
void CHeavyWeapon::StartUse(EntityId userId)
{
    // holster user item here
    SetOwnerId(userId);

    CActor* pOwner = GetOwnerActor();
    if (!pOwner)
        return;

    HighlightWeapon(false);
    Physicalize(false, false);

    if(gEnv->bMultiplayer)
        {
            m_properties.usable &= strlen(g_pGameCVars->g_forceHeavyWeapon->GetString()) == 0;

            CHANGED_NETWORK_STATE(pOwner, CPlayer::ASPECT_CURRENT_ITEM);
        }

    if(IItem* pCurrentItem = pOwner->GetCurrentItem())
        {
            //Don't keep history if we're switching from Pick & Throw otherwsie we'll switch back to it when we're done with the heavy weapon
            static IEntityClass* pPickAndThrowWeaponClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass("PickAndThrowWeapon");
            m_pItemSystem->SetActorItem(pOwner, GetEntityId(), pCurrentItem->GetEntity()->GetClass() != pPickAndThrowWeaponClass);
        }
    else
        {
            m_pItemSystem->SetActorItem(pOwner, GetEntityId(), true);
        }

    TriggerRespawn();

    EnableUpdate(true, eIUS_General);
    RequireUpdate(eIUS_General);

    RegisterAsUser();

    HandleHeavyWeaponPro(*pOwner);

    m_stats.brandnew = false;
    m_stats.used = true;
    m_stats.detached = false;

    if(IsClient() && gEnv->pGame->GetIGameFramework()->GetClientActorId()==userId)
        {
            if(IEntity* pEntity = GetEntity())
                {
                    const char* collectibleId = pEntity->GetClass()->GetName();
                    CPersistantStats* pStats = g_pGame->GetPersistantStats();
                    if(pStats && pStats->GetStat(collectibleId, EMPS_SPWeaponByName) == 0)
                        {
                            pStats->SetMapStat(EMPS_SPWeaponByName, collectibleId, eDatabaseStatValueFlag_Available);

                            if(!gEnv->bMultiplayer)
                                {
                                    // Show hud unlock msg
                                    SHUDEventWrapper::DisplayWeaponUnlockMsg(collectibleId);
                                }
                        }
                }
        }

    if (IsServer())
        {
            pOwner->GetGameObject()->InvokeRMIWithDependentObject(CActor::ClStartUse(), CActor::ItemIdParam(GetEntityId()), eRMI_ToAllClients|eRMI_NoLocalCalls, GetEntityId());
            g_pGame->GetGameRules()->AbortEntityRemoval(GetEntityId());
        }

    OnStartUsing();
}