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
4void napalm_damage(entity this, float dist, float damage, float edgedamage, float burntime)
5{
6 entity e;
7 float d;
8 vector p;
9
10 if ( damage < 0 )
11 return;
12
14 for(e = WarpZone_FindRadius(this.origin, dist, true); e; e = e.chain)
15 if(e.takedamage == DAMAGE_AIM)
17 if(!IS_PLAYER(e) || !this.realowner || DIFF_TEAM(e, this))
18 if(!STAT(FROZEN, e))
19 {
20 p = e.origin;
21 p.x += e.mins.x + random() * (e.maxs.x - e.mins.x);
22 p.y += e.mins.y + random() * (e.maxs.y - e.mins.y);
23 p.z += e.mins.z + random() * (e.maxs.z - e.mins.z);
24 d = vlen(WarpZone_UnTransformOrigin(e, this.origin) - p);
25 if(d < dist)
26 {
27 e.fireball_impactvec = p;
28 RandomSelection_AddEnt(e, 1 / (1 + d), !StatusEffects_active(STATUSEFFECT_Burning, e));
29 }
30 }
32 {
34 d = damage + (edgedamage - damage) * (d / dist);
36 //trailparticles(this, particleeffectnum(EFFECT_FIREBALL_LASER), this.origin, RandomSelection_chosen_ent.fireball_impactvec);
37 Send_Effect(EFFECT_FIREBALL_LASER, this.origin, RandomSelection_chosen_ent.fireball_impactvec - this.origin, 1);
38 }
39}
40
42{
45 {
46 delete(this);
47 return;
48 }
49
50 if(time > this.pushltime)
51 {
52 delete(this);
53 return;
54 }
55
56 vector midpoint = ((this.absmin + this.absmax) * 0.5);
57 if(pointcontents(midpoint) == CONTENT_WATER)
58 {
59 this.velocity = this.velocity * 0.5;
60
61 if(pointcontents(midpoint + '0 0 16') == CONTENT_WATER)
62 { this.velocity_z = 200; }
63 }
64
65 this.angles = vectoangles(this.velocity);
66
69
70 this.nextthink = time + 0.1;
71}
72
74{
75 entity proj;
76 vector kick;
77
79
80 proj = new(grenade);
81 proj.owner = this.owner;
82 proj.realowner = this.realowner;
83 proj.team = this.owner.team;
84 proj.bot_dodge = true;
85 proj.bot_dodgerating = autocvar_g_nades_napalm_ball_damage;
87 proj.projectiledeathtype = DEATH_NADE_NAPALM.m_id;
89 setmodel(proj, MDL_Null);
90 proj.scale = 1;//0.5;
91 setsize(proj, '-4 -4 -4', '4 4 4');
92 setorigin(proj, this.origin);
94 proj.nextthink = time;
96 proj.effects = EF_LOWPRECISION | EF_FLAME;
97
98 kick.x =(random() - 0.5) * 2 * autocvar_g_nades_napalm_ball_spread;
99 kick.y = (random() - 0.5) * 2 * autocvar_g_nades_napalm_ball_spread;
100 kick.z = (random()/2+0.5) * autocvar_g_nades_napalm_ball_spread;
101 proj.velocity = kick;
102
104
105 proj.angles = vectoangles(proj.velocity);
106 proj.flags = FL_PROJECTILE;
107 IL_PUSH(g_projectiles, proj);
108 IL_PUSH(g_bot_dodge, proj);
109 proj.missile_flags = MIF_SPLASH | MIF_PROXY | MIF_ARC;
110
111 //CSQCProjectile(proj, true, PROJECTILE_NAPALM_FIRE, true);
112}
113
115{
116
119 {
120 delete(this);
121 return;
122 }
123
124 if(time >= this.ltime)
125 {
126 delete(this);
127 return;
128 }
129
130 vector midpoint = ((this.absmin + this.absmax) * 0.5);
131 if(pointcontents(midpoint) == CONTENT_WATER)
132 {
133 this.velocity = this.velocity * 0.5;
134
135 if(pointcontents(midpoint + '0 0 16') == CONTENT_WATER)
136 { this.velocity_z = 200; }
137
139 }
140
143
144 this.nextthink = time + 0.1;
145 if(time >= this.nade_special_time)
146 {
148 nade_napalm_ball(this);
149 }
150}
151
153{
154 for (int c = 0; c < autocvar_g_nades_napalm_ball_count; ++c)
155 nade_napalm_ball(this);
156
157 entity fountain = new(nade_napalm_fountain);
158 fountain.owner = this.owner;
159 fountain.realowner = this.realowner;
160 fountain.origin = this.origin;
161 fountain.flags = FL_PROJECTILE;
162 IL_PUSH(g_projectiles, fountain);
163 IL_PUSH(g_bot_dodge, fountain);
164 setorigin(fountain, fountain.origin);
166 fountain.nextthink = time;
168 fountain.pushltime = fountain.ltime;
169 fountain.team = this.team;
170 set_movetype(fountain, MOVETYPE_TOSS);
171 fountain.projectiledeathtype = DEATH_NADE_NAPALM.m_id;
172 fountain.bot_dodge = true;
173 fountain.bot_dodgerating = autocvar_g_nades_napalm_fountain_damage;
174 fountain.nade_special_time = time;
175 setsize(fountain, '-16 -16 -16', '16 16 16');
176 CSQCProjectile(fountain, true, PROJECTILE_NAPALM_FOUNTAIN, true);
177}
178#endif // SVQC
179#ifdef MENUQC
180METHOD(NapalmNade, describe, string(NapalmNade this))
181{
182 TC(NapalmNade, this);
184 PAR(_("The %s detonates after a short delay, spreading fiery napalm globs around in a fountain. "
185 "The napalm fire balls burn for a while, and damage players who get too close."), COLORED_NAME(this));
186 return PAGE_TEXT;
187}
188#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:195
#define setmodel(this, m)
Definition model.qh:26
#define IS_PLAYER(s)
Definition player.qh:243
const int FL_PROJECTILE
Definition constants.qh:85
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 Fire_AddDamage(entity e, entity o, float d, float t, float dt)
Definition damage.qc:1002
float EF_LOWPRECISION
void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
Definition all.qc:124
ent angles
Definition ent_cs.qc:121
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:82
entity WarpZone_FindRadius(vector org, float rad, bool needlineofsight)
Definition common.qc:686
vector WarpZone_UnTransformOrigin(entity wz, vector v)
Definition common.qc:545
float random(void)
float vlen(vector v)
vector vectoangles(vector v)
void set_movetype(entity this, int mt)
Definition movetypes.qc:4
const int MOVETYPE_TOSS
Definition movetypes.qh:135
const int MOVETYPE_BOUNCE
Definition movetypes.qh:139
void nade_napalm_boom(entity this)
Definition napalm.qc:152
void napalm_fountain_think(entity this)
Definition napalm.qc:114
void napalm_damage(entity this, float dist, float damage, float edgedamage, float burntime)
Definition napalm.qc:4
void nade_napalm_ball(entity this)
Definition napalm.qc:73
void napalm_ball_think(entity this)
Definition napalm.qc:41
const int PROJECTILE_NAPALM_FOUNTAIN
Definition napalm.qh:26
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
float ltime
Definition net.qc:10
#define METHOD(cname, name, prototype)
Definition oo.qh:269
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
#define round_handler_IsActive()
#define round_handler_IsRoundStarted()
#define setthink(e, f)
vector
Definition self.qh:92
const int MIF_SPLASH
Definition common.qh:46
int projectiledeathtype
Definition common.qh:21
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
bool StatusEffects_active(StatusEffect this, entity actor)
#define PAGE_TEXT
Definition string.qh:643
#define PAR(...)
Adds an individually translatable paragraph to PAGE_TEXT without having to deal with strcat and sprin...
Definition string.qh:649
#define PAGE_TEXT_INIT()
Definition string.qh:642
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