Esempio n. 1
0
void CASW_Laser_Mine::LaserThink( void )
{
	if ( !m_bMineActive )
	{
		SetNextThink( gpGlobals->curtime );
		return;
	}
		
	UpdateLaser();

	// check for destroying the mine if we attach to a moving door
	if ( GetMoveParent() && GetMoveParent()->Classify() == CLASS_ASW_DOOR )
	{
		CASW_Door *pDoor = assert_cast<CASW_Door*>( GetMoveParent() );
		if ( !pDoor->IsDoorClosed() )
		{
			// do a small explosion when we die in this fashion
			m_flDamage = 10.0f;
			m_flDamageRadius = 64.0f;
			Explode();
		}
	}
	
	SetNextThink( gpGlobals->curtime + 0.1f );
}
Esempio n. 2
0
void CJaw::Update(SEntityUpdateContext& ctx, int slot)
{
	CWeapon::Update(ctx, slot);

	if (!IsSelected())
		return;

	if(slot == eIUS_Zooming)
	{
		UpdateLaser(ctx);
	}

	if (slot != eIUS_General)
		return;

	UpdatePendingShot();

	if (!IsInputFlagSet(CWeapon::eWeaponAction_Zoom) && IsInputFlagSet(CWeapon::eWeaponAction_Fire) && !IsZoomingIn())
		AutoZoomOut();

	if (m_controllingRocket && !IsZoomed() && !m_zoomTriggerDown)
		DoAutoDrop();

	if (m_autoDropping)
	{
		m_autoDropPendingTimer += ctx.fFrameTime;
		if (CanAutoDrop())
		{
			m_autoDropping = false;
			DoAutoDrop();
		}
	}

	if (m_dropped)
	{
		m_dropTime += ctx.fFrameTime;
		if (m_dropTime > g_hideTimeAfterDrop)
		{
			if(gEnv->bServer)
			{
				if(gEnv->IsEditor())
					Hide(true);
				else
					gEnv->pEntitySystem->RemoveEntity(GetEntity()->GetId());	
			}
			EnableUpdate(false);
		}
		else
		{
			RequireUpdate();
		}
	}
}