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

Go to the source code of this file.

Functions

void W_Fireball_Attack1 (entity actor,.entity weaponentity)
void W_Fireball_Attack1_Frame0 (Weapon thiswep, entity actor,.entity weaponentity, int fire)
void W_Fireball_Attack1_Frame1 (Weapon thiswep, entity actor,.entity weaponentity, int fire)
void W_Fireball_Attack1_Frame2 (Weapon thiswep, entity actor,.entity weaponentity, int fire)
void W_Fireball_Attack1_Frame3 (Weapon thiswep, entity actor,.entity weaponentity, int fire)
void W_Fireball_Attack1_Frame4 (Weapon thiswep, entity actor,.entity weaponentity, int fire)
void W_Fireball_Attack2 (entity actor,.entity weaponentity)
void W_Fireball_AttackEffect (entity actor,.entity weaponentity, float i, vector f_diff)
void W_Fireball_Damage (entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
void W_Fireball_Explode (entity this, entity directhitentity)
void W_Fireball_Explode_think (entity this)
void W_Fireball_Explode_use (entity this, entity actor, entity trigger)
void W_Fireball_Firemine_Think (entity this)
void W_Fireball_Firemine_Touch (entity this, entity toucher)
void W_Fireball_LaserPlay (entity this, float dt, float dist, float damage, float edgedamage, float burntime)
void W_Fireball_Think (entity this)
void W_Fireball_TouchExplode (entity this, entity toucher)

Variables

bool bot_primary_fireballmooth

Function Documentation

◆ W_Fireball_Attack1()

void W_Fireball_Attack1 ( entity actor,
.entity weaponentity )

Definition at line 156 of file fireball.qc.

157{
158 W_SetupShot_ProjectileSize(actor, weaponentity, '-16 -16 -16', '16 16 16', false, 2, SND_FIREBALL_FIRE2, CH_WEAPON_A, WEP_CVAR_PRI(WEP_FIREBALL, damage) + WEP_CVAR_PRI(WEP_FIREBALL, bfgdamage), WEP_FIREBALL.m_id);
159
160 W_MuzzleFlash(WEP_FIREBALL, actor, weaponentity, w_shotorg, w_shotdir);
161
162 entity proj = new(plasma_prim);
163 proj.owner = proj.realowner = actor;
164 proj.bot_dodge = true;
165 proj.bot_dodgerating = WEP_CVAR_PRI(WEP_FIREBALL, damage);
166 proj.pushltime = time + WEP_CVAR_PRI(WEP_FIREBALL, lifetime);
167 proj.use = W_Fireball_Explode_use;
169 proj.nextthink = time;
170 SetResourceExplicit(proj, RES_HEALTH, WEP_CVAR_PRI(WEP_FIREBALL, health));
171 proj.team = actor.team;
172 proj.event_damage = W_Fireball_Damage;
173 proj.takedamage = DAMAGE_YES;
174 proj.damageforcescale = WEP_CVAR_PRI(WEP_FIREBALL, damageforcescale);
176 proj.projectiledeathtype = WEP_FIREBALL.m_id;
177 proj.weaponentity_fld = weaponentity;
178 setorigin(proj, w_shotorg);
179
181 W_SetupProjVelocity_PRI(proj, WEP_FIREBALL);
182 proj.angles = vectoangles(proj.velocity);
184 setsize(proj, '-16 -16 -16', '16 16 16');
185 proj.flags = FL_PROJECTILE;
186 IL_PUSH(g_projectiles, proj);
187 IL_PUSH(g_bot_dodge, proj);
188 proj.missile_flags = MIF_SPLASH | MIF_PROXY;
189
190 CSQCProjectile(proj, true, PROJECTILE_FIREBALL, true);
191
192 MUTATOR_CALLHOOK(EditProjectile, actor, proj);
193}
IntrusiveList g_bot_dodge
Definition api.qh:150
#define MUTATOR_CALLHOOK(id,...)
Definition base.qh:143
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
float lifetime
Definition powerups.qc:23
const int FL_PROJECTILE
Definition constants.qh:85
float time
void CSQCProjectile(entity e, float clientanimate, int type, float docull)
float damageforcescale
void W_Fireball_Think(entity this)
Definition fireball.qc:126
void W_Fireball_Explode_use(entity this, entity actor, entity trigger)
Definition fireball.qc:78
void W_Fireball_TouchExplode(entity this, entity toucher)
Definition fireball.qc:83
void W_Fireball_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
Definition fireball.qc:141
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
vector vectoangles(vector v)
void set_movetype(entity this, int mt)
Definition movetypes.qc:4
const int MOVETYPE_FLY
Definition movetypes.qh:134
const int PROJECTILE_FIREBALL
float health
Legacy fields for the resources. To be removed.
Definition resources.qh:9
#define setthink(e, f)
#define settouch(e, f)
Definition self.qh:73
const int MIF_SPLASH
Definition common.qh:46
IntrusiveList g_projectiles
Definition common.qh:58
const int MIF_PROXY
Definition common.qh:48
#define PROJECTILE_MAKETRIGGER(e)
Definition common.qh:34
const int CH_WEAPON_A
Definition sound.qh:7
const int DAMAGE_YES
Definition subs.qh:80
vector w_shotdir
Definition tracing.qh:20
#define W_SetupShot_ProjectileSize(ent, wepent, mi, ma, antilag, recoil, snd, chan, maxdamage, deathtype)
Definition tracing.qh:30
#define W_SetupProjVelocity_PRI(ent, wep)
Definition tracing.qh:67
vector w_shotorg
Definition tracing.qh:19
void W_MuzzleFlash(Weapon thiswep, entity actor,.entity weaponentity, vector shotorg, vector shotdir)
Definition all.qc:715
#define WEP_CVAR_PRI(wep, name)
Definition all.qh:338

References CH_WEAPON_A, CSQCProjectile(), DAMAGE_YES, damageforcescale, entity(), FL_PROJECTILE, g_bot_dodge, g_projectiles, health, IL_PUSH(), lifetime, MIF_PROXY, MIF_SPLASH, MOVETYPE_FLY, MUTATOR_CALLHOOK, PROJECTILE_FIREBALL, PROJECTILE_MAKETRIGGER, set_movetype(), SetResourceExplicit(), setthink, settouch, time, vectoangles(), W_Fireball_Damage(), W_Fireball_Explode_use(), W_Fireball_Think(), W_Fireball_TouchExplode(), W_MuzzleFlash(), W_SetupProjVelocity_PRI, W_SetupShot_ProjectileSize, w_shotdir, w_shotorg, and WEP_CVAR_PRI.

Referenced by W_Fireball_Attack1_Frame4().

◆ W_Fireball_Attack1_Frame0()

void W_Fireball_Attack1_Frame0 ( Weapon thiswep,
entity actor,
.entity weaponentity,
int fire )

Definition at line 226 of file fireball.qc.

227{
228 W_Fireball_AttackEffect(actor, weaponentity, 0, '-1.25 -3.75 0');
229 sound(actor, CH_WEAPON_SINGLE, SND_FIREBALL_PREFIRE2, VOL_BASE, ATTEN_NORM);
230 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_FIREBALL, animtime), W_Fireball_Attack1_Frame1);
231}
void W_Fireball_Attack1_Frame1(Weapon thiswep, entity actor,.entity weaponentity, int fire)
Definition fireball.qc:220
void W_Fireball_AttackEffect(entity actor,.entity weaponentity, float i, vector f_diff)
Definition fireball.qc:195
const int CH_WEAPON_SINGLE
Definition sound.qh:9
const float VOL_BASE
Definition sound.qh:36
const float ATTEN_NORM
Definition sound.qh:30
#define sound(e, c, s, v, a)
Definition sound.qh:52
void weapon_thinkf(entity actor,.entity weaponentity, WFRAME fr, float t, void(Weapon thiswep, entity actor,.entity weaponentity, int fire) func)

References ATTEN_NORM, CH_WEAPON_SINGLE, entity(), sound, VOL_BASE, W_Fireball_Attack1_Frame1(), W_Fireball_AttackEffect(), weapon_thinkf(), and WEP_CVAR_PRI.

◆ W_Fireball_Attack1_Frame1()

void W_Fireball_Attack1_Frame1 ( Weapon thiswep,
entity actor,
.entity weaponentity,
int fire )

Definition at line 220 of file fireball.qc.

221{
222 W_Fireball_AttackEffect(actor, weaponentity, 1, '+1.25 -3.75 0');
223 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_FIREBALL, animtime), W_Fireball_Attack1_Frame2);
224}
void W_Fireball_Attack1_Frame2(Weapon thiswep, entity actor,.entity weaponentity, int fire)
Definition fireball.qc:214

References entity(), W_Fireball_Attack1_Frame2(), W_Fireball_AttackEffect(), weapon_thinkf(), and WEP_CVAR_PRI.

Referenced by W_Fireball_Attack1_Frame0().

◆ W_Fireball_Attack1_Frame2()

void W_Fireball_Attack1_Frame2 ( Weapon thiswep,
entity actor,
.entity weaponentity,
int fire )

Definition at line 214 of file fireball.qc.

215{
216 W_Fireball_AttackEffect(actor, weaponentity, 0, '-1.25 +3.75 0');
217 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_FIREBALL, animtime), W_Fireball_Attack1_Frame3);
218}
void W_Fireball_Attack1_Frame3(Weapon thiswep, entity actor,.entity weaponentity, int fire)
Definition fireball.qc:208

References entity(), W_Fireball_Attack1_Frame3(), W_Fireball_AttackEffect(), weapon_thinkf(), and WEP_CVAR_PRI.

Referenced by W_Fireball_Attack1_Frame1().

◆ W_Fireball_Attack1_Frame3()

void W_Fireball_Attack1_Frame3 ( Weapon thiswep,
entity actor,
.entity weaponentity,
int fire )

Definition at line 208 of file fireball.qc.

209{
210 W_Fireball_AttackEffect(actor, weaponentity, 0, '+1.25 +3.75 0');
211 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_FIREBALL, animtime), W_Fireball_Attack1_Frame4);
212}
void W_Fireball_Attack1_Frame4(Weapon thiswep, entity actor,.entity weaponentity, int fire)
Definition fireball.qc:202

References entity(), W_Fireball_Attack1_Frame4(), W_Fireball_AttackEffect(), weapon_thinkf(), and WEP_CVAR_PRI.

Referenced by W_Fireball_Attack1_Frame2().

◆ W_Fireball_Attack1_Frame4()

void W_Fireball_Attack1_Frame4 ( Weapon thiswep,
entity actor,
.entity weaponentity,
int fire )

Definition at line 202 of file fireball.qc.

203{
204 W_Fireball_Attack1(actor, weaponentity);
205 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_FIREBALL, animtime), w_ready);
206}
void W_Fireball_Attack1(entity actor,.entity weaponentity)
Definition fireball.qc:156
void w_ready(Weapon thiswep, entity actor,.entity weaponentity, int fire)

References entity(), W_Fireball_Attack1(), w_ready(), weapon_thinkf(), and WEP_CVAR_PRI.

Referenced by W_Fireball_Attack1_Frame3().

◆ W_Fireball_Attack2()

void W_Fireball_Attack2 ( entity actor,
.entity weaponentity )

Definition at line 271 of file fireball.qc.

272{
273 vector f_diff;
274
275 float c = actor.(weaponentity).bulletcounter % 4;
276 switch (c)
277 {
278 case 0:
279 f_diff = '-1.25 -3.75 0';
280 break;
281 case 1:
282 f_diff = '+1.25 -3.75 0';
283 break;
284 case 2:
285 f_diff = '-1.25 +3.75 0';
286 break;
287 case 3:
288 default:
289 f_diff = '+1.25 +3.75 0';
290 break;
291 }
292 W_SetupShot_ProjectileSize(actor, weaponentity, '-4 -4 -4', '4 4 4', false, 2, SND_FIREBALL_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(WEP_FIREBALL, damage), WEP_FIREBALL.m_id | HITTYPE_SECONDARY);
293 traceline(w_shotorg, w_shotorg + f_diff.x * v_up + f_diff.y * v_right, MOVE_NORMAL, actor);
295
296 W_MuzzleFlash(WEP_FIREBALL, actor, weaponentity, w_shotorg, w_shotdir);
297
298 entity proj = new(grenade);
299 proj.owner = proj.realowner = actor;
300 proj.bot_dodge = true;
301 proj.bot_dodgerating = WEP_CVAR_SEC(WEP_FIREBALL, damage);
303 proj.projectiledeathtype = WEP_FIREBALL.m_id | HITTYPE_SECONDARY;
306 setsize(proj, '-4 -4 -4', '4 4 4');
307 setorigin(proj, w_shotorg);
309 proj.nextthink = time;
310 proj.damageforcescale = WEP_CVAR_SEC(WEP_FIREBALL, damageforcescale);
311 proj.pushltime = time + WEP_CVAR_SEC(WEP_FIREBALL, lifetime);
312 W_SetupProjVelocity_UP_SEC(proj, WEP_FIREBALL);
313
314 proj.angles = vectoangles(proj.velocity);
315 proj.flags = FL_PROJECTILE;
316 IL_PUSH(g_projectiles, proj);
317 IL_PUSH(g_bot_dodge, proj);
318 proj.missile_flags = MIF_SPLASH | MIF_PROXY | MIF_ARC;
319
320 CSQCProjectile(proj, true, PROJECTILE_FIREMINE, true);
321
322 MUTATOR_CALLHOOK(EditProjectile, actor, proj);
323}
vector v_up
const float MOVE_NORMAL
vector v_right
vector trace_endpos
const int HITTYPE_SECONDARY
Definition all.qh:29
void W_Fireball_Firemine_Touch(entity this, entity toucher)
Definition fireball.qc:259
void W_Fireball_Firemine_Think(entity this)
Definition fireball.qc:233
const int MOVETYPE_BOUNCE
Definition movetypes.qh:139
const int PROJECTILE_FIREMINE
vector
Definition self.qh:92
const int MIF_ARC
Definition common.qh:47
#define W_SetupProjVelocity_UP_SEC(ent, wep)
Definition tracing.qh:56
#define WEP_CVAR_SEC(wep, name)
Definition all.qh:339
float bulletcounter

References bulletcounter, CH_WEAPON_A, CSQCProjectile(), damageforcescale, entity(), FL_PROJECTILE, g_bot_dodge, g_projectiles, HITTYPE_SECONDARY, IL_PUSH(), lifetime, MIF_ARC, MIF_PROXY, MIF_SPLASH, MOVE_NORMAL, MOVETYPE_BOUNCE, MUTATOR_CALLHOOK, PROJECTILE_FIREMINE, PROJECTILE_MAKETRIGGER, set_movetype(), setthink, settouch, time, trace_endpos, v_right, v_up, vectoangles(), vector, W_Fireball_Firemine_Think(), W_Fireball_Firemine_Touch(), W_MuzzleFlash(), W_SetupProjVelocity_UP_SEC, W_SetupShot_ProjectileSize, w_shotdir, w_shotorg, and WEP_CVAR_SEC.

◆ W_Fireball_AttackEffect()

void W_Fireball_AttackEffect ( entity actor,
.entity weaponentity,
float i,
vector f_diff )

Definition at line 195 of file fireball.qc.

196{
197 W_SetupShot_ProjectileSize(actor, weaponentity, '-16 -16 -16', '16 16 16', false, 0, SND_Null, 0, 0, WEP_FIREBALL.m_id); // TODO: probably doesn't need deathtype, just a prefire effect
198 w_shotorg += f_diff.x * v_up + f_diff.y * v_right;
199 Send_Effect(EFFECT_FIREBALL_PRE_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
200}
void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
Definition all.qc:120

References entity(), Send_Effect(), v_right, v_up, vector, W_SetupShot_ProjectileSize, w_shotdir, and w_shotorg.

Referenced by W_Fireball_Attack1_Frame0(), W_Fireball_Attack1_Frame1(), W_Fireball_Attack1_Frame2(), and W_Fireball_Attack1_Frame3().

◆ W_Fireball_Damage()

void W_Fireball_Damage ( entity this,
entity inflictor,
entity attacker,
float damage,
int deathtype,
.entity weaponentity,
vector hitloc,
vector force )

Definition at line 141 of file fireball.qc.

142{
143 if (GetResource(this, RES_HEALTH) <= 0)
144 return;
145 if (!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
146 return; // g_projectiles_damage says to halt
147
148 TakeResource(this, RES_HEALTH, damage);
149 if (GetResource(this, RES_HEALTH) <= 0)
150 {
151 this.cnt = 1;
153 }
154}
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
void TakeResource(entity receiver, Resource res_type, float amount)
Takes an entity some resource.
float cnt
Definition powerups.qc:24
void W_Fireball_Explode_think(entity this)
Definition fireball.qc:73
float W_CheckProjectileDamage(entity inflictor, entity projowner, int deathtype, float exception)
Definition common.qc:45
void W_PrepareExplosionByDamage(entity this, entity attacker, void(entity this) explode)
Definition common.qc:87

References cnt, entity(), GetResource(), TakeResource(), vector, W_CheckProjectileDamage(), W_Fireball_Explode_think(), and W_PrepareExplosionByDamage().

Referenced by W_Fireball_Attack1().

◆ W_Fireball_Explode()

void W_Fireball_Explode ( entity this,
entity directhitentity )

Definition at line 5 of file fireball.qc.

6{
7 this.event_damage = func_null;
9
10 // 1. dist damage
11 float d = GetResource(this.realowner, RES_HEALTH) + GetResource(this.realowner, RES_ARMOR);
12
13 RadiusDamage(this, this.realowner,
14 WEP_CVAR_PRI(WEP_FIREBALL, damage),
15 WEP_CVAR_PRI(WEP_FIREBALL, edgedamage),
16 WEP_CVAR_PRI(WEP_FIREBALL, radius),
17 NULL,
18 NULL,
19 WEP_CVAR_PRI(WEP_FIREBALL, force),
21 this.weaponentity_fld, directhitentity
22 );
23
24 if (GetResource(this.realowner, RES_HEALTH) + GetResource(this.realowner, RES_ARMOR) >= d
25 && !this.cnt)
26 {
27 float dist;
28 float points;
29 vector dir;
30
31 modeleffect_spawn("models/sphere/sphere.md3", 0, 0, this.origin, '0 0 0', '0 0 0', '0 0 0', 0, WEP_CVAR_PRI(WEP_FIREBALL, bfgradius), 0.2, 0.05, 0.25);
32
33 // 2. bfg effect
34 // NOTE: this cannot be made warpzone aware by design. So, better intentionally ignore warpzones here.
35 for (entity e = findradius(this.origin, WEP_CVAR_PRI(WEP_FIREBALL, bfgradius)); e; e = e.chain)
36 if (e != this.realowner && e.takedamage == DAMAGE_AIM && !IS_INDEPENDENT_PLAYER(e)
37 && (!IS_PLAYER(e) || !this.realowner || DIFF_TEAM(e, this)))
38 {
39
40 // can we see fireball?
41 traceline(e.origin + e.view_ofs, this.origin, MOVE_NORMAL, e);
42 if (/* trace_startsolid || */ trace_fraction != 1) // startsolid should be never happening anyway
43 continue;
44 // can we see player who shot fireball?
45 traceline(e.origin + e.view_ofs, this.realowner.origin + this.realowner.view_ofs, MOVE_NORMAL, e);
46 if (trace_ent != this.realowner)
47 if (/* trace_startsolid || */ trace_fraction != 1)
48 continue;
49 dist = vlen(this.origin - e.origin - e.view_ofs);
50 points = 1 - sqrt(dist / WEP_CVAR_PRI(WEP_FIREBALL, bfgradius));
51 if (points <= 0)
52 continue;
53 dir = normalize(e.origin + e.view_ofs - this.origin);
54
56 accuracy_add(this.realowner, WEP_FIREBALL, 0, WEP_CVAR_PRI(WEP_FIREBALL, bfgdamage) * points, 0); // add to hit
57
58 Damage(e, this, this.realowner,
59 WEP_CVAR_PRI(WEP_FIREBALL, bfgdamage) * points,
62 e.origin + e.view_ofs,
63 WEP_CVAR_PRI(WEP_FIREBALL, bfgforce) * dir
64 );
65
66 Send_Effect(EFFECT_FIREBALL_BFGDAMAGE, e.origin, -dir, 1);
67 }
68 }
69
70 delete(this);
71}
void accuracy_add(entity this, Weapon w, float fired, float hit, float real)
update accuracy stats
Definition accuracy.qc:102
bool accuracy_isgooddamage(entity attacker, entity targ)
does this damage count towards accuracy stats?
Definition accuracy.qc:133
float radius
Definition impulse.qh:11
#define IS_PLAYER(s)
Definition player.qh:242
entity trace_ent
vector origin
float trace_fraction
void Damage(entity targ, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
Definition damage.qc:493
float RadiusDamage(entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype,.entity weaponentity, entity directhitentity)
Definition damage.qc:943
const int HITTYPE_BOUNCE
Definition all.qh:31
const int HITTYPE_SPLASH
Definition all.qh:30
RES_ARMOR
Definition ent_cs.qc:130
float vlen(vector v)
float sqrt(float f)
vector normalize(vector v)
void modeleffect_spawn(string m, float s, float f, vector o, vector v, vector ang, vector angv, float s0, float s2, float a, float t1, float t2)
var void func_null()
#define NULL
Definition post.qh:14
#define IS_INDEPENDENT_PLAYER(e)
Definition client.qh:312
int dir
Definition impulse.qc:89
int projectiledeathtype
Definition common.qh:21
const int DAMAGE_NO
Definition subs.qh:79
const int DAMAGE_AIM
Definition subs.qh:81
float takedamage
Definition subs.qh:78
#define DIFF_TEAM(a, b)
Definition teams.qh:242
entity realowner
entity weaponentity_fld

References accuracy_add(), accuracy_isgooddamage(), cnt, Damage(), DAMAGE_AIM, DAMAGE_NO, DIFF_TEAM, dir, entity(), func_null(), GetResource(), HITTYPE_BOUNCE, HITTYPE_SPLASH, IS_INDEPENDENT_PLAYER, IS_PLAYER, modeleffect_spawn(), MOVE_NORMAL, normalize(), NULL, origin, projectiledeathtype, radius, RadiusDamage(), realowner, RES_ARMOR, Send_Effect(), sqrt(), takedamage, trace_ent, trace_fraction, vector, vlen(), weaponentity_fld, and WEP_CVAR_PRI.

Referenced by W_Fireball_Explode_think(), W_Fireball_Explode_use(), W_Fireball_Think(), and W_Fireball_TouchExplode().

◆ W_Fireball_Explode_think()

void W_Fireball_Explode_think ( entity this)

Definition at line 73 of file fireball.qc.

74{
76}
void W_Fireball_Explode(entity this, entity directhitentity)
Definition fireball.qc:5

References entity(), NULL, and W_Fireball_Explode().

Referenced by W_Fireball_Damage().

◆ W_Fireball_Explode_use()

void W_Fireball_Explode_use ( entity this,
entity actor,
entity trigger )

Definition at line 78 of file fireball.qc.

79{
80 W_Fireball_Explode(this, trigger);
81}

References entity(), and W_Fireball_Explode().

Referenced by W_Fireball_Attack1().

◆ W_Fireball_Firemine_Think()

void W_Fireball_Firemine_Think ( entity this)

Definition at line 233 of file fireball.qc.

234{
235 if (time > this.pushltime)
236 {
237 delete(this);
238 return;
239 }
240
241 // make it "hot" once it leaves its owner
242 if (this.owner)
243 {
244 if (vdist(this.origin - this.owner.origin - this.owner.view_ofs, >, WEP_CVAR_SEC(WEP_FIREBALL, laserradius)))
245 {
246 ++this.cnt;
247 if (this.cnt == 3)
248 this.owner = NULL;
249 }
250 else
251 this.cnt = 0;
252 }
253
254 W_Fireball_LaserPlay(this, 0.1, WEP_CVAR_SEC(WEP_FIREBALL, laserradius), WEP_CVAR_SEC(WEP_FIREBALL, laserdamage), WEP_CVAR_SEC(WEP_FIREBALL, laseredgedamage), WEP_CVAR_SEC(WEP_FIREBALL, laserburntime));
255
256 this.nextthink = time + 0.1;
257}
entity owner
Definition main.qh:87
float nextthink
void W_Fireball_LaserPlay(entity this, float dt, float dist, float damage, float edgedamage, float burntime)
Definition fireball.qc:89
float pushltime
Definition jumppads.qh:21
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
Definition vector.qh:8

References cnt, entity(), nextthink, NULL, origin, owner, pushltime, time, vdist, W_Fireball_LaserPlay(), and WEP_CVAR_SEC.

Referenced by W_Fireball_Attack2().

◆ W_Fireball_Firemine_Touch()

void W_Fireball_Firemine_Touch ( entity this,
entity toucher )

Definition at line 259 of file fireball.qc.

260{
262 if (toucher.takedamage == DAMAGE_AIM
263 && Fire_AddDamage(toucher, this.realowner, WEP_CVAR_SEC(WEP_FIREBALL, damage), WEP_CVAR_SEC(WEP_FIREBALL, damagetime), this.projectiledeathtype) >= 0)
264 {
265 delete(this);
266 return;
267 }
269}
float Fire_AddDamage(entity e, entity o, float d, float t, float dt)
Definition damage.qc:974
entity entity toucher
Definition self.qh:72
#define PROJECTILE_TOUCH(e, t)
Definition common.qh:28

References DAMAGE_AIM, entity(), Fire_AddDamage(), HITTYPE_BOUNCE, PROJECTILE_TOUCH, projectiledeathtype, realowner, toucher, and WEP_CVAR_SEC.

Referenced by W_Fireball_Attack2().

◆ W_Fireball_LaserPlay()

void W_Fireball_LaserPlay ( entity this,
float dt,
float dist,
float damage,
float edgedamage,
float burntime )

Definition at line 89 of file fireball.qc.

90{
91 if (damage <= 0)
92 return;
93
95 vector p;
96 float d;
97 for (entity e = WarpZone_FindRadius(this.origin, dist, true); e; e = e.chain)
98 {
99 if (STAT(FROZEN, e) || StatusEffects_active(STATUSEFFECT_Frozen, e)
100 || e == this.realowner || IS_INDEPENDENT_PLAYER(e)
101 || e.takedamage != DAMAGE_AIM
102 || (IS_PLAYER(e) && this.realowner && SAME_TEAM(e, this)))
103 continue;
104
105 p = e.origin;
106 p.x += e.mins.x + random() * (e.maxs.x - e.mins.x);
107 p.y += e.mins.y + random() * (e.maxs.y - e.mins.y);
108 p.z += e.mins.z + random() * (e.maxs.z - e.mins.z);
109 d = vlen(WarpZone_UnTransformOrigin(e, this.origin) - p);
110 if (d < dist)
111 {
112 e.fireball_impactvec = p;
113 RandomSelection_AddEnt(e, 1 / (1 + d), !StatusEffects_active(STATUSEFFECT_Burning, e));
114 }
115 }
117 {
119 d = damage + (edgedamage - damage) * (d / dist);
121 //trailparticles(this, particleeffectnum(EFFECT_FIREBALL_LASER), this.origin, RandomSelection_chosen_ent.fireball_impactvec);
122 Send_Effect(EFFECT_FIREBALL_LASER, this.origin, RandomSelection_chosen_ent.fireball_impactvec - this.origin, 1);
123 }
124}
#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 random(void)
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
bool StatusEffects_active(StatusEffect this, entity actor)
#define SAME_TEAM(a, b)
Definition teams.qh:241

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

Referenced by W_Fireball_Firemine_Think(), and W_Fireball_Think().

◆ W_Fireball_Think()

void W_Fireball_Think ( entity this)

Definition at line 126 of file fireball.qc.

127{
128 if (time > this.pushltime)
129 {
130 this.cnt = 1;
133 return;
134 }
135
136 W_Fireball_LaserPlay(this, 0.1, WEP_CVAR_PRI(WEP_FIREBALL, laserradius), WEP_CVAR_PRI(WEP_FIREBALL, laserdamage), WEP_CVAR_PRI(WEP_FIREBALL, laseredgedamage), WEP_CVAR_PRI(WEP_FIREBALL, laserburntime));
137
138 this.nextthink = time + 0.1;
139}

References cnt, entity(), HITTYPE_SPLASH, nextthink, NULL, projectiledeathtype, pushltime, time, W_Fireball_Explode(), W_Fireball_LaserPlay(), and WEP_CVAR_PRI.

Referenced by W_Fireball_Attack1().

◆ W_Fireball_TouchExplode()

void W_Fireball_TouchExplode ( entity this,
entity toucher )

Definition at line 83 of file fireball.qc.

84{
87}

References entity(), PROJECTILE_TOUCH, toucher, and W_Fireball_Explode().

Referenced by W_Fireball_Attack1().

Variable Documentation

◆ bot_primary_fireballmooth

bool bot_primary_fireballmooth

Definition at line 325 of file fireball.qc.