Xonotic
sv_nexball.qh File Reference
#include "weapon.qh"
+ Include dependency graph for sv_nexball.qh:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void DropBall (entity ball, vector org, vector vel)
 
void nb_Initialize ()
 
 REGISTER_MUTATOR (nb, false)
 

Variables

float autocvar_g_nexball_basketball_delay_hold
 
float autocvar_g_nexball_basketball_delay_hold_forteam
 
float autocvar_g_nexball_basketball_effects_default
 
float autocvar_g_nexball_basketball_teamsteal
 
float autocvar_g_nexball_delay_idle
 
float autocvar_g_nexball_football_boost_forward
 
float autocvar_g_nexball_football_boost_up
 
float autocvar_g_nexball_football_physics
 
float autocvar_g_nexball_meter_period
 
const vector BALL_ATTACHORG = '3 0 16'
 
const float BALL_BASKET = 2
 
const float BALL_EFFECTMASK = 1229
 
const float BALL_FOOT = 1
 
const vector BALL_MAXS = '16 16 16'
 
const vector BALL_MINS = '-16 -16 -16'
 
float ball_scale
 
float balls
 
float g_nexball_meter_period
 
const float GOAL_FAULT = -1
 
const float GOAL_OUT = -2
 
const float GOAL_TOUCHPLAYER = 1
 
entity nb_dropper
 
float nb_droptime
 
float nb_teams
 

Function Documentation

◆ DropBall()

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

Definition at line 202 of file sv_nexball.qc.

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, ResetBall(), set_movetype(), setorigin(), setthink, SPRITERULE_DEFAULT, state, time, UNSET_ONGROUND, and WS_READY.

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

203 {
205  ball.effects &= ~EF_NOSHADOW;
206  ball.owner.effects &= ~autocvar_g_nexball_basketball_effects_default;
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;
215  settouch(ball, basketball_touch);
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 }
float state
Definition: subs.qh:32
const int SPRITERULE_DEFAULT
void GameRules_scoring_vip(entity player, bool value)
Mark a player as being 'important' (flag carrier, ball carrier, etc)
Definition: sv_rules.qc:98
entity() spawn
void basketball_touch(entity this, entity toucher)
Definition: sv_nexball.qc:337
float ball_scale
Definition: sv_nexball.qh:48
float autocvar_g_nexball_delay_idle
Definition: sv_nexball.qh:40
float MOVETYPE_BOUNCE
Definition: progsdefs.qc:256
const int WS_READY
idle frame
Definition: weapon.qh:38
#define UNSET_ONGROUND(s)
Definition: movetypes.qh:18
const float EF_NOSHADOW
Definition: csprogsdefs.qc:306
float autocvar_g_nexball_basketball_effects_default
Definition: sv_nexball.qh:43
#define NULL
Definition: post.qh:17
void ResetBall(entity this)
Definition: sv_nexball.qc:255
setorigin(ent, v)
#define setthink(e, f)
float time
Definition: csprogsdefs.qc:16
void set_movetype(entity this, int mt)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nb_Initialize()

void nb_Initialize ( )

Definition at line 943 of file sv_nexball.qc.

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(), nb_delayedinit(), NULL, and rint().

Referenced by REGISTER_MUTATOR().

944 {
946  if(g_nexball_meter_period <= 0)
947  g_nexball_meter_period = 2; // avoid division by zero etc. due to silly users
948  g_nexball_meter_period = rint(g_nexball_meter_period * 32) / 32; //Round to 1/32ths to send as a byte multiplied by 32
949 
950  // General settings
951  /*
952  CVTOV(g_nexball_football_boost_forward); //100
953  CVTOV(g_nexball_football_boost_up); //200
954  CVTOV(g_nexball_delay_idle); //10
955  CVTOV(g_nexball_football_physics); //0
956  */
957  radar_showenemies = autocvar_g_nexball_radar_showallplayers;
958 
959  GameRules_teams(true);
962 
963  InitializeEntity(NULL, nb_delayedinit, INITPRIO_GAMETYPE);
964 }
float g_nexball_meter_period
Definition: sv_nexball.qh:54
void GameRules_limit_score(int limit)
Definition: sv_rules.qc:34
int autocvar_g_nexball_goalleadlimit
Definition: sv_nexball.qc:13
bool autocvar_g_nexball_radar_showallplayers
Definition: sv_nexball.qc:29
void GameRules_teams(bool value)
Definition: sv_rules.qc:6
#define NULL
Definition: post.qh:17
void InitializeEntity(entity e, void(entity this) func, int order)
Definition: world.qc:2146
void GameRules_limit_lead(int limit)
Definition: sv_rules.qc:44
void nb_delayedinit(entity this)
Definition: sv_nexball.qc:515
float autocvar_g_nexball_meter_period
Definition: sv_nexball.qh:45
float autocvar_g_nexball_goallimit
Definition: sv_nexball.qc:14
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ REGISTER_MUTATOR()

REGISTER_MUTATOR ( nb  ,
false   
)

Definition at line 7 of file sv_nexball.qh.

References MUTATOR_ONADD, MUTATOR_ONROLLBACK_OR_REMOVE, MUTATOR_STATIC, nb_Initialize(), and WEP_FLAG_MUTATORBLOCKED.

8 {
11  {
12  nb_Initialize();
13  WEP_NEXBALL.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED;
14  }
15 
17  {
18  WEP_NEXBALL.spawnflags |= WEP_FLAG_MUTATORBLOCKED;
19  }
20  return 0;
21 }
#define MUTATOR_STATIC()
Definition: base.qh:288
#define MUTATOR_ONROLLBACK_OR_REMOVE
Definition: base.qh:286
const int WEP_FLAG_MUTATORBLOCKED
Definition: weapon.qh:203
#define MUTATOR_ONADD
Definition: base.qh:284
void nb_Initialize()
Definition: sv_nexball.qc:943
+ Here is the call graph for this function:

Variable Documentation

◆ autocvar_g_nexball_basketball_delay_hold

float autocvar_g_nexball_basketball_delay_hold

Definition at line 41 of file sv_nexball.qh.

Referenced by GiveBall().

◆ autocvar_g_nexball_basketball_delay_hold_forteam

float autocvar_g_nexball_basketball_delay_hold_forteam

Definition at line 42 of file sv_nexball.qh.

Referenced by GiveBall().

◆ autocvar_g_nexball_basketball_effects_default

float autocvar_g_nexball_basketball_effects_default

Definition at line 43 of file sv_nexball.qh.

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

◆ autocvar_g_nexball_basketball_teamsteal

float autocvar_g_nexball_basketball_teamsteal

Definition at line 44 of file sv_nexball.qh.

Referenced by W_Nexball_Touch().

◆ autocvar_g_nexball_delay_idle

float autocvar_g_nexball_delay_idle

Definition at line 40 of file sv_nexball.qh.

Referenced by basketball_touch(), DropBall(), football_touch(), and InitBall().

◆ autocvar_g_nexball_football_boost_forward

float autocvar_g_nexball_football_boost_forward

Definition at line 37 of file sv_nexball.qh.

Referenced by football_touch().

◆ autocvar_g_nexball_football_boost_up

float autocvar_g_nexball_football_boost_up

Definition at line 38 of file sv_nexball.qh.

Referenced by football_touch().

◆ autocvar_g_nexball_football_physics

float autocvar_g_nexball_football_physics

Definition at line 39 of file sv_nexball.qh.

Referenced by football_touch().

◆ autocvar_g_nexball_meter_period

float autocvar_g_nexball_meter_period

Definition at line 45 of file sv_nexball.qh.

Referenced by nb_Initialize().

◆ BALL_ATTACHORG

const vector BALL_ATTACHORG = '3 0 16'

Definition at line 27 of file sv_nexball.qh.

◆ BALL_BASKET

const float BALL_BASKET = 2

Definition at line 29 of file sv_nexball.qh.

Referenced by spawnfunc().

◆ BALL_EFFECTMASK

const float BALL_EFFECTMASK = 1229

Definition at line 24 of file sv_nexball.qh.

Referenced by spawnfunc().

◆ BALL_FOOT

const float BALL_FOOT = 1

Definition at line 28 of file sv_nexball.qh.

Referenced by spawnfunc().

◆ BALL_MAXS

const vector BALL_MAXS = '16 16 16'

Definition at line 26 of file sv_nexball.qh.

Referenced by relocate_nexball(), SpawnBall(), and W_Nexball_Attack().

◆ BALL_MINS

const vector BALL_MINS = '-16 -16 -16'

Definition at line 25 of file sv_nexball.qh.

Referenced by relocate_nexball(), SpawnBall(), and W_Nexball_Attack().

◆ ball_scale

float ball_scale

Definition at line 48 of file sv_nexball.qh.

Referenced by DropBall(), and SpawnBall().

◆ balls

float balls

Definition at line 47 of file sv_nexball.qh.

Referenced by spawnfunc().

◆ g_nexball_meter_period

float g_nexball_meter_period

Definition at line 54 of file sv_nexball.qh.

Referenced by ClientInit_misc(), nb_Initialize(), and W_Nexball_Attack().

◆ GOAL_FAULT

const float GOAL_FAULT = -1

Definition at line 33 of file sv_nexball.qh.

Referenced by GoalTouch(), and spawnfunc().

◆ GOAL_OUT

const float GOAL_OUT = -2

Definition at line 34 of file sv_nexball.qh.

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

◆ GOAL_TOUCHPLAYER

const float GOAL_TOUCHPLAYER = 1

Definition at line 31 of file sv_nexball.qh.

Referenced by GoalTouch().

◆ nb_dropper

entity nb_dropper

Definition at line 51 of file sv_nexball.qh.

Referenced by basketball_touch().

◆ nb_droptime

float nb_droptime

Definition at line 52 of file sv_nexball.qh.

Referenced by basketball_touch().

◆ nb_teams

float nb_teams

Definition at line 49 of file sv_nexball.qh.

Referenced by GoalTouch(), nb_delayedinit(), and nb_spawnteams().