//------------------------------------------------------------------------
void CWeapon::NetStartMeleeAttack(bool boostedAttack, int8 attackIndex /*= -1*/)
{
    if(m_melee)
    {
        BoostMelee(boostedAttack);
        m_melee->NetAttack();
    }
}
Esempio n. 2
0
//---------------------------------------------------------------------
bool CWeapon::OnActionSpecial(EntityId actorId, const ActionId& actionId, int activationMode, float value)
{
	CPlayer* pOwnerPlayer = GetOwnerPlayer();
	if (pOwnerPlayer && !pOwnerPlayer->CanMelee())
		return true;

	if(gEnv->bMultiplayer && AreAnyItemFlagsSet(eIF_Transitioning)) //Ignore the transition from attachments menu and melee immediately
	{
		ClearItemFlags( eIF_Transitioning );
	}

	if (gEnv->bMultiplayer && !g_pGameCVars->pl_boostedMelee_allowInMP)
	{
		if (activationMode == eAAM_OnPress)
		{
			if (CanMeleeAttack())
			{
				if (PreMeleeAttack())
					MeleeAttack();
			}
			else
			{
				CCCPOINT(Melee_PressedButMeleeNotAllowed);
			}
		}
	}
	else
	{
		if (activationMode == eAAM_OnPress)
		{
			if(CanMeleeAttack())
			{
				if (pOwnerPlayer)
				{
					if (PreMeleeAttack())
					{
						BoostMelee(false);
						MeleeAttack();
					}
				}
			}
			else
			{
				CCCPOINT(Melee_PressedButMeleeNotAllowed);
			}
		}
	}


	return true;
}