//--------------------------------------------
void CLaser::TurnOnLaser(bool manual /*= false*/)
{
	CWeapon* pParentWeapon = GetWeapon();
	if(pParentWeapon == NULL)
		return;

	m_laserHelperFP.clear();
	const SAccessoryParams *params = GetWeapon()->GetAccessoryParams(GetEntity()->GetClass());
	if (params)
		m_laserHelperFP = params->attach_helper;

	int slot = pParentWeapon->IsOwnerFP() ? eIGS_FirstPerson: eIGS_ThirdPerson;

	CActor* pOwner = pParentWeapon->GetOwnerActor();
	GetGameObject()->EnableUpdateSlot(this, eIUS_General);
	if (pOwner && pOwner->IsPlayer())
		pParentWeapon->SetFiringLocator(this);
	m_laserBeam.TurnOnLaser();

	//Turn off crosshair
	if (pParentWeapon->IsOwnerClient())
	{
		pParentWeapon->SetCrosshairMode(CWeapon::eWeaponCrossHair_ForceOff);
		pParentWeapon->FadeCrosshair(0.0f, g_pGame->GetUI()->GetCVars()->hud_Crosshair_laser_fadeOutTime);
	}
}
bool CLaser::GetProbableHit(EntityId weaponId, const IFireMode* pFireMode, Vec3& hit)
{
	if (!m_laserBeam.IsLaserActivated())
		return false;

	if(gEnv->bMultiplayer)
	{
		CWeapon* pParentWeapon = GetWeapon();
		if (pParentWeapon && pParentWeapon->IsZoomed())
		{
			return false;
		}
	}

	CWeapon* pWeapon = GetWeapon();
	int slot = pWeapon->IsOwnerFP() ? eIGS_FirstPerson : eIGS_ThirdPerson;

	Vec3 lastBeamHit = m_laserBeam.GetLastHit();
	Vec3 currentBeamPosition = pWeapon->GetSlotHelperPos(slot, "weapon_term", true);
	Matrix33 rotation = pWeapon->GetSlotHelperRotation(slot, "weapon_term", true);
	Vec3 currentBeamDirection = rotation.GetColumn1();

	const CFireMode* pCFireMode = static_cast<const CFireMode*>(pFireMode);
	const CSingle* pSingle = crygti_cast<const CSingle*>(pCFireMode);
	if (pSingle && pSingle->GetShared()->fireparams.laser_beam_uses_spread)
	{
		currentBeamDirection = pSingle->ApplySpread(currentBeamDirection, pSingle->GetSpread());
	}

	float distanceToLastHit = lastBeamHit.GetDistance(currentBeamPosition);
	hit = currentBeamPosition + currentBeamDirection * distanceToLastHit;

	return true;
}
Example #3
0
void CSpammer::UpdateLoadIn(float frameTime)
{
	const int currentAmmoCount = GetAmmoCount();
	const bool infiniteAmmo = (GetClipSize() < 0);

	if ((!infiniteAmmo) && (m_numLoadedRockets >= currentAmmoCount))
	{
		GetWeapon()->PlayAction(GetFragmentIds().empty_clip);
		StopFire();
		return;
	}

	const SSpammerParams& params = GetShared()->spammerParams;

	const float loadInTime = 1.0f / (params.loadInRate / 60.0f);
	m_timer -= frameTime;

	while (m_timer < 0.0f && m_numLoadedRockets < params.maxNumRockets)
	{
		m_timer += loadInTime;
		AddTarget();
		GetWeapon()->PlayAction(GetFragmentIds().c**k);
	}

	if (m_numLoadedRockets != m_targetsAssigned.GetNumLockOns())
	{
		EntityId nextTarget = GetNextLockOnTarget();
		if (nextTarget != 0)
			m_targetsAssigned.LockOn(nextTarget);
	}
}
void CCinematicInput::UpdateWeapons()
{
	CWeapon* pPrimaryWeapon = GetWeapon(eWeapon_Primary);
	CWeapon* pSecondaryWeapon = GetWeapon(eWeapon_Secondary);

	const bool doUpdate = (pPrimaryWeapon != NULL) || (pSecondaryWeapon != NULL);
	if (doUpdate)
	{
		const CCamera& camera = gEnv->pSystem->GetViewCamera();

		const Vec3 viewPosition  = camera.GetPosition();
		const Vec3 viewDirection = camera.GetViewdir();

		// Update raycast
		if (m_aimingRayID == 0)
		{
			IEntity *pIgnoredEntity = gEnv->pEntitySystem->GetEntity(m_weapons[eWeapon_Primary].m_parentId);
			IEntity *pIgnoredEntity2 = gEnv->pEntitySystem->GetEntity(m_weapons[eWeapon_Secondary].m_parentId);
			int ignoreCount = 0;
			IPhysicalEntity *pIgnoredEntityPhysics[2] = { NULL, NULL };
			if (pIgnoredEntity)
			{
				pIgnoredEntityPhysics[ignoreCount] = pIgnoredEntity->GetPhysics();
				ignoreCount += pIgnoredEntityPhysics[ignoreCount] ? 1 : 0;
			}
			if (pIgnoredEntity2 && (pIgnoredEntity2 != pIgnoredEntity))
			{
				pIgnoredEntityPhysics[ignoreCount] = pIgnoredEntity2->GetPhysics();
				ignoreCount += pIgnoredEntityPhysics[ignoreCount] ? 1 : 0;
			}

			m_aimingRayID = g_pGame->GetRayCaster().Queue(
				RayCastRequest::HighestPriority,
				RayCastRequest(viewPosition, viewDirection * CINEMATIC_INPUT_MAX_AIM_DISTANCE,
				ent_all|ent_water,
				rwi_stop_at_pierceable|rwi_ignore_back_faces,
				pIgnoredEntityPhysics,
				ignoreCount),
				functor(*this, &CCinematicInput::OnRayCastDataReceived));
		}

		// Update weapon orientation
		const Vec3 aimTargetPosition = viewPosition + (viewDirection * m_aimingDistance);
		if (pPrimaryWeapon != NULL)
		{
			UpdateWeaponOrientation( pPrimaryWeapon->GetEntity(), aimTargetPosition );
		}

		if (pSecondaryWeapon != NULL)
		{
			UpdateWeaponOrientation( pSecondaryWeapon->GetEntity(), aimTargetPosition );
		}
	}
}
Example #5
0
void CPedSA::SetCurrentWeaponSlot ( eWeaponSlot weaponSlot )
{
    if ( weaponSlot < WEAPONSLOT_MAX )
    {
        eWeaponSlot currentSlot = GetCurrentWeaponSlot ();
        if ( weaponSlot != GetCurrentWeaponSlot () )
        {
            CWeapon * pWeapon = GetWeapon ( currentSlot );
            if ( pWeapon ) RemoveWeaponModel ( pWeapon->GetInfo ( WEAPONSKILL_STD )->GetModel () );

            CPedSAInterface * thisPed = (CPedSAInterface *)this->GetInterface();
         
            // set the new weapon slot
            thisPed->bCurrentWeaponSlot = weaponSlot;

            // is the player the local player?
            CPed * pPed = pGame->GetPools()->GetPedFromRef ( (DWORD)1 );
            //if ( pPed == this && thisPed->pPlayerInfo )
            //{
            
            DWORD dwThis = (DWORD)this->GetInterface();
            if ( pPed == this )
            {
               ((CPlayerInfoSA *)pGame->GetPlayerInfo())->GetInterface()->PlayerPedData.m_nChosenWeapon = weaponSlot;

                DWORD dwFunc = FUNC_MakeChangesForNewWeapon_Slot;
                _asm
                {
                    mov     ecx, dwThis
                    push    weaponSlot
                    call    dwFunc
                }
            }
void WBCompEldHands::ShowWeaponHUD() const
{
	WBEntity* const pWeapon = GetWeapon();
	ASSERT( pWeapon );

	WBCompEldWeapon* const pWeaponComponent = GET_WBCOMP( pWeapon, EldWeapon );
	ASSERT( pWeaponComponent );

	STATIC_HASHED_STRING( HUD );
	STATIC_HASHED_STRING( WeaponIcon );

	{
		WB_MAKE_EVENT( SetWidgetImage, NULL );
		WB_SET_AUTO( SetWidgetImage, Hash, Screen, sHUD );
		WB_SET_AUTO( SetWidgetImage, Hash, Widget, sWeaponIcon );
		WB_SET_AUTO( SetWidgetImage, Hash, Image, pWeaponComponent->GetWeaponIcon() );
		WB_DISPATCH_EVENT( WBWorld::GetInstance()->GetEventManager(), SetWidgetImage, NULL );
	}

	{
		WB_MAKE_EVENT( SetWidgetHidden, NULL );
		WB_SET_AUTO( SetWidgetHidden, Hash, Screen, sHUD );
		WB_SET_AUTO( SetWidgetHidden, Hash, Widget, sWeaponIcon );
		WB_SET_AUTO( SetWidgetHidden, Bool, Hidden, false );
		WB_DISPATCH_EVENT( WBWorld::GetInstance()->GetEventManager(), SetWidgetHidden, NULL );
	}
}
Example #7
0
//-----------------------------------------------------------------------------
// Purpose: Called every usercmd by the player PreThink
//-----------------------------------------------------------------------------
void CBasePlayer::ItemPreFrame()
{
	// Handle use events
	PlayerUse();

	CBaseCombatWeapon *pActive = GetActiveWeapon();

	// Allow all the holstered weapons to update
	for ( int i = 0; i < WeaponCount(); ++i )
	{
		CBaseCombatWeapon *pWeapon = GetWeapon( i );

		if ( pWeapon == NULL )
			continue;

		if ( pActive == pWeapon )
			continue;

		pWeapon->ItemHolsterFrame();
	}

    if ( gpGlobals->curtime < m_flNextAttack )
		return;

	if (!pActive)
		return;

#if defined( CLIENT_DLL )
	// Not predicting this weapon
	if ( !pActive->IsPredicted() )
		return;
#endif

	pActive->ItemPreFrame();
}
Example #8
0
void CFireMode::Activate(bool activate)
{
	const int numPlugins = m_plugins.size();

	for (int i = 0; i < numPlugins; i++)
	{
		m_plugins[i]->Activate(activate);
	}

	for (TFireModeListeners::Notifier notifier(m_listeners); notifier.IsValid(); notifier.Next())
	{
		notifier->OnFireModeActivated(activate);
	}

	if (GetWeapon()->GetOwnerId())
	{
		if (m_pWeapon->IsSelected())
		{
			UpdateMannequinTags(activate);
		}
	}
	else
	{
		UpdateMannequinTags(activate);
	}
}
Example #9
0
//------------------------------------------------------------------------
int CScriptBind_Weapon::SetAmmoCount(IFunctionHandler *pH)
{
	CWeapon *pWeapon = GetWeapon(pH);
	if (!pWeapon)
		return pH->EndFunction();

	IFireMode* pFireMode = GetRequestedFireMode(pWeapon, pH);

	if (pFireMode)
	{
		if (pH->GetParamType(2) != svtNumber)
			return pH->EndFunction();

		const char *ammoName = 0;
		if (pH->GetParamType(1) == svtString)
			pH->GetParam(1, ammoName);

		IEntityClass* pAmmoType = pFireMode->GetAmmoType();

		if (ammoName)
			pAmmoType = gEnv->pEntitySystem->GetClassRegistry()->FindClass(ammoName);

		int ammo = 0;
		pH->GetParam(2, ammo);

		pWeapon->SetAmmoCount(pAmmoType, ammo);
	}

	return pH->EndFunction();
}
Example #10
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);
				}
			}
		}
	}
bool CLaser::GetFiringDir(EntityId weaponId, const IFireMode* pFireMode, Vec3& dir, const Vec3& probableHit, const Vec3& firingPos)
{
	CWeapon* pParentWeapon = GetWeapon();

	if (!m_laserBeam.IsLaserActivated())
		return false;

	if(gEnv->bMultiplayer && pParentWeapon && pParentWeapon->IsZoomed())
	{
		return false;
	}

	if(!probableHit.IsZero() && !firingPos.IsZero())
	{
		dir = (probableHit - firingPos).GetNormalized();

		return true;
	}


	if (pParentWeapon)
	{
		int slot = pParentWeapon->IsOwnerFP() ? eIGS_FirstPerson : eIGS_ThirdPerson;

		Matrix33 rotation = pParentWeapon->GetSlotHelperRotation(slot, "weapon_term", true);

		dir = rotation.GetColumn1();
		return true;
	}

	return false;
}
Example #12
0
void CC4Projectile::Arm(bool arm)
{
	if(arm != m_armed)
	{
		m_armed = arm;

		if(gEnv->bServer)
		{
			CHANGED_NETWORK_STATE(this, ASPECT_C4_STATUS);

			if(CWeapon* pWeapon = GetWeapon())
			{
				CHANGED_NETWORK_STATE(pWeapon, CC4::ASPECT_DETONATE);
			}
		}

		if(m_pStatObj)
		{
			m_pStatObj->SetMaterial(arm ? m_pArmedMaterial : m_pDisarmedMaterial);
		}

		if(m_pLightSource)
		{
			UpdateLight(0.f, true);
		}
	}
}
Example #13
0
//------------------------------------------------------------------------
int CScriptBind_Weapon::AutoShoot(IFunctionHandler *pH, int shots, bool autoReload)
{
	struct AutoShootHelper : public IWeaponEventListener
	{
		AutoShootHelper(int n, bool autoreload): m_nshots(n), m_reload(autoreload) {};
		virtual ~AutoShootHelper() {};

		int		m_nshots;
		bool	m_reload;

		virtual void OnShoot(IWeapon *pWeapon, EntityId shooterId, EntityId ammoId, IEntityClass* pAmmoType,
			const Vec3 &pos, const Vec3 &dir, const Vec3 &vel) {};
		virtual void OnStartFire(IWeapon *pWeapon, EntityId shooterId) {};
		virtual void OnStopFire(IWeapon *pWeapon, EntityId shooterId) {};
		virtual void OnStartReload(IWeapon *pWeapon, EntityId shooterId, IEntityClass* pAmmoType) {};
		virtual void OnEndReload(IWeapon *pWeapon, EntityId shooterId, IEntityClass* pAmmoType) {};
		virtual void OnSetAmmoCount(IWeapon *pWeapon, EntityId shooterId) {}
		virtual void OnOutOfAmmo(IWeapon *pWeapon, IEntityClass* pAmmoType)
		{
			if (m_reload)
				pWeapon->Reload(false);
			else
			{
				pWeapon->StopFire();
				pWeapon->RemoveEventListener(this);
			}
		};
		virtual void OnReadyToFire(IWeapon *pWeapon)
		{
			if (!(--m_nshots))
			{
				pWeapon->StopFire();
				pWeapon->RemoveEventListener(this);
			}
			else
			{
				pWeapon->StartFire();
				pWeapon->StopFire();
			}
		};
		virtual void OnPickedUp(IWeapon *pWeapon, EntityId actorId, bool destroyed){}
		virtual void OnDropped(IWeapon *pWeapon, EntityId actorId){}
		virtual void OnMelee(IWeapon* pWeapon, EntityId shooterId){}
		virtual void OnStartTargetting(IWeapon *pWeapon) {}
		virtual void OnStopTargetting(IWeapon *pWeapon) {}
		virtual void OnSelected(IWeapon *pWeapon, bool select) {}
		virtual void OnFireModeChanged(IWeapon *pWeapon, int currentFireMode) {}
		virtual void OnZoomChanged(IWeapon* pWeapon, bool zoomed, int idx) {}
	};

	CWeapon *pWeapon = GetWeapon(pH);
	if (!pWeapon)
		return pH->EndFunction();

	pWeapon->AddEventListener(new AutoShootHelper(shots, autoReload), __FUNCTION__); 	// FIXME: possible small memory leak here. 
	pWeapon->StartFire();
	pWeapon->StopFire();

	return pH->EndFunction();
}
CBaseCombatWeapon* CSDKPlayer::GetLastWeapon()
{
	// This is pretty silly, but I'd rather mess around with stock Valve code as little as possible.
#ifdef CLIENT_DLL
	CBaseCombatWeapon* pLastWeapon = BaseClass::GetLastWeapon();
#else
	CBaseCombatWeapon* pLastWeapon = BaseClass::Weapon_GetLast();
#endif

	if (pLastWeapon && pLastWeapon != GetActiveWeapon())
		return pLastWeapon;

	CWeaponSDKBase* pHeaviest = NULL;
	CWeaponSDKBase* pBrawl = NULL;
	for (int i = 0; i < WeaponCount(); i++)
	{
		if (!GetWeapon(i))
			continue;

		if (GetWeapon(i) == GetActiveWeapon())
			continue;

		CWeaponSDKBase* pSDKWeapon = dynamic_cast<CWeaponSDKBase*>(GetWeapon(i));
		if (!pSDKWeapon)
			continue;

		if (pSDKWeapon->GetWeaponID() == SDK_WEAPON_BRAWL)
		{
			pBrawl = pSDKWeapon;
			continue;
		}

		if (!pHeaviest)
		{
			pHeaviest = pSDKWeapon;
			continue;
		}

		if (pHeaviest->GetWeight() < pSDKWeapon->GetWeight())
			pHeaviest = pSDKWeapon;
	}

	if (!pHeaviest)
		pHeaviest = pBrawl;

	return pHeaviest;
}
void CAutoDefenseClass::Update (CInstalledDevice *pDevice, 
								CSpaceObject *pSource, 
								int iTick,
								bool *retbSourceDestroyed,
								bool *retbConsumedItems)

//	Update
//
//	Update device

	{
	if (pDevice->IsReady() && pDevice->IsEnabled())
		{
		int i;

		//	Look for a target

		CSpaceObject *pBestTarget = NULL;
		Metric rBestDist2 = MAX_INTERCEPT_DISTANCE * MAX_INTERCEPT_DISTANCE;

		for (i = 0; i < pSource->GetSystem()->GetObjectCount(); i++)
			{
			CSpaceObject *pObj = pSource->GetSystem()->GetObject(i);

			if (pObj
					&& pObj->GetCategory() == CSpaceObject::catMissile
					&& pObj->GetSource() != pSource
					&& (pObj->GetSource() == NULL || pSource->IsEnemy(pObj->GetSource())))
				{
				CVector vRange = pObj->GetPos() - pSource->GetPos();
				Metric rDistance2 = vRange.Dot(vRange);

				if (rDistance2 < rBestDist2)
					{
					pBestTarget = pObj;
					rBestDist2 = rDistance2;
					}
				}
			}

		//	If we found a target, try to shoot at it

		if (pBestTarget)
			{
			CDeviceClass *pWeapon = GetWeapon();

			if (pWeapon)
				{
				int iFireAngle;
				if (pWeapon->IsWeaponAligned(pSource, pDevice, pBestTarget, &iFireAngle))
					{
					pDevice->SetFireAngle(iFireAngle);
					pWeapon->Activate(pDevice, pSource, pBestTarget, iFireAngle, retbSourceDestroyed, retbConsumedItems);
					pDevice->SetActivationDelay(m_iRechargeTicks);
					}
				}
			}
		}
	}
Example #16
0
	virtual void RemoveListener(EntityId weaponId, IWeaponEventListener* pListener)
	{
		if (!(weaponId && pListener))
			return;

		if (IWeapon* pWeapon = GetWeapon(weaponId))      
			pWeapon->RemoveEventListener(pListener);
	}
Example #17
0
//
//------------------------------------------------------------------------
int CScriptBind_Weapon::Reload(IFunctionHandler *pH)
{
	CWeapon *pWeapon = GetWeapon(pH);
	if (pWeapon)
		pWeapon->Reload();

	return pH->EndFunction();
}
Example #18
0
//------------------------------------------------------------------------
int CScriptBind_Weapon::GetCrosshairVisibility(IFunctionHandler *pH)
{
	CWeapon *pWeapon = GetWeapon(pH);
	if (!pWeapon)
		return pH->EndFunction();

	return pH->EndFunction(pWeapon->GetCrosshairVisibility());
}
Example #19
0
	virtual void AddListener(EntityId weaponId, IWeaponEventListener* pListener)
	{
		if (!(weaponId && pListener))
			return;

		if (IWeapon* pWeapon = GetWeapon(weaponId))      
			pWeapon->AddEventListener(pListener, __FUNCTION__);
	}
Example #20
0
int CScriptBind_Weapon::SupportsAccessory(IFunctionHandler *pH, const char *accessoryName)
{
	CWeapon *pWeapon = GetWeapon(pH);
	if (!pWeapon)
		return pH->EndFunction();

	CItem::SAccessoryParams *params = pWeapon->GetAccessoryParams(accessoryName);
	return pH->EndFunction(params != 0);
}
Example #21
0
int CScriptBind_Weapon::GetShooter(IFunctionHandler *pH)
{
	CWeapon *pWeapon = GetWeapon(pH);
	if (!pWeapon)
		return pH->EndFunction();

	IEntity *owner = pWeapon->GetOwner();
	return pH->EndFunction(owner->GetScriptTable());
}
Example #22
0
//------------------------------------------------------------------------
CRocket::~CRocket()
{
	//LAW might be dropped automatically (to be sure that works in MP too)
	if(CWeapon* pWeapon = GetWeapon())
	{
		if(pWeapon->IsAutoDroppable())
			pWeapon->AutoDrop();
	}
}
Example #23
0
void UBurstFiremode::HandleFire()
{
	if (!IsFiring()) return; //If we aren't firing anymore, don't fire a shot

	BurstsRemaining--;

	GetWeapon()->FireShot();
	
	if (BurstsRemaining > 0)
	{
		//get the time until the next shot
		float FireTime = (1.0f / GetWeapon()->GetActiveFiremodeData().RoundsPerMinute) * 60.0f;

		FTimerHandle handle;

		GetWorld()->GetTimerManager().SetTimer(handle, this, &UBurstFiremode::HandleFire, FireTime, false);
	}
	
}
Example #24
0
CWeapon * CPedSA::GetWeapon ( eWeaponType weaponType )
{
    if ( weaponType < WEAPONTYPE_LAST_WEAPONTYPE )
    {
        CWeapon* pWeapon = GetWeapon ( pGame->GetWeaponInfo ( weaponType )->GetSlot () );
        if ( pWeapon->GetType () == weaponType )
            return pWeapon;
    }
    return NULL;
}
Example #25
0
//------------------------------------------------------------------------
int CScriptBind_Weapon::SetCurrentZoomMode(IFunctionHandler *pH, const char *name)
{
	CWeapon *pWeapon = GetWeapon(pH);
	if (!pWeapon)
		return pH->EndFunction();

	pWeapon->SetCurrentZoomMode(name);

	return pH->EndFunction();
}
Example #26
0
int CScriptBind_Weapon::ScheduleAttach(IFunctionHandler *pH, const char *className, bool attach)
{
	CWeapon *pWeapon = GetWeapon(pH);
	if (!pWeapon)
		return pH->EndFunction();

	pWeapon->GetScheduler()->ScheduleAction(CSchedulerAction<ScheduleAttachClass>::Create(ScheduleAttachClass(pWeapon, className, attach)));

	return pH->EndFunction();
}
Example #27
0
//------------------------------------------------------------------------
int CScriptBind_Weapon::GetNumOfFireModes(IFunctionHandler *pH)
{
	CWeapon *pWeapon = GetWeapon(pH);
	int nCountFireModes = 0;
	if (pWeapon)
	{
		nCountFireModes = pWeapon->GetNumOfFireModes();
	}
	return pH->EndFunction(nCountFireModes);
}
Example #28
0
//-----------------------------------------------------------------------
int CScriptBind_Weapon::ActivateLamLaser(IFunctionHandler *pH, bool activate)
{
	CWeapon *pWeapon = GetWeapon(pH);
	if (!pWeapon)
		return pH->EndFunction();

	pWeapon->ActivateLamLaser(activate);

	return pH->EndFunction();
}
Example #29
0
int CScriptBind_Weapon::AttachAccessory(IFunctionHandler *pH, const char *className, bool attach, bool force)
{
	CWeapon *pWeapon = GetWeapon(pH);
	if (!pWeapon)
		return pH->EndFunction();

	if (className)
		pWeapon->AttachAccessory(className, attach, true, force);

	return pH->EndFunction();
}
Example #30
0
int CScriptBind_Weapon::SwitchAccessory(IFunctionHandler *pH, const char *className)
{
	CWeapon *pWeapon = GetWeapon(pH);
	if (!pWeapon)
		return pH->EndFunction();

	if (className)
		pWeapon->SwitchAccessory(className);

	return pH->EndFunction();
}