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

Go to the source code of this file.

Functions

void nade_napalm_ball (entity this)
void nade_napalm_boom (entity this)
void napalm_ball_think (entity this)
void napalm_damage (entity this, float dist, float damage, float edgedamage, float burntime)
void napalm_fountain_think (entity this)

Function Documentation

◆ nade_napalm_ball()

void nade_napalm_ball ( entity this)

Definition at line 64 of file napalm.qc.

65{
67
68 entity proj = new(grenade);
69 proj.owner = this.owner;
70 proj.realowner = this.realowner;
71 proj.team = this.owner.team;
72 proj.bot_dodge = true;
73 proj.bot_dodgerating = autocvar_g_nades_napalm_ball_damage;
75 proj.projectiledeathtype = DEATH_NADE_NAPALM.m_id;
77 setmodel(proj, MDL_Null);
78 proj.scale = 1;//0.5;
79 setsize(proj, '-4 -4 -4', '4 4 4');
80 setorigin(proj, this.origin);
82 proj.nextthink = time;
84 proj.effects = EF_LOWPRECISION | EF_FLAME;
85
86 vector kick;
89 kick.z = autocvar_g_nades_napalm_ball_spread * (random() * 0.5 + 0.5);
90 proj.velocity = kick;
91
93
94 proj.angles = vectoangles(proj.velocity);
95 proj.flags = FL_PROJECTILE;
97 IL_PUSH(g_bot_dodge, proj);
98 proj.missile_flags = MIF_SPLASH | MIF_PROXY | MIF_ARC;
99
100 //CSQCProjectile(proj, true, PROJECTILE_NAPALM_FIRE, true);
101}
IntrusiveList g_bot_dodge
Definition api.qh:150
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
entity owner
Definition main.qh:87
#define setmodel(this, m)
Definition model.qh:26
const int FL_PROJECTILE
Definition constants.qh:85
float time
const float EF_FLAME
vector origin
float EF_LOWPRECISION
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
float random(void)
vector vectoangles(vector v)
void set_movetype(entity this, int mt)
Definition movetypes.qc:4
const int MOVETYPE_BOUNCE
Definition movetypes.qh:139
void napalm_ball_think(entity this)
Definition napalm.qc:38
float autocvar_g_nades_napalm_ball_damage
Definition napalm.qh:9
float autocvar_g_nades_napalm_ball_damageforcescale
Definition napalm.qh:10
float autocvar_g_nades_napalm_ball_lifetime
Definition napalm.qh:11
float autocvar_g_nades_napalm_ball_spread
Definition napalm.qh:8
#define crandom()
Returns a random number between -1.0 and 1.0.
Definition random.qh:32
#define setthink(e, f)
vector
Definition self.qh:92
const int MIF_SPLASH
Definition common.qh:46
IntrusiveList g_projectiles
Definition common.qh:58
const int MIF_PROXY
Definition common.qh:48
const int MIF_ARC
Definition common.qh:47
#define PROJECTILE_MAKETRIGGER(e)
Definition common.qh:34
const float VOL_BASE
Definition sound.qh:36
const int CH_SHOTS
Definition sound.qh:14
const float ATTEN_NORM
Definition sound.qh:30
#define SND_NADE_NAPALM_FIRE
Definition all.inc:185
float spamsound(entity e, int chan, Sound samp, float vol, float _atten)
use this one if you might be causing spam (e.g.
Definition all.qc:124
entity realowner

References ATTEN_NORM, autocvar_g_nades_napalm_ball_damage, autocvar_g_nades_napalm_ball_damageforcescale, autocvar_g_nades_napalm_ball_lifetime, autocvar_g_nades_napalm_ball_spread, CH_SHOTS, crandom, EF_FLAME, EF_LOWPRECISION, entity(), FL_PROJECTILE, g_bot_dodge, g_projectiles, IL_PUSH(), MIF_ARC, MIF_PROXY, MIF_SPLASH, MOVETYPE_BOUNCE, napalm_ball_think(), origin, owner, PROJECTILE_MAKETRIGGER, random(), realowner, set_movetype(), setmodel, setthink, SND_NADE_NAPALM_FIRE, spamsound(), time, vectoangles(), vector, and VOL_BASE.

Referenced by nade_napalm_boom(), and napalm_fountain_think().

◆ nade_napalm_boom()

void nade_napalm_boom ( entity this)

Definition at line 134 of file napalm.qc.

135{
136 for (int c = 0; c < autocvar_g_nades_napalm_ball_count; ++c)
137 nade_napalm_ball(this);
138
139 entity fountain = new(nade_napalm_fountain);
140 fountain.owner = this.owner;
141 fountain.realowner = this.realowner;
142 fountain.origin = this.origin;
143 fountain.flags = FL_PROJECTILE;
144 IL_PUSH(g_projectiles, fountain);
145 IL_PUSH(g_bot_dodge, fountain);
146 setorigin(fountain, fountain.origin);
148 fountain.nextthink = time;
150 fountain.pushltime = fountain.ltime;
151 fountain.team = this.team;
152 set_movetype(fountain, MOVETYPE_TOSS);
153 fountain.projectiledeathtype = DEATH_NADE_NAPALM.m_id;
154 fountain.bot_dodge = true;
155 fountain.bot_dodgerating = autocvar_g_nades_napalm_fountain_damage;
156 fountain.nade_special_time = time;
157 setsize(fountain, '-16 -16 -16', '16 16 16');
158 CSQCProjectile(fountain, true, PROJECTILE_NAPALM_FOUNTAIN, true);
159}
int team
Definition main.qh:188
void CSQCProjectile(entity e, float clientanimate, int type, float docull)
const int MOVETYPE_TOSS
Definition movetypes.qh:135
void napalm_fountain_think(entity this)
Definition napalm.qc:103
void nade_napalm_ball(entity this)
Definition napalm.qc:64
const int PROJECTILE_NAPALM_FOUNTAIN
Definition napalm.qh:27
float autocvar_g_nades_napalm_fountain_lifetime
Definition napalm.qh:13
int autocvar_g_nades_napalm_ball_count
Definition napalm.qh:7
float autocvar_g_nades_napalm_fountain_damage
Definition napalm.qh:16

References autocvar_g_nades_napalm_ball_count, autocvar_g_nades_napalm_fountain_damage, autocvar_g_nades_napalm_fountain_lifetime, CSQCProjectile(), entity(), FL_PROJECTILE, g_bot_dodge, g_projectiles, IL_PUSH(), MOVETYPE_TOSS, nade_napalm_ball(), napalm_fountain_think(), origin, owner, PROJECTILE_NAPALM_FOUNTAIN, realowner, set_movetype(), setthink, team, and time.

Referenced by nade_boom().

◆ napalm_ball_think()

void napalm_ball_think ( entity this)

Definition at line 38 of file napalm.qc.

39{
41 || time > this.pushltime)
42 {
43 delete(this);
44 return;
45 }
46
47 vector midpoint = (this.absmin + this.absmax) * 0.5;
48 if (pointcontents(midpoint) == CONTENT_WATER)
49 {
50 this.velocity *= 0.5;
51
52 if (pointcontents(midpoint + '0 0 16') == CONTENT_WATER)
53 this.velocity.z = 200;
54 }
55
56 this.angles = vectoangles(this.velocity);
57
60
61 this.nextthink = time + 0.1;
62}
vector velocity
const float CONTENT_WATER
float nextthink
vector absmax
vector absmin
ent angles
Definition ent_cs.qc:121
float pushltime
Definition jumppads.qh:21
void napalm_damage(entity this, float dist, float damage, float edgedamage, float burntime)
Definition napalm.qc:4
float autocvar_g_nades_napalm_burntime
Definition napalm.qh:18
float autocvar_g_nades_napalm_ball_radius
Definition napalm.qh:12
#define round_handler_IsActive()
#define round_handler_IsRoundStarted()

References absmax, absmin, angles, autocvar_g_nades_napalm_ball_damage, autocvar_g_nades_napalm_ball_radius, autocvar_g_nades_napalm_burntime, CONTENT_WATER, entity(), napalm_damage(), nextthink, pushltime, round_handler_IsActive, round_handler_IsRoundStarted, time, vectoangles(), vector, and velocity.

Referenced by nade_napalm_ball().

◆ napalm_damage()

void napalm_damage ( entity this,
float dist,
float damage,
float edgedamage,
float burntime )

Definition at line 4 of file napalm.qc.

5{
6 if (damage < 0)
7 return;
8
9 float d;
11 for (entity e = WarpZone_FindRadius(this.origin, dist, true); e; e = e.chain)
12 if (e.takedamage == DAMAGE_AIM
13 && (this.realowner != e || autocvar_g_nades_napalm_selfdamage)
14 && (!IS_PLAYER(e) || !this.realowner || DIFF_TEAM(e, this))
15 && !STAT(FROZEN, e))
16 {
17 vector p = e.origin;
18 p.x += e.mins.x + random() * (e.maxs.x - e.mins.x);
19 p.y += e.mins.y + random() * (e.maxs.y - e.mins.y);
20 p.z += e.mins.z + random() * (e.maxs.z - e.mins.z);
21 d = vlen(WarpZone_UnTransformOrigin(e, this.origin) - p);
22 if (d < dist)
23 {
24 e.fireball_impactvec = p;
25 RandomSelection_AddEnt(e, 1 / (1 + d), !StatusEffects_active(STATUSEFFECT_Burning, e));
26 }
27 }
29 {
31 d = damage + (edgedamage - damage) * (d / dist);
33 //trailparticles(this, particleeffectnum(EFFECT_FIREBALL_LASER), this.origin, RandomSelection_chosen_ent.fireball_impactvec);
34 Send_Effect(EFFECT_FIREBALL_LASER, this.origin, RandomSelection_chosen_ent.fireball_impactvec - this.origin, 1);
35 }
36}
#define IS_PLAYER(s)
Definition player.qh:242
float Fire_AddDamage(entity e, entity o, float d, float t, float dt)
Definition damage.qc:974
void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
Definition all.qc:120
#define STAT(...)
Definition stats.qh:82
entity WarpZone_FindRadius(vector org, float rad, bool needlineofsight)
Definition common.qc:684
vector WarpZone_UnTransformOrigin(entity wz, vector v)
Definition common.qc:544
float vlen(vector v)
bool autocvar_g_nades_napalm_selfdamage
Definition napalm.qh:19
ERASEABLE void RandomSelection_Init()
Definition random.qc:4
#define RandomSelection_AddEnt(e, weight, priority)
Definition random.qh:14
entity RandomSelection_chosen_ent
Definition random.qh:5
int projectiledeathtype
Definition common.qh:21
bool StatusEffects_active(StatusEffect this, entity actor)
const int DAMAGE_AIM
Definition subs.qh:81
#define DIFF_TEAM(a, b)
Definition teams.qh:242

References autocvar_g_nades_napalm_selfdamage, DAMAGE_AIM, DIFF_TEAM, entity(), Fire_AddDamage(), IS_PLAYER, origin, projectiledeathtype, random(), RandomSelection_AddEnt, RandomSelection_chosen_ent, RandomSelection_Init(), realowner, Send_Effect(), STAT, StatusEffects_active(), vector, vlen(), WarpZone_FindRadius(), and WarpZone_UnTransformOrigin().

Referenced by napalm_ball_think(), and napalm_fountain_think().

◆ napalm_fountain_think()

void napalm_fountain_think ( entity this)

Definition at line 103 of file napalm.qc.

104{
106 || time >= this.ltime)
107 {
108 delete(this);
109 return;
110 }
111
112 vector midpoint = (this.absmin + this.absmax) * 0.5;
113 if (pointcontents(midpoint) == CONTENT_WATER)
114 {
115 this.velocity *= 0.5;
116
117 if (pointcontents(midpoint + '0 0 16') == CONTENT_WATER)
118 this.velocity.z = 200;
119
121 }
122
125
126 this.nextthink = time + 0.1;
127 if (time >= this.nade_special_time)
128 {
130 nade_napalm_ball(this);
131 }
132}
float ltime
Definition net.qh:10
void UpdateCSQCProjectile(entity e)
float autocvar_g_nades_napalm_fountain_radius
Definition napalm.qh:15
float autocvar_g_nades_napalm_fountain_edgedamage
Definition napalm.qh:17
float autocvar_g_nades_napalm_fountain_delay
Definition napalm.qh:14
float nade_special_time
Definition sv_nades.qh:47

References absmax, absmin, autocvar_g_nades_napalm_burntime, autocvar_g_nades_napalm_fountain_damage, autocvar_g_nades_napalm_fountain_delay, autocvar_g_nades_napalm_fountain_edgedamage, autocvar_g_nades_napalm_fountain_radius, CONTENT_WATER, entity(), ltime, nade_napalm_ball(), nade_special_time, napalm_damage(), nextthink, round_handler_IsActive, round_handler_IsRoundStarted, time, UpdateCSQCProjectile(), vector, and velocity.

Referenced by nade_napalm_boom().