Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
sv_nexball.qc File Reference
Include dependency graph for sv_nexball.qc:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool ball_customize (entity this, entity client)
void ball_restart (entity this)
void basketball_touch (entity this, entity toucher)
void DropBall (entity ball, vector org, vector vel)
void DropOwner (entity this)
void football_touch (entity this, entity toucher)
void GiveBall (entity plyr, entity ball)
void GoalTouch (entity this, entity toucher)
void InitBall (entity this)
void LogNB (string mode, entity actor)
 MUTATOR_HOOKFUNCTION (nb, ClientDisconnect)
 MUTATOR_HOOKFUNCTION (nb, DropSpecialItems)
 MUTATOR_HOOKFUNCTION (nb, FilterItem)
 MUTATOR_HOOKFUNCTION (nb, ForbidDropCurrentWeapon)
 MUTATOR_HOOKFUNCTION (nb, ForbidThrowCurrentWeapon)
 MUTATOR_HOOKFUNCTION (nb, ItemTouch)
 MUTATOR_HOOKFUNCTION (nb, MakePlayerObserver)
 MUTATOR_HOOKFUNCTION (nb, PlayerDies)
 MUTATOR_HOOKFUNCTION (nb, PlayerPhysics_UpdateStats)
 MUTATOR_HOOKFUNCTION (nb, PlayerPreThink)
 MUTATOR_HOOKFUNCTION (nb, PlayerSpawn)
 MUTATOR_HOOKFUNCTION (nb, SendWaypoint)
 MUTATOR_HOOKFUNCTION (nb, SpectateCopy)
 MUTATOR_HOOKFUNCTION (nb, TeamBalance_CheckAllowedTeams)
 MUTATOR_HOOKFUNCTION (nb, WantWeapon)
void nb_delayedinit (entity this)
void nb_DropBall (entity player)
bool nb_Goal_Customize (entity this, entity client)
void nb_Initialize ()
void nb_ScoreRules (int teams)
void nb_spawnteam (string teamname, float teamcolor)
void nb_spawnteams ()
void nexball_setstatus (entity this)
float OtherTeam (float t)
void relocate_nexball (entity this)
void ResetBall (entity this)
void SpawnBall (entity this)
 spawnfunc (ball)
 spawnfunc (ball_basketball)
 spawnfunc (ball_bluegoal)
 spawnfunc (ball_bound)
 spawnfunc (ball_fault)
 spawnfunc (ball_football)
 spawnfunc (ball_redgoal)
 spawnfunc (nexball_basketball)
 spawnfunc (nexball_bluegoal)
 spawnfunc (nexball_fault)
 spawnfunc (nexball_football)
 spawnfunc (nexball_out)
 spawnfunc (nexball_pinkgoal)
 spawnfunc (nexball_redgoal)
 spawnfunc (nexball_team)
 spawnfunc (nexball_yellowgoal)
void SpawnGoal (entity this)

Variables

float autocvar_g_balance_nexball_primary_animtime
float autocvar_g_balance_nexball_primary_refire
float autocvar_g_balance_nexball_primary_speed
float autocvar_g_balance_nexball_secondary_animtime
float autocvar_g_balance_nexball_secondary_force
float autocvar_g_balance_nexball_secondary_lifetime
float autocvar_g_balance_nexball_secondary_refire
float autocvar_g_balance_nexball_secondary_speed
float autocvar_g_nexball_basketball_bouncefactor
float autocvar_g_nexball_basketball_bouncestop
float autocvar_g_nexball_basketball_carrier_highspeed
bool autocvar_g_nexball_basketball_jumppad = true
bool autocvar_g_nexball_basketball_meter
float autocvar_g_nexball_basketball_meter_maxpower
float autocvar_g_nexball_basketball_meter_minpower
float autocvar_g_nexball_delay_collect
float autocvar_g_nexball_delay_goal
float autocvar_g_nexball_delay_start
float autocvar_g_nexball_football_bouncefactor
float autocvar_g_nexball_football_bouncestop
bool autocvar_g_nexball_football_jumppad = true
int autocvar_g_nexball_goalleadlimit
float autocvar_g_nexball_goallimit
bool autocvar_g_nexball_playerclip_collisions = true
bool autocvar_g_nexball_radar_showallplayers
float autocvar_g_nexball_safepass_holdtime
float autocvar_g_nexball_safepass_maxdist
float autocvar_g_nexball_safepass_turnrate
bool autocvar_g_nexball_sound_bounce
float autocvar_g_nexball_tackling
int autocvar_g_nexball_trail_color
vector autocvar_g_nexball_viewmodel_offset
float autocvar_g_nexball_viewmodel_scale
entity ballcarried
const int NBM_BASKETBALL = 4
const int NBM_FOOTBALL = 2
const int NBM_NONE = 0
float nexball_mode
const int ST_NEXBALL_GOALS = 1

Function Documentation

◆ ball_customize()

bool ball_customize ( entity this,
entity client )

Definition at line 714 of file sv_nexball.qc.

715{
716 if(!this.owner)
717 {
718 this.effects &= ~EF_FLAME;
719 this.scale = 1;
720 setcefc(this, func_null);
721 return true;
722 }
723
724 if(client == this.owner)
725 {
727 if(this.enemy)
728 this.effects |= EF_FLAME;
729 else
730 this.effects &= ~EF_FLAME;
731 }
732 else
733 {
734 this.effects &= ~EF_FLAME;
735 this.scale = 1;
736 }
737
738 return true;
739}
entity owner
Definition main.qh:87
float effects
const float EF_FLAME
var void func_null()
float scale
Definition projectile.qc:14
#define setcefc(e, f)
entity enemy
Definition sv_ctf.qh:153
float autocvar_g_nexball_viewmodel_scale
Definition sv_nexball.qc:37

References autocvar_g_nexball_viewmodel_scale, EF_FLAME, effects, enemy, entity(), func_null(), owner, scale, and setcefc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ ball_restart()

void ball_restart ( entity this)

Definition at line 87 of file sv_nexball.qc.

88{
89 if(this.owner)
90 DropBall(this, this.owner.origin, '0 0 0');
91 ResetBall(this);
92}
void DropBall(entity ball, vector org, vector vel)
void ResetBall(entity this)

References DropBall(), entity(), owner, and ResetBall().

Referenced by SpawnBall().

◆ basketball_touch()

void basketball_touch ( entity this,
entity toucher )

Definition at line 335 of file sv_nexball.qc.

336{
337 if(toucher.ballcarried)
338 {
339 football_touch(this, toucher);
340 return;
341 }
342 // TODO: mutator hook to prevent picking up objectives
344 {
345 if(GetResource(toucher, RES_HEALTH) < 1)
346 return;
347 LogNB("caught", toucher);
348 GiveBall(toucher, this);
349 }
350 else if(toucher.solid == SOLID_BSP)
351 {
353 if(this.velocity && !this.cnt)
355 }
356}
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
float lifetime
Definition powerups.qc:23
float cnt
Definition powerups.qc:24
#define IS_DEAD(s)
Definition player.qh:244
#define IS_PLAYER(s)
Definition player.qh:242
vector velocity
float time
float nextthink
const float SOLID_BSP
float min(float f,...)
entity entity toucher
Definition self.qh:72
const int CH_TRIGGER
Definition sound.qh:12
const float VOL_BASE
Definition sound.qh:36
#define _sound(e, c, s, v, a)
Definition sound.qh:43
const float ATTEN_NORM
Definition sound.qh:30
string noise
Definition subs.qh:83
void LogNB(string mode, entity actor)
Definition sv_nexball.qc:76
float autocvar_g_nexball_delay_collect
Definition sv_nexball.qc:23
void football_touch(entity this, entity toucher)
void GiveBall(entity plyr, entity ball)
float autocvar_g_nexball_delay_idle
Definition sv_nexball.qh:40
entity nb_dropper
Definition sv_nexball.qh:51
float nb_droptime
Definition sv_nexball.qh:52

References _sound, ATTEN_NORM, autocvar_g_nexball_delay_collect, autocvar_g_nexball_delay_idle, CH_TRIGGER, cnt, entity(), football_touch(), GetResource(), GiveBall(), IS_DEAD, IS_PLAYER, lifetime, LogNB(), min(), nb_dropper, nb_droptime, nextthink, noise, SOLID_BSP, time, toucher, velocity, and VOL_BASE.

Referenced by DropBall(), and InitBall().

◆ DropBall()

void DropBall ( entity ball,
vector org,
vector vel )

Definition at line 200 of file sv_nexball.qc.

201{
203 ball.effects &= ~EF_NOSHADOW;
205
206 setattachment(ball, NULL, "");
207 setorigin(ball, org);
209 UNSET_ONGROUND(ball);
210 ball.scale = ball_scale;
211 ball.velocity = vel;
212 ball.nb_droptime = time;
214 setthink(ball, ResetBall);
215 ball.nextthink = min(time + autocvar_g_nexball_delay_idle, ball.lifetime);
216
217 if(STAT(NB_METERSTART, ball.owner))
218 {
219 STAT(NB_METERSTART, ball.owner) = 0;
220 .entity weaponentity = ball.weaponentity_fld;
221 ball.owner.(weaponentity).state = WS_READY;
222 }
223
224 WaypointSprite_Kill(ball.owner.waypointsprite_attachedforcarrier);
225 WaypointSprite_Spawn(WP_NbBall, 0, 0, ball, '0 0 64', NULL, ball.team, ball, waypointsprite_attachedforcarrier, false, RADARICON_FLAGCARRIER); // no health bar please
226 WaypointSprite_UpdateRule(ball.waypointsprite_attachedforcarrier, 0, SPRITERULE_DEFAULT);
227
228 entity e = ball.owner; ball.owner = NULL;
229 e.ballcarried = NULL;
230 GameRules_scoring_vip(e, false);
231}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
const float EF_NOSHADOW
int state
#define STAT(...)
Definition stats.qh:82
void set_movetype(entity this, int mt)
Definition movetypes.qc:4
#define UNSET_ONGROUND(s)
Definition movetypes.qh:18
const int MOVETYPE_BOUNCE
Definition movetypes.qh:139
#define NULL
Definition post.qh:14
#define setthink(e, f)
vector org
Definition self.qh:92
#define settouch(e, f)
Definition self.qh:73
void basketball_touch(entity this, entity toucher)
float ball_scale
Definition sv_nexball.qh:48
float autocvar_g_nexball_basketball_effects_default
Definition sv_nexball.qh:43
#define GameRules_scoring_vip(player, value)
Definition sv_rules.qh:78
void WaypointSprite_Kill(entity wp)
entity WaypointSprite_Spawn(entity spr, float _lifetime, float maxdistance, entity ref, vector ofs, entity showto, float t, entity own,.entity ownfield, float hideable, entity icon)
void WaypointSprite_UpdateRule(entity e, float t, float r)
const int SPRITERULE_DEFAULT
entity waypointsprite_attachedforcarrier
const int WS_READY
idle frame
Definition weapon.qh:38

References autocvar_g_nexball_basketball_effects_default, autocvar_g_nexball_delay_idle, ball_scale, basketball_touch(), EF_NOSHADOW, entity(), GameRules_scoring_vip, min(), MOVETYPE_BOUNCE, NULL, org, ResetBall(), set_movetype(), setthink, settouch, SPRITERULE_DEFAULT, STAT, state, time, UNSET_ONGROUND, vector, waypointsprite_attachedforcarrier, WaypointSprite_Kill(), WaypointSprite_Spawn(), WaypointSprite_UpdateRule(), and WS_READY.

Referenced by ball_restart(), DropOwner(), GoalTouch(), MUTATOR_HOOKFUNCTION(), nb_DropBall(), nexball_setstatus(), W_Nexball_Attack(), and W_Nexball_Attack2().

◆ DropOwner()

void DropOwner ( entity this)

Definition at line 130 of file sv_nexball.qc.

131{
132 entity ownr = this.owner;
133 DropBall(this, ownr.origin, ownr.velocity);
134 makevectors(ownr.v_angle.y * '0 1 0');
135 ownr.velocity += ('0 0 0.75' - v_forward) * 1000;
136 UNSET_ONGROUND(ownr);
137}
vector v_forward
#define makevectors
Definition post.qh:21

References DropBall(), entity(), makevectors, owner, UNSET_ONGROUND, and v_forward.

Referenced by GiveBall().

◆ football_touch()

void football_touch ( entity this,
entity toucher )

Definition at line 289 of file sv_nexball.qc.

290{
291 if(toucher.solid == SOLID_BSP)
292 {
293 if(time > this.lastground + 0.1)
294 {
296 this.lastground = time;
297 }
298 if(this.velocity && !this.cnt)
300 return;
301 }
303 return;
304 if(GetResource(toucher, RES_HEALTH) < 1)
305 return;
306 if(!this.cnt)
308
309 this.pusher = toucher;
310 this.team = toucher.team;
311
312 if(autocvar_g_nexball_football_physics == -1) // MrBougo try 1, before decompiling Rev's original
313 {
314 if(toucher.velocity)
315 this.velocity = toucher.velocity * 1.5 + '0 0 1' * autocvar_g_nexball_football_boost_up;
316 }
317 else if(autocvar_g_nexball_football_physics == 1) // MrBougo's modded Rev style: partially independant of the height of the aiming point
318 {
319 makevectors(toucher.v_angle);
321 }
322 else if(autocvar_g_nexball_football_physics == 2) // 2nd mod try: totally independant. Really playable!
323 {
324 makevectors(toucher.v_angle.y * '0 1 0');
326 }
327 else // Revenant's original style (from the original mod's disassembly, acknowledged by Revenant)
328 {
329 makevectors(toucher.v_angle);
331 }
332 this.avelocity = -250 * v_forward; // maybe there is a way to make it look better?
333}
int team
Definition main.qh:188
float lastground
Definition player.qh:64
vector v_up
vector avelocity
entity pusher
Definition laser.qc:57
float autocvar_g_nexball_football_physics
Definition sv_nexball.qh:39
float autocvar_g_nexball_football_boost_forward
Definition sv_nexball.qh:37
float autocvar_g_nexball_football_boost_up
Definition sv_nexball.qh:38
#define IS_VEHICLE(v)
Definition utils.qh:24

References _sound, ATTEN_NORM, autocvar_g_nexball_delay_idle, autocvar_g_nexball_football_boost_forward, autocvar_g_nexball_football_boost_up, autocvar_g_nexball_football_physics, avelocity, CH_TRIGGER, cnt, entity(), GetResource(), IS_PLAYER, IS_VEHICLE, lastground, makevectors, nextthink, noise, pusher, SOLID_BSP, team, time, toucher, v_forward, v_up, velocity, and VOL_BASE.

Referenced by basketball_touch(), GoalTouch(), and InitBall().

◆ GiveBall()

void GiveBall ( entity plyr,
entity ball )

Definition at line 139 of file sv_nexball.qc.

140{
141 .entity weaponentity = weaponentities[0]; // TODO: find ballstealer
142 entity ownr = ball.owner;
143 if(ownr)
144 {
146 ownr.ballcarried = NULL;
147 GameRules_scoring_vip(ownr, false);
148 if(STAT(NB_METERSTART, ownr))
149 {
150 STAT(NB_METERSTART, ownr) = 0;
151 ownr.(weaponentity).state = WS_READY;
152 }
153 WaypointSprite_Kill(ownr.waypointsprite_attachedforcarrier);
154 }
155 else
156 {
157 WaypointSprite_Kill(ball.waypointsprite_attachedforcarrier);
158 }
159
160 //setattachment(ball, plyr, "");
161 setorigin(ball, plyr.origin + plyr.view_ofs);
162
163 if(ball.team != plyr.team)
165
166 ball.owner = ball.pusher = plyr; //"owner" is set to the player carrying, "pusher" to the last player who touched it
167 ball.weaponentity_fld = weaponentity;
168 ball.team = plyr.team;
169 plyr.ballcarried = ball;
170 GameRules_scoring_vip(plyr, true);
171 ball.nb_dropper = plyr;
172
175
176 ball.velocity = '0 0 0';
178 settouch(ball, func_null);
179 ball.effects |= EF_NOSHADOW;
180 ball.scale = 1; // scale down.
181
182 WaypointSprite_AttachCarrier(WP_NbBall, plyr, RADARICON_FLAGCARRIER);
183 WaypointSprite_UpdateRule(plyr.waypointsprite_attachedforcarrier, 0, SPRITERULE_DEFAULT);
184
186 {
187 setthink(ball, DropOwner);
189 }
190
191 STAT(WEAPONS, plyr.(weaponentity)) = STAT(WEAPONS, plyr);
192 plyr.m_switchweapon = plyr.(weaponentity).m_weapon;
193 STAT(WEAPONS, plyr) = WEPSET(NEXBALL);
194 Weapon w = WEP_NEXBALL;
195 w.wr_resetplayer(w, plyr);
196 plyr.(weaponentity).m_switchweapon = WEP_NEXBALL;
197 W_SwitchWeapon(plyr, WEP_NEXBALL, weaponentity);
198}
fields which are explicitly/manually set are marked with "M", fields set automatically are marked wit...
Definition weapon.qh:42
virtual void wr_resetplayer()
(SERVER) clears fields that the weapon may use
Definition weapon.qh:130
const int MOVETYPE_NONE
Definition movetypes.qh:129
bool W_SwitchWeapon(entity this, Weapon w,.entity weaponentity)
Definition selection.qc:265
void DropOwner(entity this)
float autocvar_g_nexball_basketball_delay_hold_forteam
Definition sv_nexball.qh:42
float autocvar_g_nexball_basketball_delay_hold
Definition sv_nexball.qh:41
entity WaypointSprite_AttachCarrier(entity spr, entity carrier, entity icon)
#define WEPSET(id)
Definition all.qh:47
entity weaponentities[MAX_WEAPONSLOTS]
Definition weapon.qh:17
Weapon m_weapon
Definition wepent.qh:26
Weapon m_switchweapon
Definition wepent.qh:25

References autocvar_g_nexball_basketball_delay_hold, autocvar_g_nexball_basketball_delay_hold_forteam, autocvar_g_nexball_basketball_effects_default, DropOwner(), EF_NOSHADOW, entity(), func_null(), GameRules_scoring_vip, m_switchweapon, m_weapon, MOVETYPE_NONE, NULL, set_movetype(), setthink, settouch, SPRITERULE_DEFAULT, STAT, state, time, W_SwitchWeapon(), WaypointSprite_AttachCarrier(), WaypointSprite_Kill(), WaypointSprite_UpdateRule(), weaponentities, WEPSET, Weapon::wr_resetplayer(), and WS_READY.

Referenced by basketball_touch(), and W_Nexball_Touch().

◆ GoalTouch()

void GoalTouch ( entity this,
entity toucher )

Definition at line 358 of file sv_nexball.qc.

359{
360 entity ball;
361 float isclient, pscore, otherteam;
362 string pname;
363
364 if(game_stopped) return;
365 if((this.spawnflags & GOAL_TOUCHPLAYER) && toucher.ballcarried)
366 ball = toucher.ballcarried;
367 else
368 ball = toucher;
369 if(ball.classname != "nexball_basketball")
370 if(ball.classname != "nexball_football")
371 return;
372 if((!ball.pusher && this.team != GOAL_OUT) || ball.cnt)
373 return;
375
376
377 if(NumTeams(nb_teams) == 2)
378 otherteam = OtherTeam(ball.team);
379 else
380 otherteam = 0;
381
382 if((isclient = IS_CLIENT(ball.pusher)))
383 pname = ball.pusher.netname;
384 else
385 pname = "Someone (?)";
386
387 if(ball.team == this.team) //owngoal (regular goals)
388 {
389 LogNB("owngoal", ball.pusher);
390 bprint("Boo! ", pname, "^7 scored a goal against their own team!\n");
391 pscore = -1;
392 }
393 else if(this.team == GOAL_FAULT)
394 {
395 LogNB("fault", ball.pusher);
396 if(NumTeams(nb_teams) == 2)
397 bprint(Team_ColoredFullName(otherteam), " gets a point due to ", pname, "^7's silliness.\n");
398 else
399 bprint(Team_ColoredFullName(ball.team), " loses a point due to ", pname, "^7's silliness.\n");
400 pscore = -1;
401 }
402 else if(this.team == GOAL_OUT)
403 {
404 LogNB("out", ball.pusher);
405 if((this.spawnflags & GOAL_TOUCHPLAYER) && ball.owner)
406 bprint(pname, "^7 went out of bounds.\n");
407 else
408 bprint("The ball was returned.\n");
409 pscore = 0;
410 }
411 else //score
412 {
413 LogNB(strcat("goal:", ftos(this.team)), ball.pusher);
414 bprint("Goaaaaal! ", pname, "^7 scored a point for the ", Team_ColoredFullName(ball.team), ".\n");
415 pscore = 1;
416 }
417
419
420 if(ball.team && pscore)
421 {
422 if(NumTeams(nb_teams) == 2 && pscore < 0)
423 TeamScore_AddToTeam(otherteam, ST_NEXBALL_GOALS, -pscore);
424 else
425 TeamScore_AddToTeam(ball.team, ST_NEXBALL_GOALS, pscore);
426 }
427 if(isclient)
428 {
429 if(pscore > 0)
430 GameRules_scoring_add(ball.pusher, NEXBALL_GOALS, pscore);
431 else if(pscore < 0)
432 GameRules_scoring_add(ball.pusher, NEXBALL_FAULTS, -pscore);
433 }
434
435 if(ball.owner) // Happens on spawnflag GOAL_TOUCHPLAYER
436 DropBall(ball, ball.owner.origin, ball.owner.velocity);
437
438 WaypointSprite_Ping(ball.waypointsprite_attachedforcarrier);
439
440 ball.cnt = 1;
441 setthink(ball, ResetBall);
442 if(ball.classname == "nexball_basketball")
443 settouch(ball, football_touch); // better than func_null: football control until the ball gets reset
444 ball.nextthink = time + autocvar_g_nexball_delay_goal * (this.team != GOAL_OUT);
445}
int spawnflags
Definition ammo.qh:15
#define IS_CLIENT(s)
Definition player.qh:241
float game_stopped
Definition stats.qh:81
#define EXACTTRIGGER_TOUCH(e, t)
Definition common.qh:115
void bprint(string text,...)
string ftos(float f)
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
float TeamScore_AddToTeam(int t, float scorefield, float score)
Adds a score to the given team.
Definition scores.qc:108
int NumTeams(int teams)
const float ATTEN_NONE
Definition sound.qh:27
float OtherTeam(float t)
Definition sv_nexball.qc:58
float autocvar_g_nexball_delay_goal
Definition sv_nexball.qc:24
const int ST_NEXBALL_GOALS
Definition sv_nexball.qc:66
float nb_teams
Definition sv_nexball.qh:49
const float GOAL_OUT
Definition sv_nexball.qh:34
const float GOAL_FAULT
Definition sv_nexball.qh:33
const float GOAL_TOUCHPLAYER
Definition sv_nexball.qh:31
#define GameRules_scoring_add(client, fld, value)
Definition sv_rules.qh:85
#define Team_ColoredFullName(teamid)
Definition teams.qh:232
void WaypointSprite_Ping(entity e)

References _sound, ATTEN_NONE, autocvar_g_nexball_delay_goal, bprint(), CH_TRIGGER, DropBall(), entity(), EXACTTRIGGER_TOUCH, football_touch(), ftos(), game_stopped, GameRules_scoring_add, GOAL_FAULT, GOAL_OUT, GOAL_TOUCHPLAYER, IS_CLIENT, LogNB(), nb_teams, noise, NumTeams(), OtherTeam(), ResetBall(), setthink, settouch, spawnflags, ST_NEXBALL_GOALS, strcat(), team, Team_ColoredFullName, TeamScore_AddToTeam(), time, toucher, VOL_BASE, and WaypointSprite_Ping().

Referenced by SpawnGoal().

◆ InitBall()

void InitBall ( entity this)

Definition at line 233 of file sv_nexball.qc.

234{
235 if(game_stopped) return;
236 UNSET_ONGROUND(this);
238 if(this.classname == "nexball_basketball")
240 else if(this.classname == "nexball_football")
242 this.cnt = 0;
243 setthink(this, ResetBall);
245 this.lifetime = 0;
246 this.pusher = NULL;
247 this.team = false;
250 LogNB("init", NULL);
251}
string classname
string noise1
Definition subs.qh:83

References _sound, ATTEN_NORM, autocvar_g_nexball_delay_idle, basketball_touch(), CH_TRIGGER, classname, cnt, entity(), football_touch(), game_stopped, lifetime, LogNB(), MOVETYPE_BOUNCE, nextthink, noise1, NULL, pusher, ResetBall(), set_movetype(), setthink, settouch, team, time, UNSET_ONGROUND, VOL_BASE, waypointsprite_attachedforcarrier, and WaypointSprite_Ping().

Referenced by ResetBall(), and SpawnBall().

◆ LogNB()

void LogNB ( string mode,
entity actor )

Definition at line 76 of file sv_nexball.qc.

77{
78 string s;
80 return;
81 s = strcat(":nexball:", mode);
82 if(actor != NULL)
83 s = strcat(s, ":", ftos(actor.playerid));
84 GameLogEcho(s);
85}
void GameLogEcho(string s)
Definition gamelog.qc:15
bool autocvar_sv_eventlog
Definition gamelog.qh:3

References autocvar_sv_eventlog, entity(), ftos(), GameLogEcho(), NULL, and strcat().

Referenced by basketball_touch(), GoalTouch(), InitBall(), ResetBall(), and W_Nexball_Touch().

◆ MUTATOR_HOOKFUNCTION() [1/15]

MUTATOR_HOOKFUNCTION ( nb ,
ClientDisconnect  )

Definition at line 747 of file sv_nexball.qc.

748{
749 entity player = M_ARGV(0, entity);
750
751 nb_DropBall(player);
752}
#define M_ARGV(x, type)
Definition events.qh:17
void nb_DropBall(entity player)

References ClientDisconnect, entity(), M_ARGV, and nb_DropBall().

◆ MUTATOR_HOOKFUNCTION() [2/15]

MUTATOR_HOOKFUNCTION ( nb ,
DropSpecialItems  )

Definition at line 926 of file sv_nexball.qc.

927{
929
930 if(frag_target.ballcarried)
931 DropBall(frag_target.ballcarried, frag_target.origin, frag_target.velocity);
932
933 return false;
934}
entity frag_target
Definition sv_ctf.qc:2314

References DropBall(), entity(), frag_target, and M_ARGV.

◆ MUTATOR_HOOKFUNCTION() [3/15]

MUTATOR_HOOKFUNCTION ( nb ,
FilterItem  )

Definition at line 892 of file sv_nexball.qc.

893{
894 entity item = M_ARGV(0, entity);
895
896 if(ITEM_IS_LOOT(item))
897 if(item.weapon == WEP_NEXBALL.m_id)
898 return true;
899
900 return false;
901}
#define ITEM_IS_LOOT(item)
Returns whether the item is loot.
Definition spawning.qh:39

References entity(), ITEM_IS_LOOT, and M_ARGV.

◆ MUTATOR_HOOKFUNCTION() [4/15]

MUTATOR_HOOKFUNCTION ( nb ,
ForbidDropCurrentWeapon  )

Definition at line 884 of file sv_nexball.qc.

885{
886 //entity player = M_ARGV(0, entity);
887 int wep = M_ARGV(1, int);
888
889 return wep == WEP_MORTAR.m_id; // TODO: what is this for?
890}

References M_ARGV.

◆ MUTATOR_HOOKFUNCTION() [5/15]

MUTATOR_HOOKFUNCTION ( nb ,
ForbidThrowCurrentWeapon  )

Definition at line 876 of file sv_nexball.qc.

877{
878 //entity player = M_ARGV(0, entity);
879 entity wepent = M_ARGV(1, entity);
880
881 return wepent.m_weapon == WEP_NEXBALL;
882}

References entity(), and M_ARGV.

◆ MUTATOR_HOOKFUNCTION() [6/15]

MUTATOR_HOOKFUNCTION ( nb ,
ItemTouch  )

Definition at line 903 of file sv_nexball.qc.

904{
905 entity item = M_ARGV(0, entity);
907
908 if(item.weapon && toucher.ballcarried)
909 return MUT_ITEMTOUCH_RETURN; // no new weapons for you, mister!
910
912}
@ MUT_ITEMTOUCH_RETURN
Definition events.qh:735
@ MUT_ITEMTOUCH_CONTINUE
Definition events.qh:734

References entity(), M_ARGV, MUT_ITEMTOUCH_CONTINUE, MUT_ITEMTOUCH_RETURN, and toucher.

◆ MUTATOR_HOOKFUNCTION() [7/15]

MUTATOR_HOOKFUNCTION ( nb ,
MakePlayerObserver  )

Definition at line 761 of file sv_nexball.qc.

762{
763 entity player = M_ARGV(0, entity);
764
765 nb_DropBall(player);
766 return false;
767}

References entity(), M_ARGV, and nb_DropBall().

◆ MUTATOR_HOOKFUNCTION() [8/15]

MUTATOR_HOOKFUNCTION ( nb ,
PlayerDies  )

Definition at line 754 of file sv_nexball.qc.

755{
757
759}

References entity(), frag_target, M_ARGV, and nb_DropBall().

◆ MUTATOR_HOOKFUNCTION() [9/15]

MUTATOR_HOOKFUNCTION ( nb ,
PlayerPhysics_UpdateStats  )

Definition at line 867 of file sv_nexball.qc.

868{
869 entity player = M_ARGV(0, entity);
870 // these automatically reset, no need to worry
871
872 if(player.ballcarried)
873 STAT(MOVEVARS_HIGHSPEED, player) *= autocvar_g_nexball_basketball_carrier_highspeed;
874}
float autocvar_g_nexball_basketball_carrier_highspeed
Definition sv_nexball.qc:19

References autocvar_g_nexball_basketball_carrier_highspeed, entity(), M_ARGV, and STAT.

◆ MUTATOR_HOOKFUNCTION() [10/15]

MUTATOR_HOOKFUNCTION ( nb ,
PlayerPreThink  )

Definition at line 769 of file sv_nexball.qc.

770{
771 entity player = M_ARGV(0, entity);
772
773 makevectors(player.v_angle);
775 {
776 if(player.ballcarried)
777 {
778 // 'view ball'
779 player.ballcarried.velocity = player.velocity;
780 setcefc(player.ballcarried, ball_customize);
781
782 vector org = player.origin + player.view_ofs +
786 setorigin(player.ballcarried, org);
787
788 // 'safe passing'
790 {
791 if(player.ballcarried.wait < time && player.ballcarried.enemy)
792 {
793 //centerprint(player, sprintf("Lost lock on %s", player.ballcarried.enemy.netname));
794 player.ballcarried.enemy = NULL;
795 }
796
797
798 //tracebox(player.origin + player.view_ofs, '-2 -2 -2', '2 2 2', player.origin + player.view_ofs + v_forward * autocvar_g_nexball_safepass_maxdist);
799 crosshair_trace(player);
800 if( trace_ent &&
802 !IS_DEAD(trace_ent) &&
803 trace_ent.team == player.team &&
804 vdist(trace_ent.origin - player.origin, <=, autocvar_g_nexball_safepass_maxdist) )
805 {
806
807 //if(player.ballcarried.enemy != trace_ent)
808 // centerprint(player, sprintf("Locked to %s", trace_ent.netname));
809 player.ballcarried.enemy = trace_ent;
810 player.ballcarried.wait = time + autocvar_g_nexball_safepass_holdtime;
811
812
813 }
814 }
815 }
816 else
817 {
818 for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
819 {
820 .entity weaponentity = weaponentities[slot];
821
822 if(STAT(WEAPONS, player.(weaponentity)))
823 {
824 STAT(WEAPONS, player) = STAT(WEAPONS, player.(weaponentity));
825 Weapon w = WEP_NEXBALL;
826 w.wr_resetplayer(w, player);
827 player.(weaponentity).m_switchweapon = player.m_switchweapon;
828 W_SwitchWeapon(player, player.(weaponentity).m_switchweapon, weaponentity);
829
830 STAT(WEAPONS, player.(weaponentity)) = '0 0 0';
831 }
832 }
833 }
834
835 }
836
837 nexball_setstatus(player);
838}
entity trace_ent
vector v_right
vector
Definition self.qh:92
void nexball_setstatus(entity this)
Definition sv_nexball.qc:94
const int NBM_BASKETBALL
Definition sv_nexball.qc:55
float nexball_mode
Definition sv_nexball.qc:56
vector autocvar_g_nexball_viewmodel_offset
Definition sv_nexball.qc:39
float autocvar_g_nexball_safepass_holdtime
Definition sv_nexball.qc:36
float autocvar_g_nexball_safepass_maxdist
Definition sv_nexball.qc:35
bool ball_customize(entity this, entity client)
void crosshair_trace(entity pl)
Definition tracing.qc:542
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
Definition vector.qh:8
const int MAX_WEAPONSLOTS
Definition weapon.qh:16

References autocvar_g_nexball_safepass_holdtime, autocvar_g_nexball_safepass_maxdist, autocvar_g_nexball_viewmodel_offset, ball_customize(), crosshair_trace(), entity(), IS_CLIENT, IS_DEAD, M_ARGV, m_switchweapon, makevectors, MAX_WEAPONSLOTS, NBM_BASKETBALL, nexball_mode, nexball_setstatus(), NULL, org, PlayerPreThink, setcefc, STAT, time, trace_ent, v_forward, v_right, v_up, vdist, vector, W_SwitchWeapon(), weaponentities, and Weapon::wr_resetplayer().

◆ MUTATOR_HOOKFUNCTION() [11/15]

MUTATOR_HOOKFUNCTION ( nb ,
PlayerSpawn  )

Definition at line 848 of file sv_nexball.qc.

849{
850 entity player = M_ARGV(0, entity);
851
852 STAT(NB_METERSTART, player) = 0;
853 for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
854 {
855 .entity weaponentity = weaponentities[slot];
856 STAT(WEAPONS, player.(weaponentity)) = '0 0 0';
857 }
858
860 STAT(WEAPONS, player) |= WEPSET(NEXBALL);
861 else
862 STAT(WEAPONS, player) = '0 0 0';
863
864 return false;
865}

References entity(), M_ARGV, MAX_WEAPONSLOTS, NBM_BASKETBALL, nexball_mode, STAT, weaponentities, and WEPSET.

◆ MUTATOR_HOOKFUNCTION() [12/15]

MUTATOR_HOOKFUNCTION ( nb ,
SendWaypoint  )

Definition at line 936 of file sv_nexball.qc.

937{
938 M_ARGV(2, int) &= ~0x80;
939}

References M_ARGV.

◆ MUTATOR_HOOKFUNCTION() [13/15]

MUTATOR_HOOKFUNCTION ( nb ,
SpectateCopy  )

Definition at line 840 of file sv_nexball.qc.

841{
842 entity spectatee = M_ARGV(0, entity);
843 entity client = M_ARGV(1, entity);
844
845 STAT(NB_METERSTART, client) = STAT(NB_METERSTART, spectatee);
846}

References entity(), M_ARGV, SpectateCopy(), and STAT.

◆ MUTATOR_HOOKFUNCTION() [14/15]

MUTATOR_HOOKFUNCTION ( nb ,
TeamBalance_CheckAllowedTeams  )

Definition at line 914 of file sv_nexball.qc.

915{
916 M_ARGV(1, string) = "nexball_team";
917 return true;
918}

References M_ARGV, and TeamBalance_CheckAllowedTeams().

◆ MUTATOR_HOOKFUNCTION() [15/15]

MUTATOR_HOOKFUNCTION ( nb ,
WantWeapon  )

Definition at line 920 of file sv_nexball.qc.

921{
922 M_ARGV(1, float) = 0; // weapon is set a few lines later, apparently
923 return true;
924}

References M_ARGV.

◆ nb_delayedinit()

void nb_delayedinit ( entity this)

Definition at line 513 of file sv_nexball.qc.

514{
515 if(find(NULL, classname, "nexball_team") == NULL)
518}
entity find(entity start,.string field, string match)
void nb_ScoreRules(int teams)
Definition sv_nexball.qc:67
void nb_spawnteams()

References classname, entity(), find(), nb_ScoreRules(), nb_spawnteams(), nb_teams, and NULL.

Referenced by nb_Initialize().

◆ nb_DropBall()

void nb_DropBall ( entity player)

Definition at line 741 of file sv_nexball.qc.

742{
743 if(player.ballcarried && g_nexball)
744 DropBall(player.ballcarried, player.origin, player.velocity);
745}
#define g_nexball
Definition nexball.qh:33

References DropBall(), entity(), and g_nexball.

Referenced by MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), and MUTATOR_HOOKFUNCTION().

◆ nb_Goal_Customize()

bool nb_Goal_Customize ( entity this,
entity client )

Definition at line 614 of file sv_nexball.qc.

615{
617 entity wp_owner = this.owner;
618 if(SAME_TEAM(e, wp_owner)) { return false; }
619
620 return true;
621}
#define SAME_TEAM(a, b)
Definition teams.qh:241
entity WaypointSprite_getviewentity(entity e)

References entity(), owner, SAME_TEAM, and WaypointSprite_getviewentity().

Referenced by SpawnGoal().

◆ nb_Initialize()

void nb_Initialize ( )

Definition at line 941 of file sv_nexball.qc.

942{
945 g_nexball_meter_period = 2; // avoid division by zero etc. due to silly users
946 g_nexball_meter_period = rint(g_nexball_meter_period * 32) / 32; //Round to 1/32ths to send as a byte multiplied by 32
947
948 // General settings
949 /*
950 CVTOV(g_nexball_football_boost_forward); //100
951 CVTOV(g_nexball_football_boost_up); //200
952 CVTOV(g_nexball_delay_idle); //10
953 CVTOV(g_nexball_football_physics); //0
954 */
956
957 GameRules_teams(true);
960
962}
const int INITPRIO_GAMETYPE
Definition constants.qh:94
bool radar_showenemies
Definition ent_cs.qh:50
float rint(float f)
bool autocvar_g_nexball_radar_showallplayers
Definition sv_nexball.qc:29
int autocvar_g_nexball_goalleadlimit
Definition sv_nexball.qc:13
void nb_delayedinit(entity this)
float autocvar_g_nexball_goallimit
Definition sv_nexball.qc:14
float g_nexball_meter_period
Definition sv_nexball.qh:54
float autocvar_g_nexball_meter_period
Definition sv_nexball.qh:45
void GameRules_limit_score(int limit)
Definition sv_rules.qc:23
void GameRules_teams(bool value)
Definition sv_rules.qc:3
void GameRules_limit_lead(int limit)
Definition sv_rules.qc:33
void InitializeEntity(entity e, void(entity this) func, int order)
Definition world.qc:2230

References autocvar_g_nexball_goalleadlimit, autocvar_g_nexball_goallimit, autocvar_g_nexball_meter_period, autocvar_g_nexball_radar_showallplayers, g_nexball_meter_period, GameRules_limit_lead(), GameRules_limit_score(), GameRules_teams(), InitializeEntity(), INITPRIO_GAMETYPE, nb_delayedinit(), NULL, radar_showenemies, and rint().

Referenced by REGISTER_MUTATOR().

◆ nb_ScoreRules()

void nb_ScoreRules ( int teams)

Definition at line 67 of file sv_nexball.qc.

68{
70 field_team(ST_NEXBALL_GOALS, "goals", SFL_SORT_PRIO_PRIMARY);
71 field(SP_NEXBALL_GOALS, "goals", SFL_SORT_PRIO_PRIMARY);
72 field(SP_NEXBALL_FAULTS, "faults", SFL_SORT_PRIO_SECONDARY | SFL_LOWER_IS_BETTER);
73 });
74}
entity teams
Definition main.qh:58
const int SFL_LOWER_IS_BETTER
Lower scores are better (e.g.
Definition scores.qh:102
const int SFL_SORT_PRIO_SECONDARY
Scoring priority (NOTE: PRIMARY is used for fraglimit) NOTE: SFL_SORT_PRIO_SECONDARY value must be lo...
Definition scores.qh:133
const int SFL_SORT_PRIO_PRIMARY
Definition scores.qh:134
#define GameRules_scoring(teams, spprio, stprio, fields)
Definition sv_rules.qh:58

References GameRules_scoring, SFL_LOWER_IS_BETTER, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_SECONDARY, ST_NEXBALL_GOALS, and teams.

Referenced by nb_delayedinit().

◆ nb_spawnteam()

void nb_spawnteam ( string teamname,
float teamcolor )

Definition at line 460 of file sv_nexball.qc.

461{
462 LOG_TRACE("^2spawned team ", teamname);
463 entity e = new_pure(nexball_team);
464 e.netname = teamname;
465 e.cnt = teamcolor;
466 e.team = e.cnt + 1;
467 //nb_teams += 1;
468}
#define LOG_TRACE(...)
Definition log.qh:76
#define new_pure(class)
purely logical entities (not linked to the area grid)
Definition oo.qh:67

References entity(), LOG_TRACE, and new_pure.

Referenced by nb_spawnteams().

◆ nb_spawnteams()

void nb_spawnteams ( )

Definition at line 470 of file sv_nexball.qc.

471{
472 bool t_red = false, t_blue = false, t_yellow = false, t_pink = false;
473 for(entity e = NULL; (e = find(e, classname, "nexball_goal"));)
474 {
475 switch(e.team)
476 {
477 case NUM_TEAM_1:
478 if(!t_red)
479 {
480 nb_spawnteam("Red", e.team-1) ;
481 nb_teams |= BIT(0);
482 t_red = true;
483 }
484 break;
485 case NUM_TEAM_2:
486 if(!t_blue)
487 {
488 nb_spawnteam("Blue", e.team-1) ;
489 t_blue = true;
490 nb_teams |= BIT(1);
491 }
492 break;
493 case NUM_TEAM_3:
494 if(!t_yellow)
495 {
496 nb_spawnteam("Yellow", e.team-1);
497 t_yellow = true;
498 nb_teams |= BIT(2);
499 }
500 break;
501 case NUM_TEAM_4:
502 if(!t_pink)
503 {
504 nb_spawnteam("Pink", e.team-1) ;
505 t_pink = true;
506 nb_teams |= BIT(3);
507 }
508 break;
509 }
510 }
511}
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition bits.qh:8
void nb_spawnteam(string teamname, float teamcolor)
const int NUM_TEAM_2
Definition teams.qh:14
const int NUM_TEAM_4
Definition teams.qh:16
const int NUM_TEAM_3
Definition teams.qh:15
const int NUM_TEAM_1
Definition teams.qh:13

References BIT, classname, entity(), find(), nb_spawnteam(), nb_teams, NULL, NUM_TEAM_1, NUM_TEAM_2, NUM_TEAM_3, and NUM_TEAM_4.

Referenced by nb_delayedinit().

◆ nexball_setstatus()

void nexball_setstatus ( entity this)

Definition at line 94 of file sv_nexball.qc.

95{
96 STAT(OBJECTIVE_STATUS, this) &= ~NB_CARRYING;
97 if(this.ballcarried)
98 {
99 if(this.ballcarried.lifetime && (this.ballcarried.lifetime < time))
100 {
101 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(this.team, INFO_NEXBALL_RETURN_HELD));
102 entity e = this.ballcarried;
103 DropBall(this.ballcarried, this.ballcarried.owner.origin, '0 0 0');
104 ResetBall(e);
105 }
106 else
107 STAT(OBJECTIVE_STATUS, this) |= NB_CARRYING;
108 }
109}
const int NB_CARRYING
Definition nexball.qh:36
void Send_Notification(NOTIF broadcast, entity client, MSG net_type, Notification net_name,...count)
Definition all.qc:1573
#define APP_TEAM_NUM(num, prefix)
Definition all.qh:84
entity ballcarried

References APP_TEAM_NUM, ballcarried, DropBall(), entity(), NB_CARRYING, NULL, ResetBall(), Send_Notification(), STAT, team, and time.

Referenced by MUTATOR_HOOKFUNCTION().

◆ OtherTeam()

float OtherTeam ( float t)

Definition at line 58 of file sv_nexball.qc.

59{
60 entity e = find(NULL, classname, "nexball_team");
61 if(e.team == t)
62 e = find(e, classname, "nexball_team");
63 return e.team;
64}

References classname, entity(), find(), and NULL.

Referenced by GoalTouch().

◆ relocate_nexball()

void relocate_nexball ( entity this)

Definition at line 111 of file sv_nexball.qc.

112{
113 tracebox(this.origin, BALL_MINS, BALL_MAXS, this.origin, true, this);
115 {
116 vector o = this.origin;
117 if (!move_out_of_solid(this)) {
118 objerror(this, "could not get out of solid at all!");
119 }
120 LOG_INFOF(
121 "^1NOTE: this map needs FIXING. %s at %s needs to be moved out of solid, e.g. by %s",
122 this.classname,
123 vtos(o - '0 0 1'),
124 vtos(this.origin - o)
125 );
126 this.origin = o;
127 }
128}
float trace_startsolid
vector origin
#define move_out_of_solid(e)
Definition common.qh:110
#define LOG_INFOF(...)
Definition log.qh:66
string vtos(vector v)
#define objerror
Definition pre.qh:8
const vector BALL_MAXS
Definition sv_nexball.qh:26
const vector BALL_MINS
Definition sv_nexball.qh:25

References BALL_MAXS, BALL_MINS, classname, entity(), LOG_INFOF, move_out_of_solid, objerror, origin, trace_startsolid, vector, and vtos().

Referenced by SpawnBall().

◆ ResetBall()

void ResetBall ( entity this)

Definition at line 253 of file sv_nexball.qc.

254{
255 if(this.cnt < 2) // step 1
256 {
257 if(time == this.lifetime)
258 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(this.team, INFO_NEXBALL_RETURN_HELD));
259
260 settouch(this, func_null);
262 this.velocity = '0 0 0'; // just in case?
263 if(!this.cnt)
264 LogNB("resetidle", NULL);
265 this.cnt = 2;
266 this.nextthink = time;
267 }
268 else if(this.cnt < 4) // step 2 and 3
269 {
270// dprint("Step ", ftos(this.cnt), ": Calculated velocity: ", vtos(this.spawnorigin - this.origin), ", time: ", ftos(time), "\n");
271 this.velocity = (this.spawnorigin - this.origin) * (this.cnt - 1); // 1 or 0.5 second movement
272 this.nextthink = time + 0.5;
273 this.cnt += 1;
274 }
275 else // step 4
276 {
277// dprint("Step 4: time: ", ftos(time), "\n");
278 if(vdist(this.origin - this.spawnorigin, >, 10)) // should not happen anymore
279 LOG_TRACE("The ball moved too far away from its spawn origin.\nOffset: ",
280 vtos(this.origin - this.spawnorigin), " Velocity: ", vtos(this.velocity), "\n");
281 this.velocity = '0 0 0';
282 setorigin(this, this.spawnorigin); // make sure it's positioned correctly anyway
284 setthink(this, InitBall);
286 }
287}
float game_starttime
Definition stats.qh:82
float max(float f,...)
const int MOVETYPE_NOCLIP
Definition movetypes.qh:137
void InitBall(entity this)
float autocvar_g_nexball_delay_start
Definition sv_nexball.qc:25
vector spawnorigin
Definition all.qh:416

References APP_TEAM_NUM, autocvar_g_nexball_delay_start, cnt, entity(), func_null(), game_starttime, InitBall(), lifetime, LOG_TRACE, LogNB(), max(), MOVETYPE_NOCLIP, MOVETYPE_NONE, nextthink, NULL, origin, Send_Notification(), set_movetype(), setthink, settouch, spawnorigin, team, time, vdist, velocity, and vtos().

Referenced by ball_restart(), DropBall(), GoalTouch(), InitBall(), and nexball_setstatus().

◆ SpawnBall()

void SpawnBall ( entity this)

Definition at line 525 of file sv_nexball.qc.

526{
527 if(!g_nexball) { delete(this); return; }
528
529// balls += 4; // using the remaining bits to count balls will leave more than the max edict count, so it's fine
530
531 if(this.model == "")
532 {
533 this.model = "models/nexball/ball.md3";
534 this.scale = 1.3;
535 }
536
537 precache_model(this.model);
538 _setmodel(this, this.model);
539 setsize(this, BALL_MINS, BALL_MAXS);
540 ball_scale = this.scale;
541
542 relocate_nexball(this);
543 this.spawnorigin = this.origin;
544
545 this.effects |= EF_LOWPRECISION;
546
547 if(cvar(strcat("g_", this.classname, "_trail"))) //nexball_basketball :p
548 {
550 this.glow_trail = true;
551 }
552
554
557
559 this.noise = "";
560 else if(this.noise == "")
561 this.noise = strzone(SND(NB_BOUNCE));
562 //bounce sound placeholder (FIXME)
563 if(this.noise1 == "")
564 this.noise1 = strzone(SND(NB_DROP));
565 //ball drop sound placeholder (FIXME)
566 if(this.noise2 == "")
567 this.noise2 = strzone(SND(NB_STEAL));
568 //stealing sound placeholder (FIXME)
569 if(this.noise) precache_sound(this.noise);
572
573 WaypointSprite_AttachCarrier(WP_NbBall, this, RADARICON_FLAGCARRIER); // the ball's team is not set yet, no rule update needed
574
575 this.reset = ball_restart;
576 setthink(this, InitBall);
578}
float DPCONTENTS_SOLID
float DPCONTENTS_BODY
float DPCONTENTS_PLAYERCLIP
float dphitcontentsmask
float EF_LOWPRECISION
float glow_trail
float glow_color
model
Definition ent_cs.qc:139
float cvar(string name)
string precache_sound(string sample)
string strzone(string s)
const int MOVETYPE_FLY
Definition movetypes.qh:134
#define SND(id)
Definition all.qh:35
string noise2
Definition subs.qh:83
int autocvar_g_nexball_trail_color
Definition sv_nexball.qc:31
bool autocvar_g_nexball_playerclip_collisions
Definition sv_nexball.qc:32
void relocate_nexball(entity this)
void ball_restart(entity this)
Definition sv_nexball.qc:87
bool autocvar_g_nexball_sound_bounce
Definition sv_nexball.qc:30

References autocvar_g_nexball_delay_start, autocvar_g_nexball_playerclip_collisions, autocvar_g_nexball_sound_bounce, autocvar_g_nexball_trail_color, BALL_MAXS, BALL_MINS, ball_restart(), ball_scale, classname, cvar(), DPCONTENTS_BODY, DPCONTENTS_PLAYERCLIP, DPCONTENTS_SOLID, dphitcontentsmask, EF_LOWPRECISION, effects, entity(), g_nexball, game_starttime, glow_color, glow_trail, InitBall(), model, MOVETYPE_FLY, nextthink, noise, noise1, noise2, origin, precache_sound(), relocate_nexball(), scale, set_movetype(), setthink, SND, spawnorigin, strcat(), strzone(), and WaypointSprite_AttachCarrier().

Referenced by spawnfunc(), and spawnfunc().

◆ spawnfunc() [1/16]

spawnfunc ( ball )

Definition at line 684 of file sv_nexball.qc.

685{
686 spawnfunc_nexball_football(this);
687}

◆ spawnfunc() [2/16]

spawnfunc ( ball_basketball )

Definition at line 692 of file sv_nexball.qc.

693{
694 spawnfunc_nexball_basketball(this);
695}

◆ spawnfunc() [3/16]

spawnfunc ( ball_bluegoal )

Definition at line 701 of file sv_nexball.qc.

702{
703 spawnfunc_nexball_redgoal(this); // but he didn't mean to cause trouble :p
704}

◆ spawnfunc() [4/16]

spawnfunc ( ball_bound )

Definition at line 709 of file sv_nexball.qc.

710{
711 spawnfunc_nexball_out(this);
712}

◆ spawnfunc() [5/16]

spawnfunc ( ball_fault )

Definition at line 705 of file sv_nexball.qc.

706{
707 spawnfunc_nexball_fault(this);
708}

◆ spawnfunc() [6/16]

spawnfunc ( ball_football )

Definition at line 688 of file sv_nexball.qc.

689{
690 spawnfunc_nexball_football(this);
691}

◆ spawnfunc() [7/16]

spawnfunc ( ball_redgoal )

Definition at line 697 of file sv_nexball.qc.

698{
699 spawnfunc_nexball_bluegoal(this); // I blame Revenant
700}

◆ spawnfunc() [8/16]

spawnfunc ( nexball_basketball )

Definition at line 580 of file sv_nexball.qc.

581{
583 if (!(balls & BALL_BASKET))
584 {
585 /*
586 CVTOV(g_nexball_basketball_effects_default);
587 CVTOV(g_nexball_basketball_delay_hold);
588 CVTOV(g_nexball_basketball_delay_hold_forteam);
589 CVTOV(g_nexball_basketball_teamsteal);
590 */
592 }
593 if(!this.effects)
595 this.solid = SOLID_TRIGGER;
600 SpawnBall(this);
601}
bool pushable
Definition items.qc:14
const float SOLID_TRIGGER
solid
Definition ent_cs.qc:165
float bouncefactor
Definition movetypes.qh:47
float bouncestop
Definition movetypes.qh:46
float autocvar_g_nexball_basketball_bouncestop
Definition sv_nexball.qc:18
bool autocvar_g_nexball_basketball_jumppad
Definition sv_nexball.qc:16
float autocvar_g_nexball_basketball_bouncefactor
Definition sv_nexball.qc:17
void SpawnBall(entity this)
const float BALL_BASKET
Definition sv_nexball.qh:29
float balls
Definition sv_nexball.qh:47
const float BALL_EFFECTMASK
Definition sv_nexball.qh:24

References autocvar_g_nexball_basketball_bouncefactor, autocvar_g_nexball_basketball_bouncestop, autocvar_g_nexball_basketball_effects_default, autocvar_g_nexball_basketball_jumppad, BALL_BASKET, BALL_EFFECTMASK, balls, bouncefactor, bouncestop, effects, NBM_BASKETBALL, nexball_mode, pushable, solid, SOLID_TRIGGER, and SpawnBall().

◆ spawnfunc() [9/16]

spawnfunc ( nexball_bluegoal )

Definition at line 648 of file sv_nexball.qc.

649{
650 this.team = NUM_TEAM_2;
651 SpawnGoal(this);
652}
void SpawnGoal(entity this)

References NUM_TEAM_2, SpawnGoal(), and team.

◆ spawnfunc() [10/16]

spawnfunc ( nexball_fault )

Definition at line 664 of file sv_nexball.qc.

665{
666 this.team = GOAL_FAULT;
667 if(this.noise == "")
668 this.noise = strzone(SND(TYPEHIT));
669 SpawnGoal(this);
670}

References GOAL_FAULT, noise, SND, SpawnGoal(), strzone(), and team.

◆ spawnfunc() [11/16]

spawnfunc ( nexball_football )

◆ spawnfunc() [12/16]

spawnfunc ( nexball_out )

Definition at line 672 of file sv_nexball.qc.

673{
674 this.team = GOAL_OUT;
675 if(this.noise == "")
676 this.noise = strzone(SND(TYPEHIT));
677 SpawnGoal(this);
678}

References GOAL_OUT, noise, SND, SpawnGoal(), strzone(), and team.

◆ spawnfunc() [13/16]

spawnfunc ( nexball_pinkgoal )

Definition at line 658 of file sv_nexball.qc.

659{
660 this.team = NUM_TEAM_4;
661 SpawnGoal(this);
662}

References NUM_TEAM_4, SpawnGoal(), and team.

◆ spawnfunc() [14/16]

spawnfunc ( nexball_redgoal )

Definition at line 643 of file sv_nexball.qc.

644{
645 this.team = NUM_TEAM_1;
646 SpawnGoal(this);
647}

References NUM_TEAM_1, SpawnGoal(), and team.

◆ spawnfunc() [15/16]

spawnfunc ( nexball_team )

Definition at line 450 of file sv_nexball.qc.

451{
452 if(!g_nexball)
453 {
454 delete(this);
455 return;
456 }
457 this.team = this.cnt + 1;
458}

References cnt, g_nexball, and team.

◆ spawnfunc() [16/16]

spawnfunc ( nexball_yellowgoal )

Definition at line 653 of file sv_nexball.qc.

654{
655 this.team = NUM_TEAM_3;
656 SpawnGoal(this);
657}

References NUM_TEAM_3, SpawnGoal(), and team.

◆ SpawnGoal()

void SpawnGoal ( entity this)

Definition at line 623 of file sv_nexball.qc.

624{
625 if(!g_nexball) { delete(this); return; }
626
628
629 if(this.team != GOAL_OUT && Team_IsValidTeam(this.team))
630 {
631 entity wp = WaypointSprite_SpawnFixed(WP_NbGoal, (this.absmin + this.absmax) * 0.5, this, sprite, RADARICON_NONE);
632 wp.colormod = ((this.team) ? Team_ColorRGB(this.team) : '1 0.5 0');
634 }
635
636 this.classname = "nexball_goal";
637 if(this.noise == "")
638 this.noise = "ctf/respawn.wav";
639 precache_sound(this.noise);
640 settouch(this, GoalTouch);
641}
vector absmax
vector absmin
#define EXACTTRIGGER_INIT
Definition common.qh:116
entity sprite
Definition sv_assault.qc:11
void GoalTouch(entity this, entity toucher)
bool nb_Goal_Customize(entity this, entity client)
bool Team_IsValidTeam(int team_num)
Returns whether team value is valid.
Definition teams.qh:133
vector Team_ColorRGB(int teamid)
Definition teams.qh:76
entity WaypointSprite_SpawnFixed(entity spr, vector ofs, entity own,.entity ownfield, entity icon)

References absmax, absmin, classname, entity(), EXACTTRIGGER_INIT, g_nexball, GOAL_OUT, GoalTouch(), nb_Goal_Customize(), noise, precache_sound(), setcefc, settouch, sprite, team, Team_ColorRGB(), Team_IsValidTeam(), and WaypointSprite_SpawnFixed().

Referenced by spawnfunc(), spawnfunc(), spawnfunc(), spawnfunc(), spawnfunc(), and spawnfunc().

Variable Documentation

◆ autocvar_g_balance_nexball_primary_animtime

float autocvar_g_balance_nexball_primary_animtime

Definition at line 41 of file sv_nexball.qc.

◆ autocvar_g_balance_nexball_primary_refire

float autocvar_g_balance_nexball_primary_refire

Definition at line 42 of file sv_nexball.qc.

◆ autocvar_g_balance_nexball_primary_speed

float autocvar_g_balance_nexball_primary_speed

Definition at line 43 of file sv_nexball.qc.

Referenced by W_Nexball_Attack().

◆ autocvar_g_balance_nexball_secondary_animtime

float autocvar_g_balance_nexball_secondary_animtime

Definition at line 44 of file sv_nexball.qc.

◆ autocvar_g_balance_nexball_secondary_force

float autocvar_g_balance_nexball_secondary_force

Definition at line 45 of file sv_nexball.qc.

Referenced by W_Nexball_Touch().

◆ autocvar_g_balance_nexball_secondary_lifetime

float autocvar_g_balance_nexball_secondary_lifetime

Definition at line 46 of file sv_nexball.qc.

Referenced by W_Nexball_Attack2().

◆ autocvar_g_balance_nexball_secondary_refire

float autocvar_g_balance_nexball_secondary_refire

Definition at line 47 of file sv_nexball.qc.

◆ autocvar_g_balance_nexball_secondary_speed

float autocvar_g_balance_nexball_secondary_speed

Definition at line 48 of file sv_nexball.qc.

Referenced by W_Nexball_Attack2().

◆ autocvar_g_nexball_basketball_bouncefactor

float autocvar_g_nexball_basketball_bouncefactor

Definition at line 17 of file sv_nexball.qc.

Referenced by spawnfunc().

◆ autocvar_g_nexball_basketball_bouncestop

float autocvar_g_nexball_basketball_bouncestop

Definition at line 18 of file sv_nexball.qc.

Referenced by spawnfunc().

◆ autocvar_g_nexball_basketball_carrier_highspeed

float autocvar_g_nexball_basketball_carrier_highspeed

Definition at line 19 of file sv_nexball.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_nexball_basketball_jumppad

bool autocvar_g_nexball_basketball_jumppad = true

Definition at line 16 of file sv_nexball.qc.

Referenced by spawnfunc().

◆ autocvar_g_nexball_basketball_meter

bool autocvar_g_nexball_basketball_meter

Definition at line 20 of file sv_nexball.qc.

◆ autocvar_g_nexball_basketball_meter_maxpower

float autocvar_g_nexball_basketball_meter_maxpower

Definition at line 21 of file sv_nexball.qc.

Referenced by W_Nexball_Attack().

◆ autocvar_g_nexball_basketball_meter_minpower

float autocvar_g_nexball_basketball_meter_minpower

Definition at line 22 of file sv_nexball.qc.

Referenced by W_Nexball_Attack().

◆ autocvar_g_nexball_delay_collect

float autocvar_g_nexball_delay_collect

Definition at line 23 of file sv_nexball.qc.

Referenced by basketball_touch().

◆ autocvar_g_nexball_delay_goal

float autocvar_g_nexball_delay_goal

Definition at line 24 of file sv_nexball.qc.

Referenced by GoalTouch().

◆ autocvar_g_nexball_delay_start

float autocvar_g_nexball_delay_start

Definition at line 25 of file sv_nexball.qc.

Referenced by ResetBall(), and SpawnBall().

◆ autocvar_g_nexball_football_bouncefactor

float autocvar_g_nexball_football_bouncefactor

Definition at line 27 of file sv_nexball.qc.

Referenced by spawnfunc().

◆ autocvar_g_nexball_football_bouncestop

float autocvar_g_nexball_football_bouncestop

Definition at line 28 of file sv_nexball.qc.

Referenced by spawnfunc().

◆ autocvar_g_nexball_football_jumppad

bool autocvar_g_nexball_football_jumppad = true

Definition at line 26 of file sv_nexball.qc.

Referenced by spawnfunc().

◆ autocvar_g_nexball_goalleadlimit

int autocvar_g_nexball_goalleadlimit

Definition at line 13 of file sv_nexball.qc.

Referenced by nb_Initialize().

◆ autocvar_g_nexball_goallimit

float autocvar_g_nexball_goallimit

Definition at line 14 of file sv_nexball.qc.

Referenced by nb_Initialize().

◆ autocvar_g_nexball_playerclip_collisions

bool autocvar_g_nexball_playerclip_collisions = true

Definition at line 32 of file sv_nexball.qc.

Referenced by SpawnBall().

◆ autocvar_g_nexball_radar_showallplayers

bool autocvar_g_nexball_radar_showallplayers

Definition at line 29 of file sv_nexball.qc.

Referenced by nb_Initialize().

◆ autocvar_g_nexball_safepass_holdtime

float autocvar_g_nexball_safepass_holdtime

Definition at line 36 of file sv_nexball.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_nexball_safepass_maxdist

float autocvar_g_nexball_safepass_maxdist

Definition at line 35 of file sv_nexball.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_nexball_safepass_turnrate

float autocvar_g_nexball_safepass_turnrate

Definition at line 34 of file sv_nexball.qc.

Referenced by W_Nexball_Think().

◆ autocvar_g_nexball_sound_bounce

bool autocvar_g_nexball_sound_bounce

Definition at line 30 of file sv_nexball.qc.

Referenced by SpawnBall().

◆ autocvar_g_nexball_tackling

float autocvar_g_nexball_tackling

Definition at line 38 of file sv_nexball.qc.

Referenced by W_Nexball_Attack2().

◆ autocvar_g_nexball_trail_color

int autocvar_g_nexball_trail_color

Definition at line 31 of file sv_nexball.qc.

Referenced by SpawnBall().

◆ autocvar_g_nexball_viewmodel_offset

vector autocvar_g_nexball_viewmodel_offset

Definition at line 39 of file sv_nexball.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_nexball_viewmodel_scale

float autocvar_g_nexball_viewmodel_scale

Definition at line 37 of file sv_nexball.qc.

Referenced by ball_customize().

◆ ballcarried

entity ballcarried

Definition at line 11 of file sv_nexball.qc.

◆ NBM_BASKETBALL

const int NBM_BASKETBALL = 4

Definition at line 55 of file sv_nexball.qc.

Referenced by MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), and spawnfunc().

◆ NBM_FOOTBALL

const int NBM_FOOTBALL = 2

Definition at line 54 of file sv_nexball.qc.

Referenced by spawnfunc().

◆ NBM_NONE

const int NBM_NONE = 0

Definition at line 53 of file sv_nexball.qc.

◆ nexball_mode

float nexball_mode

Definition at line 56 of file sv_nexball.qc.

Referenced by MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), spawnfunc(), and spawnfunc().

◆ ST_NEXBALL_GOALS

const int ST_NEXBALL_GOALS = 1

Definition at line 66 of file sv_nexball.qc.

Referenced by GoalTouch(), and nb_ScoreRules().