Example #1
0
//---------------------------------------------------------------------------------
bool CWeapon::OnActionFiremode(EntityId actorId, const ActionId& actionId, int activationMode, float value)
{
	if (activationMode==eAAM_OnPress)
	{
		bool isDualWield = false;
		CWeapon *dualWield = NULL;
		GetDualWieldInfo(this,isDualWield,&dualWield);

		if (isDualWield)
		{
			if(IsWeaponRaised())
				RaiseWeapon(false,true);

			if(dualWield->IsWeaponRaised())
				dualWield->RaiseWeapon(false,true);

			StartChangeFireMode();
		}
		else
		{
			if(m_weaponRaised)
				RaiseWeapon(false,true);

			StartChangeFireMode();
		}
	}

	return true;
}
bool CLTag::OnActionSwitchFireMode(EntityId actorId, const ActionId& actionId, int activationMode, float value)
{
	if (activationMode != eAAM_OnPress)
		return true;
	StartChangeFireMode();
	return true;
}
Example #3
0
//---------------------------------------------------------------------------------
bool CWeapon::OnActionFiremode(EntityId actorId, const ActionId& actionId, int activationMode, float value)
{
	CActor* pOwner = GetOwnerActor();
	CPlayer* pPlayer = pOwner && pOwner->IsPlayer() ? static_cast<CPlayer*>(pOwner) : 0;
	if (pPlayer && (pPlayer->IsCinematicFlagActive(SPlayerStats::eCinematicFlag_LowerWeapon) || pPlayer->IsCinematicFlagActive(SPlayerStats::eCinematicFlag_LowerWeaponMP)) )
		return true;

	bool incompatibleZommMode = (m_secondaryZmId != 0 && (IsZoomed() || IsZoomingInOrOut()));

	if (AreAnyItemFlagsSet(eIF_BlockActions) || incompatibleZommMode)
	{
		return true;
	}

	if (activationMode == eAAM_OnPress)
	{
		IFireMode* pNewFiremode = GetFireMode(GetNextFireMode(GetCurrentFireMode()));
		if (pNewFiremode == m_fm)
		{
			if(pPlayer && pPlayer->CanSwitchItems())
			{
				pPlayer->SwitchToWeaponWithAccessoryFireMode();
			}
		}
		else if (!IsReloading())
		{
			StartChangeFireMode();
		}
	}

	return true;
}