diff --git a/dlls/plats.cpp b/dlls/plats.cpp index 93fb22fe..8b1d6588 100644 --- a/dlls/plats.cpp +++ b/dlls/plats.cpp @@ -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;