Ejemplo n.º 1
0
//=========================================================
//=========================================================
int CTeamplayRules::PlayerRelationship( CBaseEntity *pPlayer, CBaseEntity *pTarget )
{
	// half life multiplay has a simple concept of Player Relationships.
	// you are either on another player's team, or you are not.
	if ( !pPlayer || !pTarget || !pTarget->IsPlayer() )
		return GR_NOTTEAMMATE;

	if ( (*GetTeamID(pPlayer) != '\0') && (*GetTeamID(pTarget) != '\0') && !stricmp( GetTeamID(pPlayer), GetTeamID(pTarget) ) )
	{
		return GR_TEAMMATE;
	}

	return GR_NOTTEAMMATE;
}
Ejemplo n.º 2
0
//-----------------------------------------------------------------------------
// Purpose: Find the relationship between players (teamplay vs. deathmatch)
//-----------------------------------------------------------------------------
int CSDKGameRules::PlayerRelationship( CBaseEntity *pPlayer, CBaseEntity *pTarget )
{
#ifndef CLIENT_DLL
	// half life multiplay has a simple concept of Player Relationships.
	// you are either on another player's team, or you are not.
	if ( !pPlayer || !pTarget || !pTarget->IsPlayer() || IsTeamplay() == false )
		return GR_NOTTEAMMATE;

	if ( (*GetTeamID(pPlayer) != '\0') && (*GetTeamID(pTarget) != '\0') && !stricmp( GetTeamID(pPlayer), GetTeamID(pTarget) ) )
		return GR_TEAMMATE;

#endif

	return GR_NOTTEAMMATE;
}
Ejemplo n.º 3
0
DBOOL FlagStand::SpawnFlag()
{
	// Sanity checks...

	if (m_nTeamID < 1) return(DFALSE);
	if (m_nTeamID > 2) return(DFALSE);


	// Get the position and rotation for the flag...

	DVector vPos;
	g_pServerDE->GetObjectPos(m_hObject, &vPos);
	vPos.x -= 16;
	vPos.y += 32;

	DRotation rRot;
	g_pServerDE->GetObjectRotation(m_hObject, &rRot);


	// Spawn the flag object for the team..

	if (!m_hFlagObject)
	{
		char sSpawnString[128];
		sprintf(sSpawnString, "FlagObject TeamID %i", GetTeamID());

		m_hFlagObject = SpawnObject(sSpawnString, &vPos, &rRot, NULL);
		if (!m_hFlagObject) return(DFALSE);
	}


	// All done...

	return(DTRUE);
}
Ejemplo n.º 4
0
CSpringUnit* CSpringGame::CreateUnit(springai::Unit* unit, bool addToVectors) {
    std::map<int, CSpringUnit*>::iterator i = aliveUnits.find(unit->GetUnitId());
    if (i == aliveUnits.end()) {
        CSpringUnit* u = new CSpringUnit(callback, unit, this);
        aliveUnits[unit->GetUnitId()] = u;

        if (addToVectors) {
            if (u->Team() == GetTeamID()) {
                teamUnits.push_back(u);
                friendlyUnits.push_back(u);
            } else if (u->IsAlly(game->GetMyAllyTeam())) {
                friendlyUnits.push_back(u);
            } else {
                enemyUnits.push_back(u);
            }
        }

        return u;
    } else {
        delete unit;
        return i->second;
    }
}