From e739165fdf8267df796b488fd8f3cceb95e1d2d0 Mon Sep 17 00:00:00 2001 From: mittorn Date: Mon, 3 Oct 2016 03:55:11 +0000 Subject: [PATCH] Stop tracktrains that does not have players --- dlls/plats.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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;