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

Go to the source code of this file.

Functions

void raptor_bomb_burst (entity this)
void raptor_bomb_touch (entity this, entity toucher)
void raptor_bombdrop (entity this)
void raptor_bomblet_boom (entity this)
void raptor_bomblet_touch (entity this, entity toucher)
void raptor_flare_damage (entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
void raptor_flare_think (entity this)
void raptor_flare_touch (entity this, entity toucher)
void RaptorCBShellfragDraw (entity this)
void RaptorCBShellfragToss (vector _org, vector _vel, vector _ang)
 SOUND (RaptorCannon_FIRE, W_Sound("lasergun_fire"))

Function Documentation

◆ raptor_bomb_burst()

void raptor_bomb_burst ( entity this)

Definition at line 134 of file raptor_weapons.qc.

135{
136 vector norm_vel = normalize(this.velocity);
137 if (this.cnt > time
139 {
140 this.nextthink = time;
141 traceline(this.origin, this.origin + (norm_vel * autocvar_g_vehicle_raptor_bomblet_alt), MOVE_NORMAL, this);
142 if (trace_fraction == 1.0
144 {
146 return;
147 }
148 }
149
150 Damage_DamageInfo(this.origin, 0, 0, 0, '0 0 0', DEATH_VH_RAPT_FRAGMENT.m_id, 0, this);
151
152 entity bomblet;
153 float speed = vlen(this.velocity);
154 for (int i = 0; i < autocvar_g_vehicle_raptor_bomblets; ++i)
155 {
156 bomblet = new(raptor_bomb_bomblet);
157 setorigin(bomblet, this.origin);
158
159 set_movetype(bomblet, MOVETYPE_TOSS);
162 bomblet.nextthink = time + 5;
163 bomblet.owner = this.owner;
164 bomblet.realowner = this.realowner;
165 bomblet.velocity = normalize(norm_vel + (randomvec() * autocvar_g_vehicle_raptor_bomblet_spread)) * speed;
166
167 PROJECTILE_MAKETRIGGER(bomblet);
168 CSQCProjectile(bomblet, true, PROJECTILE_RAPTORBOMBLET, true);
169 }
170
171 delete(this);
172}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
float cnt
Definition powerups.qc:24
entity owner
Definition main.qh:87
const float MOVE_NORMAL
vector velocity
float time
float nextthink
vector origin
float trace_fraction
void UpdateCSQCProjectile(entity e)
void CSQCProjectile(entity e, float clientanimate, int type, float docull)
void Damage_DamageInfo(vector org, float coredamage, float edgedamage, float rad, vector force, int deathtype, float bloodtype, entity dmgowner)
float speed
Definition dynlight.qc:9
float vlen(vector v)
vector randomvec(void)
vector normalize(vector v)
void set_movetype(entity this, int mt)
Definition movetypes.qc:4
const int MOVETYPE_TOSS
Definition movetypes.qh:135
const int PROJECTILE_RAPTORBOMBLET
void raptor_bomblet_touch(entity this, entity toucher)
void raptor_bomblet_boom(entity this)
float autocvar_g_vehicle_raptor_bomblet_radius
float autocvar_g_vehicle_raptor_bomblets
float autocvar_g_vehicle_raptor_bomblet_alt
float autocvar_g_vehicle_raptor_bomblet_spread
#define setthink(e, f)
vector
Definition self.qh:92
#define settouch(e, f)
Definition self.qh:73
#define PROJECTILE_MAKETRIGGER(e)
Definition common.qh:34
entity realowner
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
Definition vector.qh:8

References autocvar_g_vehicle_raptor_bomblet_alt, autocvar_g_vehicle_raptor_bomblet_radius, autocvar_g_vehicle_raptor_bomblet_spread, autocvar_g_vehicle_raptor_bomblets, cnt, CSQCProjectile(), Damage_DamageInfo(), entity(), MOVE_NORMAL, MOVETYPE_TOSS, nextthink, normalize(), origin, owner, PROJECTILE_MAKETRIGGER, PROJECTILE_RAPTORBOMBLET, randomvec(), raptor_bomblet_boom(), raptor_bomblet_touch(), realowner, set_movetype(), setthink, settouch, speed, time, trace_fraction, UpdateCSQCProjectile(), vdist, vector, velocity, and vlen().

Referenced by raptor_bomb_touch(), and raptor_bombdrop().

◆ raptor_bomb_touch()

void raptor_bomb_touch ( entity this,
entity toucher )

Definition at line 174 of file raptor_weapons.qc.

175{
176 raptor_bomb_burst(this);
177}
void raptor_bomb_burst(entity this)

References entity(), raptor_bomb_burst(), and toucher.

Referenced by raptor_bombdrop().

◆ raptor_bombdrop()

void raptor_bombdrop ( entity this)

Definition at line 179 of file raptor_weapons.qc.

180{
181 entity bomb_1 = new(bombmount_left);
182 entity bomb_2 = new(bombmount_right);
183
184 vector org = gettaginfo(this, gettagindex(this, "bombmount_left"));
185 bomb_1.solid = bomb_2.solid = SOLID_BBOX; // before setorigin to ensure area grid linking
186 setorigin(bomb_1, org);
187 org = gettaginfo(this, gettagindex(this, "bombmount_right"));
188 setorigin(bomb_2, org);
189
192 bomb_1.velocity = bomb_2.velocity = this.velocity;
197 bomb_1.cnt = bomb_2.cnt = time + 10;
198
200 bomb_1.nextthink = bomb_2.nextthink = time;
201 else
202 bomb_1.nextthink = bomb_2.nextthink = time + autocvar_g_vehicle_raptor_bomblet_time;
203
204 bomb_1.owner = bomb_2.owner = this;
205 bomb_1.realowner = bomb_2.realowner = this.owner;
206 bomb_1.gravity = bomb_2.gravity = 1;
207
210
211 CSQCProjectile(bomb_1, true, PROJECTILE_RAPTORBOMB, true);
212 CSQCProjectile(bomb_2, true, PROJECTILE_RAPTORBOMB, true);
213}
const float SOLID_BBOX
#define gettagindex
const int MOVETYPE_BOUNCE
Definition movetypes.qh:139
#define gettaginfo
Definition post.qh:32
const int PROJECTILE_RAPTORBOMB
void raptor_bomb_touch(entity this, entity toucher)
float autocvar_g_vehicle_raptor_bomblet_time
vector org
Definition self.qh:92

References autocvar_g_vehicle_raptor_bomblet_alt, autocvar_g_vehicle_raptor_bomblet_time, CSQCProjectile(), entity(), gettagindex, gettaginfo, MOVETYPE_BOUNCE, org, owner, PROJECTILE_MAKETRIGGER, PROJECTILE_RAPTORBOMB, raptor_bomb_burst(), raptor_bomb_touch(), set_movetype(), setthink, settouch, SOLID_BBOX, time, vector, and velocity.

◆ raptor_bomblet_boom()

void raptor_bomblet_boom ( entity this)

Definition at line 108 of file raptor_weapons.qc.

109{
110 RadiusDamage(this, this.realowner,
114 NULL,
115 NULL,
117 DEATH_VH_RAPT_BOMB.m_id,
118 DMG_NOWEP,
119 NULL
120 );
121 delete(this);
122}
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
#define DMG_NOWEP
Definition damage.qh:104
#define NULL
Definition post.qh:14
float autocvar_g_vehicle_raptor_bomblet_edgedamage
float autocvar_g_vehicle_raptor_bomblet_force
float autocvar_g_vehicle_raptor_bomblet_damage

References autocvar_g_vehicle_raptor_bomblet_damage, autocvar_g_vehicle_raptor_bomblet_edgedamage, autocvar_g_vehicle_raptor_bomblet_force, autocvar_g_vehicle_raptor_bomblet_radius, DMG_NOWEP, entity(), NULL, RadiusDamage(), and realowner.

Referenced by raptor_bomb_burst(), and raptor_bomblet_touch().

◆ raptor_bomblet_touch()

void raptor_bomblet_touch ( entity this,
entity toucher )

Definition at line 124 of file raptor_weapons.qc.

125{
126 if (toucher == this.owner)
127 return;
128
132}
float random(void)
float autocvar_g_vehicle_raptor_bomblet_explode_delay
entity entity toucher
Definition self.qh:72
#define PROJECTILE_TOUCH(e, t)
Definition common.qh:28

References autocvar_g_vehicle_raptor_bomblet_explode_delay, entity(), nextthink, owner, PROJECTILE_TOUCH, random(), raptor_bomblet_boom(), setthink, time, and toucher.

Referenced by raptor_bomb_burst().

◆ raptor_flare_damage()

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

Definition at line 220 of file raptor_weapons.qc.

221{
222 TakeResource(this, RES_HEALTH, damage);
223 if (GetResource(this, RES_HEALTH) <= 0)
224 delete(this);
225}
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.

References entity(), GetResource(), TakeResource(), and vector.

◆ raptor_flare_think()

void raptor_flare_think ( entity this)

Definition at line 227 of file raptor_weapons.qc.

228{
229 this.nextthink = time + 0.1;
230 IL_EACH(g_projectiles, it.enemy == this.owner,
231 {
232 if (vdist(this.origin - it.origin, <, autocvar_g_vehicle_raptor_flare_range)
233 && random() > autocvar_g_vehicle_raptor_flare_chase)
234 it.enemy = this;
235 });
236
237 if (this.tur_impacttime < time)
238 delete(this);
239}
#define IL_EACH(this, cond, body)
IntrusiveList g_projectiles
Definition common.qh:58
float tur_impacttime
Definition sv_turrets.qh:32

References entity(), g_projectiles, IL_EACH, nextthink, time, and tur_impacttime.

◆ raptor_flare_touch()

void raptor_flare_touch ( entity this,
entity toucher )

Definition at line 215 of file raptor_weapons.qc.

216{
217 delete(this);
218}

References entity(), and toucher.

◆ RaptorCBShellfragDraw()

void RaptorCBShellfragDraw ( entity this)

Definition at line 244 of file raptor_weapons.qc.

245{
246 if (wasfreed(this))
247 return;
248
250 this.avelocity += randomvec() * 15;
251 this.renderflags = 0;
252
253 if (this.cnt < time)
254 this.alpha = bound(0, this.nextthink - time, 1);
255
256 if (this.alpha < ALPHA_MIN_VISIBLE)
257 delete(this);
258}
float alpha
Definition items.qc:13
float renderflags
Definition main.qh:111
const float ALPHA_MIN_VISIBLE
Definition main.qh:158
vector avelocity
float autocvar_cl_gibs_ticrate
Definition gibs.qh:13
bool autocvar_cl_gibs_sloppy
Definition gibs.qh:12
float bound(float min, float value, float max)
void Movetype_Physics_MatchTicrate(entity this, float tr, bool sloppy)
Definition movetypes.qc:835

References alpha, ALPHA_MIN_VISIBLE, autocvar_cl_gibs_sloppy, autocvar_cl_gibs_ticrate, avelocity, bound(), cnt, entity(), Movetype_Physics_MatchTicrate(), nextthink, randomvec(), renderflags, and time.

Referenced by RaptorCBShellfragToss().

◆ RaptorCBShellfragToss()

void RaptorCBShellfragToss ( vector _org,
vector _vel,
vector _ang )

Definition at line 260 of file raptor_weapons.qc.

261{
262 entity sfrag = new(RaptorCBShellfrag);
263 setmodel(sfrag, MDL_VEH_RAPTOR_CB_FRAGMENT);
264 sfrag.solid = SOLID_CORPSE; // before setorigin to ensure area grid linking
265 setorigin(sfrag, _org);
266
268 sfrag.gravity = 0.15;
269
270 sfrag.draw = RaptorCBShellfragDraw;
271 IL_PUSH(g_drawables, sfrag);
272
273 sfrag.velocity = _vel;
274 sfrag.avelocity = prandomvec() * vlen(sfrag.velocity);
275 sfrag.angles = _ang;
276
277 sfrag.move_time = time;
278 sfrag.damageforcescale = 4;
279
280 sfrag.nextthink = time + 3;
281 sfrag.cnt = time + 2;
282 sfrag.alpha = 1;
283 sfrag.drawmask = MASK_NORMAL;
284}
IntrusiveList g_drawables
Definition main.qh:91
#define setmodel(this, m)
Definition model.qh:26
const float MASK_NORMAL
const float SOLID_CORPSE
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
vector prandomvec()
Definition random.qc:120
void RaptorCBShellfragDraw(entity this)

References entity(), g_drawables, IL_PUSH(), MASK_NORMAL, MOVETYPE_BOUNCE, prandomvec(), RaptorCBShellfragDraw(), set_movetype(), setmodel, SOLID_CORPSE, time, vector, and vlen().

Referenced by NET_HANDLE().

◆ SOUND()

SOUND ( RaptorCannon_FIRE ,
W_Sound("lasergun_fire")  )