mirror of
https://github.com/fortressforever/fortressforever-2013.git
synced 2024-11-10 07:11:45 +00:00
team joining is kinda working now woo. use 'team' concommand
This commit is contained in:
parent
46658bdc5b
commit
1f115eb8c5
5 changed files with 57 additions and 9 deletions
|
@ -1544,7 +1544,6 @@ bool CFF_SV_Player::CanHearAndReadChatFrom( CBasePlayer *pPlayer )
|
||||||
// do any eg class cleanup here etc
|
// do any eg class cleanup here etc
|
||||||
void CFF_SV_Player::PreChangeTeam( int iOldTeam, int iNewTeam )
|
void CFF_SV_Player::PreChangeTeam( int iOldTeam, int iNewTeam )
|
||||||
{
|
{
|
||||||
// set team unassigned
|
|
||||||
// set class unassigned
|
// set class unassigned
|
||||||
// remove items
|
// remove items
|
||||||
// special infection stuff,
|
// special infection stuff,
|
||||||
|
@ -1552,6 +1551,14 @@ void CFF_SV_Player::PreChangeTeam( int iOldTeam, int iNewTeam )
|
||||||
// clear state (might do w/ player func)
|
// clear state (might do w/ player func)
|
||||||
// check kill
|
// check kill
|
||||||
// lua player_killed
|
// lua player_killed
|
||||||
|
RemoveAllItems( true );
|
||||||
|
|
||||||
|
if ( IsAlive() && GetTeamNumber( ) >= TEAM_BLUE )
|
||||||
|
{
|
||||||
|
KillPlayer( );
|
||||||
|
|
||||||
|
// TODO: lua killed predicate
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// called by team manager once a valid team is found, and after new team set
|
// called by team manager once a valid team is found, and after new team set
|
||||||
|
@ -1560,4 +1567,22 @@ void CFF_SV_Player::PostChangeTeam( int iOldTeam, int iNewTeam )
|
||||||
{
|
{
|
||||||
// reset state
|
// reset state
|
||||||
// spawn called
|
// spawn called
|
||||||
|
|
||||||
|
if ( iOldTeam == TEAM_SPECTATOR )
|
||||||
|
{
|
||||||
|
StopObserverMode( );
|
||||||
|
}
|
||||||
|
|
||||||
|
// dont force spawn here right now, death think will spawn the player
|
||||||
|
//Spawn( );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CFF_SV_Player::KillPlayer( void )
|
||||||
|
{
|
||||||
|
// TODO: FF stuff
|
||||||
|
m_iHealth = 0;
|
||||||
|
// slam it
|
||||||
|
SetThink(&CBasePlayer::PlayerDeathThink);
|
||||||
|
SetNextThink(gpGlobals->curtime);
|
||||||
}
|
}
|
|
@ -141,6 +141,8 @@ public:
|
||||||
void PreChangeTeam( int iOldTeam, int iNewTeam );
|
void PreChangeTeam( int iOldTeam, int iNewTeam );
|
||||||
// called by team manager once a valid team is found, and after new team set
|
// called by team manager once a valid team is found, and after new team set
|
||||||
void PostChangeTeam( int iOldTeam, int iNewTeam );
|
void PostChangeTeam( int iOldTeam, int iNewTeam );
|
||||||
|
|
||||||
|
void KillPlayer( void );
|
||||||
private:
|
private:
|
||||||
|
|
||||||
CNetworkQAngle( m_angEyeAngles );
|
CNetworkQAngle( m_angEyeAngles );
|
||||||
|
|
|
@ -2151,11 +2151,11 @@ void CBasePlayer::PlayerDeathThink(void)
|
||||||
// if the player has been dead for one second longer than allowed by forcerespawn,
|
// if the player has been dead for one second longer than allowed by forcerespawn,
|
||||||
// forcerespawn isn't on. Send the player off to an intermission camera until they
|
// forcerespawn isn't on. Send the player off to an intermission camera until they
|
||||||
// choose to respawn.
|
// choose to respawn.
|
||||||
if ( g_pGameRules->IsMultiplayer() && ( gpGlobals->curtime > (m_flDeathTime + DEATH_ANIMATION_TIME) ) && !IsObserver() )
|
//if ( g_pGameRules->IsMultiplayer() && ( gpGlobals->curtime > (m_flDeathTime + DEATH_ANIMATION_TIME) ) && !IsObserver() )
|
||||||
{
|
//{
|
||||||
// go to dead camera.
|
// // go to dead camera.
|
||||||
StartObserverMode( m_iObserverLastMode );
|
// StartObserverMode( m_iObserverLastMode );
|
||||||
}
|
//}
|
||||||
|
|
||||||
// wait for any button down, or mp_forcerespawn is set and the respawn time is up
|
// wait for any button down, or mp_forcerespawn is set and the respawn time is up
|
||||||
if (!fAnyButtonDown
|
if (!fAnyButtonDown
|
||||||
|
|
|
@ -199,6 +199,9 @@ CFF_SH_Rules::CFF_SH_Rules()
|
||||||
{
|
{
|
||||||
#ifndef CLIENT_DLL
|
#ifndef CLIENT_DLL
|
||||||
// Create the team managers
|
// Create the team managers
|
||||||
|
// TODO: right now this creates a team for every team name string,
|
||||||
|
// hook this into lua and have it create teams as needed per map
|
||||||
|
// or something cool like that
|
||||||
for ( int i = 0; i < ARRAYSIZE( sTeamNames ); i++ )
|
for ( int i = 0; i < ARRAYSIZE( sTeamNames ); i++ )
|
||||||
{
|
{
|
||||||
CFF_SH_TeamManager *pTeam = static_cast<CFF_SH_TeamManager*>(CreateEntityByName( "ff_team_manager" ));
|
CFF_SH_TeamManager *pTeam = static_cast<CFF_SH_TeamManager*>(CreateEntityByName( "ff_team_manager" ));
|
||||||
|
@ -207,7 +210,9 @@ CFF_SH_Rules::CFF_SH_Rules()
|
||||||
g_Teams.AddToTail( pTeam );
|
g_Teams.AddToTail( pTeam );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_bTeamPlayEnabled = teamplay.GetBool();
|
// Dexter: slammed this to always true instead of the cvar for now
|
||||||
|
//m_bTeamPlayEnabled = teamplay.GetBool();
|
||||||
|
m_bTeamPlayEnabled = true;
|
||||||
m_flIntermissionEndTime = 0.0f;
|
m_flIntermissionEndTime = 0.0f;
|
||||||
m_flGameStartTime = 0;
|
m_flGameStartTime = 0;
|
||||||
|
|
||||||
|
|
|
@ -343,6 +343,9 @@ bool CFF_SH_TeamManager::HandlePlayerTeamCommand( CFF_SV_Player &pPlayer, const
|
||||||
int CFF_SH_TeamManager::PickAutoJoinTeam( )
|
int CFF_SH_TeamManager::PickAutoJoinTeam( )
|
||||||
{
|
{
|
||||||
// TODO:
|
// TODO:
|
||||||
|
// it is me, the auto picker thingy majig
|
||||||
|
|
||||||
|
|
||||||
return TEAM_BLUE;
|
return TEAM_BLUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,7 +354,7 @@ bool CFF_SH_TeamManager::IsTeamFull() const
|
||||||
if (m_iMaxPlayers == 0)
|
if (m_iMaxPlayers == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int numActive = 0;
|
int numActive = 0;
|
||||||
for( int i = 1; i <= gpGlobals->maxClients; i++ )
|
for( int i = 1; i <= gpGlobals->maxClients; i++ )
|
||||||
{
|
{
|
||||||
CFF_SV_Player *pPlayer = (CFF_SV_Player *) UTIL_PlayerByIndex( i );
|
CFF_SV_Player *pPlayer = (CFF_SV_Player *) UTIL_PlayerByIndex( i );
|
||||||
|
@ -359,7 +362,7 @@ bool CFF_SH_TeamManager::IsTeamFull() const
|
||||||
numActive++;
|
numActive++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return numActive > m_iMaxPlayers;
|
return m_iMaxPlayers == 0 ||numActive > m_iMaxPlayers; // GetNumPlayers( ) > m_iMaxPlayers;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -386,6 +389,19 @@ void DebugSetTeamName_f( const CCommand &args )
|
||||||
DevMsg("Team name after set ='%s'\n", pTeam->GetName());
|
DevMsg("Team name after set ='%s'\n", pTeam->GetName());
|
||||||
}
|
}
|
||||||
ConCommand cc_ffdbg_setteamname("ffdbg_set_team_name", DebugSetTeamName_f);
|
ConCommand cc_ffdbg_setteamname("ffdbg_set_team_name", DebugSetTeamName_f);
|
||||||
|
|
||||||
|
void DebugCurTeam_f( const CCommand &args )
|
||||||
|
{
|
||||||
|
CBasePlayer* pPlayer = UTIL_GetCommandClient();
|
||||||
|
if ( !pPlayer )
|
||||||
|
return;
|
||||||
|
CTeam *pPlayerTeam = pPlayer->GetTeam();
|
||||||
|
if ( !pPlayerTeam )
|
||||||
|
return;
|
||||||
|
pPlayerTeam->GetNumPlayers( );
|
||||||
|
DevMsg("Player team=%i name='%s' players on team=%d\n", pPlayerTeam->GetTeamNumber( ), pPlayerTeam->GetName( ), pPlayerTeam->GetNumPlayers( ) );
|
||||||
|
}
|
||||||
|
ConCommand cc_ffdbg_curteam("ffdbg_curteam", DebugCurTeam_f);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue