Browse Source

Stop tracktrains that does not have players

hlzbot-dirty
mittorn 8 years ago
parent
commit
e739165fdf
  1. 17
      dlls/plats.cpp

17
dlls/plats.cpp

@ -25,6 +25,7 @@ @@ -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 ) @@ -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…
Cancel
Save