예제 #1
0
파일: Turret.cpp 프로젝트: Arc0re/lithtech
void Turret::Activate( HOBJECT hSender )
{
	if( IsInUse( ) || m_Damage.IsDead( ))
		return;

	if( m_swtDestroyedDeactivationDelay.IsStarted( ))
	{
		g_pLTServer->CPrint( "Activated with deactivation delay" );
	}

	// Activating turret...
	m_hOperatingObject = hSender;

	CreateSpecialFX( true );

	if( IsPlayer( m_hOperatingObject ))
	{
		// Change the players weapon to the turret weapon...
		CPlayerObj *pPlayer = dynamic_cast<CPlayerObj*>(g_pLTServer->HandleToObject( m_hOperatingObject ));
		pPlayer->SetOperatingTurret( *this, true );
	}

	// Process any activation command we may have...
	if( !m_sActivateCommand.empty( ))
	{
		g_pCmdMgr->QueueCommand( m_sActivateCommand.c_str( ), hSender, m_hObject );
	}

	SetNextUpdate( UPDATE_NEXT_FRAME );
}
예제 #2
0
파일: Turret.cpp 프로젝트: Arc0re/lithtech
void Turret::Deactivate( )
{
	if( !IsInUse( ))
	{
		DebugCPrint(1, "Deactivation failed!");
		return;
	}

	CAutoMessage cMsg;
	cMsg.Writeuint8( MID_SFX_MESSAGE );
	cMsg.Writeuint8( SFX_TURRET_ID );
	cMsg.WriteObject( m_hObject );
	cMsg.Writeuint8( kTurretFXMsg_Deactivate );
	g_pLTServer->SendToClient( cMsg.Read( ), NULL, MESSAGE_GUARANTEED );

	if( IsPlayer( m_hOperatingObject ))
	{
		// Change the players weapon to the turret weapon...
		CPlayerObj *pPlayer = dynamic_cast<CPlayerObj*>(g_pLTServer->HandleToObject( m_hOperatingObject ));
		pPlayer->SetOperatingTurret( *this, false );
	}

	// Process any deactivation command we may have...
	if( !m_sDeactivateCommand.empty( ))
	{
		g_pCmdMgr->QueueCommand( m_sDeactivateCommand.c_str( ), m_hOperatingObject, m_hObject );
	}

	m_hOperatingObject = NULL;

	CreateSpecialFX( false );

	// [RP] NOTE: We still need to continually update to manually keep accurate positions.
	//		Using attachments was causing issues of not being able to activate.  Need to look
	//		further into this.  Once this issue is resolved we should not need to update if 
	//		the turret is deactivates.
	SetNextUpdate( /*UPDATE_NEVER*/ UPDATE_NEXT_FRAME );
}