mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-01-13 16:37:57 +00:00
Stop tracktrains that does not have players
This commit is contained in:
parent
9eee0f6b89
commit
e739165fdf
@ -25,6 +25,7 @@
|
||||
#include "cbase.h"
|
||||
#include "trains.h"
|
||||
#include "saverestore.h"
|
||||
#include "game.h"
|
||||
|
||||
static void PlatSpawnInsideTrigger(entvars_t* pevPlatform);
|
||||
|
||||
@ -1131,6 +1132,22 @@ void CFuncTrackTrain::Next( void )
|
||||
return;
|
||||
}
|
||||
|
||||
// prevent train without players going to other map
|
||||
if( mp_coop.value && pev->globalname && STRING( pev->globalname )[0] )
|
||||
{
|
||||
CBaseEntity *pList;
|
||||
Vector mins = pev->absmin;
|
||||
Vector maxs = pev->absmax;
|
||||
maxs.z += 8;
|
||||
int count = UTIL_EntitiesInBox( &pList, 1, mins, maxs, FL_ONGROUND );
|
||||
if( !count || !pList->IsPlayer() )
|
||||
{
|
||||
pev->velocity = g_vecZero;
|
||||
NextThink( pev->ltime + time, TRUE );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
UpdateSound();
|
||||
|
||||
Vector nextPos = pev->origin;
|
||||
|
Loading…
Reference in New Issue
Block a user