[nexuiz-commits] r6760 - in branches/nexuiz-2.0: . Docs data data/qcsrc/client data/qcsrc/common data/qcsrc/server data/scripts misc/netradiant-NexuizPack/nexuiz.game/data

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun May 24 05:07:23 EDT 2009


Author: div0
Date: 2009-05-24 05:07:22 -0400 (Sun, 24 May 2009)
New Revision: 6760

Modified:
   branches/nexuiz-2.0/.patchsets
   branches/nexuiz-2.0/Docs/mapping.txt
   branches/nexuiz-2.0/data/defaultNexuiz.cfg
   branches/nexuiz-2.0/data/qcsrc/client/sbar.qc
   branches/nexuiz-2.0/data/qcsrc/common/mapinfo.qc
   branches/nexuiz-2.0/data/qcsrc/server/g_triggers.qc
   branches/nexuiz-2.0/data/qcsrc/server/miscfunctions.qc
   branches/nexuiz-2.0/data/qcsrc/server/nexball.qc
   branches/nexuiz-2.0/data/qcsrc/server/scores_rules.qc
   branches/nexuiz-2.0/data/qcsrc/server/teamplay.qc
   branches/nexuiz-2.0/data/scripts/entities.def
   branches/nexuiz-2.0/misc/netradiant-NexuizPack/nexuiz.game/data/entities.def
Log:
r6584 | mrbougo | 2009-04-24 19:27:58 +0200 (Fri, 24 Apr 2009) | 1 line
nexball: make the power meter less transparent
r6590 | mrbougo | 2009-04-25 22:57:37 +0200 (Sat, 25 Apr 2009) | 5 lines
Nexball changes:
 - HUD blending changed for more visibility
 - Scoring and goal entities partially re-made, supports more than 2 teams
 - Entities renamed to make sense
r6591 | mrbougo | 2009-04-25 23:06:59 +0200 (Sat, 25 Apr 2009) | 1 line
woops, entities.def mismatch
r6594 | mrbougo | 2009-04-26 14:16:29 +0200 (Sun, 26 Apr 2009) | 1 line
forgot a few changes to support >2 teams
r6595 | mrbougo | 2009-04-26 14:52:51 +0200 (Sun, 26 Apr 2009) | 1 line
nexball: laser and shotgun disabled by default
r6596 | mrbougo | 2009-04-26 15:00:28 +0200 (Sun, 26 Apr 2009) | 1 line
woops, I did it wrong :P
r6631 | mrbougo | 2009-05-01 15:33:50 +0200 (Fri, 01 May 2009) | 1 line
prevent non-players from stealing, and add 'same team' voice messages on teamstealing
r6661 | mrbougo | 2009-05-04 18:24:40 +0200 (Mon, 04 May 2009) | 1 line
nexball hud fixes
r6663 | mrbougo | 2009-05-04 20:49:32 +0200 (Mon, 04 May 2009) | 1 line
tweaked the scoreboard columns for nexball


Modified: branches/nexuiz-2.0/.patchsets
===================================================================
--- branches/nexuiz-2.0/.patchsets	2009-05-24 09:03:35 UTC (rev 6759)
+++ branches/nexuiz-2.0/.patchsets	2009-05-24 09:07:22 UTC (rev 6760)
@@ -1,2 +1,2 @@
 master = svn://svn.icculus.org/nexuiz/trunk
-revisions_applied = 1-6582,6585-6589,6592-6593,6597-6629,6632-6660,6662-6662,6664-6675
+revisions_applied = 1-6675

Modified: branches/nexuiz-2.0/Docs/mapping.txt
===================================================================
--- branches/nexuiz-2.0/Docs/mapping.txt	2009-05-24 09:03:35 UTC (rev 6759)
+++ branches/nexuiz-2.0/Docs/mapping.txt	2009-05-24 09:07:22 UTC (rev 6760)
@@ -366,13 +366,17 @@
 =VI. Nexball=
 =============
 
-There are three required entities: ball_redgoal, ball_bluegoal, and one of ball_basketball
-or ball_football. Pay extra attention to the goals, as their names can be somewhat counter-
-intuitive: ball_redgoal will give a point to the red team when scored in, NOT to the blue team!
+There are three required entities: nexball_redgoal, nexball_bluegoal, and one of nexball_basketball
+or nexball_football. There are also optional nexball_yellowgoal and nexball_pinkgoal entities (don't
+add a pink goal when there is no yellow goal on the map, it will crash)
 
-There are also two other goal-like triggers, ball_fault and ball_bound, the first giving a point to
-the opposing team when the ball hits it, the second simply returning it. You can spawn the ball inside
-a goal-like trigger, this can be useful for basketball maps with separate teams and a common ball spawn.
+Goals are made just like any other regular triggers. You can use multiple brushes for one trigger,
+but avoid this if possible.
+
+There are also two other goal-like entities, nexball_fault and nexball_bound, the first taking a point
+from the team that hits the trigger with the ball, the second simply returning it. You can spawn the
+ball inside a goal-like trigger, this can be useful for basketball maps with separate teams and a
+common ball spawn.
 The different keys for the entities are documented in entities.def.
 
 The ball is affected by trigger_impulse, but not by trigger_push or teleporters.

Modified: branches/nexuiz-2.0/data/defaultNexuiz.cfg
===================================================================
--- branches/nexuiz-2.0/data/defaultNexuiz.cfg	2009-05-24 09:03:35 UTC (rev 6759)
+++ branches/nexuiz-2.0/data/defaultNexuiz.cfg	2009-05-24 09:07:22 UTC (rev 6760)
@@ -1234,6 +1234,8 @@
 con_notifysize 10
 sbar_alpha_bg 0.4
 sbar_flagstatus_pos 115
+seta sbar_ballstatus_pos 123
+seta sbar_ballstatus_right 0
 
 // for menu server list (eventually make them have engine support?)
 seta menu_slist_showfull 1
@@ -1260,12 +1262,12 @@
 // useful keybind to maximize the chat area temporarily
 set _backup_con_chatvars_set 0
 alias _restore_con_chatvars_0 ""
-alias _restore_con_chatvars_1 "set _backup_con_chatvars_set 0; con_chatpos $_backup_con_chatpos; con_chat $_backup_con_chat; con_notify $_backup_con_notify; con_chattime $_backup_con_chattime; cl_deathscoreboard $_backup_cl_deathscoreboard; sbar_flagstatus_right $_backup_sbar_flagstatus_right; scr_centertime $_backup_scr_centertime;r_track_sprites $_backup_r_track_sprites"
+alias _restore_con_chatvars_1 "set _backup_con_chatvars_set 0; con_chatpos $_backup_con_chatpos; con_chat $_backup_con_chat; con_notify $_backup_con_notify; con_chattime $_backup_con_chattime; cl_deathscoreboard $_backup_cl_deathscoreboard; sbar_flagstatus_right $_backup_sbar_flagstatus_right; sbar_ballstatus_right $_backup_sbar_ballstatus_right; scr_centertime $_backup_scr_centertime;r_track_sprites $_backup_r_track_sprites"
 alias _restore_con_chatvars "_restore_con_chatvars_$_backup_con_chatvars_set"
-alias _backup_con_chatvars_0 "set _backup_con_chatvars_set 1; set _backup_con_chatpos $con_chatpos; set _backup_con_chat $con_chat; set _backup_con_notify $con_notify; set _backup_con_chattime $con_chattime; set _backup_cl_deathscoreboard $cl_deathscoreboard; set _backup_sbar_flagstatus_right $sbar_flagstatus_right; set _backup_scr_centertime $scr_centertime;set _backup_r_track_sprites $r_track_sprites"
+alias _backup_con_chatvars_0 "set _backup_con_chatvars_set 1; set _backup_con_chatpos $con_chatpos; set _backup_con_chat $con_chat; set _backup_con_notify $con_notify; set _backup_con_chattime $con_chattime; set _backup_cl_deathscoreboard $cl_deathscoreboard; set _backup_sbar_flagstatus_right $sbar_flagstatus_right; set _backup_sbar_ballstatus_right $sbar_ballstatus_right; set _backup_scr_centertime $scr_centertime;set _backup_r_track_sprites $r_track_sprites"
 alias _backup_con_chatvars_1 ""
 alias _backup_con_chatvars "_backup_con_chatvars_$_backup_con_chatvars_set"
-alias +con_chat_maximize "_backup_con_chatvars; con_chatpos -7; con_chat 100; con_notify 0; con_chattime 3600; cl_deathscoreboard 0; sbar_flagstatus_right 1; scr_centertime 0; r_track_sprites 0"
+alias +con_chat_maximize "_backup_con_chatvars; con_chatpos -7; con_chat 100; con_notify 0; con_chattime 3600; cl_deathscoreboard 0; sbar_flagstatus_right 1; sbar_ballstatus_right 1; scr_centertime 0; r_track_sprites 0"
 alias -con_chat_maximize "_restore_con_chatvars"
 
 // tab completion

Modified: branches/nexuiz-2.0/data/qcsrc/client/sbar.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/client/sbar.qc	2009-05-24 09:03:35 UTC (rev 6759)
+++ branches/nexuiz-2.0/data/qcsrc/client/sbar.qc	2009-05-24 09:07:22 UTC (rev 6760)
@@ -362,8 +362,8 @@
 		"+lms/lives +lms/rank ",
 		"+kh/caps +kh/pushes +kh/destroyed ",
 		"?+race/laps ?+race/time ?+race/fastest ",
-		"+as/objectives ",
-		"-lms,race/score");
+		"+as/objectives +nexball/faults +nexball/goals",
+		"-lms,race,nexball/score");
 }
 
 void Cmd_Sbar_SetFields(float argc)
@@ -2202,7 +2202,7 @@
 #define NBPB_BALPH 1                //alpha
 #define NBPB_BFLAG DRAWFLAG_NORMAL
 #define NBPB_IALPH 0.4
-#define NBPB_IFLAG DRAWFLAG_ADDITIVE
+#define NBPB_IFLAG DRAWFLAG_NORMAL
 #define NBPB_IRGB '0.7 0.1 0'
 
 void CSQC_nb_hud(void)
@@ -2213,17 +2213,17 @@
 	stat_items = getstati(STAT_ITEMS);
 	nb_pb_starttime = getstatf(STAT_NB_METERSTART);
 	
-	if(cvar("sbar_flagstatus_right"))
-		pos_x = vid_conwidth - 10 - sbar_x - 64;
+	if(cvar("sbar_ballstatus_right"))
+		pos_x = vid_conwidth - 66 - sbar_x - 64; // the 66 comes from trial and error, no idea about the 64 (see CTF)
 	else
 		pos_x = 10 - sbar_x;
 	
 	pos_z = 0;
 
 	if(sbar_hudselector == 1)
-		pos_y = (vid_conheight - sbar_y) - cvar("sbar_flagstatus_pos") - 64;
+		pos_y = (vid_conheight - sbar_y) - cvar("sbar_ballstatus_pos") - 64;
 	else
-		pos_y = -117;
+		pos_y = -124; // 17 more than flag icons
 
 	pos += sbar;
 	pos_y -= 1; //vertical margin to the picture

Modified: branches/nexuiz-2.0/data/qcsrc/common/mapinfo.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/common/mapinfo.qc	2009-05-24 09:03:35 UTC (rev 6759)
+++ branches/nexuiz-2.0/data/qcsrc/common/mapinfo.qc	2009-05-24 09:07:22 UTC (rev 6760)
@@ -399,7 +399,7 @@
 					MapInfo_Map_supportedGametypes |= MAPINFO_TYPE_ASSAULT;
 				else if(v == "onslaught_generator")
 					MapInfo_Map_supportedGametypes |= MAPINFO_TYPE_ONSLAUGHT;
-				else if(v == "ball_bluegoal")
+				else if(substring(v, 0, 8) == "nexball_" || substring(v, 0, 4) == "ball")
 					MapInfo_Map_supportedGametypes |= MAPINFO_TYPE_NEXBALL;
 				else if(v == "info_player_team1")
 					++spawnpoints;

Modified: branches/nexuiz-2.0/data/qcsrc/server/g_triggers.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/g_triggers.qc	2009-05-24 09:03:35 UTC (rev 6759)
+++ branches/nexuiz-2.0/data/qcsrc/server/g_triggers.qc	2009-05-24 09:07:22 UTC (rev 6760)
@@ -1101,8 +1101,8 @@
 	if (other.classname != "plasma_prim")
 	if (other.classname != "plasma_chain")
 	if (other.classname != "droppedweapon")
-	if (other.classname != "ball_basketball")
-	if (other.classname != "ball_football")
+	if (other.classname != "nexball_basketball")
+	if (other.classname != "nexball_football")
 		return;
 
 	if (other.deadflag && other.iscreature)
@@ -1152,8 +1152,8 @@
 	if (other.classname != "plasma_prim")
 	if (other.classname != "plasma_chain")
 	if (other.classname != "droppedweapon")
-	if (other.classname != "ball_basketball")
-	if (other.classname != "ball_football")
+	if (other.classname != "nexball_basketball")
+	if (other.classname != "nexball_football")
 		return;
 
 	if (other.deadflag && other.iscreature)
@@ -1191,8 +1191,8 @@
 	if (other.classname != "plasma_prim")
 	if (other.classname != "plasma_chain")
 	if (other.classname != "droppedweapon")
-	if (other.classname != "ball_basketball")
-	if (other.classname != "ball_football")
+	if (other.classname != "nexball_basketball")
+	if (other.classname != "nexball_football")
 		return;
 
 	if (other.deadflag && other.iscreature)

Modified: branches/nexuiz-2.0/data/qcsrc/server/miscfunctions.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/miscfunctions.qc	2009-05-24 09:03:35 UTC (rev 6759)
+++ branches/nexuiz-2.0/data/qcsrc/server/miscfunctions.qc	2009-05-24 09:07:22 UTC (rev 6760)
@@ -886,6 +886,8 @@
 					t = (e.spawnflags & WEPSPAWNFLAG_NORMAL);
 				else if(g_race)
 					t = (i == WEP_LASER);
+				else if(g_nexball)
+					t = 0; //GL is set a few lines later
 				else
 					t = (i == WEP_LASER || i == WEP_SHOTGUN);
 				if(g_grappling_hook) // if possible, redirect off-hand hook to on-hand hook

Modified: branches/nexuiz-2.0/data/qcsrc/server/nexball.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/nexball.qc	2009-05-24 09:03:35 UTC (rev 6759)
+++ branches/nexuiz-2.0/data/qcsrc/server/nexball.qc	2009-05-24 09:07:22 UTC (rev 6760)
@@ -5,7 +5,12 @@
 #define BALL_ATTACHORG '3 0 16'
 #define BALL_FOOT   1
 #define BALL_BASKET 2
+//spawnflags
 #define GOAL_TOUCHPLAYER 1
+//goal types
+#define GOAL_FAULT -1
+#define GOAL_OUT -2
+
 #define CVTOV(s) s = cvar( #s )
 
 float g_nexball_football_boost_forward;
@@ -21,6 +26,7 @@
 
 .float teamtime;
 
+void nb_delayedinit();
 void nb_init() // Called early (worldspawn stage)
 {
 	CVTOV(g_nexball_meter_period); //sent with the client init entity
@@ -34,6 +40,8 @@
 	CVTOV(g_nexball_football_boost_up);        //200
 	CVTOV(g_nexball_delay_idle);               //10
 	CVTOV(g_nexball_football_physics);         //0
+
+	InitializeEntity(world, nb_delayedinit, INITPRIO_GAMETYPE);
 }
 
 void ResetBall();
@@ -138,9 +146,9 @@
 	if (gameover) return;
 	self.flags &~= FL_ONGROUND;
 	self.movetype = MOVETYPE_BOUNCE;
-	if (self.classname == "ball_basketball")
+	if (self.classname == "nexball_basketball")
 		self.touch = basketball_touch;
-	else if (self.classname == "ball_football")
+	else if (self.classname == "nexball_football")
 		self.touch = football_touch;
 	self.cnt = 0;
 	self.think = ResetBall;
@@ -235,7 +243,7 @@
 		if (self.team != other.team)
 			self.teamtime = time + g_nexball_basketball_delay_hold_forteam;
 
-		self.owner = self.pusher = other;
+		self.owner = self.pusher = other; //"owner" is set to the player carrying, "pusher" to the last player who touched it
 		self.team = other.team;
 		other.ballcarried = self;
 		other.effects = other.effects | g_nexball_basketball_effects_default;
@@ -260,115 +268,114 @@
 	}
 }
 
-void ReturnTouch (void)
+void GoalTouch (void)
 {
-	string othername;
-	entity tempother;
-	tempother = other;
+	entity ball;
+	float isclient, pscore;
+	string pname;
 
 	if (gameover) return;
-	if ((self.spawnflags & GOAL_TOUCHPLAYER) && tempother.ballcarried)
-		tempother = tempother.ballcarried; // Can't drop here yet because of EXACTTRIGGER
-	if (tempother.classname != "ball_basketball")
-	if (tempother.classname != "ball_football")
+	if ((self.spawnflags & GOAL_TOUCHPLAYER) && other.ballcarried)
+		ball = other.ballcarried;
+	else
+		ball = other;
+	if (ball.classname != "nexball_basketball")
+	if (ball.classname != "nexball_football")
 		return;
-	if (tempother.cnt)
+	if ((!ball.pusher && self.team != GOAL_OUT) || ball.cnt)
 		return;
 	EXACTTRIGGER_TOUCH;
-	other = tempother;
 
-	if (other.owner)
+
+	if((isclient = ball.pusher.flags & FL_CLIENT))
+		pname = ball.pusher.netname;
+	else
+		pname = "Someone (?)";
+
+	if        (ball.team == self.team) //owngoal (regular goals)
 	{
-		othername = other.owner.netname;
-		DropBall(other, other.owner.origin, '0 0 0');
+		LogNB("owngoal", ball.pusher);
+		bprint("Boo! ", pname, "^7 scored a goal against his own team!\n");
+		pscore = -1;
+	} else if (self.team == GOAL_FAULT) {
+		LogNB("fault", ball.pusher);
+		bprint(ColoredTeamName(ball.team), " loses a point due to ", pname, "^7's silliness.\n");
+		pscore = -1;
+	} else if (self.team == GOAL_OUT) {
+		LogNB("out", ball.pusher);
+		if ((self.spawnflags & GOAL_TOUCHPLAYER) && ball.owner)
+			bprint(pname, "^7 went out of bounds.\n");
+		else
+			bprint("The ball was returned.\n");
+		pscore = 0;
+	} else {                           //score
+		LogNB(strcat("goal:", ftos(self.team)), ball.pusher);
+		bprint("Goaaaaal! ", pname, "^7 scored a point for the ", ColoredTeamName(ball.team), ".\n");
+		pscore = 1;
 	}
-	else
-		othername = "The ball";
 
-	LogNB("out", other.pusher);
-	if (self.spawnflags & GOAL_TOUCHPLAYER)
-		bprint(othername, "^7 went out of bounds.\n");
-	else
-		bprint("The ball was returned.\n");
-	sound (other, CHAN_AUTO, self.noise, VOL_BASE, ATTN_NONE);
+	sound (ball, CHAN_AUTO, self.noise, VOL_BASE, ATTN_NONE);
 
-	other.cnt = 1;
-	other.think = ResetBall;
-	if (other.classname == "ball_basketball")
-		other.touch = football_touch;
-	other.nextthink = time + 1.5;
+	if(ball.team && pscore)
+		TeamScore_AddToTeam(ball.team, ST_NEXBALL_GOALS, pscore);
+	if (isclient && pscore > 0)
+		PlayerScore_Add(ball.pusher, SP_NEXBALL_GOALS, pscore);
+	else if (isclient && pscore < 0)
+		PlayerScore_Add(ball.pusher, SP_NEXBALL_FAULTS, pscore);
+
+	if (ball.owner) // Happens on spawnflag GOAL_TOUCHPLAYER
+		DropBall(ball, ball.owner.origin, ball.owner.velocity);
+	ball.cnt = 1;
+	ball.think = ResetBall;
+	if (ball.classname == "nexball_basketball")
+		ball.touch = football_touch; // better than SUB_Null: football control until the ball gets reset
+	ball.nextthink = time + cvar("g_nexball_delay_goal") * (self.team != GOAL_OUT);
 }
 
-void GoalTouch (void)
+//=======================//
+//       team ents       //
+//=======================//
+void spawnfunc_nexball_team (void)
 {
-	string othername;
-	entity tempother;
-	float isclient;
-	tempother = other; // EXACTTRIGGER uses "other"
+	if(!g_nexball) { remove(self); return; }
+	self.team = self.cnt + 1;
+}
 
-	if (gameover) return;
-	if ((self.spawnflags & GOAL_TOUCHPLAYER) && tempother.ballcarried)
-		tempother = tempother.ballcarried; // Can't drop here yet because of EXACTTRIGGER
-	if (tempother.classname != "ball_basketball")
-	if (tempother.classname != "ball_football")
-		return;
-	if (!tempother.pusher || tempother.cnt)
-		return;
-	EXACTTRIGGER_TOUCH;
-	other = tempother;
+void nb_spawnteam (string teamname, float teamcolor)
+{
+	dprint("^2spawned team ", teamname, "\n");
+	local entity e;
+	e = spawn();
+	e.classname = "nexball_team";
+	e.netname = teamname;
+	e.cnt = teamcolor;
+	e.team = e.cnt + 1;
+};
 
-	isclient = other.pusher.flags & FL_CLIENT;
-
-	if (isclient)
-		othername = other.pusher.netname;
-	else
-		othername = "Someone (?)";
-
-	if (self.classname == "ball_fault") { // FIXME?: this is ugly
-		     if (other.team == COLOR_TEAM1) self.team = COLOR_TEAM2;
-		else if (other.team == COLOR_TEAM2) self.team = COLOR_TEAM1;
-		else                                self.team = FALSE;
-
-		if (isclient)
-			PlayerScore_Add(other.pusher, SP_NEXBALL_OWNGOALS, 1);
-		if (self.team)
+void nb_spawnteams (void)
+{
+	float t_r, t_b, t_y, t_p;
+	entity e;
+	for(e = world; (e = find(e, classname, "nexball_goal")); )
+	{
+		switch(e.team)
 		{
-			bprint(ColoredTeamName(self.team), " gets awarded 1 point for ", othername, "^7's silliness.\n");
-			LogNB("fault-score", other.pusher);
+			case COLOR_TEAM1: if(!t_r) { nb_spawnteam ("Red", e.team-1)   ; t_r = 1; } break;
+			case COLOR_TEAM2: if(!t_b) { nb_spawnteam ("Blue", e.team-1)  ; t_b = 1; } break; 
+			case COLOR_TEAM3: if(!t_y) { nb_spawnteam ("Yellow", e.team-1); t_y = 1; } break;
+			case COLOR_TEAM4: if(!t_p) { nb_spawnteam ("Pink", e.team-1)  ; t_p = 1; } break;
 		}
-		else
-		{
-			bprint("The ball was reset.\n");
-			LogNB("fault-reset", other.pusher);
-		}
-	} else if (other.team == self.team) { // the goal's .team is set to the team it gives points to
-		if (isclient)
-			PlayerScore_Add(other.pusher, SP_NEXBALL_GOALS, 1);
-		bprint("Goaaaaal! ", othername, "^7 scored a point for the ", ColoredTeamName(self.team), ".\n");
-		LogNB("goal", other.pusher);
-	} else if (other.team) {
-		if (isclient)
-			PlayerScore_Add(other.pusher, SP_NEXBALL_OWNGOALS, 1);
-		bprint("Boo! ", othername, "^7 scored a point for the opposing ", ColoredTeamName(self.team), ".\n");
-		LogNB("owngoal", other.pusher);
-	} else {
-		bprint(othername, "^7 scored a point for the ", ColoredTeamName(self.team), ".\n"); //Should not happen
-		LogNB("goal-noteam", other.pusher);
 	}
-	sound (other, CHAN_AUTO, self.noise, VOL_BASE, ATTN_NONE);
+}
 
-	if (self.team)
-		TeamScore_AddToTeam(self.team, ST_NEXBALL_GOALS, 1);
-
-	if (other.owner) // Happens on spawnflag GOAL_TOUCHPLAYER
-		DropBall(other, other.owner.origin, other.owner.velocity);
-	other.cnt = 1;
-	other.think = ResetBall;
-	if (other.classname == "ball_basketball")
-		other.touch = football_touch; // better than SUB_Null: football control until the ball gets reset
-	other.nextthink = time + cvar("g_nexball_delay_goal");
+void nb_delayedinit (void)
+{
+	if (find(world, classname, "nexball_team") == world)
+		nb_spawnteams();
+	ScoreRules_nexball();
 }
 
+
 //=======================//
 //      spawnfuncs       //
 //=======================//
@@ -392,7 +399,7 @@
 
 	self.effects = self.effects | EF_LOWPRECISION;
 
-	if (cvar(strcat("g_nex", self.classname, "_trail")))
+	if (cvar(strcat("g_", self.classname, "_trail"))) //nexball_basketball :p
 	{
 		self.glow_color = cvar("g_nexball_trail_color");
 		self.glow_trail = TRUE;
@@ -420,8 +427,9 @@
 	self.nextthink = game_starttime + cvar("g_nexball_delay_start");
 }
 
-void spawnfunc_ball_basketball (void)
+void spawnfunc_nexball_basketball (void)
 {
+	self.classname = "nexball_basketball";
 	if(!balls & BALL_BASKET)
 	{
 		CVTOV(g_nexball_basketball_effects_default);
@@ -433,73 +441,79 @@
 	if (!self.effects)
 		self.effects = g_nexball_basketball_effects_default;
 	self.solid = SOLID_TRIGGER;
-
 	balls |= BALL_BASKET;
-
 	SpawnBall();
 }
 
-void spawnfunc_ball_football (void)
+void spawnfunc_nexball_football (void)
 {
+	self.classname = "nexball_football";
 	self.solid = SOLID_TRIGGER;
-
 	balls |= BALL_FOOT;
-
 	SpawnBall();
 }
 
-void spawnfunc_ball (void)
+void SpawnGoal (void)
 {
-	self.classname = "ball_football";
-	spawnfunc_ball_football();
-}
-
-// The "red goal" is defended by blue team. A ball in there counts as a point for red.
-void spawnfunc_ball_redgoal (void)
-{
 	if(!g_nexball) { remove(self); return; }
-	//COLOR_TEAM1 is red
 	EXACTTRIGGER_INIT;
-	self.team = COLOR_TEAM1;
+	self.classname = "nexball_goal";
 	if (!self.noise)
-		self.noise = "ctf/redcapture.wav";
+		self.noise = "ctf/respawn.wav";
 	precache_sound(self.noise);
 	self.touch = GoalTouch;
 }
 
-//Same comment.
-void spawnfunc_ball_bluegoal (void)
+void spawnfunc_nexball_redgoal (void)
 {
-	if(!g_nexball) { remove(self); return; }
-	EXACTTRIGGER_INIT;
+	self.team = COLOR_TEAM1;
+	SpawnGoal();
+}
+void spawnfunc_nexball_bluegoal (void)
+{
 	self.team = COLOR_TEAM2;
-	if (!self.noise)
-		self.noise = "ctf/bluecapture.wav";
-	precache_sound(self.noise);
-	self.touch = GoalTouch;
+	SpawnGoal();
 }
+void spawnfunc_nexball_yellowgoal (void)
+{
+	self.team = COLOR_TEAM3;
+	SpawnGoal();
+}
+void spawnfunc_nexball_pinkgoal (void)
+{
+	self.team = COLOR_TEAM4;
+	SpawnGoal();
+}
 
-void spawnfunc_ball_fault (void)
+void spawnfunc_nexball_fault (void)
 {
-	if(!g_nexball) { remove(self); return; }
-	EXACTTRIGGER_INIT;
+	self.team = GOAL_FAULT;
 	if (!self.noise)
 		self.noise = "misc/typehit.wav";
-	precache_sound(self.noise);
-	self.touch = GoalTouch;
+	SpawnGoal();
 }
 
-void spawnfunc_ball_bound (void)
+void spawnfunc_nexball_out (void)
 {
-	if(!g_nexball) { remove(self); return; }
-	EXACTTRIGGER_INIT;
+	self.team = GOAL_OUT;
 	if (!self.noise)
 		self.noise = "misc/typehit.wav";
-	precache_sound(self.noise);
-	self.touch = ReturnTouch;
+	SpawnGoal();
 }
 
+//
+//Spawnfuncs preserved for compatibility
+//
 
+void spawnfunc_ball            (void) { spawnfunc_nexball_football(); }
+void spawnfunc_ball_football   (void) { spawnfunc_nexball_football(); }
+void spawnfunc_ball_basketball (void) { spawnfunc_nexball_basketball(); }
+// The "red goal" is defended by blue team. A ball in there counts as a point for red.
+void spawnfunc_ball_redgoal    (void) { spawnfunc_nexball_bluegoal(); } // I blame Revenant
+void spawnfunc_ball_bluegoal   (void) { spawnfunc_nexball_redgoal(); }  // but he didn't mean to cause trouble :p
+void spawnfunc_ball_fault      (void) { spawnfunc_nexball_fault(); }
+void spawnfunc_ball_bound      (void) { spawnfunc_nexball_out(); }
+
 //=======================//
 //      Weapon code      //
 //=======================//
@@ -511,7 +525,7 @@
 
 	PROJECTILE_TOUCH;
 	if(attacker.team != other.team || g_nexball_basketball_teamsteal)
-	if((ball = other.ballcarried))
+	if((ball = other.ballcarried) && (attacker.classname == "player" || attacker.classname == "gib"))
 	{
 		other.velocity = other.velocity + normalize(self.velocity) * other.damageforcescale * cvar("g_balance_nexball_secondary_force");
 		other.flags &~= FL_ONGROUND;
@@ -544,6 +558,13 @@
 
 			LogNB("stole", attacker);
 			sound (other, CHAN_AUTO, ball.noise2, VOL_BASE, ATTN_NORM);
+
+			if(attacker.team == other.team && time > attacker.teamkill_complain)
+			{
+				attacker.teamkill_complain = time + 5;
+				attacker.teamkill_soundtime = time + 0.4;
+				attacker.teamkill_soundsource = other;
+			}
 		}
 	}
 	remove(self);

Modified: branches/nexuiz-2.0/data/qcsrc/server/scores_rules.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/scores_rules.qc	2009-05-24 09:03:35 UTC (rev 6759)
+++ branches/nexuiz-2.0/data/qcsrc/server/scores_rules.qc	2009-05-24 09:07:22 UTC (rev 6760)
@@ -176,12 +176,12 @@
 // Nexball stuff
 #define ST_NEXBALL_GOALS 1
 #define SP_NEXBALL_GOALS 4
-#define SP_NEXBALL_OWNGOALS 5
+#define SP_NEXBALL_FAULTS 5
 void ScoreRules_nexball()
 {
-	ScoreRules_basics(2, 0, 0, TRUE);
-	ScoreInfo_SetLabel_TeamScore  (   ST_NEXBALL_GOALS,    "goals", SFL_SORT_PRIO_PRIMARY);
-	ScoreInfo_SetLabel_PlayerScore(   SP_NEXBALL_GOALS,    "goals", SFL_SORT_PRIO_PRIMARY);
-	ScoreInfo_SetLabel_PlayerScore(SP_NEXBALL_OWNGOALS, "owngoals", SFL_SORT_PRIO_SECONDARY | SFL_LOWER_IS_BETTER);
+	ScoreRules_basics(((c4>=0) ? 4 : (c3>=0) ? 3 : 2), 0, 0, TRUE);
+	ScoreInfo_SetLabel_TeamScore(   ST_NEXBALL_GOALS,  "goals", SFL_SORT_PRIO_PRIMARY);
+	ScoreInfo_SetLabel_PlayerScore( SP_NEXBALL_GOALS,  "goals", SFL_SORT_PRIO_PRIMARY);
+	ScoreInfo_SetLabel_PlayerScore(SP_NEXBALL_FAULTS, "faults", SFL_SORT_PRIO_SECONDARY | SFL_LOWER_IS_BETTER);
 	ScoreRules_basics_end();
 }

Modified: branches/nexuiz-2.0/data/qcsrc/server/teamplay.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/teamplay.qc	2009-05-24 09:03:35 UTC (rev 6759)
+++ branches/nexuiz-2.0/data/qcsrc/server/teamplay.qc	2009-05-24 09:07:22 UTC (rev 6760)
@@ -330,9 +330,8 @@
 		game = GAME_NEXBALL;
 		gamemode_name = "Nexball";
 		fraglimit_override = cvar("g_nexball_goallimit");
+		ActivateTeamplay();
 		nb_init();
-		ActivateTeamplay();
-		ScoreRules_nexball();
 	}
 
 	if(teams_matter)
@@ -573,9 +572,11 @@
 		teament_name = "ctf_team";
 	else if(g_tdm)
 		teament_name = "tdm_team";
-	else if(g_assault || g_nexball)
+	else if(g_nexball)
+		teament_name = "nexball_team";
+	else if(g_assault)
 	{
-		c1 = c2 = 0; // Assault and nexball always have 2 teams
+		c1 = c2 = 0; // Assault always has 2 teams
 		return;
 	}
 	else

Modified: branches/nexuiz-2.0/data/scripts/entities.def
===================================================================
--- branches/nexuiz-2.0/data/scripts/entities.def	2009-05-24 09:03:35 UTC (rev 6759)
+++ branches/nexuiz-2.0/data/scripts/entities.def	2009-05-24 09:07:22 UTC (rev 6760)
@@ -1579,23 +1579,40 @@
 targetname: name that identifies this entity so it can be triggered
 */
 
-/*QUAKED ball_redgoal (1 0 0) ?
-"Red" goal. Defended by blue team, the red team tries to put the ball in there.
+/*QUAKED nexball_redgoal (1 0 0) ?
+Red goal. Defended by the red team.
 -------- KEYS --------
 noise: sound played when a point is scored
 -------- SPAWNFLAGS --------
 GOAL_TOUCHPLAYER: The trigger also affects ball-carrying players (the ball is then auto-dropped)
 */
 
-/*QUAKED ball_bluegoal (0 0 1) ?
-"Blue" goal. Defended by red team, the blue team tries to put the ball in there.
+/*QUAKED nexball_bluegoal (0 0 1) ?
+Blue goal. Defended by the blue team.
 -------- KEYS --------
 noise: sound played when a point is scored
 -------- SPAWNFLAGS --------
 GOAL_TOUCHPLAYER: The trigger also affects ball-carrying players (the ball is then auto-dropped)
 */
 
-/*QUAKED ball_fault (0.6 0.1 0) ?
+/*QUAKED nexball_yellowgoal (1 1 0) ?
+Yellow goal. Defended by the yellow team. Needs both red and blue goals on the map to work.
+-------- KEYS --------
+noise: sound played when a point is scored
+-------- SPAWNFLAGS --------
+GOAL_TOUCHPLAYER: The trigger also affects ball-carrying players (the ball is then auto-dropped)
+*/
+
+/*QUAKED nexball_bluegoal (1 0 1) ?
+Pink goal. Defended by the pink team. Needs red, blue and pink goals on the map to work.
+-------- KEYS --------
+noise: sound played when a point is scored
+-------- SPAWNFLAGS --------
+GOAL_TOUCHPLAYER: The trigger also affects ball-carrying players (the ball is then auto-dropped)
+*/
+
+
+/*QUAKED nexball_fault (0.6 0.1 0) ?
 This acts as a goal that always gives points to the opposing team.
 -------- KEYS --------
 noise: sound played when a point is scored
@@ -1603,7 +1620,7 @@
 GOAL_TOUCHPLAYER: The trigger also affects ball-carrying players (the ball is then auto-dropped)
 */
 
-/*QUAKED ball_bound (0.1 0.6 0) ?
+/*QUAKED nexball_out (0.1 0.6 0) ?
 When the ball touches this, it is returned.
 -------- KEYS --------
 noise: sound played when a point is scored
@@ -1611,7 +1628,7 @@
 GOAL_TOUCHPLAYER: The trigger also affects ball-carrying players (the ball is then auto-dropped)
 */
 
-/*QUAKED ball_football (.9 .9 .9) (-16 -16 -16) (16 16 16)
+/*QUAKED nexball_football (.9 .9 .9) (-16 -16 -16) (16 16 16)
 The soccer type Nexball.
 -------- KEYS --------
 model: set this if you want to use your own model
@@ -1620,7 +1637,7 @@
 noise1: played when the ball is dropped on the map
 */
 
-/*QUAKED ball_basketball (.5 .2 0) (-16 -16 -16) (16 16 16)
+/*QUAKED nexball_basketball (.5 .2 0) (-16 -16 -16) (16 16 16)
 The basket ball type Nexball.
 -------- KEYS --------
 model: set this if you want to use your own model

Modified: branches/nexuiz-2.0/misc/netradiant-NexuizPack/nexuiz.game/data/entities.def
===================================================================
--- branches/nexuiz-2.0/misc/netradiant-NexuizPack/nexuiz.game/data/entities.def	2009-05-24 09:03:35 UTC (rev 6759)
+++ branches/nexuiz-2.0/misc/netradiant-NexuizPack/nexuiz.game/data/entities.def	2009-05-24 09:07:22 UTC (rev 6760)
@@ -1579,23 +1579,40 @@
 targetname: name that identifies this entity so it can be triggered
 */
 
-/*QUAKED ball_redgoal (1 0 0) ?
-"Red" goal. Defended by blue team, the red team tries to put the ball in there.
+/*QUAKED nexball_redgoal (1 0 0) ?
+Red goal. Defended by the red team.
 -------- KEYS --------
 noise: sound played when a point is scored
 -------- SPAWNFLAGS --------
 GOAL_TOUCHPLAYER: The trigger also affects ball-carrying players (the ball is then auto-dropped)
 */
 
-/*QUAKED ball_bluegoal (0 0 1) ?
-"Blue" goal. Defended by red team, the blue team tries to put the ball in there.
+/*QUAKED nexball_bluegoal (0 0 1) ?
+Blue goal. Defended by the blue team.
 -------- KEYS --------
 noise: sound played when a point is scored
 -------- SPAWNFLAGS --------
 GOAL_TOUCHPLAYER: The trigger also affects ball-carrying players (the ball is then auto-dropped)
 */
 
-/*QUAKED ball_fault (0.6 0.1 0) ?
+/*QUAKED nexball_yellowgoal (1 1 0) ?
+Yellow goal. Defended by the yellow team. Needs both red and blue goals on the map to work.
+-------- KEYS --------
+noise: sound played when a point is scored
+-------- SPAWNFLAGS --------
+GOAL_TOUCHPLAYER: The trigger also affects ball-carrying players (the ball is then auto-dropped)
+*/
+
+/*QUAKED nexball_bluegoal (1 0 1) ?
+Pink goal. Defended by the pink team. Needs red, blue and pink goals on the map to work.
+-------- KEYS --------
+noise: sound played when a point is scored
+-------- SPAWNFLAGS --------
+GOAL_TOUCHPLAYER: The trigger also affects ball-carrying players (the ball is then auto-dropped)
+*/
+
+
+/*QUAKED nexball_fault (0.6 0.1 0) ?
 This acts as a goal that always gives points to the opposing team.
 -------- KEYS --------
 noise: sound played when a point is scored
@@ -1603,7 +1620,7 @@
 GOAL_TOUCHPLAYER: The trigger also affects ball-carrying players (the ball is then auto-dropped)
 */
 
-/*QUAKED ball_bound (0.1 0.6 0) ?
+/*QUAKED nexball_out (0.1 0.6 0) ?
 When the ball touches this, it is returned.
 -------- KEYS --------
 noise: sound played when a point is scored
@@ -1611,7 +1628,7 @@
 GOAL_TOUCHPLAYER: The trigger also affects ball-carrying players (the ball is then auto-dropped)
 */
 
-/*QUAKED ball_football (.9 .9 .9) (-16 -16 -16) (16 16 16)
+/*QUAKED nexball_football (.9 .9 .9) (-16 -16 -16) (16 16 16)
 The soccer type Nexball.
 -------- KEYS --------
 model: set this if you want to use your own model
@@ -1620,7 +1637,7 @@
 noise1: played when the ball is dropped on the map
 */
 
-/*QUAKED ball_basketball (.5 .2 0) (-16 -16 -16) (16 16 16)
+/*QUAKED nexball_basketball (.5 .2 0) (-16 -16 -16) (16 16 16)
 The basket ball type Nexball.
 -------- KEYS --------
 model: set this if you want to use your own model



More information about the nexuiz-commits mailing list