Example #1
0
//------------------------------------------------------------------------------
// Display the hull type of the specified NPC.
//------------------------------------------------------------------------------
void CC_AI_Hull( const CCommand &args )
{
	if ( !g_pAINetworkManager )
		return;

	bool bSpawned = false;
	CBaseEntity *pEnt = NULL;

	if ( !args[1] || !args[1][0] )
	{		
		// No arg means the entity under the crosshair.
		pEnt = FindPickerEntity( UTIL_GetCommandClient() );
		if ( !pEnt )
		{
			DevMsg( "No entity under the crosshair.\n" );
			return;
		}
	}
	else
	{
		// Find the entity specified on the command line.
		pEnt = gEntList.FindEntityGeneric( NULL, args[1] );

		if ( !pEnt )
		{
			// Not found, try to create one.
			pEnt = (CAI_BaseNPC *)CreateEntityByName( args[1] );
			if ( !pEnt )
			{
				DevMsg( "Entity %s not found, and couldn't create!\n", args[1] );
				return;
			}

			bSpawned = true;
			DispatchSpawn( pEnt );
		}
	}

	CAI_BaseNPC *pNPC = dynamic_cast<CAI_BaseNPC *>( pEnt );
	if ( !pNPC )
	{
		DevMsg( "Entity %s is not an NPC.\n", pEnt->GetDebugName() );
		return;
	}
	
	Hull_t eHull = pNPC->GetHullType();

	if ( bSpawned )
	{
		UTIL_Remove( pEnt );
	}

	g_pAINetworkManager->GetEditOps()->DrawHull( eHull );

	CBaseEntity::m_nDebugPlayer = UTIL_GetCommandClientIndex();
}
Example #2
0
void CC_ASW_WC_EditEmitter( void )
{
	// Only allowed in wc_edit_mode
	if (engine->IsInEditMode())
	{
		CBaseEntity::m_nDebugPlayer = UTIL_GetCommandClientIndex();
		
		ASW_WCEdit::EditEmitter(UTIL_GetCommandClient());		
	}
}
//------------------------------------------------------------------------------
// Purpose : 
// Input   :
// Output  :
//------------------------------------------------------------------------------
void CC_WC_DestroyUndo( void )
{
	// Only allowed in wc_edit_mode
	if (engine->IsInEditMode())
	{
		CBaseEntity::m_nDebugPlayer = UTIL_GetCommandClientIndex();

		NWCEdit::UndoDestroyAINode();
	}
}
Example #4
0
//------------------------------------------------------------------------------
// Purpose: Show node connections with hulls
//------------------------------------------------------------------------------
void CC_AI_ShowHull( const CCommand &args )
{
	// Eventually this will be done by name when mulitple
	// networks are used, but for now have one big AINet
	//static char entName[256];	
	//Q_strncpy( entName, args[1),sizeof(entName) );

	g_pAINetworkManager->GetEditOps()->SetDebugBits("BigNet",bits_debugOverlayHulls);
	CBaseEntity::m_nDebugPlayer = UTIL_GetCommandClientIndex();
}
Example #5
0
/**
 * Returns true if the command was issued by the listenserver host, or by the dedicated server, via rcon or the server console.
 * This is valid during ConCommand execution.
 */
bool UTIL_IsCommandIssuedByServerAdmin( void )
{
    int issuingPlayerIndex = UTIL_GetCommandClientIndex();

    if ( engine->IsDedicatedServer() && issuingPlayerIndex > 0 )
        return false;

    if ( issuingPlayerIndex > 1 )
        return false;

    return true;
}
Example #6
0
//------------------------------------------------------------------------------
// Purpose: Switch to display of next hull type
//------------------------------------------------------------------------------
void CC_AI_NextHull( const CCommand &args )
{
	// Eventually this will be done by name when mulitple
	// networks are used, but for now have one big AINet
	//static char entName[256];	
	//Q_strncpy( entName, args[1],sizeof(entName) );
	if ( !g_pAINetworkManager )
		return;

	g_pAINetworkManager->GetEditOps()->DrawNextHull("BigNet");
	CBaseEntity::m_nDebugPlayer = UTIL_GetCommandClientIndex();
}
Example #7
0
void CC_AI_Disable( void )
{
	if (CAI_BaseNPC::m_nDebugBits & bits_debugDisableAI)
	{
		EnableAI();
	}
	else
	{
		DisableAI();
	}

	CBaseEntity::m_nDebugPlayer = UTIL_GetCommandClientIndex();
}
Example #8
0
//------------------------------------------------------------------------------
// Purpose: Disables all NPCs
//------------------------------------------------------------------------------
void CC_AI_Disable( void )
{
	if (CAI_BaseNPC::m_nDebugBits & bits_debugDisableAI)
	{
		CAI_BaseNPC::m_nDebugBits &= ~bits_debugDisableAI;
		DevMsg("AI Enabled.\n");
	}
	else
	{
		CAI_BaseNPC::m_nDebugBits |= bits_debugDisableAI;
		DevMsg("AI Disabled.\n");
		g_bAIDisabledByUser = true;
	}

	CBaseEntity::m_nDebugPlayer = UTIL_GetCommandClientIndex();
}
//------------------------------------------------------------------------------
// Purpose : 
// Input   :
// Output  :
//------------------------------------------------------------------------------
void CC_WC_Create( void )
{
	// Only allowed in wc_edit_mode
	if (engine->IsInEditMode())
	{
		CBaseEntity::m_nDebugPlayer = UTIL_GetCommandClientIndex();

		if (g_pAINetworkManager->GetEditOps()->m_bLinkEditMode)
		{
			NWCEdit::CreateAILink(UTIL_GetCommandClient());
		}
		else
		{
			NWCEdit::CreateAINode(UTIL_GetCommandClient());
		}
	}
}
//------------------------------------------------------------------------------
// Purpose : 
// Input   :
// Output  :
//------------------------------------------------------------------------------
void CC_WC_Destroy( void )
{
	// Only allowed in wc_edit_mode
	if (engine->IsInEditMode())
	{
		CBaseEntity::m_nDebugPlayer = UTIL_GetCommandClientIndex();

		// UNDONE: For now just deal with info_nodes
		//CBaseEntity* pEntity = FindEntity( pEdict, ""); - use when generalize this to any class
		//int status = Editor_DeleteEntity("info_node", pEdict->origin.x, pEdict->origin.y, pEdict->origin.z, false);

		if (g_pAINetworkManager->GetEditOps()->m_bLinkEditMode)
		{
			NWCEdit::DestroyAILink(UTIL_GetCommandClient());
		}
		else
		{
			NWCEdit::DestroyAINode(UTIL_GetCommandClient());
		}
	}
}