about summary refs log tree commit diff
path: root/src/game
diff options
context:
space:
mode:
authorTeetime <TeetimeTW@yahoo.de>2012-02-18 18:24:07 +0100
committerTeetime <TeetimeTW@yahoo.de>2012-02-18 18:24:07 +0100
commitfd9d2084828292f88f569a4d02e75b30a7f6fdc2 (patch)
tree45c4835af03568ceb16e37697dd7e30c935cff1a /src/game
parent8cfdd5b7e75cec9a1bcd9838bef2a6324c278169 (diff)
downloadzcatch-fd9d2084828292f88f569a4d02e75b30a7f6fdc2.tar.gz
zcatch-fd9d2084828292f88f569a4d02e75b30a7f6fdc2.zip
no endless ammo for grenade and all weapons, so player cannot shoot anymore all the time
Diffstat (limited to 'src/game')
-rw-r--r--src/game/server/entities/character.cpp13
-rw-r--r--src/game/server/gamemodes/zcatch.cpp22
2 files changed, 24 insertions, 11 deletions
diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp
index c70e0850..47f5e9f4 100644
--- a/src/game/server/entities/character.cpp
+++ b/src/game/server/entities/character.cpp
@@ -472,6 +472,17 @@ void CCharacter::HandleWeapons()
 
 	// ammo regen
 	int AmmoRegenTime = g_pData->m_Weapons.m_aId[m_ActiveWeapon].m_Ammoregentime;
+	if(GameServer()->m_pController->IsZCatch() && m_aWeapons[m_ActiveWeapon].m_Ammo > -1)
+	{
+		switch(m_ActiveWeapon)
+		{
+			case WEAPON_GUN: AmmoRegenTime = 125*5; break;
+			case WEAPON_GRENADE: AmmoRegenTime = 1000; break;
+			case WEAPON_RIFLE: AmmoRegenTime = 1200; break;
+			case WEAPON_SHOTGUN: AmmoRegenTime = 1000; break;
+		}
+	}
+
 	if(AmmoRegenTime)
 	{
 		// If equipped and not active, regen ammo?
@@ -483,7 +494,7 @@ void CCharacter::HandleWeapons()
 			if ((Server()->Tick() - m_aWeapons[m_ActiveWeapon].m_AmmoRegenStart) >= AmmoRegenTime * Server()->TickSpeed() / 1000)
 			{
 				// Add some ammo
-				m_aWeapons[m_ActiveWeapon].m_Ammo = min(m_aWeapons[m_ActiveWeapon].m_Ammo + 1, 10);
+				m_aWeapons[m_ActiveWeapon].m_Ammo = min(m_aWeapons[m_ActiveWeapon].m_Ammo + 1, (GameServer()->m_pController->IsZCatch()) ? 6 : 10);
 				m_aWeapons[m_ActiveWeapon].m_AmmoRegenStart = -1;
 			}
 		}
diff --git a/src/game/server/gamemodes/zcatch.cpp b/src/game/server/gamemodes/zcatch.cpp
index 7bdd706c..a003f741 100644
--- a/src/game/server/gamemodes/zcatch.cpp
+++ b/src/game/server/gamemodes/zcatch.cpp
@@ -164,29 +164,31 @@ void CGameController_zCatch::OnCharacterSpawn(class CCharacter *pChr)
 	pChr->IncreaseHealth(10);
 	if(g_Config.m_SvMode == 2)
 		pChr->IncreaseArmor(10);
+
 	// give default weapons
 	switch(g_Config.m_SvMode)
 		{
-			case 1:
+			case 1: /* Instagib - Only Riffle */
 				pChr->GiveWeapon(WEAPON_RIFLE, -1);
 				break;
-			case 2:
+			case 2: /* All Weapons */
 				pChr->GiveWeapon(WEAPON_HAMMER, -1);
-				pChr->GiveWeapon(WEAPON_GUN, -1);
-				pChr->GiveWeapon(WEAPON_GRENADE, -1);
-				pChr->GiveWeapon(WEAPON_SHOTGUN, -1);
-				pChr->GiveWeapon(WEAPON_RIFLE, -1);
+				pChr->GiveWeapon(WEAPON_GUN, 6);
+				pChr->GiveWeapon(WEAPON_GRENADE, 6);
+				pChr->GiveWeapon(WEAPON_SHOTGUN, 6);
+				pChr->GiveWeapon(WEAPON_RIFLE, 6);
 				break;
-			case 3:
+			case 3: /* Hammer */
 				pChr->GiveWeapon(WEAPON_HAMMER, -1);
 				break;
-			case 4:
-				pChr->GiveWeapon(WEAPON_GRENADE, -1);
+			case 4: /* Grenade */
+				pChr->GiveWeapon(WEAPON_GRENADE, 6);
 				break;
-			case 5:
+			case 5: /* Ninja */
 				pChr->GiveNinja();
 				break;
 		}
+
 	//Update color of spawning tees
 	OnPlayerInfoChange(pChr->GetPlayer());
 }