about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTeetime <TeetimeTW@yahoo.de>2012-02-18 16:55:57 +0100
committerTeetime <TeetimeTW@yahoo.de>2012-02-18 16:55:57 +0100
commit5bf6ba19e964856396fcd470cfd52c47f8b1a55b (patch)
tree9e388ae16e89f5115129a91f686122d54550a37e
parent4c582edf1d7669369da7f785bb8cfbb7267fb9b0 (diff)
downloadzcatch-5bf6ba19e964856396fcd470cfd52c47f8b1a55b.tar.gz
zcatch-5bf6ba19e964856396fcd470cfd52c47f8b1a55b.zip
added laserjumps and cleaned up some code
-rw-r--r--src/game/server/entities/character.cpp35
-rw-r--r--src/game/server/entities/laser.cpp4
-rw-r--r--src/game/variables.h1
3 files changed, 19 insertions, 21 deletions
diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp
index 60b1d0f9..c70e0850 100644
--- a/src/game/server/entities/character.cpp
+++ b/src/game/server/entities/character.cpp
@@ -780,36 +780,29 @@ bool CCharacter::TakeDamage(vec2 Force, int Dmg, int From, int Weapon)
 		return false;
 	
 	/* zCatch */
-	bool Is_zCatch = GameServer()->m_pController->IsZCatch();
-	
-	if(From == m_pPlayer->GetCID())
+	if(GameServer()->m_pController->IsZCatch())
 	{
-		//No selfdamage
-		if(Is_zCatch)
-			Dmg = 0;
-		// m_pPlayer only inflicts half damage on self
-		else
+		if(From == m_pPlayer->GetCID() || Weapon == WEAPON_GAME)
+			return false;
+
+		if(g_Config.m_SvMode == 4 && Weapon == WEAPON_GRENADE && Dmg < g_Config.m_SvGrenadeMinDamage)
+			return false;
+
+		m_Health = 0;
+		m_Armor = 0;
+	}
+	else
+	{
+		if(From == m_pPlayer->GetCID())
 			Dmg = max(1, Dmg/2);
 	}
-
-	if(g_Config.m_SvMode == 4 && Weapon == WEAPON_GRENADE && Dmg < g_Config.m_SvGrenadeMinDamage)
-		Dmg = 0;
 	/* end zCatch */
 	
 	m_DamageTaken++;
 
 	if(Dmg)
 	{
-		/* zCatch*/
-		//One-Shot-One-Kill
-		if(Is_zCatch)
-		{
-			m_Health = 0;
-			m_Armor = 0;
-		}
-		/* end zCatch*/
-
-		else if(m_Armor)
+		if(m_Armor)
 		{
 			if(Dmg > 1)
 			{
diff --git a/src/game/server/entities/laser.cpp b/src/game/server/entities/laser.cpp
index eb40c4e1..f45a1d1d 100644
--- a/src/game/server/entities/laser.cpp
+++ b/src/game/server/entities/laser.cpp
@@ -2,6 +2,7 @@
 /* If you are missing that file, acquire a complete release at teeworlds.com.                */
 #include <game/generated/protocol.h>
 #include <game/server/gamecontext.h>
+#include <engine/shared/config.h>
 #include "laser.h"
 
 CLaser::CLaser(CGameWorld *pGameWorld, vec2 Pos, vec2 Direction, float StartEnergy, int Owner)
@@ -67,6 +68,9 @@ void CLaser::DoBounce()
 				m_Energy = -1;
 
 			GameServer()->CreateSound(m_Pos, SOUND_RIFLE_BOUNCE);
+
+			if(m_Bounces == 1 && g_Config.m_SvLaserjumps && GameServer()->m_pController->IsZCatch())
+				GameServer()->CreateExplosion(m_Pos, m_Owner, WEAPON_GAME, false);
 		}
 	}
 	else
diff --git a/src/game/variables.h b/src/game/variables.h
index 99377a64..4b321a36 100644
--- a/src/game/variables.h
+++ b/src/game/variables.h
@@ -98,6 +98,7 @@ MACRO_CONFIG_INT(SvAllowJoin, sv_allow_join, 2, 1, 2, CFGFLAG_SERVER, "Allow new
 MACRO_CONFIG_INT(SvColorIndicator, sv_color_indicator, 1, 0, 1, CFGFLAG_SERVER, "Color tees apropriate to the number of currently catched players")
 MACRO_CONFIG_INT(SvBonus, sv_bonus, 0, 0, 10000, CFGFLAG_SERVER, "Give the last player extra points")
 MACRO_CONFIG_INT(SvFollowCatcher, sv_follow_catcher, 1, 0, 1, CFGFLAG_SERVER, "If a victim should follow his catcher")
+MACRO_CONFIG_INT(SvLaserjumps, sv_laserjumps, 0, 0, 1, CFGFLAG_SERVER, "Use laserjumps - on a laser bounce a explosion will occur which takes no damage")
 
 MACRO_CONFIG_INT(SvChatValue, sv_chat_value, 250, 100, 1000, CFGFLAG_SERVER, "A value which is added on each message and decreased on each tick")
 MACRO_CONFIG_INT(SvChatThreshold, sv_chat_threshold, 1000, 250, 10000, CFGFLAG_SERVER, "If this threshold will exceed by too many messages the player will be muted")