1 float autocvar_g_nexball_safepass_turnrate;
2 float autocvar_g_nexball_safepass_maxdist;
3 float autocvar_g_nexball_safepass_holdtime;
4 float autocvar_g_nexball_viewmodel_scale;
5 vector autocvar_g_nexball_viewmodel_offset;
7 void basketball_touch();
11 #define NBM_FOOTBALL 2
12 #define NBM_BASKETBALL 4
15 float OtherTeam(float t) //works only if there are two teams on the map!
18 e = find(world, classname, "nexball_team");
20 e = find(e, classname, "nexball_team");
25 void LogNB(string mode, entity actor)
28 if(!autocvar_sv_eventlog)
30 s = strcat(":nexball:", mode);
32 s = strcat(s, ":", ftos(actor.playerid));
36 void ball_restart(void)
39 DropBall(self, self.owner.origin, '0 0 0');
43 void nexball_setstatus(void)
46 self.items &~= IT_KEY1;
49 if(self.ballcarried.teamtime && (self.ballcarried.teamtime < time))
51 bprint("The ", ColoredTeamName(self.team), " held the ball for too long.\n");
53 self = self.ballcarried;
54 DropBall(self, self.owner.origin, '0 0 0');
59 self.items |= IT_KEY1;
63 void relocate_nexball(void)
65 tracebox(self.origin, BALL_MINS, BALL_MAXS, self.origin, TRUE, self);
70 if(!move_out_of_solid(self))
71 objerror("could not get out of solid at all!");
72 print("^1NOTE: this map needs FIXING. ", self.classname, " at ", vtos(o - '0 0 1'));
73 print(" needs to be moved out of solid, e.g. by '", ftos(self.origin_x - o_x));
74 print(" ", ftos(self.origin_y - o_y));
75 print(" ", ftos(self.origin_z - o_z), "'\n");
84 DropBall(self, ownr.origin, ownr.velocity);
85 makevectors(ownr.v_angle_y * '0 1 0');
86 ownr.velocity += ('0 0 0.75' - v_forward) * 1000;
87 ownr.flags &~= FL_ONGROUND;
90 void GiveBall(entity plyr, entity ball)
94 if((ownr = ball.owner))
96 ownr.effects &~= autocvar_g_nexball_basketball_effects_default;
97 ownr.ballcarried = world;
101 ownr.weaponentity.state = WS_READY;
103 WaypointSprite_Kill(ownr.waypointsprite_attachedforcarrier);
107 WaypointSprite_Kill(ball.waypointsprite_attachedforcarrier);
110 //setattachment(ball, plyr, "");
111 setorigin(ball, plyr.origin + plyr.view_ofs);
113 if(ball.team != plyr.team)
114 ball.teamtime = time + autocvar_g_nexball_basketball_delay_hold_forteam;
116 ball.owner = ball.pusher = plyr; //"owner" is set to the player carrying, "pusher" to the last player who touched it
117 ball.team = plyr.team;
118 plyr.ballcarried = ball;
119 ball.dropperid = plyr.playerid;
121 plyr.effects |= autocvar_g_nexball_basketball_effects_default;
122 ball.effects &~= autocvar_g_nexball_basketball_effects_default;
124 ball.velocity = '0 0 0';
125 ball.movetype = MOVETYPE_NONE;
126 ball.touch = SUB_Null;
127 ball.effects |= EF_NOSHADOW;
128 ball.scale = 1; // scale down.
130 WaypointSprite_AttachCarrier("nb-ball", plyr, RADARICON_FLAGCARRIER, BALL_SPRITECOLOR);
131 WaypointSprite_UpdateRule(plyr.waypointsprite_attachedforcarrier, 0, SPRITERULE_DEFAULT);
133 if(autocvar_g_nexball_basketball_delay_hold)
135 ball.think = DropOwner;
136 ball.nextthink = time + autocvar_g_nexball_basketball_delay_hold;
141 self.weaponentity.weapons = self.weapons;
142 self.weaponentity.switchweapon = self.weapon;
143 self.weapons = W_WeaponBit(WEP_PORTO);
144 weapon_action(WEP_PORTO, WR_RESETPLAYER);
145 self.switchweapon = WEP_PORTO;
146 W_SwitchWeapon(WEP_PORTO);
150 void DropBall(entity ball, vector org, vector vel)
152 ball.effects |= autocvar_g_nexball_basketball_effects_default;
153 ball.effects &~= EF_NOSHADOW;
154 ball.owner.effects &~= autocvar_g_nexball_basketball_effects_default;
156 setattachment(ball, world, "");
157 setorigin(ball, org);
158 ball.movetype = MOVETYPE_BOUNCE;
159 ball.flags &~= FL_ONGROUND;
160 ball.scale = ball_scale;
162 ball.ctf_droptime = time;
163 ball.touch = basketball_touch;
164 ball.think = ResetBall;
165 ball.nextthink = min(time + autocvar_g_nexball_delay_idle, ball.teamtime);
167 if(ball.owner.metertime)
169 ball.owner.metertime = 0;
170 ball.owner.weaponentity.state = WS_READY;
173 WaypointSprite_Kill(ball.owner.waypointsprite_attachedforcarrier);
174 WaypointSprite_Spawn("nb-ball", 0, 0, ball, '0 0 64', world, ball.team, ball, waypointsprite_attachedforcarrier, FALSE, RADARICON_FLAGCARRIER, BALL_SPRITECOLOR); // no health bar please
175 WaypointSprite_UpdateRule(ball.waypointsprite_attachedforcarrier, 0, SPRITERULE_DEFAULT);
177 ball.owner.ballcarried = world;
184 self.flags &~= FL_ONGROUND;
185 self.movetype = MOVETYPE_BOUNCE;
186 if(self.classname == "nexball_basketball")
187 self.touch = basketball_touch;
188 else if(self.classname == "nexball_football")
189 self.touch = football_touch;
191 self.think = ResetBall;
192 self.nextthink = time + autocvar_g_nexball_delay_idle + 3;
196 sound(self, CH_TRIGGER, self.noise1, VOL_BASE, ATTN_NORM);
197 WaypointSprite_Ping(self.waypointsprite_attachedforcarrier);
198 LogNB("init", world);
203 if(self.cnt < 2) // step 1
205 if(time == self.teamtime)
206 bprint("The ", ColoredTeamName(self.team), " held the ball for too long.\n");
207 self.touch = SUB_Null;
208 self.movetype = MOVETYPE_NOCLIP;
209 self.velocity = '0 0 0'; // just in case?
211 LogNB("resetidle", world);
213 self.nextthink = time;
215 else if(self.cnt < 4) // step 2 and 3
217 // dprint("Step ", ftos(self.cnt), ": Calculated velocity: ", vtos(self.spawnorigin - self.origin), ", time: ", ftos(time), "\n");
218 self.velocity = (self.spawnorigin - self.origin) * (self.cnt - 1); // 1 or 0.5 second movement
219 self.nextthink = time + 0.5;
224 // dprint("Step 4: time: ", ftos(time), "\n");
225 if(vlen(self.origin - self.spawnorigin) > 10) // should not happen anymore
226 dprint("The ball moved too far away from its spawn origin.\nOffset: ",
227 vtos(self.origin - self.spawnorigin), " Velocity: ", vtos(self.velocity), "\n");
228 self.velocity = '0 0 0';
229 setorigin(self, self.spawnorigin); // make sure it's positioned correctly anyway
230 self.movetype = MOVETYPE_NONE;
231 self.think = InitBall;
232 self.nextthink = max(time, game_starttime) + autocvar_g_nexball_delay_start;
236 void football_touch(void)
238 if(other.solid == SOLID_BSP)
240 if(time > self.lastground + 0.1)
242 sound(self, CH_TRIGGER, self.noise, VOL_BASE, ATTN_NORM);
243 self.lastground = time;
245 if(vlen(self.velocity) && !self.cnt)
246 self.nextthink = time + autocvar_g_nexball_delay_idle;
249 if(other.classname != "player")
254 self.nextthink = time + autocvar_g_nexball_delay_idle;
257 self.team = other.team;
259 if(autocvar_g_nexball_football_physics == -1) // MrBougo try 1, before decompiling Rev's original
261 if(vlen(other.velocity))
262 self.velocity = other.velocity * 1.5 + '0 0 1' * autocvar_g_nexball_football_boost_up;
264 else if(autocvar_g_nexball_football_physics == 1) // MrBougo's modded Rev style: partially independant of the height of the aiming point
266 makevectors(other.v_angle);
267 self.velocity = other.velocity + v_forward * autocvar_g_nexball_football_boost_forward + '0 0 1' * autocvar_g_nexball_football_boost_up;
269 else if(autocvar_g_nexball_football_physics == 2) // 2nd mod try: totally independant. Really playable!
271 makevectors(other.v_angle_y * '0 1 0');
272 self.velocity = other.velocity + v_forward * autocvar_g_nexball_football_boost_forward + v_up * autocvar_g_nexball_football_boost_up;
274 else // Revenant's original style (from the original mod's disassembly, acknowledged by Revenant)
276 makevectors(other.v_angle);
277 self.velocity = other.velocity + v_forward * autocvar_g_nexball_football_boost_forward + v_up * autocvar_g_nexball_football_boost_up;
279 self.avelocity = -250 * v_forward; // maybe there is a way to make it look better?
282 void basketball_touch(void)
284 if(other.ballcarried)
289 if(!self.cnt && other.classname == "player" && (other.playerid != self.dropperid || time > self.ctf_droptime + autocvar_g_nexball_delay_collect))
291 if(other.health <= 0)
293 LogNB("caught", other);
294 GiveBall(other, self);
296 else if(other.solid == SOLID_BSP)
298 sound(self, CH_TRIGGER, self.noise, VOL_BASE, ATTN_NORM);
299 if(vlen(self.velocity) && !self.cnt)
300 self.nextthink = min(time + autocvar_g_nexball_delay_idle, self.teamtime);
307 float isclient, pscore, otherteam;
311 if((self.spawnflags & GOAL_TOUCHPLAYER) && other.ballcarried)
312 ball = other.ballcarried;
315 if(ball.classname != "nexball_basketball")
316 if(ball.classname != "nexball_football")
318 if((!ball.pusher && self.team != GOAL_OUT) || ball.cnt)
324 otherteam = OtherTeam(ball.team);
326 if((isclient = ball.pusher.flags & FL_CLIENT))
327 pname = ball.pusher.netname;
329 pname = "Someone (?)";
331 if(ball.team == self.team) //owngoal (regular goals)
333 LogNB("owngoal", ball.pusher);
334 bprint("Boo! ", pname, "^7 scored a goal against their own team!\n");
337 else if(self.team == GOAL_FAULT)
339 LogNB("fault", ball.pusher);
341 bprint(ColoredTeamName(otherteam), " gets a point due to ", pname, "^7's silliness.\n");
343 bprint(ColoredTeamName(ball.team), " loses a point due to ", pname, "^7's silliness.\n");
346 else if(self.team == GOAL_OUT)
348 LogNB("out", ball.pusher);
349 if((self.spawnflags & GOAL_TOUCHPLAYER) && ball.owner)
350 bprint(pname, "^7 went out of bounds.\n");
352 bprint("The ball was returned.\n");
357 LogNB(strcat("goal:", ftos(self.team)), ball.pusher);
358 bprint("Goaaaaal! ", pname, "^7 scored a point for the ", ColoredTeamName(ball.team), ".\n");
362 sound(ball, CH_TRIGGER, self.noise, VOL_BASE, ATTN_NONE);
364 if(ball.team && pscore)
366 if(nb_teams == 2 && pscore < 0)
367 TeamScore_AddToTeam(otherteam, ST_NEXBALL_GOALS, -pscore);
369 TeamScore_AddToTeam(ball.team, ST_NEXBALL_GOALS, pscore);
374 PlayerScore_Add(ball.pusher, SP_NEXBALL_GOALS, pscore);
376 PlayerScore_Add(ball.pusher, SP_NEXBALL_FAULTS, -pscore);
379 if(ball.owner) // Happens on spawnflag GOAL_TOUCHPLAYER
380 DropBall(ball, ball.owner.origin, ball.owner.velocity);
382 WaypointSprite_Ping(ball.waypointsprite_attachedforcarrier);
385 ball.think = ResetBall;
386 if(ball.classname == "nexball_basketball")
387 ball.touch = football_touch; // better than SUB_Null: football control until the ball gets reset
388 ball.nextthink = time + autocvar_g_nexball_delay_goal * (self.team != GOAL_OUT);
391 //=======================//
393 //=======================//
394 void spawnfunc_nexball_team(void)
401 self.team = self.cnt + 1;
404 void nb_spawnteam(string teamname, float teamcolor)
406 dprint("^2spawned team ", teamname, "\n");
409 e.classname = "nexball_team";
410 e.netname = teamname;
416 void nb_spawnteams(void)
418 float t_r, t_b, t_y, t_p;
420 for(e = world; (e = find(e, classname, "nexball_goal"));)
427 nb_spawnteam("Red", e.team-1) ;
434 nb_spawnteam("Blue", e.team-1) ;
441 nb_spawnteam("Yellow", e.team-1);
448 nb_spawnteam("Pink", e.team-1) ;
456 void nb_delayedinit(void)
458 if(find(world, classname, "nexball_team") == world)
460 ScoreRules_nexball(nb_teams);
464 //=======================//
466 //=======================//
476 // balls += 4; // using the remaining bits to count balls will leave more than the max edict count, so it's fine
480 self.model = "models/nexball/ball.md3";
484 precache_model(self.model);
485 setmodel(self, self.model);
486 setsize(self, BALL_MINS, BALL_MAXS);
487 ball_scale = self.scale;
490 self.spawnorigin = self.origin;
492 self.effects = self.effects | EF_LOWPRECISION;
494 if(cvar(strcat("g_", self.classname, "_trail"))) //nexball_basketball :p
496 self.glow_color = autocvar_g_nexball_trail_color;
497 self.glow_trail = TRUE;
500 self.movetype = MOVETYPE_FLY;
502 if(!autocvar_g_nexball_sound_bounce)
505 self.noise = "sound/nexball/bounce.wav";
506 //bounce sound placeholder (FIXME)
508 self.noise1 = "sound/nexball/drop.wav";
509 //ball drop sound placeholder (FIXME)
511 self.noise2 = "sound/nexball/steal.wav";
512 //stealing sound placeholder (FIXME)
513 if(self.noise) precache_sound(self.noise);
514 precache_sound(self.noise1);
515 precache_sound(self.noise2);
517 WaypointSprite_AttachCarrier("nb-ball", self, RADARICON_FLAGCARRIER, BALL_SPRITECOLOR); // the ball's team is not set yet, no rule update needed
519 self.reset = ball_restart;
520 self.think = InitBall;
521 self.nextthink = game_starttime + autocvar_g_nexball_delay_start;
524 void spawnfunc_nexball_basketball(void)
526 nexball_mode |= NBM_BASKETBALL;
527 self.classname = "nexball_basketball";
528 if not(balls & BALL_BASKET)
531 CVTOV(g_nexball_basketball_effects_default);
532 CVTOV(g_nexball_basketball_delay_hold);
533 CVTOV(g_nexball_basketball_delay_hold_forteam);
534 CVTOV(g_nexball_basketball_teamsteal);
536 autocvar_g_nexball_basketball_effects_default = autocvar_g_nexball_basketball_effects_default & BALL_EFFECTMASK;
539 self.effects = autocvar_g_nexball_basketball_effects_default;
540 self.solid = SOLID_TRIGGER;
541 balls |= BALL_BASKET;
542 self.bouncefactor = autocvar_g_nexball_basketball_bouncefactor;
543 self.bouncestop = autocvar_g_nexball_basketball_bouncestop;
547 void spawnfunc_nexball_football(void)
549 nexball_mode |= NBM_FOOTBALL;
550 self.classname = "nexball_football";
551 self.solid = SOLID_TRIGGER;
553 self.bouncefactor = autocvar_g_nexball_football_bouncefactor;
554 self.bouncestop = autocvar_g_nexball_football_bouncestop;
566 self.classname = "nexball_goal";
568 self.noise = "ctf/respawn.wav";
569 precache_sound(self.noise);
570 self.touch = GoalTouch;
573 void spawnfunc_nexball_redgoal(void)
575 self.team = COLOR_TEAM1;
578 void spawnfunc_nexball_bluegoal(void)
580 self.team = COLOR_TEAM2;
583 void spawnfunc_nexball_yellowgoal(void)
585 self.team = COLOR_TEAM3;
588 void spawnfunc_nexball_pinkgoal(void)
590 self.team = COLOR_TEAM4;
594 void spawnfunc_nexball_fault(void)
596 self.team = GOAL_FAULT;
598 self.noise = "misc/typehit.wav";
602 void spawnfunc_nexball_out(void)
604 self.team = GOAL_OUT;
606 self.noise = "misc/typehit.wav";
611 //Spawnfuncs preserved for compatibility
614 void spawnfunc_ball(void)
616 spawnfunc_nexball_football();
618 void spawnfunc_ball_football(void)
620 spawnfunc_nexball_football();
622 void spawnfunc_ball_basketball(void)
624 spawnfunc_nexball_basketball();
626 // The "red goal" is defended by blue team. A ball in there counts as a point for red.
627 void spawnfunc_ball_redgoal(void)
629 spawnfunc_nexball_bluegoal(); // I blame Revenant
631 void spawnfunc_ball_bluegoal(void)
633 spawnfunc_nexball_redgoal(); // but he didn't mean to cause trouble :p
635 void spawnfunc_ball_fault(void)
637 spawnfunc_nexball_fault();
639 void spawnfunc_ball_bound(void)
641 spawnfunc_nexball_out();
644 //=======================//
646 //=======================//
649 void W_Nexball_Think()
651 dprint("W_Nexball_Think\n");
652 //vector new_dir = steerlib_arrive(self.enemy.origin, 2500);
653 vector new_dir = steerlib_pull(self.enemy.origin);
654 vector old_dir = normalize(self.velocity);
655 float _speed = vlen(self.velocity);
657 vector new_vel = (old_dir + (new_dir * autocvar_g_nexball_safepass_turnrate)) * _speed;
658 self.velocity = new_vel;
660 self.nextthink = time;
663 void W_Nexball_Touch(void)
665 entity ball, attacker;
666 attacker = self.owner;
667 //self.think = SUB_Null;
668 //self.enemy = world;
671 if(attacker.team != other.team || autocvar_g_nexball_basketball_teamsteal)
672 if((ball = other.ballcarried) && (attacker.classname == "player"))
674 other.velocity = other.velocity + normalize(self.velocity) * other.damageforcescale * autocvar_g_balance_nexball_secondary_force;
675 other.flags &~= FL_ONGROUND;
676 if(!attacker.ballcarried)
678 LogNB("stole", attacker);
679 sound(other, CH_TRIGGER, ball.noise2, VOL_BASE, ATTN_NORM);
681 if(attacker.team == other.team && time > attacker.teamkill_complain)
683 attacker.teamkill_complain = time + 5;
684 attacker.teamkill_soundtime = time + 0.4;
685 attacker.teamkill_soundsource = other;
688 GiveBall(attacker, other.ballcarried);
694 void W_Nexball_Attack(float t)
698 if(!(ball = self.ballcarried))
701 W_SetupShot(self, FALSE, 4, "nexball/shoot1.wav", CH_WEAPON_A, 0);
702 tracebox(w_shotorg, BALL_MINS, BALL_MAXS, w_shotorg, MOVE_WORLDONLY, world);
706 self.metertime = 0; // Shot failed, hide the power meter
710 //Calculate multiplier
715 mi = autocvar_g_nexball_basketball_meter_minpower;
716 ma = max(mi, autocvar_g_nexball_basketball_meter_maxpower); // avoid confusion
717 //One triangle wave period with 1 as max
718 mul = 2 * mod(t, g_nexball_meter_period) / g_nexball_meter_period;
721 mul = mi + (ma - mi) * mul; // range from the minimal power to the maximal power
724 DropBall(ball, w_shotorg, W_CalculateProjectileVelocity(self.velocity, w_shotdir * autocvar_g_balance_nexball_primary_speed * mul, FALSE));
727 //TODO: use the speed_up cvar too ??
730 void W_Nexball_Attack2(void)
734 ball.think = W_Nexball_Think;
735 ball.nextthink = time;
736 DropBall(ball, w_shotorg, trigger_push_calculatevelocity(ball.origin, ball.enemy, 32));
741 if(!(balls & BALL_BASKET))
743 W_SetupShot(self, FALSE, 2, "nexball/shoot2.wav", CH_WEAPON_A, 0);
744 // pointparticles(particleeffectnum("grenadelauncher_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
747 missile.owner = self;
748 missile.classname = "ballstealer";
750 missile.movetype = MOVETYPE_FLY;
751 PROJECTILE_MAKETRIGGER(missile);
753 setmodel(missile, "models/elaser.mdl"); // precision set below
754 setsize(missile, '0 0 0', '0 0 0');
755 setorigin(missile, w_shotorg);
757 W_SetupProjectileVelocity(missile, autocvar_g_balance_nexball_secondary_speed, 0);
758 missile.angles = vectoangles(missile.velocity);
759 missile.touch = W_Nexball_Touch;
760 missile.think = SUB_Remove;
761 missile.nextthink = time + autocvar_g_balance_nexball_secondary_lifetime; //FIXME: use a distance instead?
763 missile.effects = EF_BRIGHTFIELD | EF_LOWPRECISION;
764 missile.flags = FL_PROJECTILE;
767 var const float() nullfunc;
768 float ball_customize()
772 self.effects &~= EF_FLAME;
774 self.customizeentityforclient = nullfunc;
778 if(other == self.owner)
780 self.scale = autocvar_g_nexball_viewmodel_scale;
782 self.effects |= EF_FLAME;
784 self.effects &~= EF_FLAME;
788 self.effects &~= EF_FLAME;
795 float w_nexball_weapon(float req)
800 if(weapon_prepareattack(0, autocvar_g_balance_nexball_primary_refire))
801 if(autocvar_g_nexball_basketball_meter)
803 if(self.ballcarried && !self.metertime)
804 self.metertime = time;
806 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
810 W_Nexball_Attack(-1);
811 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
813 if(self.BUTTON_ATCK2)
814 if(weapon_prepareattack(1, autocvar_g_balance_nexball_secondary_refire))
817 weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_nexball_secondary_animtime, w_ready);
820 if(!self.BUTTON_ATCK && self.metertime && self.ballcarried)
822 W_Nexball_Attack(time - self.metertime);
823 // DropBall or stealing will set metertime back to 0
824 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
827 else if(req == WR_PRECACHE)
829 precache_model("models/weapons/g_porto.md3");
830 precache_model("models/weapons/v_porto.md3");
831 precache_model("models/weapons/h_porto.iqm");
832 precache_model("models/elaser.mdl");
833 precache_sound("nexball/shoot1.wav");
834 precache_sound("nexball/shoot2.wav");
835 precache_sound("misc/typehit.wav");
837 else if(req == WR_SETUP)
838 weapon_setup(WEP_PORTO);
839 else if(req == WR_SUICIDEMESSAGE)
841 w_deathtypestring = "is a weirdo";
843 else if(req == WR_KILLMESSAGE)
845 w_deathtypestring = "got killed by #'s black magic";
847 // No need to check WR_CHECKAMMO* or WR_AIM, it should always return TRUE
851 MUTATOR_HOOKFUNCTION(nexball_BallDrop)
853 if(self.ballcarried && g_nexball)
854 DropBall(self.ballcarried, self.origin, self.velocity);
859 MUTATOR_HOOKFUNCTION(nexball_BuildMutatorsString)
861 ret_string = strcat(ret_string, ":NB");
865 MUTATOR_HOOKFUNCTION(nexball_BuildMutatorsPrettyString)
867 ret_string = strcat(ret_string, ", NexBall");
871 MUTATOR_HOOKFUNCTION(nexball_PlayerPreThink)
873 makevectors(self.v_angle);
874 if(nexball_mode & NBM_BASKETBALL)
879 self.ballcarried.velocity = self.velocity;
880 self.ballcarried.customizeentityforclient = ball_customize;
882 setorigin(self.ballcarried, self.origin + self.view_ofs +
883 v_forward * autocvar_g_nexball_viewmodel_offset_x +
884 v_right * autocvar_g_nexball_viewmodel_offset_y +
885 v_up * autocvar_g_nexball_viewmodel_offset_z);
888 if(autocvar_g_nexball_safepass_maxdist)
890 if(self.ballcarried.wait < time && self.ballcarried.enemy)
892 //centerprint(self, sprintf("Lost lock on %s", self.ballcarried.enemy.netname));
893 self.ballcarried.enemy = world;
897 //tracebox(self.origin + self.view_ofs, '-2 -2 -2', '2 2 2', self.origin + self.view_ofs + v_forward * autocvar_g_nexball_safepass_maxdist);
898 crosshair_trace(self);
900 trace_ent.flags & FL_CLIENT &&
901 trace_ent.deadflag == DEAD_NO &&
902 trace_ent.team == self.team &&
903 vlen(trace_ent.origin - self.origin) <= autocvar_g_nexball_safepass_maxdist )
906 //if(self.ballcarried.enemy != trace_ent)
907 // centerprint(self, sprintf("Locked to %s", trace_ent.netname));
908 self.ballcarried.enemy = trace_ent;
909 self.ballcarried.wait = time + autocvar_g_nexball_safepass_holdtime;
917 if(self.weaponentity.weapons)
919 self.weapons = self.weaponentity.weapons;
920 weapon_action(WEP_PORTO, WR_RESETPLAYER);
921 self.switchweapon = self.weaponentity.switchweapon;
922 W_SwitchWeapon(self.switchweapon);
924 self.weaponentity.weapons = 0;
933 MUTATOR_HOOKFUNCTION(nexball_PlayerSpawn)
935 self.weaponentity.weapons = 0;
937 if(nexball_mode & NBM_BASKETBALL)
940 if(autocvar_g_weapon_stay)
947 MUTATOR_DEFINITION(gamemode_nexball)
949 MUTATOR_HOOK(PlayerDies, nexball_BallDrop, CBC_ORDER_ANY);
950 MUTATOR_HOOK(MakePlayerObserver, nexball_BallDrop, CBC_ORDER_ANY);
951 MUTATOR_HOOK(ClientDisconnect, nexball_BallDrop, CBC_ORDER_ANY);
952 MUTATOR_HOOK(BuildMutatorsPrettyString, nexball_BuildMutatorsPrettyString, CBC_ORDER_ANY);
953 MUTATOR_HOOK(BuildMutatorsString, nexball_BuildMutatorsString, CBC_ORDER_ANY);
954 MUTATOR_HOOK(PlayerSpawn, nexball_PlayerSpawn, CBC_ORDER_ANY);
955 MUTATOR_HOOK(PlayerPreThink, nexball_PlayerPreThink, CBC_ORDER_ANY);
960 g_nexball_meter_period = autocvar_g_nexball_meter_period;
961 if(g_nexball_meter_period <= 0)
962 g_nexball_meter_period = 2; // avoid division by zero etc. due to silly users
963 g_nexball_meter_period = rint(g_nexball_meter_period * 32) / 32; //Round to 1/32ths to send as a byte multiplied by 32
964 addstat(STAT_NB_METERSTART, AS_FLOAT, metertime);
968 CVTOV(g_nexball_football_boost_forward); //100
969 CVTOV(g_nexball_football_boost_up); //200
970 CVTOV(g_nexball_delay_idle); //10
971 CVTOV(g_nexball_football_physics); //0
973 radar_showennemies = autocvar_g_nexball_radar_showallplayers;
975 InitializeEntity(world, nb_delayedinit, INITPRIO_GAMETYPE);