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 717 of file sv_nexball.qc.

718{
719 if(!this.owner)
720 {
721 this.effects &= ~EF_FLAME;
722 this.scale = 1;
723 setcefc(this, func_null);
724 return true;
725 }
726
727 if(client == this.owner)
728 {
730 if(this.enemy)
731 this.effects |= EF_FLAME;
732 else
733 this.effects &= ~EF_FLAME;
734 }
735 else
736 {
737 this.effects &= ~EF_FLAME;
738 this.scale = 1;
739 }
740
741 return true;
742}
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 88 of file sv_nexball.qc.

89{
90 if(this.owner)
91 DropBall(this, this.owner.origin, '0 0 0');
92 ResetBall(this);
93}
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 337 of file sv_nexball.qc.

338{
339 if(toucher.ballcarried)
340 {
341 football_touch(this, toucher);
342 return;
343 }
344 // TODO: mutator hook to prevent picking up objectives
346 {
347 if(GetResource(toucher, RES_HEALTH) < 1)
348 return;
349 LogNB("caught", toucher);
350 GiveBall(toucher, this);
351 }
352 else if(toucher.solid == SOLID_BSP)
353 {
355 if(this.velocity && !this.cnt)
357 }
358}
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:245
#define IS_PLAYER(s)
Definition player.qh:243
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:77
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 202 of file sv_nexball.qc.

203{
205 ball.effects &= ~EF_NOSHADOW;
207
208 setattachment(ball, NULL, "");
209 setorigin(ball, org);
211 UNSET_ONGROUND(ball);
212 ball.scale = ball_scale;
213 ball.velocity = vel;
214 ball.nb_droptime = time;
216 setthink(ball, ResetBall);
217 ball.nextthink = min(time + autocvar_g_nexball_delay_idle, ball.lifetime);
218
219 if(STAT(NB_METERSTART, ball.owner))
220 {
221 STAT(NB_METERSTART, ball.owner) = 0;
222 .entity weaponentity = ball.weaponentity_fld;
223 ball.owner.(weaponentity).state = WS_READY;
224 }
225
226 WaypointSprite_Kill(ball.owner.waypointsprite_attachedforcarrier);
227 WaypointSprite_Spawn(WP_NbBall, 0, 0, ball, '0 0 64', NULL, ball.team, ball, waypointsprite_attachedforcarrier, false, RADARICON_FLAGCARRIER); // no health bar please
228 WaypointSprite_UpdateRule(ball.waypointsprite_attachedforcarrier, 0, SPRITERULE_DEFAULT);
229
230 entity e = ball.owner; ball.owner = NULL;
231 e.ballcarried = NULL;
232 GameRules_scoring_vip(e, false);
233}
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:41

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 131 of file sv_nexball.qc.

132{
133 entity ownr;
134 ownr = this.owner;
135 DropBall(this, ownr.origin, ownr.velocity);
136 makevectors(ownr.v_angle.y * '0 1 0');
137 ownr.velocity += ('0 0 0.75' - v_forward) * 1000;
138 UNSET_ONGROUND(ownr);
139}
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 291 of file sv_nexball.qc.

292{
293 if(toucher.solid == SOLID_BSP)
294 {
295 if(time > this.lastground + 0.1)
296 {
298 this.lastground = time;
299 }
300 if(this.velocity && !this.cnt)
302 return;
303 }
305 return;
306 if(GetResource(toucher, RES_HEALTH) < 1)
307 return;
308 if(!this.cnt)
310
311 this.pusher = toucher;
312 this.team = toucher.team;
313
314 if(autocvar_g_nexball_football_physics == -1) // MrBougo try 1, before decompiling Rev's original
315 {
316 if(toucher.velocity)
317 this.velocity = toucher.velocity * 1.5 + '0 0 1' * autocvar_g_nexball_football_boost_up;
318 }
319 else if(autocvar_g_nexball_football_physics == 1) // MrBougo's modded Rev style: partially independant of the height of the aiming point
320 {
321 makevectors(toucher.v_angle);
323 }
324 else if(autocvar_g_nexball_football_physics == 2) // 2nd mod try: totally independant. Really playable!
325 {
326 makevectors(toucher.v_angle.y * '0 1 0');
328 }
329 else // Revenant's original style (from the original mod's disassembly, acknowledged by Revenant)
330 {
331 makevectors(toucher.v_angle);
333 }
334 this.avelocity = -250 * v_forward; // maybe there is a way to make it look better?
335}
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:22

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 141 of file sv_nexball.qc.

142{
143 .entity weaponentity = weaponentities[0]; // TODO: find ballstealer
144 entity ownr = ball.owner;
145 if(ownr)
146 {
148 ownr.ballcarried = NULL;
149 GameRules_scoring_vip(ownr, false);
150 if(STAT(NB_METERSTART, ownr))
151 {
152 STAT(NB_METERSTART, ownr) = 0;
153 ownr.(weaponentity).state = WS_READY;
154 }
155 WaypointSprite_Kill(ownr.waypointsprite_attachedforcarrier);
156 }
157 else
158 {
159 WaypointSprite_Kill(ball.waypointsprite_attachedforcarrier);
160 }
161
162 //setattachment(ball, plyr, "");
163 setorigin(ball, plyr.origin + plyr.view_ofs);
164
165 if(ball.team != plyr.team)
167
168 ball.owner = ball.pusher = plyr; //"owner" is set to the player carrying, "pusher" to the last player who touched it
169 ball.weaponentity_fld = weaponentity;
170 ball.team = plyr.team;
171 plyr.ballcarried = ball;
172 GameRules_scoring_vip(plyr, true);
173 ball.nb_dropper = plyr;
174
177
178 ball.velocity = '0 0 0';
180 settouch(ball, func_null);
181 ball.effects |= EF_NOSHADOW;
182 ball.scale = 1; // scale down.
183
184 WaypointSprite_AttachCarrier(WP_NbBall, plyr, RADARICON_FLAGCARRIER);
185 WaypointSprite_UpdateRule(plyr.waypointsprite_attachedforcarrier, 0, SPRITERULE_DEFAULT);
186
188 {
189 setthink(ball, DropOwner);
191 }
192
193 STAT(WEAPONS, plyr.(weaponentity)) = STAT(WEAPONS, plyr);
194 plyr.m_switchweapon = plyr.(weaponentity).m_weapon;
195 STAT(WEAPONS, plyr) = WEPSET(NEXBALL);
196 Weapon w = WEP_NEXBALL;
197 w.wr_resetplayer(w, plyr);
198 plyr.(weaponentity).m_switchweapon = WEP_NEXBALL;
199 W_SwitchWeapon(plyr, WEP_NEXBALL, weaponentity);
200}
fields which are explicitly/manually set are marked with "M", fields set automatically are marked wit...
Definition weapon.qh:44
virtual void wr_resetplayer()
(SERVER) clears fields that the weapon may use
Definition weapon.qh:106
const int MOVETYPE_NONE
Definition movetypes.qh:129
bool W_SwitchWeapon(entity this, Weapon w,.entity weaponentity)
Definition selection.qc:275
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:45
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 360 of file sv_nexball.qc.

361{
362 entity ball;
363 float isclient, pscore, otherteam;
364 string pname;
365
366 if(game_stopped) return;
367 if((this.spawnflags & GOAL_TOUCHPLAYER) && toucher.ballcarried)
368 ball = toucher.ballcarried;
369 else
370 ball = toucher;
371 if(ball.classname != "nexball_basketball")
372 if(ball.classname != "nexball_football")
373 return;
374 if((!ball.pusher && this.team != GOAL_OUT) || ball.cnt)
375 return;
377
378
379 if(NumTeams(nb_teams) == 2)
380 otherteam = OtherTeam(ball.team);
381 else
382 otherteam = 0;
383
384 if((isclient = IS_CLIENT(ball.pusher)))
385 pname = ball.pusher.netname;
386 else
387 pname = "Someone (?)";
388
389 if(ball.team == this.team) //owngoal (regular goals)
390 {
391 LogNB("owngoal", ball.pusher);
392 bprint("Boo! ", pname, "^7 scored a goal against their own team!\n");
393 pscore = -1;
394 }
395 else if(this.team == GOAL_FAULT)
396 {
397 LogNB("fault", ball.pusher);
398 if(NumTeams(nb_teams) == 2)
399 bprint(Team_ColoredFullName(otherteam), " gets a point due to ", pname, "^7's silliness.\n");
400 else
401 bprint(Team_ColoredFullName(ball.team), " loses a point due to ", pname, "^7's silliness.\n");
402 pscore = -1;
403 }
404 else if(this.team == GOAL_OUT)
405 {
406 LogNB("out", ball.pusher);
407 if((this.spawnflags & GOAL_TOUCHPLAYER) && ball.owner)
408 bprint(pname, "^7 went out of bounds.\n");
409 else
410 bprint("The ball was returned.\n");
411 pscore = 0;
412 }
413 else //score
414 {
415 LogNB(strcat("goal:", ftos(this.team)), ball.pusher);
416 bprint("Goaaaaal! ", pname, "^7 scored a point for the ", Team_ColoredFullName(ball.team), ".\n");
417 pscore = 1;
418 }
419
421
422 if(ball.team && pscore)
423 {
424 if(NumTeams(nb_teams) == 2 && pscore < 0)
425 TeamScore_AddToTeam(otherteam, ST_NEXBALL_GOALS, -pscore);
426 else
427 TeamScore_AddToTeam(ball.team, ST_NEXBALL_GOALS, pscore);
428 }
429 if(isclient)
430 {
431 if(pscore > 0)
432 GameRules_scoring_add(ball.pusher, NEXBALL_GOALS, pscore);
433 else if(pscore < 0)
434 GameRules_scoring_add(ball.pusher, NEXBALL_FAULTS, -pscore);
435 }
436
437 if(ball.owner) // Happens on spawnflag GOAL_TOUCHPLAYER
438 DropBall(ball, ball.owner.origin, ball.owner.velocity);
439
440 WaypointSprite_Ping(ball.waypointsprite_attachedforcarrier);
441
442 ball.cnt = 1;
443 setthink(ball, ResetBall);
444 if(ball.classname == "nexball_basketball")
445 settouch(ball, football_touch); // better than func_null: football control until the ball gets reset
446 ball.nextthink = time + autocvar_g_nexball_delay_goal * (this.team != GOAL_OUT);
447}
int spawnflags
Definition ammo.qh:15
#define IS_CLIENT(s)
Definition player.qh:242
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:107
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:67
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 235 of file sv_nexball.qc.

236{
237 if(game_stopped) return;
238 UNSET_ONGROUND(this);
240 if(this.classname == "nexball_basketball")
242 else if(this.classname == "nexball_football")
244 this.cnt = 0;
245 setthink(this, ResetBall);
247 this.lifetime = 0;
248 this.pusher = NULL;
249 this.team = false;
252 LogNB("init", NULL);
253}
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 77 of file sv_nexball.qc.

78{
79 string s;
81 return;
82 s = strcat(":nexball:", mode);
83 if(actor != NULL)
84 s = strcat(s, ":", ftos(actor.playerid));
85 GameLogEcho(s);
86}
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 750 of file sv_nexball.qc.

751{
752 entity player = M_ARGV(0, entity);
753
754 nb_DropBall(player);
755}
#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 929 of file sv_nexball.qc.

930{
932
933 if(frag_target.ballcarried)
934 DropBall(frag_target.ballcarried, frag_target.origin, frag_target.velocity);
935
936 return false;
937}
entity frag_target
Definition sv_ctf.qc:2321

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

◆ MUTATOR_HOOKFUNCTION() [3/15]

MUTATOR_HOOKFUNCTION ( nb ,
FilterItem  )

Definition at line 895 of file sv_nexball.qc.

896{
897 entity item = M_ARGV(0, entity);
898
899 if(ITEM_IS_LOOT(item))
900 if(item.weapon == WEP_NEXBALL.m_id)
901 return true;
902
903 return false;
904}
#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 887 of file sv_nexball.qc.

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

References M_ARGV.

◆ MUTATOR_HOOKFUNCTION() [5/15]

MUTATOR_HOOKFUNCTION ( nb ,
ForbidThrowCurrentWeapon  )

Definition at line 879 of file sv_nexball.qc.

880{
881 //entity player = M_ARGV(0, entity);
882 entity wepent = M_ARGV(1, entity);
883
884 return wepent.m_weapon == WEP_NEXBALL;
885}

References entity(), and M_ARGV.

◆ MUTATOR_HOOKFUNCTION() [6/15]

MUTATOR_HOOKFUNCTION ( nb ,
ItemTouch  )

Definition at line 906 of file sv_nexball.qc.

907{
908 entity item = M_ARGV(0, entity);
910
911 if(item.weapon && toucher.ballcarried)
912 return MUT_ITEMTOUCH_RETURN; // no new weapons for you, mister!
913
915}
@ 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 764 of file sv_nexball.qc.

765{
766 entity player = M_ARGV(0, entity);
767
768 nb_DropBall(player);
769 return false;
770}

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

◆ MUTATOR_HOOKFUNCTION() [8/15]

MUTATOR_HOOKFUNCTION ( nb ,
PlayerDies  )

Definition at line 757 of file sv_nexball.qc.

758{
760
762}

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

◆ MUTATOR_HOOKFUNCTION() [9/15]

MUTATOR_HOOKFUNCTION ( nb ,
PlayerPhysics_UpdateStats  )

Definition at line 870 of file sv_nexball.qc.

871{
872 entity player = M_ARGV(0, entity);
873 // these automatically reset, no need to worry
874
875 if(player.ballcarried)
876 STAT(MOVEVARS_HIGHSPEED, player) *= autocvar_g_nexball_basketball_carrier_highspeed;
877}
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 772 of file sv_nexball.qc.

773{
774 entity player = M_ARGV(0, entity);
775
776 makevectors(player.v_angle);
778 {
779 if(player.ballcarried)
780 {
781 // 'view ball'
782 player.ballcarried.velocity = player.velocity;
783 setcefc(player.ballcarried, ball_customize);
784
785 vector org = player.origin + player.view_ofs +
789 setorigin(player.ballcarried, org);
790
791 // 'safe passing'
793 {
794 if(player.ballcarried.wait < time && player.ballcarried.enemy)
795 {
796 //centerprint(player, sprintf("Lost lock on %s", player.ballcarried.enemy.netname));
797 player.ballcarried.enemy = NULL;
798 }
799
800
801 //tracebox(player.origin + player.view_ofs, '-2 -2 -2', '2 2 2', player.origin + player.view_ofs + v_forward * autocvar_g_nexball_safepass_maxdist);
802 crosshair_trace(player);
803 if( trace_ent &&
805 !IS_DEAD(trace_ent) &&
806 trace_ent.team == player.team &&
807 vdist(trace_ent.origin - player.origin, <=, autocvar_g_nexball_safepass_maxdist) )
808 {
809
810 //if(player.ballcarried.enemy != trace_ent)
811 // centerprint(player, sprintf("Locked to %s", trace_ent.netname));
812 player.ballcarried.enemy = trace_ent;
813 player.ballcarried.wait = time + autocvar_g_nexball_safepass_holdtime;
814
815
816 }
817 }
818 }
819 else
820 {
821 for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
822 {
823 .entity weaponentity = weaponentities[slot];
824
825 if(STAT(WEAPONS, player.(weaponentity)))
826 {
827 STAT(WEAPONS, player) = STAT(WEAPONS, player.(weaponentity));
828 Weapon w = WEP_NEXBALL;
829 w.wr_resetplayer(w, player);
830 player.(weaponentity).m_switchweapon = player.m_switchweapon;
831 W_SwitchWeapon(player, player.(weaponentity).m_switchweapon, weaponentity);
832
833 STAT(WEAPONS, player.(weaponentity)) = '0 0 0';
834 }
835 }
836 }
837
838 }
839
840 nexball_setstatus(player);
841}
entity trace_ent
vector v_right
vector
Definition self.qh:92
void nexball_setstatus(entity this)
Definition sv_nexball.qc:95
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:549
#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 851 of file sv_nexball.qc.

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

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 939 of file sv_nexball.qc.

940{
941 M_ARGV(2, int) &= ~0x80;
942}

References M_ARGV.

◆ MUTATOR_HOOKFUNCTION() [13/15]

MUTATOR_HOOKFUNCTION ( nb ,
SpectateCopy  )

Definition at line 843 of file sv_nexball.qc.

844{
845 entity spectatee = M_ARGV(0, entity);
846 entity client = M_ARGV(1, entity);
847
848 STAT(NB_METERSTART, client) = STAT(NB_METERSTART, spectatee);
849}

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

◆ MUTATOR_HOOKFUNCTION() [14/15]

MUTATOR_HOOKFUNCTION ( nb ,
TeamBalance_CheckAllowedTeams  )

Definition at line 917 of file sv_nexball.qc.

918{
919 M_ARGV(1, string) = "nexball_team";
920 return true;
921}

References M_ARGV, and TeamBalance_CheckAllowedTeams().

◆ MUTATOR_HOOKFUNCTION() [15/15]

MUTATOR_HOOKFUNCTION ( nb ,
WantWeapon  )

Definition at line 923 of file sv_nexball.qc.

924{
925 M_ARGV(1, float) = 0; // weapon is set a few lines later, apparently
926 return true;
927}

References M_ARGV.

◆ nb_delayedinit()

void nb_delayedinit ( entity this)

Definition at line 516 of file sv_nexball.qc.

517{
518 if(find(NULL, classname, "nexball_team") == NULL)
521}
entity find(entity start,.string field, string match)
void nb_ScoreRules(int teams)
Definition sv_nexball.qc:68
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 744 of file sv_nexball.qc.

745{
746 if(player.ballcarried && g_nexball)
747 DropBall(player.ballcarried, player.origin, player.velocity);
748}
#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 617 of file sv_nexball.qc.

618{
620 entity wp_owner = this.owner;
621 if(SAME_TEAM(e, wp_owner)) { return false; }
622
623 return true;
624}
#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 944 of file sv_nexball.qc.

945{
948 g_nexball_meter_period = 2; // avoid division by zero etc. due to silly users
949 g_nexball_meter_period = rint(g_nexball_meter_period * 32) / 32; //Round to 1/32ths to send as a byte multiplied by 32
950
951 // General settings
952 /*
953 CVTOV(g_nexball_football_boost_forward); //100
954 CVTOV(g_nexball_football_boost_up); //200
955 CVTOV(g_nexball_delay_idle); //10
956 CVTOV(g_nexball_football_physics); //0
957 */
959
960 GameRules_teams(true);
963
965}
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:2209

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 68 of file sv_nexball.qc.

69{
71 field_team(ST_NEXBALL_GOALS, "goals", SFL_SORT_PRIO_PRIMARY);
72 field(SP_NEXBALL_GOALS, "goals", SFL_SORT_PRIO_PRIMARY);
73 field(SP_NEXBALL_FAULTS, "faults", SFL_SORT_PRIO_SECONDARY | SFL_LOWER_IS_BETTER);
74 });
75}
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 462 of file sv_nexball.qc.

463{
464 LOG_TRACE("^2spawned team ", teamname);
465 entity e = new_pure(nexball_team);
466 e.netname = teamname;
467 e.cnt = teamcolor;
468 e.team = e.cnt + 1;
469 //nb_teams += 1;
470}
#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 472 of file sv_nexball.qc.

473{
474 bool t_red = false, t_blue = false, t_yellow = false, t_pink = false;
475 entity e;
476 for(e = NULL; (e = find(e, classname, "nexball_goal"));)
477 {
478 switch(e.team)
479 {
480 case NUM_TEAM_1:
481 if(!t_red)
482 {
483 nb_spawnteam("Red", e.team-1) ;
484 nb_teams |= BIT(0);
485 t_red = true;
486 }
487 break;
488 case NUM_TEAM_2:
489 if(!t_blue)
490 {
491 nb_spawnteam("Blue", e.team-1) ;
492 t_blue = true;
493 nb_teams |= BIT(1);
494 }
495 break;
496 case NUM_TEAM_3:
497 if(!t_yellow)
498 {
499 nb_spawnteam("Yellow", e.team-1);
500 t_yellow = true;
501 nb_teams |= BIT(2);
502 }
503 break;
504 case NUM_TEAM_4:
505 if(!t_pink)
506 {
507 nb_spawnteam("Pink", e.team-1) ;
508 t_pink = true;
509 nb_teams |= BIT(3);
510 }
511 break;
512 }
513 }
514}
#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 95 of file sv_nexball.qc.

96{
97 STAT(OBJECTIVE_STATUS, this) &= ~NB_CARRYING;
98 if(this.ballcarried)
99 {
100 if(this.ballcarried.lifetime && (this.ballcarried.lifetime < time))
101 {
102 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(this.team, INFO_NEXBALL_RETURN_HELD));
103 entity e = this.ballcarried;
104 DropBall(this.ballcarried, this.ballcarried.owner.origin, '0 0 0');
105 ResetBall(e);
106 }
107 else
108 STAT(OBJECTIVE_STATUS, this) |= NB_CARRYING;
109 }
110}
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;
61 e = find(NULL, classname, "nexball_team");
62 if(e.team == t)
63 e = find(e, classname, "nexball_team");
64 return e.team;
65}

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

Referenced by GoalTouch().

◆ relocate_nexball()

void relocate_nexball ( entity this)

Definition at line 112 of file sv_nexball.qc.

113{
114 tracebox(this.origin, BALL_MINS, BALL_MAXS, this.origin, true, this);
116 {
117 vector o = this.origin;
118 if (!move_out_of_solid(this)) {
119 objerror(this, "could not get out of solid at all!");
120 }
121 LOG_INFOF(
122 "^1NOTE: this map needs FIXING. %s at %s needs to be moved out of solid, e.g. by %s",
123 this.classname,
124 vtos(o - '0 0 1'),
125 vtos(this.origin - o)
126 );
127 this.origin = o;
128 }
129}
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 255 of file sv_nexball.qc.

256{
257 if(this.cnt < 2) // step 1
258 {
259 if(time == this.lifetime)
260 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(this.team, INFO_NEXBALL_RETURN_HELD));
261
262 settouch(this, func_null);
264 this.velocity = '0 0 0'; // just in case?
265 if(!this.cnt)
266 LogNB("resetidle", NULL);
267 this.cnt = 2;
268 this.nextthink = time;
269 }
270 else if(this.cnt < 4) // step 2 and 3
271 {
272// dprint("Step ", ftos(this.cnt), ": Calculated velocity: ", vtos(this.spawnorigin - this.origin), ", time: ", ftos(time), "\n");
273 this.velocity = (this.spawnorigin - this.origin) * (this.cnt - 1); // 1 or 0.5 second movement
274 this.nextthink = time + 0.5;
275 this.cnt += 1;
276 }
277 else // step 4
278 {
279// dprint("Step 4: time: ", ftos(time), "\n");
280 if(vdist(this.origin - this.spawnorigin, >, 10)) // should not happen anymore
281 LOG_TRACE("The ball moved too far away from its spawn origin.\nOffset: ",
282 vtos(this.origin - this.spawnorigin), " Velocity: ", vtos(this.velocity), "\n");
283 this.velocity = '0 0 0';
284 setorigin(this, this.spawnorigin); // make sure it's positioned correctly anyway
286 setthink(this, InitBall);
288 }
289}
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:391

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 528 of file sv_nexball.qc.

529{
530 if(!g_nexball) { delete(this); return; }
531
532// balls += 4; // using the remaining bits to count balls will leave more than the max edict count, so it's fine
533
534 if(this.model == "")
535 {
536 this.model = "models/nexball/ball.md3";
537 this.scale = 1.3;
538 }
539
540 precache_model(this.model);
541 _setmodel(this, this.model);
542 setsize(this, BALL_MINS, BALL_MAXS);
543 ball_scale = this.scale;
544
545 relocate_nexball(this);
546 this.spawnorigin = this.origin;
547
548 this.effects = this.effects | EF_LOWPRECISION;
549
550 if(cvar(strcat("g_", this.classname, "_trail"))) //nexball_basketball :p
551 {
553 this.glow_trail = true;
554 }
555
557
560
562 this.noise = "";
563 else if(this.noise == "")
564 this.noise = strzone(SND(NB_BOUNCE));
565 //bounce sound placeholder (FIXME)
566 if(this.noise1 == "")
567 this.noise1 = strzone(SND(NB_DROP));
568 //ball drop sound placeholder (FIXME)
569 if(this.noise2 == "")
570 this.noise2 = strzone(SND(NB_STEAL));
571 //stealing sound placeholder (FIXME)
572 if(this.noise) precache_sound(this.noise);
575
576 WaypointSprite_AttachCarrier(WP_NbBall, this, RADARICON_FLAGCARRIER); // the ball's team is not set yet, no rule update needed
577
578 this.reset = ball_restart;
579 setthink(this, InitBall);
581}
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:88
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 687 of file sv_nexball.qc.

688{
689 spawnfunc_nexball_football(this);
690}

◆ spawnfunc() [2/16]

spawnfunc ( ball_basketball )

Definition at line 695 of file sv_nexball.qc.

696{
697 spawnfunc_nexball_basketball(this);
698}

◆ spawnfunc() [3/16]

spawnfunc ( ball_bluegoal )

Definition at line 704 of file sv_nexball.qc.

705{
706 spawnfunc_nexball_redgoal(this); // but he didn't mean to cause trouble :p
707}

◆ spawnfunc() [4/16]

spawnfunc ( ball_bound )

Definition at line 712 of file sv_nexball.qc.

713{
714 spawnfunc_nexball_out(this);
715}

◆ spawnfunc() [5/16]

spawnfunc ( ball_fault )

Definition at line 708 of file sv_nexball.qc.

709{
710 spawnfunc_nexball_fault(this);
711}

◆ spawnfunc() [6/16]

spawnfunc ( ball_football )

Definition at line 691 of file sv_nexball.qc.

692{
693 spawnfunc_nexball_football(this);
694}

◆ spawnfunc() [7/16]

spawnfunc ( ball_redgoal )

Definition at line 700 of file sv_nexball.qc.

701{
702 spawnfunc_nexball_bluegoal(this); // I blame Revenant
703}

◆ spawnfunc() [8/16]

spawnfunc ( nexball_basketball )

Definition at line 583 of file sv_nexball.qc.

584{
586 if (!(balls & BALL_BASKET))
587 {
588 /*
589 CVTOV(g_nexball_basketball_effects_default);
590 CVTOV(g_nexball_basketball_delay_hold);
591 CVTOV(g_nexball_basketball_delay_hold_forteam);
592 CVTOV(g_nexball_basketball_teamsteal);
593 */
595 }
596 if(!this.effects)
598 this.solid = SOLID_TRIGGER;
603 SpawnBall(this);
604}
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 651 of file sv_nexball.qc.

652{
653 this.team = NUM_TEAM_2;
654 SpawnGoal(this);
655}
void SpawnGoal(entity this)

References NUM_TEAM_2, SpawnGoal(), and team.

◆ spawnfunc() [10/16]

spawnfunc ( nexball_fault )

Definition at line 667 of file sv_nexball.qc.

668{
669 this.team = GOAL_FAULT;
670 if(this.noise == "")
671 this.noise = strzone(SND(TYPEHIT));
672 SpawnGoal(this);
673}

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

◆ spawnfunc() [11/16]

spawnfunc ( nexball_football )

◆ spawnfunc() [12/16]

spawnfunc ( nexball_out )

Definition at line 675 of file sv_nexball.qc.

676{
677 this.team = GOAL_OUT;
678 if(this.noise == "")
679 this.noise = strzone(SND(TYPEHIT));
680 SpawnGoal(this);
681}

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

◆ spawnfunc() [13/16]

spawnfunc ( nexball_pinkgoal )

Definition at line 661 of file sv_nexball.qc.

662{
663 this.team = NUM_TEAM_4;
664 SpawnGoal(this);
665}

References NUM_TEAM_4, SpawnGoal(), and team.

◆ spawnfunc() [14/16]

spawnfunc ( nexball_redgoal )

Definition at line 646 of file sv_nexball.qc.

647{
648 this.team = NUM_TEAM_1;
649 SpawnGoal(this);
650}

References NUM_TEAM_1, SpawnGoal(), and team.

◆ spawnfunc() [15/16]

spawnfunc ( nexball_team )

Definition at line 452 of file sv_nexball.qc.

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

References cnt, g_nexball, and team.

◆ spawnfunc() [16/16]

spawnfunc ( nexball_yellowgoal )

Definition at line 656 of file sv_nexball.qc.

657{
658 this.team = NUM_TEAM_3;
659 SpawnGoal(this);
660}

References NUM_TEAM_3, SpawnGoal(), and team.

◆ SpawnGoal()

void SpawnGoal ( entity this)

Definition at line 626 of file sv_nexball.qc.

627{
628 if(!g_nexball) { delete(this); return; }
629
631
632 if(this.team != GOAL_OUT && Team_IsValidTeam(this.team))
633 {
634 entity wp = WaypointSprite_SpawnFixed(WP_NbGoal, (this.absmin + this.absmax) * 0.5, this, sprite, RADARICON_NONE);
635 wp.colormod = ((this.team) ? Team_ColorRGB(this.team) : '1 0.5 0');
637 }
638
639 this.classname = "nexball_goal";
640 if(this.noise == "")
641 this.noise = "ctf/respawn.wav";
642 precache_sound(this.noise);
643 settouch(this, GoalTouch);
644}
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 67 of file sv_nexball.qc.

Referenced by GoalTouch(), and nb_ScoreRules().