mirror of
https://github.com/ValveSoftware/source-sdk-2013.git
synced 2025-04-09 03:24:52 +00:00
Merge 55c3fa955a
into 0565403b15
This commit is contained in:
commit
a68597ceb8
2 changed files with 46 additions and 14 deletions
|
@ -19411,17 +19411,44 @@ void CTFPlayer::ModifyOrAppendCriteria( AI_CriteriaSet& criteriaSet )
|
|||
CTeamControlPoint *pCP = pAreaTrigger->GetControlPoint();
|
||||
if ( pCP )
|
||||
{
|
||||
if ( pCP->GetOwner() == GetTeamNumber() )
|
||||
const int iPlayerTeam = GetTeamNumber();
|
||||
const int iEnemyTeam = GetEnemyTeam( GetTeamNumber() );
|
||||
const int iPointOwner = pCP->GetOwner();
|
||||
const int iPointIndex = pCP->GetPointIndex();
|
||||
|
||||
if ( iPointOwner == iPlayerTeam )
|
||||
{
|
||||
criteriaSet.AppendCriteria( "OnFriendlyControlPoint", "1" );
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
if ( TeamplayGameRules()->TeamMayCapturePoint( GetTeamNumber(), pCP->GetPointIndex() ) &&
|
||||
TeamplayGameRules()->PlayerMayCapturePoint( this, pCP->GetPointIndex() ) )
|
||||
{
|
||||
criteriaSet.AppendCriteria( "OnCappableControlPoint", "1" );
|
||||
}
|
||||
criteriaSet.AppendCriteria( "OnEnemyOrNeutralControlPoint", "1" );
|
||||
}
|
||||
|
||||
// A point is only considered cappable if:
|
||||
// a. Our team is ever allowed to capture it, we specifically are currently allowed to capture it,
|
||||
// and it is owned by either the other team or neither team.
|
||||
// or
|
||||
// b. The other team is ever allowed to capture it, and either we own it or neither team owns it.
|
||||
bool bIsPointCappable = (
|
||||
TeamplayGameRules()->TeamMayCapturePoint( iPlayerTeam, iPointIndex ) &&
|
||||
TeamplayGameRules()->PlayerMayCapturePoint( this, iPointIndex ) &&
|
||||
( iPointOwner == iEnemyTeam || iPointOwner == TEAM_UNASSIGNED )
|
||||
) || (
|
||||
TeamplayGameRules()->TeamMayCapturePoint( iEnemyTeam, iPointIndex ) &&
|
||||
( iPointOwner == iPlayerTeam || iPointOwner == TEAM_UNASSIGNED )
|
||||
);
|
||||
|
||||
// If the current map is round-based, make sure the point is part of the current one.
|
||||
CTeamControlPointMaster *pMaster = g_hControlPointMasters.Count() ? g_hControlPointMasters[ 0 ] : NULL;
|
||||
if ( pMaster )
|
||||
{
|
||||
bIsPointCappable = bIsPointCappable && pMaster->IsInRound( pCP );
|
||||
}
|
||||
|
||||
if ( bIsPointCappable )
|
||||
{
|
||||
criteriaSet.AppendCriteria( "OnCappableControlPoint", "1" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16720,6 +16720,18 @@ bool CTFGameRules::TeamMayCapturePoint( int iTeam, int iPointIndex )
|
|||
if ( !tf_caplinear.GetBool() )
|
||||
return true;
|
||||
|
||||
// Are points currently able to be captured?
|
||||
if ( !PointsMayBeCaptured() )
|
||||
return false;
|
||||
|
||||
// Is the point locked?
|
||||
if ( ObjectiveResource()->GetCPLocked( iPointIndex ) )
|
||||
return false;
|
||||
|
||||
// Is the point set to allow our team to cap it?
|
||||
if ( !ObjectiveResource()->TeamCanCapPoint( iPointIndex, iTeam ) )
|
||||
return false;
|
||||
|
||||
// Any previous points necessary?
|
||||
int iPointNeeded = ObjectiveResource()->GetPreviousPointForPoint( iPointIndex, iTeam, 0 );
|
||||
|
||||
|
@ -16727,13 +16739,6 @@ bool CTFGameRules::TeamMayCapturePoint( int iTeam, int iPointIndex )
|
|||
if ( iPointNeeded == iPointIndex )
|
||||
return true;
|
||||
|
||||
if ( IsInKothMode() && IsInWaitingForPlayers() )
|
||||
return false;
|
||||
|
||||
// Is the point locked?
|
||||
if ( ObjectiveResource()->GetCPLocked( iPointIndex ) )
|
||||
return false;
|
||||
|
||||
// No required points specified? Require all previous points.
|
||||
if ( iPointNeeded == -1 )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue