Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
napalm.qc
Go to the documentation of this file.
1#include "napalm.qh"
2
3#ifdef SVQC
5{
6 return (e.takedamage == DAMAGE_AIM
9 && !STAT(FROZEN, e));
10}
11
13{
15 || time > this.pushltime)
16 {
17 delete(this);
18 return;
19 }
20
21 vector midpoint = (this.absmin + this.absmax) * 0.5;
22 if (pointcontents(midpoint) == CONTENT_WATER)
23 {
24 this.velocity *= 0.5;
25
26 if (pointcontents(midpoint + '0 0 16') == CONTENT_WATER)
27 this.velocity.z = 200;
28 }
29
30 this.angles = vectoangles(this.velocity);
31
32 W_LaserPlay(this,
35 autocvar_g_nades_napalm_ball_damage, // TODO: missing cvar
38
39 this.nextthink = time + 0.1;
40}
41
43{
45
46 entity proj = new(grenade);
47 proj.owner = this.owner;
48 proj.realowner = this.realowner;
49 proj.team = this.owner.team;
50 proj.bot_dodge = true;
51 proj.bot_dodgerating = autocvar_g_nades_napalm_ball_damage;
53 proj.projectiledeathtype = DEATH_NADE_NAPALM.m_id;
55 setmodel(proj, MDL_Null);
56 proj.scale = 1;//0.5;
57 setsize(proj, '-4 -4 -4', '4 4 4');
58 setorigin(proj, this.origin);
60 proj.nextthink = time;
62 proj.effects = EF_LOWPRECISION | EF_FLAME;
63
64 vector kick;
67 kick.z = autocvar_g_nades_napalm_ball_spread * (random() * 0.5 + 0.5);
68 proj.velocity = kick;
69
71
72 proj.angles = vectoangles(proj.velocity);
73 proj.flags = FL_PROJECTILE;
75 IL_PUSH(g_bot_dodge, proj);
76 proj.missile_flags = MIF_SPLASH | MIF_PROXY | MIF_ARC;
77
78 //CSQCProjectile(proj, true, PROJECTILE_NAPALM_FIRE, true);
79}
80
82{
84 || time >= this.ltime)
85 {
86 delete(this);
87 return;
88 }
89
90 vector midpoint = (this.absmin + this.absmax) * 0.5;
91 if (pointcontents(midpoint) == CONTENT_WATER)
92 {
93 this.velocity *= 0.5;
94
95 if (pointcontents(midpoint + '0 0 16') == CONTENT_WATER)
96 this.velocity.z = 200;
97
99 }
100
101 W_LaserPlay(this,
107
108 this.nextthink = time + 0.1;
109 if (time >= this.nade_special_time)
110 {
112 nade_napalm_ball(this);
113 }
114}
115
117{
118 for (int c = 0; c < autocvar_g_nades_napalm_ball_count; ++c)
119 nade_napalm_ball(this);
120
121 entity fountain = new(nade_napalm_fountain);
122 fountain.owner = this.owner;
123 fountain.realowner = this.realowner;
124 fountain.origin = this.origin;
125 fountain.flags = FL_PROJECTILE;
126 IL_PUSH(g_projectiles, fountain);
127 IL_PUSH(g_bot_dodge, fountain);
128 setorigin(fountain, fountain.origin);
130 fountain.nextthink = time;
132 fountain.pushltime = fountain.ltime;
133 fountain.team = this.team;
134 set_movetype(fountain, MOVETYPE_TOSS);
135 fountain.projectiledeathtype = DEATH_NADE_NAPALM.m_id;
136 fountain.bot_dodge = true;
137 fountain.bot_dodgerating = autocvar_g_nades_napalm_fountain_damage;
138 fountain.nade_special_time = time;
139 setsize(fountain, '-16 -16 -16', '16 16 16');
140 CSQCProjectile(fountain, true, PROJECTILE_NAPALM_FOUNTAIN, true);
141}
142#endif // SVQC
143#ifdef MENUQC
144METHOD(NapalmNade, describe, string(NapalmNade this))
145{
146 TC(NapalmNade, this);
148 PAR(_("The %s detonates after a short delay, spreading fiery napalm globs around in a fountain. "
149 "The napalm fire balls burn for a while, and damage players who get too close."), COLORED_NAME(this));
150 return PAGE_TEXT;
151}
152#endif // MENUQC
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
int team
Definition main.qh:188
#define COLORED_NAME(this)
Definition color.qh:189
#define setmodel(this, m)
Definition model.qh:26
float ltime
Definition net.qh:10
#define IS_PLAYER(s)
Definition player.qh:242
const int FL_PROJECTILE
Definition constants.qh:77
vector velocity
const float CONTENT_WATER
float time
const float EF_FLAME
float nextthink
vector absmax
vector origin
vector absmin
void UpdateCSQCProjectile(entity e)
void CSQCProjectile(entity e, float clientanimate, int type, float docull)
float EF_LOWPRECISION
ent angles
Definition ent_cs.qc:146
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
float pushltime
Definition jumppads.qh:21
#define TC(T, sym)
Definition _all.inc:82
#define STAT(...)
Definition stats.qh:94
noref entity WarpZone_SearchInRadius_otherent
Free to use in the callback.
Definition common.qh:71
float random(void)
vector vectoangles(vector v)
void set_movetype(entity this, int mt)
Definition movetypes.qc:4
const int MOVETYPE_TOSS
Definition movetypes.qh:139
const int MOVETYPE_BOUNCE
Definition movetypes.qh:143
void nade_napalm_boom(entity this)
Definition napalm.qc:116
void napalm_fountain_think(entity this)
Definition napalm.qc:81
void nade_napalm_ball(entity this)
Definition napalm.qc:42
bool napalm_damage_cond(entity e)
Definition napalm.qc:4
void napalm_ball_think(entity this)
Definition napalm.qc:12
const int PROJECTILE_NAPALM_FOUNTAIN
Definition napalm.qh:27
float autocvar_g_nades_napalm_fountain_lifetime
Definition napalm.qh:13
float autocvar_g_nades_napalm_ball_damage
Definition napalm.qh:9
float autocvar_g_nades_napalm_fountain_radius
Definition napalm.qh:15
float autocvar_g_nades_napalm_ball_damageforcescale
Definition napalm.qh:10
int autocvar_g_nades_napalm_ball_count
Definition napalm.qh:7
float autocvar_g_nades_napalm_ball_lifetime
Definition napalm.qh:11
float autocvar_g_nades_napalm_fountain_edgedamage
Definition napalm.qh:17
float autocvar_g_nades_napalm_burntime
Definition napalm.qh:18
bool autocvar_g_nades_napalm_selfdamage
Definition napalm.qh:19
float autocvar_g_nades_napalm_fountain_delay
Definition napalm.qh:14
float autocvar_g_nades_napalm_ball_spread
Definition napalm.qh:8
float autocvar_g_nades_napalm_ball_radius
Definition napalm.qh:12
float autocvar_g_nades_napalm_fountain_damage
Definition napalm.qh:16
#define METHOD(cname, name, prototype)
Definition oo.qh:274
#define crandom()
Returns a random number between -1.0 and 1.0.
Definition random.qh:32
#define round_handler_IsActive()
#define round_handler_IsRoundStarted()
#define setthink(e, f)
vector
Definition self.qh:96
void W_LaserPlay(entity this, float rad, float damage, float edgedamage, float burntime, WarpZone_FindRadius_cond_callback_t cb)
Randomly chooses a player within the radius to shoot a laser towards.
Definition common.qc:191
const int MIF_SPLASH
Definition common.qh:58
IntrusiveList g_projectiles
Definition common.qh:70
const int MIF_PROXY
Definition common.qh:60
const int MIF_ARC
Definition common.qh:59
#define PROJECTILE_MAKETRIGGER(e)
Definition common.qh:46
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
#define PAGE_TEXT
Definition string.qh:651
#define PAR(...)
Adds an individually translatable paragraph to PAGE_TEXT without having to deal with strcat and sprin...
Definition string.qh:657
#define PAGE_TEXT_INIT()
Definition string.qh:650
const int DAMAGE_AIM
Definition subs.qh:81
float nade_special_time
Definition sv_nades.qh:47
#define DIFF_TEAM(a, b)
Definition teams.qh:242
entity realowner