about summary refs log tree commit diff
diff options
context:
space:
mode:
authordef <dennis@felsin9.de>2014-11-11 23:53:24 +0100
committerdef <dennis@felsin9.de>2014-11-11 23:53:24 +0100
commit8bbbe3afb5f34f468bcbe7812360b0ed448a7b40 (patch)
treef6912500c5d68e39e85d86df87ae6c0cf8ee65e7
parentbc72324451cf82e486a11b80ec7a49a1f5ab3690 (diff)
downloadzcatch-8bbbe3afb5f34f468bcbe7812360b0ed448a7b40.tar.gz
zcatch-8bbbe3afb5f34f468bcbe7812360b0ed448a7b40.zip
Add an otpion for respawn protection
-rw-r--r--src/engine/shared/config_variables.h1
-rw-r--r--src/game/server/entities/character.cpp5
2 files changed, 4 insertions, 2 deletions
diff --git a/src/engine/shared/config_variables.h b/src/engine/shared/config_variables.h
index b766b6c9..ee517c91 100644
--- a/src/engine/shared/config_variables.h
+++ b/src/engine/shared/config_variables.h
@@ -104,6 +104,7 @@ MACRO_CONFIG_INT(EcAuthTimeout, ec_auth_timeout, 30, 1, 120, CFGFLAG_ECON, "Time
 MACRO_CONFIG_INT(EcOutputLevel, ec_output_level, 1, 0, 2, CFGFLAG_ECON, "Adjusts the amount of information in the external console")
 
 MACRO_CONFIG_INT(SvGlobalBantime, sv_global_bantime, 60, 0, 1440, CFGFLAG_SERVER, "The time a client gets banned if the ban server reports it. 0 to disable")
+MACRO_CONFIG_INT(SvRespawnProtection, sv_respawn_protection, 1, 0, 1, CFGFLAG_SERVER, "Whether a player gets respawn protection")
 
 
 #if defined(CONF_SQL)
diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp
index 139422af..30e32a92 100644
--- a/src/game/server/entities/character.cpp
+++ b/src/game/server/entities/character.cpp
@@ -90,7 +90,8 @@ bool CCharacter::Spawn(CPlayer *pPlayer, vec2 Pos)
 		m_LastWeapon = WEAPON_HAMMER;
 	}
 
-	pPlayer->m_RespawnProtection = Server()->Tick() + Server()->TickSpeed() * 2;
+	if(g_Config.m_SvRespawnProtection)
+		pPlayer->m_RespawnProtection = Server()->Tick() + Server()->TickSpeed() * 2;
     /* end zCatch */
 	
 	m_LastNoAmmoSound = -1;
@@ -884,7 +885,7 @@ bool CCharacter::TakeDamage(vec2 Force, int Dmg, int From, int Weapon)
 	if(g_Config.m_SvMode == 4 && Weapon == WEAPON_GRENADE && Dmg < g_Config.m_SvGrenadeMinDamage)
 		return false;
 
-	if(From >= 0 && (m_pPlayer->m_RespawnProtection > Server()->Tick() || GameServer()->m_apPlayers[From]->m_RespawnProtection > Server()->Tick()))
+	if(g_Config.m_SvRespawnProtection && From >= 0 && (m_pPlayer->m_RespawnProtection > Server()->Tick() || GameServer()->m_apPlayers[From]->m_RespawnProtection > Server()->Tick()))
 		return false;
 	m_Health = 0;
 	m_Armor = 0;