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 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}
37
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}
63
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}
102
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}
133
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}
160#endif // SVQC
161#ifdef MENUQC
162METHOD(NapalmNade, describe, string(NapalmNade this))
163{
164 TC(NapalmNade, this);
166 PAR(_("The %s detonates after a short delay, spreading fiery napalm globs around in a fountain. "
167 "The napalm fire balls burn for a while, and damage players who get too close."), COLORED_NAME(this));
168 return PAGE_TEXT;
169}
170#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
float ltime
Definition net.qh:10
#define IS_PLAYER(s)
Definition player.qh:242
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:974
float EF_LOWPRECISION
void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
Definition all.qc:120
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:684
vector WarpZone_UnTransformOrigin(entity wz, vector v)
Definition common.qc:544
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:134
void napalm_fountain_think(entity this)
Definition napalm.qc:103
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:64
void napalm_ball_think(entity this)
Definition napalm.qc:38
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: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 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: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:642
#define PAR(...)
Adds an individually translatable paragraph to PAGE_TEXT without having to deal with strcat and sprin...
Definition string.qh:648
#define PAGE_TEXT_INIT()
Definition string.qh:641
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