mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-02-06 20:14:44 +00:00
Spawnpoint check
This commit is contained in:
parent
0c318c41b6
commit
0be0184c79
@ -2605,7 +2605,7 @@ USES AND SETS GLOBAL g_pLastSpawn
|
|||||||
*/
|
*/
|
||||||
edict_t *EntSelectSpawnPoint( CBaseEntity *pPlayer )
|
edict_t *EntSelectSpawnPoint( CBaseEntity *pPlayer )
|
||||||
{
|
{
|
||||||
CBaseEntity *pSpot;
|
CBaseEntity *pSpot = NULL;
|
||||||
edict_t *player;
|
edict_t *player;
|
||||||
|
|
||||||
player = pPlayer->edict();
|
player = pPlayer->edict();
|
||||||
@ -2674,15 +2674,22 @@ edict_t *EntSelectSpawnPoint( CBaseEntity *pPlayer )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If startspot is set, (re)spawn there.
|
// If startspot is set, (re)spawn there.
|
||||||
if( FStringNull( gpGlobals->startspot ) || !strlen(STRING( gpGlobals->startspot ) ) )
|
if( mp_coop.value || FStringNull( gpGlobals->startspot ) || !strlen(STRING( gpGlobals->startspot ) ) )
|
||||||
{
|
{
|
||||||
pSpot = UTIL_FindEntityByClassname( NULL, "info_player_start" );
|
pSpot = NULL;
|
||||||
if( !FNullEnt( pSpot ) )
|
while( pSpot = UTIL_FindEntityByClassname( pSpot, "info_player_start" ) )
|
||||||
goto ReturnSpot;
|
{
|
||||||
|
TraceResult tr;
|
||||||
|
UTIL_TraceHull( pSpot->pev->origin, pSpot->pev->origin , missile, 1, NULL, &tr );
|
||||||
|
if( !tr.fStartSolid && !tr.fAllSolid && !FNullEnt( pSpot ) )
|
||||||
|
goto ReturnSpot;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
// landmark may still exists when no spawn spot
|
||||||
|
if( FNullEnt( pSpot ) )
|
||||||
{
|
{
|
||||||
pSpot = UTIL_FindEntityByTargetname( NULL, STRING( gpGlobals->startspot ) );
|
pSpot = UTIL_FindEntityByTargetname( NULL, STRING( gpGlobals->startspot ) );
|
||||||
|
|
||||||
if( !FNullEnt( pSpot ) )
|
if( !FNullEnt( pSpot ) )
|
||||||
goto ReturnSpot;
|
goto ReturnSpot;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user