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" // Default value: "0"
mp_respawn_immunitytime "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 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 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 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() void GameDLL_Version_f()
{ {
@ -272,6 +273,7 @@ void EXT_FUNC GameDLLInit()
CVAR_REGISTER(&item_staytime); CVAR_REGISTER(&item_staytime);
CVAR_REGISTER(&legacy_bombtarget_touch); CVAR_REGISTER(&legacy_bombtarget_touch);
CVAR_REGISTER(&respawn_immunitytime); CVAR_REGISTER(&respawn_immunitytime);
CVAR_REGISTER(&kill_filled_spawn);
// print version // print version
CONSOLE_ECHO("ReGameDLL version: " APP_VERSION "\n"); 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 item_staytime;
extern cvar_t legacy_bombtarget_touch; extern cvar_t legacy_bombtarget_touch;
extern cvar_t respawn_immunitytime; extern cvar_t respawn_immunitytime;
extern cvar_t kill_filled_spawn;
#endif #endif

View File

@ -4947,14 +4947,21 @@ 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 // we haven't found a place to spawn yet, so kill any guy at the first spawn point and spawn there
if (!FNullEnt(pSpot)) if (!FNullEnt(pSpot))
{
#ifdef REGAMEDLL_ADD
if (kill_filled_spawn.value != 0.0)
#endif
{ {
CBaseEntity *pEntity = nullptr; CBaseEntity *pEntity = nullptr;
while ((pEntity = UTIL_FindEntityInSphere(pEntity, pSpot->pev->origin, MAX_PLAYER_USE_RADIUS))) while ((pEntity = UTIL_FindEntityInSphere(pEntity, pSpot->pev->origin, MAX_PLAYER_USE_RADIUS)))
{ {
// if ent is a client, kill em (unless they are ourselves) // if ent is a client, kill em (unless they are ourselves)
if (pEntity->IsPlayer() && pEntity->edict() != pPlayer) if (pEntity->IsPlayer() && pEntity->edict() != pPlayer)
{
pEntity->TakeDamage(VARS(eoNullEntity), VARS(eoNullEntity), 200, DMG_GENERIC); pEntity->TakeDamage(VARS(eoNullEntity), VARS(eoNullEntity), 200, DMG_GENERIC);
} }
}
}
// if so, go to pSpot // if so, go to pSpot
return true; return true;