Add mp_kill_filled_spawn (#313)

* Add mp_kill_filled_spawn
This commit is contained in:
justgo97 2018-10-26 18:11:23 +01:00 committed by Dmitry Novikov
parent b732b47874
commit cc1f584a7f
4 changed files with 23 additions and 5 deletions

8
dist/game.cfg vendored
View File

@ -193,3 +193,11 @@ mp_legacy_bombtarget_touch "1"
//
// Default value: "0"
mp_respawn_immunitytime "0"
// Kill the player in filled spawn before spawning some one else (Prevents players stucking in each other).
// Only disable this if you have semiclip or other plugins that prevents stucking
// 0 - disabled
// 1 - enabled
//
// Default value: "1"
mp_kill_filled_spawn "1"

View File

@ -117,6 +117,7 @@ cvar_t old_bomb_defused_sound = { "mp_old_bomb_defused_sound", "1", FCVAR_SERVE
cvar_t item_staytime = { "mp_item_staytime", "300", FCVAR_SERVER, 300.0f, nullptr };
cvar_t legacy_bombtarget_touch = { "mp_legacy_bombtarget_touch", "1", FCVAR_SERVER, 1.0f, nullptr };
cvar_t respawn_immunitytime = { "mp_respawn_immunitytime", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t kill_filled_spawn = { "mp_kill_filled_spawn", "1", FCVAR_SERVER, 0.0f, nullptr };
void GameDLL_Version_f()
{
@ -272,6 +273,7 @@ void EXT_FUNC GameDLLInit()
CVAR_REGISTER(&item_staytime);
CVAR_REGISTER(&legacy_bombtarget_touch);
CVAR_REGISTER(&respawn_immunitytime);
CVAR_REGISTER(&kill_filled_spawn);
// print version
CONSOLE_ECHO("ReGameDLL version: " APP_VERSION "\n");

View File

@ -154,6 +154,7 @@ extern cvar_t old_bomb_defused_sound;
extern cvar_t item_staytime;
extern cvar_t legacy_bombtarget_touch;
extern cvar_t respawn_immunitytime;
extern cvar_t kill_filled_spawn;
#endif

View File

@ -4948,12 +4948,19 @@ bool CBasePlayer::SelectSpawnSpot(const char *pEntClassName, CBaseEntity *&pSpot
// we haven't found a place to spawn yet, so kill any guy at the first spawn point and spawn there
if (!FNullEnt(pSpot))
{
CBaseEntity *pEntity = nullptr;
while ((pEntity = UTIL_FindEntityInSphere(pEntity, pSpot->pev->origin, MAX_PLAYER_USE_RADIUS)))
#ifdef REGAMEDLL_ADD
if (kill_filled_spawn.value != 0.0)
#endif
{
// if ent is a client, kill em (unless they are ourselves)
if (pEntity->IsPlayer() && pEntity->edict() != pPlayer)
pEntity->TakeDamage(VARS(eoNullEntity), VARS(eoNullEntity), 200, DMG_GENERIC);
CBaseEntity *pEntity = nullptr;
while ((pEntity = UTIL_FindEntityInSphere(pEntity, pSpot->pev->origin, MAX_PLAYER_USE_RADIUS)))
{
// if ent is a client, kill em (unless they are ourselves)
if (pEntity->IsPlayer() && pEntity->edict() != pPlayer)
{
pEntity->TakeDamage(VARS(eoNullEntity), VARS(eoNullEntity), 200, DMG_GENERIC);
}
}
}
// if so, go to pSpot