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 108 of file raptor_weapons.qc.

109{
110 if(this.cnt > time)
112 {
113 this.nextthink = time;
114 traceline(this.origin, this.origin + (normalize(this.velocity) * autocvar_g_vehicle_raptor_bomblet_alt), MOVE_NORMAL, this);
115 if((trace_fraction == 1.0) || (vdist(this.origin - this.owner.origin, <, autocvar_g_vehicle_raptor_bomblet_radius)))
116 {
118 return;
119 }
120 }
121
122 entity bomblet;
123 float i;
124
125 Damage_DamageInfo(this.origin, 0, 0, 0, '0 0 0', DEATH_VH_RAPT_FRAGMENT.m_id, 0, this);
126
127 for(i = 0; i < autocvar_g_vehicle_raptor_bomblets; ++i)
128 {
129 bomblet = new(raptor_bomb_bomblet);
130 setorigin(bomblet, this.origin);
131
132 set_movetype(bomblet, MOVETYPE_TOSS);
135 bomblet.nextthink = time + 5;
136 bomblet.owner = this.owner;
137 bomblet.realowner = this.realowner;
139
140 PROJECTILE_MAKETRIGGER(bomblet);
141 CSQCProjectile(bomblet, true, PROJECTILE_RAPTORBOMBLET, true);
142 }
143
144 delete(this);
145}
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 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)
#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, time, trace_fraction, UpdateCSQCProjectile(), vdist, 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 147 of file raptor_weapons.qc.

148{
149 raptor_bomb_burst(this);
150}
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 152 of file raptor_weapons.qc.

153{
154 entity bomb_1 = new(bombmount_left);
155 entity bomb_2 = new(bombmount_right);
156
157 vector org = gettaginfo(this, gettagindex(this, "bombmount_left"));
158 bomb_1.solid = bomb_2.solid = SOLID_BBOX; // before setorigin to ensure area grid linking
159 setorigin(bomb_1, org);
160 org = gettaginfo(this, gettagindex(this, "bombmount_right"));
161 setorigin(bomb_2, org);
162
165 bomb_1.velocity = bomb_2.velocity = this.velocity;
170 bomb_1.cnt = bomb_2.cnt = time + 10;
171
173 bomb_1.nextthink = bomb_2.nextthink = time;
174 else
175 bomb_1.nextthink = bomb_2.nextthink = time + autocvar_g_vehicle_raptor_bomblet_time;
176
177 bomb_1.owner = bomb_2.owner = this;
178 bomb_1.realowner = bomb_2.realowner = this.owner;
179 bomb_1.gravity = bomb_2.gravity = 1;
180
183
184 CSQCProjectile(bomb_1, true, PROJECTILE_RAPTORBOMB, true);
185 CSQCProjectile(bomb_2, true, PROJECTILE_RAPTORBOMB, true);
186}
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
Definition self.qh:92
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 89 of file raptor_weapons.qc.

90{
94 autocvar_g_vehicle_raptor_bomblet_force, DEATH_VH_RAPT_BOMB.m_id, DMG_NOWEP, NULL);
95 delete(this);
96}
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:981
#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 98 of file raptor_weapons.qc.

99{
100 if(toucher == this.owner)
101 return;
102
106}
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 193 of file raptor_weapons.qc.

194{
195 TakeResource(this, RES_HEALTH, damage);
196 if(GetResource(this, RES_HEALTH) <= 0)
197 delete(this);
198}
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 200 of file raptor_weapons.qc.

201{
202 this.nextthink = time + 0.1;
203 IL_EACH(g_projectiles, it.enemy == this.owner,
204 {
205 if(vdist(this.origin - it.origin, <, autocvar_g_vehicle_raptor_flare_range))
206 if(random() > autocvar_g_vehicle_raptor_flare_chase)
207 it.enemy = this;
208 });
209
210 if(this.tur_impacttime < time)
211 delete(this);
212}
#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 188 of file raptor_weapons.qc.

189{
190 delete(this);
191}

References entity(), and toucher.

◆ RaptorCBShellfragDraw()

void RaptorCBShellfragDraw ( entity this)

Definition at line 218 of file raptor_weapons.qc.

219{
220 if(wasfreed(this))
221 return;
222
224 this.avelocity += randomvec() * 15;
225 this.renderflags = 0;
226
227 if(this.cnt < time)
228 this.alpha = bound(0, this.nextthink - time, 1);
229
230 if(this.alpha < ALPHA_MIN_VISIBLE)
231 delete(this);
232}
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 234 of file raptor_weapons.qc.

235{
236 entity sfrag = new(RaptorCBShellfrag);
237 setmodel(sfrag, MDL_VEH_RAPTOR_CB_FRAGMENT);
238 sfrag.solid = SOLID_CORPSE; // before setorigin to ensure area grid linking
239 setorigin(sfrag, _org);
240
242 sfrag.gravity = 0.15;
243
244 sfrag.draw = RaptorCBShellfragDraw;
245 IL_PUSH(g_drawables, sfrag);
246
247 sfrag.velocity = _vel;
248 sfrag.avelocity = prandomvec() * vlen(sfrag.velocity);
249 sfrag.angles = _ang;
250
251 sfrag.move_time = time;
252 sfrag.damageforcescale = 4;
253
254 sfrag.nextthink = time + 3;
255 sfrag.cnt = time + 2;
256 sfrag.alpha = 1;
257 sfrag.drawmask = MASK_NORMAL;
258}
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:121
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()