コード例 #1
0
void CHL2MP_Player::GiveDefaultItems( void )
{
	EquipSuit();

	CBasePlayer::GiveAmmo( 255,	"Pistol");
	CBasePlayer::GiveAmmo( 45,	"SMG1");
	CBasePlayer::GiveAmmo( 6,	"Buckshot");
	CBasePlayer::GiveAmmo( 6,	"357" );

	GiveNamedItem( "weapon_crowbar" );
	GiveNamedItem( "weapon_pistol" );
	GiveNamedItem( "weapon_smg1" );
	GiveNamedItem( "weapon_physcannon" );

	const char *szDefaultWeaponName = engine->GetClientConVarValue( engine->IndexOfEdict( edict() ), "cl_defaultweapon" );

	CBaseCombatWeapon *pDefaultWeapon = Weapon_OwnsThisType( szDefaultWeaponName );

	if ( pDefaultWeapon )
	{
		Weapon_Switch( pDefaultWeapon );
	}
	else
	{
		Weapon_Switch( Weapon_OwnsThisType( "weapon_physcannon" ) );
	}
}
コード例 #2
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CBasePlayer::SelectItem( const char *pstr, int iSubType )
{
	if (!pstr)
		return;

	CBaseCombatWeapon *pItem = Weapon_OwnsThisType( pstr, iSubType );

	if (!pItem)
		return;

	if( GetObserverMode() != OBS_MODE_NONE )
		return;// Observers can't select things.

	if ( !Weapon_ShouldSelectItem( pItem ) )
		return;

	// FIX, this needs to queue them up and delay
	// Make sure the current weapon can be holstered
	if ( GetActiveWeapon() )
	{
		if ( !GetActiveWeapon()->CanHolster() )
			return;

		ResetAutoaim( );
	}

	Weapon_Switch( pItem );
}
コード例 #3
0
void CJaS_Marine_Jack::Spawn()
{
	CASW_Marine_Resource *pResource = dynamic_cast<CASW_Marine_Resource *>( CreateEntityByName( "asw_marine_resource" ) );
	pResource->SetProfileIndex( 6 );
	pResource->SetMarineEntity( this );
	SetMarineResource( pResource );
	pResource->Spawn();
	m_pProfileOverride = pResource->GetProfile();
	SelectModelFromProfile();
	SetModelFromProfile();

	CBaseCombatWeapon *pWeapon = dynamic_cast<CBaseCombatWeapon *>( CreateEntityByName( "asw_weapon_sniper_rifle" ) );
	if ( pWeapon )
	{
		pWeapon->Spawn();
		pWeapon->GiveDefaultAmmo();
		pWeapon->m_iClip1 = 9999;
		GiveAmmo(9999, pWeapon->GetPrimaryAmmoType());
		Weapon_Equip_In_Index( pWeapon, 0 );
		Weapon_Switch( pWeapon );
	}
	m_bConstantSlowHeal = true;

	m_hSquadFormation = static_cast<CASW_SquadFormation *>( CreateEntityByName( "asw_squadformation" ) );
	m_hSquadFormation->Leader( this );

	SetRenderColor( 0x99, 0x40, 0x40 );

	BaseClass::Spawn();
}
コード例 #4
0
void CHL2MP_Player::GiveDefaultItems( void )
{
	EquipSuit();

	//BP En période de construction du mode forts, on ne donne que le physgun
	if(HL2MPRules()->GetGameType() == GAME_FORTS && HL2MPRules()->IsFortsBuildPhase())
	{
		GiveNamedItem( "weapon_carebearstare" );
		Weapon_Switch( Weapon_OwnsThisType( "weapon_carebearstare" ) );

		return;
	}

	if(HL2MPRules()->IsHumiliation())
	{	
		if((HL2MPRules()->IsTeamplay() && HL2MPRules()->GetWinningTeamNumber() == GetTeamNumber()) || (!HL2MPRules()->IsTeamplay() && HL2MPRules()->GetBestPlayer() == this))
			GiveNamedItem("weapon_bat");
		else
			GiveNamedItem("weapon_flower");

		return;
	}

	GiveNamedItem( "weapon_flower" );
	if(!HL2MPRules()->OnlyGiveFlower())
	{
		GiveNamedItem( "weapon_uzi" );
		CBasePlayer::GiveAmmo( 60,	"SMG1");
		GiveNamedItem( "weapon_grenade" );
		GiveNamedItem( "weapon_grenade" );
		GiveNamedItem( "weapon_revolver" );
		GiveNamedItem( "weapon_flowerlauncher" );
	}

	const char *szDefaultWeaponName = engine->GetClientConVarValue( engine->IndexOfEdict( edict() ), "cl_defaultweapon" );

	CBaseCombatWeapon *pDefaultWeapon = Weapon_OwnsThisType( szDefaultWeaponName );
	if ( pDefaultWeapon )
		Weapon_Switch( pDefaultWeapon );
	else
		Weapon_Switch( Weapon_OwnsThisType( "weapon_uzi" ) );
}
コード例 #5
0
//-----------------------------------------------------------------------------
// Purpose: Switches to the best weapon that is also better than the given weapon.
// Input  : pCurrent - The current weapon used by the player.
// Output : Returns true if the weapon was switched, false if there was no better
//			weapon to switch to.
//-----------------------------------------------------------------------------
bool CBaseCombatCharacter::SwitchToNextBestWeapon(CBaseCombatWeapon *pCurrent)
{
	CBaseCombatWeapon *pNewWeapon = g_pGameRules->GetNextBestWeapon(this, pCurrent);
	
	if ( ( pNewWeapon != NULL ) && ( pNewWeapon != pCurrent ) )
	{
		return Weapon_Switch( pNewWeapon );
	}

	return false;
}
コード例 #6
0
ファイル: hl2mp_player.cpp プロジェクト: dreckard/dhl2
void CHL2MP_Player::GiveDefaultItems( void )
{
	EquipSuit();

	//GiveNamedItem( "weapon_kungfu" );
	CBaseCombatWeapon *pDefault = static_cast<CBaseCombatWeapon*>(GiveNamedItem( "weapon_combatknife" ));
	Assert( pDefault );
	Weapon_Switch( pDefault );

	if ( IsBot() )
	{
		CBaseCombatWeapon *pMac11 = static_cast<CBaseCombatWeapon*>(GiveNamedItem( "weapon_mac11" ));
		Weapon_Switch( pMac11 );
		CBasePlayer::GiveAmmo( 128, "Mac11" );
	}

	FileWeaponInfo_t* pInfo = GetFileWeaponInfoFromHandle( LookupWeaponInfoSlot( "weapon_deringer" ) );
	if ( pInfo )
		CBasePlayer::GiveAmmo( pInfo->iDefaultAmmoPrimary, "Deringer" );
}
コード例 #7
0
void CHL2MP_Player::GiveDefaultItems( void )
{
	EquipSuit();

//	CBasePlayer::GiveAmmo( 255,	"Pistol");
//	CBasePlayer::GiveAmmo( 45,	"SMG1");
//	CBasePlayer::GiveAmmo( 1,	"grenade" );
	CBasePlayer::GiveAmmo( 100,	"Buckshot");
//	CBasePlayer::GiveAmmo( 6,	"357" );
	CBasePlayer::GiveAmmo( 100,	"rpg_round");
	CBasePlayer::GiveAmmo( 200, "XBowBolt" );
	CBasePlayer::GiveAmmo( 200, "Cells");


	GiveNamedItem( "weapon_crowbar" );
	GiveNamedItem( "weapon_shotgun" );
	GiveNamedItem( "weapon_shotgundouble" );
//	GiveNamedItem( "weapon_shaft" );
	GiveNamedItem( "weapon_rpg" );
	GiveNamedItem( "weapon_grenadelauncher" );
	GiveNamedItem( "weapon_nailgun" );
	GiveNamedItem( "weapon_nailgunsuper" );
//	GiveNamedItem( "weapon_pistol" );
//	GiveNamedItem( "weapon_smg1" );
//	GiveNamedItem( "weapon_frag" );
//	GiveNamedItem( "weapon_physcannon" );

	const char *szDefaultWeaponName = engine->GetClientConVarValue( engine->IndexOfEdict( edict() ), "cl_defaultweapon" );

	CBaseCombatWeapon *pDefaultWeapon = Weapon_OwnsThisType( szDefaultWeaponName );

	if ( pDefaultWeapon )
	{
		Weapon_Switch( pDefaultWeapon );
	}
	else
	{
		Weapon_Switch( Weapon_OwnsThisType( "weapon_shotgun" ) );
	}
}
コード例 #8
0
void CHL2MP_Player::GiveDefaultItems( void )
{
	EquipSuit();

	CBasePlayer::GiveAmmo( 255,	"Pistol");
	CBasePlayer::GiveAmmo( 45,	"SMG1");
	CBasePlayer::GiveAmmo( 1,	"grenade" );
	CBasePlayer::GiveAmmo( 6,	"Buckshot");
	CBasePlayer::GiveAmmo( 6,	"357" );

	if ( GetPlayerModelType() == PLAYER_SOUNDS_METROPOLICE || GetPlayerModelType() == PLAYER_SOUNDS_COMBINESOLDIER )
	{
		GiveNamedItem( "weapon_stunstick" );
	}
	else if ( GetPlayerModelType() == PLAYER_SOUNDS_CITIZEN )
	{
		GiveNamedItem( "weapon_crowbar" );
	}
	
	GiveNamedItem( "weapon_pistol" );
	GiveNamedItem( "weapon_smg1" );
	GiveNamedItem( "weapon_frag" );
	GiveNamedItem( "weapon_physcannon" );

	const char *szDefaultWeaponName = engine->GetClientConVarValue( engine->IndexOfEdict( edict() ), "cl_defaultweapon" );

	CBaseCombatWeapon *pDefaultWeapon = Weapon_OwnsThisType( szDefaultWeaponName );

	if ( pDefaultWeapon )
	{
		Weapon_Switch( pDefaultWeapon );
	}
	else
	{
		Weapon_Switch( Weapon_OwnsThisType( "weapon_physcannon" ) );
	}
}