r5479 - in trunk/data: . qcsrc/server

esteel at icculus.org esteel at icculus.org
Fri Jan 9 17:00:58 EST 2009


Author: esteel
Date: 2009-01-09 17:00:57 -0500 (Fri, 09 Jan 2009)
New Revision: 5479

Modified:
   trunk/data/defaultNexuiz.cfg
   trunk/data/qcsrc/server/cl_player.qc
   trunk/data/qcsrc/server/clientcommands.qc
   trunk/data/qcsrc/server/constants.qh
   trunk/data/qcsrc/server/defs.qh
   trunk/data/weapons.cfg
   trunk/data/weaponsHavoc.cfg
Log:
voice flood protection!!!\
update the cvar constatns for this protection and (im too lazy to seperate this) havoc had a weapons cvar missing

Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg	2009-01-09 21:58:39 UTC (rev 5478)
+++ trunk/data/defaultNexuiz.cfg	2009-01-09 22:00:57 UTC (rev 5479)
@@ -16,7 +16,7 @@
 seta g_configversion 0
 
 // default.cfg versioning (update using update-cvarcount.sh; run that every time after adding a new cvar)
-set cvar_check_default 3a4552d8adffd3ad69fec3f0c15c62d8
+set cvar_check_default 913e35a06d0542e7ba625bfe0e0844c9
 
 // Nexuiz version (formatted for machines)
 // used to determine if a client version is compatible
@@ -890,6 +890,8 @@
 set g_chat_flood_burst_team 2     // /
 set g_chat_flood_notify_flooder 1 // when 0, the flooder still can see his own message
 set g_chat_teamcolors 0           // colorize nicknames in team color for chat
+set g_voice_flood_spv 4           // seconds between voices to not count as flooding
+set g_voice_flood_spv_team 2      //  } same for say_team
 
 set g_waypointsprite_normdistance 512
 set g_waypointsprite_minscale 1

Modified: trunk/data/qcsrc/server/cl_player.qc
===================================================================
--- trunk/data/qcsrc/server/cl_player.qc	2009-01-09 21:58:39 UTC (rev 5478)
+++ trunk/data/qcsrc/server/cl_player.qc	2009-01-09 22:00:57 UTC (rev 5479)
@@ -759,6 +759,142 @@
 		self.last_selected_player = self.selected_player;
 }
 
+.float floodcontrol_chat;
+.float floodcontrol_chatteam;
+void Say(entity source, float teamsay, string msgin)
+{
+	string msgstr, colorstr, cmsgstr, namestr;
+	float flood;
+	entity head;
+
+	if(Ban_MaybeEnforceBan(source))
+		return;
+
+	if(!teamsay)
+		if(substring(msgin, 0, 1) == " ")
+			msgin = substring(msgin, 1, strlen(msgin) - 1); // work around DP say bug (say_team does not have this!)
+
+	msgin = formatmessage(msgin);
+
+	if(msgin == "")
+		return;
+
+	if(source.classname != "player")
+		colorstr = "^0"; // black for spectators
+	else if(teams_matter)
+		colorstr = Team_ColorCode(source.team);
+	else
+		teamsay = FALSE;
+
+	if(intermission_running)
+		teamsay = FALSE;
+
+	/*
+	 * using bprint solves this... me stupid
+	// how can we prevent the message from appearing in a listen server?
+	// for now, just give "say" back and only handle say_team
+	if(!teamsay)
+	{
+		clientcommand(self, strcat("say ", msgin));
+		return;
+	}
+	*/
+
+	if(cvar("g_chat_teamcolors"))
+		namestr = playername(source);
+	else
+		namestr = source.netname;
+	if(teamsay)
+	{
+		msgstr = strzone(strcat("\{1}\{13}", colorstr, "(^3", namestr, colorstr, ") ^7", msgin, "\n"));
+		cmsgstr = strcat(colorstr, "(^3", namestr, colorstr, ")\n^7", wordwrap(msgin, 50));
+	}
+	else
+		msgstr = strzone(strcat("\{1}", namestr, "^7: ", msgin, "\n"));
+
+	// FLOOD CONTROL
+	flood = 0;
+	{
+		float flood_spl;
+		float flood_burst;
+		float flood_lmax;
+		var .float flood_field;
+		float lines;
+		if(teamsay)
+		{
+			flood_spl = cvar("g_chat_flood_spl_team");
+			flood_burst = cvar("g_chat_flood_burst_team");
+			flood_lmax = cvar("g_chat_flood_lmax_team");
+			flood_field = floodcontrol_chatteam;
+		}
+		else
+		{
+			flood_spl = cvar("g_chat_flood_spl");
+			flood_burst = cvar("g_chat_flood_burst");
+			flood_lmax = cvar("g_chat_flood_lmax");
+			flood_field = floodcontrol_chat;
+		}
+		flood_burst = max(0, flood_burst - 1);
+		// to match explanation in default.cfg, a value of 3 must allow three-line bursts and not four!
+		lines = ceil(strlennocol(msgstr) / 75);
+		if(flood_lmax && lines > flood_lmax)
+			flood = 2;
+		else if(time >= self.flood_field)
+			self.flood_field = max(time - flood_burst * flood_spl, self.flood_field) + lines * flood_spl;
+		else
+			flood = 1;
+	}
+
+	if(flood)
+	{
+		if(cvar("g_chat_flood_notify_flooder"))
+		{
+			if(flood == 1)
+				sprint(self, strcat("^3FLOOD CONTROL: ^7wait ^1", ftos(self.flood_field - time), "^3 seconds\n"));
+			else if(flood == 2)
+				sprint(self, "^3FLOOD CONTROL: ^7message too long\n");
+		}
+		else
+			sprint(self, msgstr);
+		print("NOTE: ", playername(self), "^7 is flooding.\n");
+	}
+	else if(teamsay)
+	{
+		if(source.classname == "player")
+		{
+			FOR_EACH_REALPLAYER(head)
+			{
+				if(head.team == source.team)
+				{
+					sprint(head, msgstr);
+					centerprint(head, cmsgstr);
+				}
+			}
+		}
+		else
+		{
+			FOR_EACH_REALCLIENT(head) if(head.classname != "player")
+			{
+				sprint(head, msgstr);
+				centerprint(head, cmsgstr);
+			}
+		}
+	}
+	else
+	{
+		// TODO invent a cvar name for allowing global chat by spectators during warmup anyway
+		if(cvar("g_chat_nospectators") && source.classname != "player") {
+			FOR_EACH_REALCLIENT(head) if(head.classname != "player") {
+				sprint(head, msgstr);
+			}
+		}
+		else
+			bprint(msgstr);
+	}
+
+	strunzone(msgstr);
+}
+
 float GetVoiceMessageTeamsayType(string type)
 {
 	if(type == "taunt")
@@ -981,7 +1117,9 @@
 	GlobalSound(sample, chan, teamsay);
 }
 
-void VoiceMessage(string type)
+.float floodcontrol_voice;
+.float floodcontrol_voiceteam;
+void VoiceMessage(string type, string message)
 {
 	var .string sample;
 	var float teamsay;
@@ -995,5 +1133,30 @@
 
 	teamsay = GetVoiceMessageTeamsayType(type);
 
-	PlayerSound(sample, CHAN_VOICE, teamsay);
+	float flood;
+	float flood_spv;
+	var .float flood_field;
+
+	flood = 0;
+	if(teamsay == 1)
+	{
+		flood_spv = cvar("g_voice_flood_spv_team");
+		flood_field = floodcontrol_voiceteam;
+	}
+	else
+	{
+		flood_spv = cvar("g_voice_flood_spv");
+		flood_field = floodcontrol_voice;
+	}
+
+	if(time >= self.flood_field)
+		self.flood_field = max(time, self.flood_field) + flood_spv;
+	else
+		flood = 1;
+
+	if (message != "")
+		Say(self, teamsay, message);
+
+	if (!flood)
+		PlayerSound(sample, CHAN_VOICE, teamsay);
 }

Modified: trunk/data/qcsrc/server/clientcommands.qc
===================================================================
--- trunk/data/qcsrc/server/clientcommands.qc	2009-01-09 21:58:39 UTC (rev 5478)
+++ trunk/data/qcsrc/server/clientcommands.qc	2009-01-09 22:00:57 UTC (rev 5479)
@@ -58,142 +58,6 @@
 void ReadyCount();
 string MapVote_Suggest(string m);
 
-.float floodcontrol_chat;
-.float floodcontrol_team;
-void Say(entity source, float teamsay, string msgin)
-{
-	string msgstr, colorstr, cmsgstr, namestr;
-	float flood;
-	entity head;
-
-	if(Ban_MaybeEnforceBan(source))
-		return;
-
-	if(!teamsay)
-		if(substring(msgin, 0, 1) == " ")
-			msgin = substring(msgin, 1, strlen(msgin) - 1); // work around DP say bug (say_team does not have this!)
-
-	msgin = formatmessage(msgin);
-
-	if(msgin == "")
-		return;
-
-	if(source.classname != "player")
-		colorstr = "^0"; // black for spectators
-	else if(teams_matter)
-		colorstr = Team_ColorCode(source.team);
-	else
-		teamsay = FALSE;
-
-	if(intermission_running)
-		teamsay = FALSE;
-
-	/*
-	 * using bprint solves this... me stupid
-	// how can we prevent the message from appearing in a listen server?
-	// for now, just give "say" back and only handle say_team
-	if(!teamsay)
-	{
-		clientcommand(self, strcat("say ", msgin));
-		return;
-	}
-	*/
-
-	if(cvar("g_chat_teamcolors"))
-		namestr = playername(source);
-	else
-		namestr = source.netname;
-	if(teamsay)
-	{
-		msgstr = strzone(strcat("\{1}\{13}", colorstr, "(^3", namestr, colorstr, ") ^7", msgin, "\n"));
-		cmsgstr = strcat(colorstr, "(^3", namestr, colorstr, ")\n^7", wordwrap(msgin, 50));
-	}
-	else
-		msgstr = strzone(strcat("\{1}", namestr, "^7: ", msgin, "\n"));
-
-	// FLOOD CONTROL
-	flood = 0;
-	{
-		float flood_spl;
-		float flood_burst;
-		float flood_lmax;
-		var .float flood_field;
-		float lines;
-		if(teamsay)
-		{
-			flood_spl = cvar("g_chat_flood_spl_team");
-			flood_burst = cvar("g_chat_flood_burst_team");
-			flood_lmax = cvar("g_chat_flood_lmax_team");
-			flood_field = floodcontrol_team;
-		}
-		else
-		{
-			flood_spl = cvar("g_chat_flood_spl");
-			flood_burst = cvar("g_chat_flood_burst");
-			flood_lmax = cvar("g_chat_flood_lmax");
-			flood_field = floodcontrol_chat;
-		}
-		flood_burst = max(0, flood_burst - 1);
-		// to match explanation in default.cfg, a value of 3 must allow three-line bursts and not four!
-		lines = ceil(strlennocol(msgstr) / 75);
-		if(flood_lmax && lines > flood_lmax)
-			flood = 2;
-		else if(time >= self.flood_field)
-			self.flood_field = max(time - flood_burst * flood_spl, self.flood_field) + lines * flood_spl;
-		else
-			flood = 1;
-	}
-
-	if(flood)
-	{
-		if(cvar("g_chat_flood_notify_flooder"))
-		{
-			if(flood == 1)
-				sprint(self, strcat("^3FLOOD CONTROL: ^7wait ^1", ftos(self.flood_field - time), "^3 seconds\n"));
-			else if(flood == 2)
-				sprint(self, "^3FLOOD CONTROL: ^7message too long\n");
-		}
-		else
-			sprint(self, msgstr);
-		print("NOTE: ", playername(self), "^7 is flooding.\n");
-	}
-	else if(teamsay)
-	{
-		if(source.classname == "player")
-		{
-			FOR_EACH_REALPLAYER(head)
-			{
-				if(head.team == source.team)
-				{
-					sprint(head, msgstr);
-					centerprint(head, cmsgstr);
-				}
-			}
-		}
-		else
-		{
-			FOR_EACH_REALCLIENT(head) if(head.classname != "player")
-			{
-				sprint(head, msgstr);
-				centerprint(head, cmsgstr);
-			}
-		}
-	}
-	else
-	{
-		// TODO invent a cvar name for allowing global chat by spectators during warmup anyway
-		if(cvar("g_chat_nospectators") && source.classname != "player") {
-			FOR_EACH_REALCLIENT(head) if(head.classname != "player") {
-				sprint(head, msgstr);
-			}
-		}
-		else
-			bprint(msgstr);
-	}
-
-	strunzone(msgstr);
-}
-
 entity GetPlayer(string name)
 {
 	float num;
@@ -361,7 +225,7 @@
 	} else if(argv(0) == "records") {
 		sprint(self, records_reply);
 	} else if(argv(0) == "voice") {
-		VoiceMessage(argv(1));
+		VoiceMessage(argv(1), substring(s, argv_start_index(2), argv_end_index(-1) - argv_start_index(2)));
 	} else if(argv(0) == "say") {
 		if(tokens >= 2)
 			Say(self, FALSE, substring(s, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)));

Modified: trunk/data/qcsrc/server/constants.qh
===================================================================
--- trunk/data/qcsrc/server/constants.qh	2009-01-09 21:58:39 UTC (rev 5478)
+++ trunk/data/qcsrc/server/constants.qh	2009-01-09 22:00:57 UTC (rev 5479)
@@ -1,5 +1,5 @@
-string CVAR_CHECK_DEFAULT = "3a4552d8adffd3ad69fec3f0c15c62d8";
-string CVAR_CHECK_WEAPONS = "0ce586134eb7097440e850031829efe6";
+string CVAR_CHECK_DEFAULT = "913e35a06d0542e7ba625bfe0e0844c9";
+string CVAR_CHECK_WEAPONS = "2a35f7139825257d468d22354209cf54";
 float	FALSE					= 0;
 float	TRUE					= 1;
 

Modified: trunk/data/qcsrc/server/defs.qh
===================================================================
--- trunk/data/qcsrc/server/defs.qh	2009-01-09 21:58:39 UTC (rev 5478)
+++ trunk/data/qcsrc/server/defs.qh	2009-01-09 22:00:57 UTC (rev 5479)
@@ -473,7 +473,7 @@
 void ClearPlayerSounds();
 void PlayerSound(.string samplefield, float channel, float teamsay); // 0 is normal, 1 is team, 2 is last attacker
 void GlobalSound(string samplestring, float channel, float teamsay); // 0 is normal, 1 is team, 2 is last attacker
-void VoiceMessage(string type);
+void VoiceMessage(string type, string message);
 
 // autotaunt system
 .float cvar_cl_autotaunt;

Modified: trunk/data/weapons.cfg
===================================================================
--- trunk/data/weapons.cfg	2009-01-09 21:58:39 UTC (rev 5478)
+++ trunk/data/weapons.cfg	2009-01-09 22:00:57 UTC (rev 5479)
@@ -3,7 +3,7 @@
 //
 // And... don't forget to edit weaponsPro.cfg too.
 
-set cvar_check_weapons 0ce586134eb7097440e850031829efe6
+set cvar_check_weapons 2a35f7139825257d468d22354209cf54
 
 set g_start_weapon_laser 1
 set g_start_weapon_shotgun 1

Modified: trunk/data/weaponsHavoc.cfg
===================================================================
--- trunk/data/weaponsHavoc.cfg	2009-01-09 21:58:39 UTC (rev 5478)
+++ trunk/data/weaponsHavoc.cfg	2009-01-09 22:00:57 UTC (rev 5479)
@@ -1,4 +1,4 @@
-set cvar_check_weapons 0ce586134eb7097440e850031829efe6
+set cvar_check_weapons 2a35f7139825257d468d22354209cf54
 
 set g_start_weapon_laser 1
 set g_start_weapon_shotgun 1
@@ -240,6 +240,7 @@
 set g_balance_hook_primary_refire 0 // hook monkeys
 set g_balance_hook_primary_animtime 0.3 // good shoot anim
 set g_balance_hook_primary_hooked_time_max 0 // infinite
+set g_balance_hook_primary_hooked_time_free 2 // 2s being hooked are free
 set g_balance_hook_primary_hooked_ammodecrease_delay 2.5 // no ammo used if nagative or 0
 set g_balance_hook_secondary_damage 25 // not much
 set g_balance_hook_secondary_edgedamage 5 // not much




More information about the nexuiz-commits mailing list