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

Go to the source code of this file.

Functions

 spawnfunc (vehicle_spiderbot)
void spiderbot_blowup (entity this)
void spiderbot_exit (entity this, int eject)
bool spiderbot_frame (entity this, float dt)
void spiderbot_headfade (entity this)
bool spiderbot_impulse (entity this, int _imp)

Variables

bool autocvar_g_vehicle_spiderbot = true
vector autocvar_g_vehicle_spiderbot_bouncepain = '0 0 0'
float autocvar_g_vehicle_spiderbot_head_pitchlimit_down = -20
float autocvar_g_vehicle_spiderbot_head_pitchlimit_up = 30
float autocvar_g_vehicle_spiderbot_head_turnlimit = 90
float autocvar_g_vehicle_spiderbot_head_turnspeed = 110
int autocvar_g_vehicle_spiderbot_health = 800
float autocvar_g_vehicle_spiderbot_health_regen = 10
float autocvar_g_vehicle_spiderbot_health_regen_pause = 5
float autocvar_g_vehicle_spiderbot_movement_inertia = 0.15
float autocvar_g_vehicle_spiderbot_respawntime = 45
int autocvar_g_vehicle_spiderbot_shield = 200
float autocvar_g_vehicle_spiderbot_shield_regen = 25
float autocvar_g_vehicle_spiderbot_shield_regen_pause = 0.35
float autocvar_g_vehicle_spiderbot_speed_stop = 50
float autocvar_g_vehicle_spiderbot_speed_strafe = 400
float autocvar_g_vehicle_spiderbot_speed_walk = 500
float autocvar_g_vehicle_spiderbot_springblend = 0.1
float autocvar_g_vehicle_spiderbot_springlength = 150
float autocvar_g_vehicle_spiderbot_springup = 20
float autocvar_g_vehicle_spiderbot_tiltlimit = 90
float autocvar_g_vehicle_spiderbot_turnspeed = 90
float autocvar_g_vehicle_spiderbot_turnspeed_strafe = 300
float jump_delay
const int SBRM_ARTILLERY = 3
const int SBRM_FIRST = 1
const int SBRM_GUIDE = 2
const int SBRM_LAST = 3
const int SBRM_VOLLY = 1

Function Documentation

◆ spawnfunc()

spawnfunc ( vehicle_spiderbot )

Definition at line 529 of file spiderbot.qc.

530{
532 || !vehicle_initialize(this, VEH_SPIDERBOT, false))
533 {
534 delete(this);
535 return;
536 }
537}
bool autocvar_g_vehicle_spiderbot
Definition spiderbot.qc:16
bool vehicle_initialize(entity this, Vehicle info, bool nodrop)

References autocvar_g_vehicle_spiderbot, and vehicle_initialize().

◆ spiderbot_blowup()

void spiderbot_blowup ( entity this)

Definition at line 395 of file spiderbot.qc.

396{
397 if (this.cnt > time)
398 {
399 if (random() < 0.1)
400 {
401 sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
402 Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (this.origin + '0 0 100'), '0 0 0', 1);
403 }
404 this.nextthink = time + 0.1;
405 return;
406 }
407
408 entity h = new(spiderbot_top);
409 entity g1 = new(spiderbot_gun);
410 entity g2 = new(spiderbot_gun);
411 entity b = new(spiderbot_body);
412
413 setmodel(b, MDL_VEH_SPIDERBOT_BODY);
414 setmodel(h, MDL_VEH_SPIDERBOT_TOP);
415 setmodel(g1, MDL_VEH_SPIDERBOT_GUN);
416 setmodel(g2, MDL_VEH_SPIDERBOT_GUN);
417
418 setorigin(b, this.origin);
419 b.frame = 11;
420 b.angles = this.angles;
421 setsize(b, this.mins, this.maxs);
422
423 h.solid = SOLID_BBOX; // before setorigin for immediate area grid linking
424 vector org = gettaginfo(this, gettagindex(this, "tag_head"));
425 setorigin(h, org);
427 h.velocity = v_up * (500 + random() * 500) + randomvec() * 128;
428 h.modelflags = MF_ROCKET;
429 h.effects = EF_FLAME | EF_LOWPRECISION;
430 h.avelocity = randomvec() * 360;
431
432 h.alpha = 1;
433 h.cnt = time + (3.5 * random());
434 h.fade_rate = 1 / min(this.respawntime, 10);
435 h.fade_time = time;
437 h.nextthink = time;
438
439 g1.solid = SOLID_CORPSE; // before setorigin for immediate area grid linking
440 org = gettaginfo(this.tur_head, gettagindex(this.tur_head, "tag_hardpoint01"));
441 setorigin(g1, org);
443 g1.velocity = v_forward * 700 + (randomvec() * 32);
444 g1.avelocity = randomvec() * 180;
445
446 g2.solid = SOLID_CORPSE; // before setorigin for immediate area grid linking
447 org = gettaginfo(this.tur_head, gettagindex(this.tur_head, "tag_hardpoint02"));
448 setorigin(g2, org);
450 g2.velocity = v_forward * 700 + (randomvec() * 32);
451 g2.avelocity = randomvec() * 180;
452
453 h.colormod = b.colormod = g1.colormod = g2.colormod = '-2 -2 -2';
454
455 SUB_SetFade(b, time + 5, min(this.respawntime, 1));
456 //SUB_SetFade(h, time, min(this.respawntime, 10));
457 SUB_SetFade(g1, time, min(this.respawntime, 10));
458 SUB_SetFade(g2, time, min(this.respawntime, 10));
459
460 RadiusDamage(this, this.enemy,
461 250,
462 15,
463 250,
464 NULL,
465 NULL,
466 250,
467 DEATH_VH_SPID_DEATH.m_id,
468 DMG_NOWEP,
469 NULL
470 );
471
472 this.alpha = this.tur_head.alpha = this.gun1.alpha = this.gun2.alpha = -1;
474 this.deadflag = DEAD_DEAD;
475 this.solid = SOLID_NOT;
476 this.tur_head.effects &= ~EF_FLAME;
477 this.vehicle_hudmodel.viewmodelforclient = this;
478}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
float cnt
Definition powerups.qc:24
float alpha
Definition items.qc:13
#define setmodel(this, m)
Definition model.qh:26
vector v_up
vector mins
const float SOLID_CORPSE
const float SOLID_BBOX
const float SOLID_NOT
float time
vector maxs
const float EF_FLAME
float nextthink
vector v_forward
vector origin
const int MF_ROCKET
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
float EF_LOWPRECISION
#define gettagindex
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
solid
Definition ent_cs.qc:165
float random(void)
vector randomvec(void)
float min(float f,...)
void set_movetype(entity this, int mt)
Definition movetypes.qc:4
const int MOVETYPE_NONE
Definition movetypes.qh:129
const int MOVETYPE_TOSS
Definition movetypes.qh:135
const int MOVETYPE_BOUNCE
Definition movetypes.qh:139
#define NULL
Definition post.qh:14
#define gettaginfo
Definition post.qh:32
float deadflag
Definition progsdefs.qc:149
float DEAD_DEAD
Definition progsdefs.qc:276
#define setthink(e, f)
vector
Definition self.qh:92
vector org
Definition self.qh:92
float respawntime
Definition items.qh:31
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 sound(e, c, s, v, a)
Definition sound.qh:52
void spiderbot_headfade(entity this)
Definition spiderbot.qc:378
void SUB_SetFade(entity ent, float vanish_time, float fading_time)
Definition subs.qc:77
entity enemy
Definition sv_ctf.qh:153
entity tur_head
Definition sv_turrets.qh:28
entity gun1
entity gun2
entity vehicle_hudmodel

References alpha, angles, ATTEN_NORM, CH_SHOTS, cnt, DEAD_DEAD, deadflag, DMG_NOWEP, EF_FLAME, EF_LOWPRECISION, enemy, entity(), gettagindex, gettaginfo, gun1, gun2, maxs, MF_ROCKET, min(), mins, MOVETYPE_BOUNCE, MOVETYPE_NONE, MOVETYPE_TOSS, nextthink, NULL, org, origin, RadiusDamage(), random(), randomvec(), respawntime, Send_Effect(), set_movetype(), setmodel, setthink, solid, SOLID_BBOX, SOLID_CORPSE, SOLID_NOT, sound, spiderbot_headfade(), SUB_SetFade(), time, tur_head, v_forward, v_up, vector, vehicle_hudmodel, and VOL_BASE.

◆ spiderbot_exit()

void spiderbot_exit ( entity this,
int eject )

Definition at line 323 of file spiderbot.qc.

324{
325 entity player = this.owner;
326
327 IL_EACH(g_projectiles, it.owner == player && it.classname == "spiderbot_rocket",
328 {
329 it.realowner = player;
330 it.owner = NULL;
331 });
332
334 this.nextthink = time;
335 this.frame = 5;
337
338 if (!player)
339 {
340 this.owner = NULL; // reset owner anyway?
341 return;
342 }
343
344 makevectors(this.angles);
345 vector spot;
346 if (eject)
347 {
348 spot = this.origin + v_forward * 100 + '0 0 64';
349 spot = vehicles_findgoodexit(this, player, spot);
350 setorigin(player, spot);
351 player.velocity = (v_up + v_forward * 0.25) * 750;
352 player.oldvelocity = player.velocity;
353 }
354 else
355 {
357 {
358 player.velocity = normalize(this.velocity) * vlen(this.velocity);
359 player.velocity.z += 200;
360 spot = this.origin + v_forward * 128 + '0 0 64';
361 spot = vehicles_findgoodexit(this, player, spot);
362 }
363 else
364 {
365 player.velocity = this.velocity * 0.5;
366 player.velocity.z += 10;
367 spot = this.origin + v_forward * 256 + '0 0 64';
368 spot = vehicles_findgoodexit(this, player, spot);
369 }
370 player.oldvelocity = player.velocity;
371 setorigin(player, spot);
372 }
373
374 antilag_clear(player, CS(player));
375 this.owner = NULL;
376}
float frame
primary framegroup animation (strength = 1 - lerpfrac - lerpfrac3 - lerpfrac4)
Definition anim.qh:6
void antilag_clear(entity e, entity store)
Definition antilag.qc:114
entity owner
Definition main.qh:87
vector velocity
#define IL_EACH(this, cond, body)
float vlen(vector v)
vector normalize(vector v)
const int MOVETYPE_WALK
Definition movetypes.qh:132
#define makevectors
Definition post.qh:21
IntrusiveList g_projectiles
Definition common.qh:58
float autocvar_g_vehicle_spiderbot_speed_strafe
Definition spiderbot.qc:21
ClientState CS(Client this)
Definition state.qh:47
vector vehicles_findgoodexit(entity this, entity player, vector prefer_spot)
void vehicles_think(entity this)
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
Definition vector.qh:8

References angles, antilag_clear(), autocvar_g_vehicle_spiderbot_speed_strafe, CS(), entity(), frame, g_projectiles, IL_EACH, makevectors, MOVETYPE_WALK, nextthink, normalize(), NULL, origin, owner, set_movetype(), setthink, time, v_forward, v_up, vdist, vector, vehicles_findgoodexit(), vehicles_think(), velocity, and vlen().

◆ spiderbot_frame()

bool spiderbot_frame ( entity this,
float dt )

Definition at line 49 of file spiderbot.qc.

50{
51 entity vehic = this.vehicle;
52 return = true;
53
54 if (game_stopped)
55 {
56 vehic.solid = SOLID_NOT;
57 vehic.takedamage = DAMAGE_NO;
59 return;
60 }
61
62 vehicles_frame(vehic, this);
63
64 PHYS_INPUT_BUTTON_ZOOM(this) = false;
65 PHYS_INPUT_BUTTON_CROUCH(this) = false;
66 for (int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
67 {
68 .entity weaponentity = weaponentities[slot];
69 this.(weaponentity).m_switchweapon = WEP_Null;
70 }
71 STAT(VEHICLESTAT_W2MODE, this) = STAT(VEHICLESTAT_W2MODE, vehic);
72
73
74#if 1 // 0 to enable per-gun impact aux crosshairs
75 // Avarage gun impact point's -> aux cross
76 vector ad = gettaginfo(vehic.tur_head, gettagindex(vehic.tur_head, "tag_hardpoint01"));
77 vector vf = v_forward;
78 ad += gettaginfo(vehic.tur_head, gettagindex(vehic.tur_head, "tag_hardpoint02"));
79 vf += v_forward;
80 ad *= 0.5;
81 v_forward = vf * 0.5;
82 traceline(ad, ad + v_forward * max_shot_distance, MOVE_NORMAL, vehic);
83 UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' * (1 - this.vehicle_reload1)), 0);
84#else
85 vector ad = gettaginfo(vehic.gun1, gettagindex(vehic.gun1, "barrels"));
86 traceline(ad, ad + v_forward * max_shot_distance, MOVE_NORMAL, vehic);
87 UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' * (1 - this.vehicle_reload1)), 0);
88 vector vf = ad;
89 ad = gettaginfo(vehic.gun2, gettagindex(vehic.gun2, "barrels"));
90 traceline(ad, ad + v_forward * max_shot_distance, MOVE_NORMAL, vehic);
91 UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' * (1 - this.vehicle_reload1)), 1);
92 ad = 0.5 * (ad + vf);
93#endif
94
95 crosshair_trace(this);
98 ad = AnglesTransform_Normalize(ad, true);
99 //UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload2) + ('0 1 0' * (1 - this.vehicle_reload2)), 2);
100
101 // Rotate head
103 ad.y = bound(-ftmp, ad.y, ftmp);
104 vehic.tur_head.angles.y = bound(-autocvar_g_vehicle_spiderbot_head_turnlimit, vehic.tur_head.angles.y + ad.y, autocvar_g_vehicle_spiderbot_head_turnlimit);
105
106 // Pitch head
107 ad.x = bound(-ftmp, ad.x, ftmp);
108 vehic.tur_head.angles.x = bound(autocvar_g_vehicle_spiderbot_head_pitchlimit_down, vehic.tur_head.angles.x + ad.x, autocvar_g_vehicle_spiderbot_head_pitchlimit_up);
109
110
111 //fixedmakevectors(vehic.angles);
112 makevectors(vehic.angles + '-2 0 0' * vehic.angles.x);
113
115
116 if (IS_ONGROUND(vehic))
117 vehic.jump_delay = time; // reset now so movement can begin
118
119 //if (IS_ONGROUND(vehic))
120 {
121 if (IS_ONGROUND(vehic)
122 && vehic.frame == 4 && vehic.tur_head.wait != 0)
123 {
124 sound(vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_LAND, VOL_VEHICLEENGINE, ATTEN_NORM);
125 vehic.frame = 5;
126 }
127
128 if (!PHYS_INPUT_BUTTON_JUMP(this))
129 vehic.button2 = false;
130
131 if (IS_ONGROUND(vehic) && PHYS_INPUT_BUTTON_JUMP(this)
132 && !vehic.button2 && vehic.tur_head.wait < time)
133 {
134 sound(vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_JUMP, VOL_VEHICLEENGINE, ATTEN_NORM);
135 //dprint("spiderbot_jump:", ftos(soundlength("vehicles/spiderbot_jump.wav")), "\n");
136 vehic.delay = 0;
137
138 vehic.tur_head.wait = time + 2;
139 vehic.jump_delay = time + 2;
140 vehic.button2 = true; // set spider's jump
141 //PHYS_INPUT_BUTTON_JUMP(this) = false;
142
143 vector movefix = '0 0 0';
144 if (CS(this).movement.x > 0) movefix.x = 1;
145 if (CS(this).movement.x < 0) movefix.x = -1;
146 if (CS(this).movement.y > 0) movefix.y = 1;
147 if (CS(this).movement.y < 0) movefix.y = -1;
148
149 vector rt = movefix.y * v_right;
150 vector sd = movefix.x * v_forward;
151 if (movefix.y == 0 && movefix.x == 0)
152 sd = v_forward; // always do forward
153
154 UNSET_ONGROUND(vehic);
155
156 vehic.velocity = sd * 700 + rt * 600 + v_up * 600;
157 vehic.frame = 4;
158 }
159 else if (time >= vehic.jump_delay)
160 {
161 if (!CS(this).movement)
162 {
163 if (IS_ONGROUND(vehic))
164 {
165 if (vehic.sound_nexttime < time || vehic.delay != 3)
166 {
167 vehic.delay = 3;
168 vehic.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_idle.wav");
169 //dprint("spiderbot_idle:", ftos(soundlength("vehicles/spiderbot_idle.wav")), "\n");
170 sound(vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_IDLE, VOL_VEHICLEENGINE, ATTEN_NORM);
171 }
173 vehic.frame = 5;
174 }
175 }
176 else
177 {
178 // Turn Body
179 if (CS(this).movement.x == 0 && CS(this).movement.y != 0)
181 else
183
184 ftmp = bound(-ftmp, vehic.tur_head.angles.y, ftmp);
185 vehic.angles.y = anglemods(vehic.angles.y + ftmp);
186 vehic.tur_head.angles.y -= ftmp;
187
188 if (CS(this).movement.x != 0)
189 {
190 if (CS(this).movement.x > 0)
191 {
192 CS(this).movement.x = 1;
193 if (IS_ONGROUND(vehic))
194 vehic.frame = 0;
195 }
196 else if (CS(this).movement.x < 0)
197 {
198 CS(this).movement.x = -1;
199 if (IS_ONGROUND(vehic))
200 vehic.frame = 1;
201 }
202 CS(this).movement.y = 0;
203
204 float oldvelz = vehic.velocity.z;
206 vehic.velocity.z = oldvelz;
208 if (vehic.velocity.z <= 20) // not while jumping
209 vehic.velocity.z -= g * PHYS_INPUT_FRAMETIME * PHYS_GRAVITY(NULL);
210 if (IS_ONGROUND(vehic)
211 && (vehic.sound_nexttime < time || vehic.delay != 1))
212 {
213 vehic.delay = 1;
214 vehic.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_walk.wav");
215 sound(vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_WALK, VOL_VEHICLEENGINE, ATTEN_NORM);
216 //dprint("spiderbot_walk:", ftos(soundlength("vehicles/spiderbot_walk.wav")), "\n");
217 }
218 }
219 else if (CS(this).movement.y != 0)
220 {
221 if (CS(this).movement.y < 0)
222 {
223 CS(this).movement.y = -1;
224 if (IS_ONGROUND(vehic))
225 vehic.frame = 2;
226 }
227 else if (CS(this).movement.y > 0)
228 {
229 CS(this).movement.y = 1;
230 if (IS_ONGROUND(vehic))
231 vehic.frame = 3;
232 }
233
234 float oldvelz = vehic.velocity.z;
236 vehic.velocity.z = oldvelz;
238 if (vehic.velocity.z <= 20) // not while jumping
239 vehic.velocity.z -= g * PHYS_INPUT_FRAMETIME * PHYS_GRAVITY(NULL);
240 if (IS_ONGROUND(vehic)
241 && (vehic.sound_nexttime < time || vehic.delay != 2))
242 {
243 vehic.delay = 2;
244 vehic.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_strafe.wav");
245 sound(vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_STRAFE, VOL_VEHICLEENGINE, ATTEN_NORM);
246 //dprint("spiderbot_strafe:", ftos(soundlength("vehicles/spiderbot_strafe.wav")), "\n");
247 }
248 }
249 }
250 }
251 }
252
255
256 if (!weaponLocked(this) && !weaponUseForbidden(this)
257 && PHYS_INPUT_BUTTON_ATCK(this))
258 {
259 vehic.cnt = time;
260 if (vehic.vehicle_ammo1 >= autocvar_g_vehicle_spiderbot_minigun_ammo_cost && vehic.tur_head.attack_finished_single[0] <= time)
261 {
262 ++vehic.misc_bulletcounter;
263
264 entity gun = (vehic.misc_bulletcounter % 2) ? vehic.gun1 : vehic.gun2;
265
266 vector v = gettaginfo(gun, gettagindex(gun, "barrels"));
268 v += v_forward * 50;
269
270 .entity weaponentity = weaponentities[0]; // TODO: unhardcode
273
274 sound(gun, CH_WEAPON_A, SND_VEH_SPIDERBOT_MINIGUN_FIRE, VOL_BASE, ATTEN_NORM);
275 //trailparticles(this, _particleeffectnum("spiderbot_minigun_trail"), v, trace_endpos);
276 Send_Effect(EFFECT_SPIDERBOT_MINIGUN_MUZZLEFLASH, v, v_forward * 2500, 1);
277
279 vehic.tur_head.attack_finished_single[0] = time + autocvar_g_vehicle_spiderbot_minigun_refire;
280 this.vehicle_ammo1 = (vehic.vehicle_ammo1 / autocvar_g_vehicle_spiderbot_minigun_ammo_max) * 100;
281 vehic.gun1.angles.z += 45;
282 vehic.gun2.angles.z -= 45;
283 if (vehic.gun1.angles.z >= 360)
284 {
285 vehic.gun1.angles.z = 0;
286 vehic.gun2.angles.z = 0;
287 }
288 }
289 }
290 else
294
295
296 spiderbot_rocket_do(vehic);
297
298 if (vehic.vehicle_flags & VHF_SHIELDREGEN)
300
301 if (vehic.vehicle_flags & VHF_HEALTHREGEN)
303
305 //this.vehicle_ammo2 = vehic.tur_head.frame;
306 this.vehicle_ammo2 = (9 - vehic.tur_head.frame) / 8 * 100; // Percentage, like ammo1
307
308 if (vehic.gun2.cnt <= time)
309 this.vehicle_reload2 = 100;
310 else
311 this.vehicle_reload2 = 100 - ((vehic.gun2.cnt - time) / vehic.attack_finished_single[0]) * 100;
312
313 setorigin(this, vehic.origin + '0 0 1' * vehic.maxs.z);
314 this.oldorigin = this.origin; // negate fall damage
315 this.velocity = vehic.velocity;
316
317 VEHICLE_UPDATE_PLAYER_RESOURCE(this, vehic, health, spiderbot, RES_HEALTH);
318
319 if (vehic.vehicle_flags & VHF_HASSHIELD)
320 VEHICLE_UPDATE_PLAYER(this, vehic, shield, spiderbot);
321}
ERASEABLE float anglemods(float v)
Definition angle.qc:13
vector AnglesTransform_ToAngles(vector v)
vector AnglesTransform_LeftDivide(vector from_transform, vector to_transform)
vector AnglesTransform_Normalize(vector t, float minimize_roll)
vector AnglesTransform_FromAngles(vector v)
#define PHYS_INPUT_BUTTON_CROUCH(s)
Definition player.qh:156
vector movement
Definition player.qh:228
#define PHYS_INPUT_BUTTON_JUMP(s)
Definition player.qh:153
#define PHYS_INPUT_FRAMETIME
Definition player.qh:254
#define PHYS_INPUT_BUTTON_ATCK(s)
Definition player.qh:152
#define PHYS_INPUT_BUTTON_ZOOM(s)
Definition player.qh:155
#define PHYS_INPUT_BUTTON_ATCK2(s)
Definition player.qh:154
float game_stopped
Definition stats.qh:81
bool autocvar_sv_gameplayfix_gravityunaffectedbyticrate
Definition stats.qh:398
const float MOVE_NORMAL
vector v_right
vector trace_endpos
vector oldorigin
#define STAT(...)
Definition stats.qh:82
float bound(float min, float value, float max)
vector vectoangles(vector v)
void movelib_groundalign4point(entity this, float spring_length, float spring_up, float blendrate, float _max)
Pitches and rolls the entity to match the gound.
Definition movelib.qc:182
void movelib_brake_simple(entity this, float force)
Definition movelib.qc:163
#define movelib_move_simple(e, newdir, velo, blendrate)
Definition movelib.qh:36
#define PHYS_GRAVITY(s)
Definition movetypes.qh:53
#define UNSET_ONGROUND(s)
Definition movetypes.qh:18
#define IS_ONGROUND(s)
Definition movetypes.qh:16
float health
Legacy fields for the resources. To be removed.
Definition resources.qh:9
const int CH_TRIGGER_SINGLE
Definition sound.qh:13
const int CH_WEAPON_A
Definition sound.qh:7
float autocvar_g_vehicle_spiderbot_springblend
Definition spiderbot.qc:29
float autocvar_g_vehicle_spiderbot_shield_regen
Definition spiderbot.qc:42
float autocvar_g_vehicle_spiderbot_turnspeed_strafe
Definition spiderbot.qc:24
float autocvar_g_vehicle_spiderbot_health_regen
Definition spiderbot.qc:38
int autocvar_g_vehicle_spiderbot_shield
Definition spiderbot.qc:41
float autocvar_g_vehicle_spiderbot_speed_stop
Definition spiderbot.qc:20
float autocvar_g_vehicle_spiderbot_turnspeed
Definition spiderbot.qc:23
float autocvar_g_vehicle_spiderbot_head_turnlimit
Definition spiderbot.qc:34
int autocvar_g_vehicle_spiderbot_health
Definition spiderbot.qc:37
float autocvar_g_vehicle_spiderbot_head_turnspeed
Definition spiderbot.qc:35
float autocvar_g_vehicle_spiderbot_health_regen_pause
Definition spiderbot.qc:39
float autocvar_g_vehicle_spiderbot_speed_walk
Definition spiderbot.qc:22
float autocvar_g_vehicle_spiderbot_movement_inertia
Definition spiderbot.qc:25
float autocvar_g_vehicle_spiderbot_shield_regen_pause
Definition spiderbot.qc:43
float autocvar_g_vehicle_spiderbot_head_pitchlimit_down
Definition spiderbot.qc:32
float autocvar_g_vehicle_spiderbot_springlength
Definition spiderbot.qc:27
float autocvar_g_vehicle_spiderbot_head_pitchlimit_up
Definition spiderbot.qc:33
float autocvar_g_vehicle_spiderbot_tiltlimit
Definition spiderbot.qc:30
float autocvar_g_vehicle_spiderbot_springup
Definition spiderbot.qc:28
void spiderbot_rocket_do(entity this)
float autocvar_g_vehicle_spiderbot_minigun_solidpenetration
float autocvar_g_vehicle_spiderbot_minigun_damage
float autocvar_g_vehicle_spiderbot_minigun_refire
int autocvar_g_vehicle_spiderbot_minigun_ammo_max
int autocvar_g_vehicle_spiderbot_minigun_ammo_regen
float autocvar_g_vehicle_spiderbot_minigun_ammo_regen_pause
int autocvar_g_vehicle_spiderbot_minigun_ammo_cost
float autocvar_g_vehicle_spiderbot_minigun_force
float autocvar_g_vehicle_spiderbot_minigun_spread
const int DAMAGE_NO
Definition subs.qh:79
void vehicles_regen(entity this, float timer,.float regen_field, float field_max, float rpause, float regen, float delta_time, float _healthscale)
void UpdateAuxiliaryXhair(entity own, vector loc, vector clr, int axh_id)
void vehicles_regen_resource(entity this, float timer,.float regen_field, float field_max, float rpause, float regen, float delta_time, float _healthscale, Resource resource)
void vehicles_frame(entity this, entity actor)
const float vehicle_shield
If ent is player this is 0..100 indicating precentage of shield left on vehicle. If ent is vehicle,...
const float vehicle_reload2
If ent is player this is 0..100 indicating percentage of secondary reload status. If ent is vehicle,...
const float vehicle_ammo1
If ent is player this is 0..100 indicating percentage of primary ammo left UNLESS value is already st...
const float vehicle_health
If ent is player this is 0..100 indicating precentage of health left on vehicle. Vehicle's value is t...
#define VEHICLE_UPDATE_PLAYER(ply, vehi, fld, vhname)
const float VOL_VEHICLEENGINE
#define VEHICLE_UPDATE_PLAYER_RESOURCE(ply, vehi, fld, vhname, res)
entity vehicle
const float vehicle_ammo2
If ent is player this is 0..100 indicating percentage of secondary ammo left. If ent is vehicle,...
const float vehicle_reload1
If ent is player this is 0..100 indicating percentage of primary reload status. If ent is vehicle,...
void fireBullet(entity this,.entity weaponentity, vector start, vector dir, float spread, float max_solid_penetration, float damage, float headshot_multiplier, float force, float dtype, entity tracer_effect)
Definition tracing.qc:537
void crosshair_trace(entity pl)
Definition tracing.qc:542
const int VHF_HASSHIELD
Vehicle has shileding.
Definition vehicle.qh:95
const int VHF_HEALTHREGEN
Vehicles health regenerates.
Definition vehicle.qh:97
const int VHF_SHIELDREGEN
Vehicles shield regenerates.
Definition vehicle.qh:96
const int MAX_WEAPONSLOTS
Definition weapon.qh:16
int max_shot_distance
Definition weapon.qh:245
entity weaponentities[MAX_WEAPONSLOTS]
Definition weapon.qh:17
bool weaponUseForbidden(entity player)
bool weaponLocked(entity player)
Weapon m_switchweapon
Definition wepent.qh:25

References anglemods(), AnglesTransform_FromAngles(), AnglesTransform_LeftDivide(), AnglesTransform_Normalize(), AnglesTransform_ToAngles(), ATTEN_NORM, autocvar_g_vehicle_spiderbot_head_pitchlimit_down, autocvar_g_vehicle_spiderbot_head_pitchlimit_up, autocvar_g_vehicle_spiderbot_head_turnlimit, autocvar_g_vehicle_spiderbot_head_turnspeed, autocvar_g_vehicle_spiderbot_health, autocvar_g_vehicle_spiderbot_health_regen, autocvar_g_vehicle_spiderbot_health_regen_pause, autocvar_g_vehicle_spiderbot_minigun_ammo_cost, autocvar_g_vehicle_spiderbot_minigun_ammo_max, autocvar_g_vehicle_spiderbot_minigun_ammo_regen, autocvar_g_vehicle_spiderbot_minigun_ammo_regen_pause, autocvar_g_vehicle_spiderbot_minigun_damage, autocvar_g_vehicle_spiderbot_minigun_force, autocvar_g_vehicle_spiderbot_minigun_refire, autocvar_g_vehicle_spiderbot_minigun_solidpenetration, autocvar_g_vehicle_spiderbot_minigun_spread, autocvar_g_vehicle_spiderbot_movement_inertia, autocvar_g_vehicle_spiderbot_shield, autocvar_g_vehicle_spiderbot_shield_regen, autocvar_g_vehicle_spiderbot_shield_regen_pause, autocvar_g_vehicle_spiderbot_speed_stop, autocvar_g_vehicle_spiderbot_speed_strafe, autocvar_g_vehicle_spiderbot_speed_walk, autocvar_g_vehicle_spiderbot_springblend, autocvar_g_vehicle_spiderbot_springlength, autocvar_g_vehicle_spiderbot_springup, autocvar_g_vehicle_spiderbot_tiltlimit, autocvar_g_vehicle_spiderbot_turnspeed, autocvar_g_vehicle_spiderbot_turnspeed_strafe, autocvar_sv_gameplayfix_gravityunaffectedbyticrate, bound(), CH_TRIGGER_SINGLE, CH_WEAPON_A, crosshair_trace(), CS(), DAMAGE_NO, entity(), fireBullet(), game_stopped, gettagindex, gettaginfo, health, IS_ONGROUND, m_switchweapon, makevectors, max_shot_distance, MAX_WEAPONSLOTS, MOVE_NORMAL, movelib_brake_simple(), movelib_groundalign4point(), movelib_move_simple, movement, MOVETYPE_NONE, normalize(), NULL, oldorigin, origin, PHYS_GRAVITY, PHYS_INPUT_BUTTON_ATCK, PHYS_INPUT_BUTTON_ATCK2, PHYS_INPUT_BUTTON_CROUCH, PHYS_INPUT_BUTTON_JUMP, PHYS_INPUT_BUTTON_ZOOM, PHYS_INPUT_FRAMETIME, Send_Effect(), set_movetype(), SOLID_NOT, sound, spiderbot_rocket_do(), STAT, time, trace_endpos, UNSET_ONGROUND, UpdateAuxiliaryXhair(), v_forward, v_right, v_up, vectoangles(), vector, vehicle, vehicle_ammo1, vehicle_ammo2, vehicle_health, vehicle_reload1, vehicle_reload2, vehicle_shield, VEHICLE_UPDATE_PLAYER, VEHICLE_UPDATE_PLAYER_RESOURCE, vehicles_frame(), vehicles_regen(), vehicles_regen_resource(), velocity, VHF_HASSHIELD, VHF_HEALTHREGEN, VHF_SHIELDREGEN, VOL_BASE, VOL_VEHICLEENGINE, weaponentities, weaponLocked(), and weaponUseForbidden().

◆ spiderbot_headfade()

void spiderbot_headfade ( entity this)

Definition at line 378 of file spiderbot.qc.

379{
381 this.nextthink = this.fade_time;
382 this.alpha = 1 - (time - this.fade_time) * this.fade_rate;
383
384 if (this.cnt < time || this.alpha < 0.1)
385 {
386 if (this.alpha > 0.1)
387 {
388 sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
389 Send_Effect(EFFECT_EXPLOSION_BIG, this.origin + '0 0 100', '0 0 0', 1);
390 }
391 delete(this);
392 }
393}
fade_rate
Definition projectile.qh:14
float fade_time
Definition common.qh:23

References alpha, ATTEN_NORM, CH_SHOTS, cnt, entity(), fade_rate, fade_time, nextthink, origin, Send_Effect(), setthink, sound, spiderbot_headfade(), time, and VOL_BASE.

Referenced by spiderbot_blowup(), and spiderbot_headfade().

◆ spiderbot_impulse()

bool spiderbot_impulse ( entity this,
int _imp )

Definition at line 480 of file spiderbot.qc.

481{
482 switch (_imp)
483 {
484 case IMP_weapon_group_1.impulse:
485 STAT(VEHICLESTAT_W2MODE, this.vehicle) = SBRM_VOLLY;
486 CSQCVehicleSetup(this, 0);
487 return true;
488 case IMP_weapon_group_2.impulse:
489 STAT(VEHICLESTAT_W2MODE, this.vehicle) = SBRM_GUIDE;
490 CSQCVehicleSetup(this, 0);
491 return true;
492 case IMP_weapon_group_3.impulse:
493 STAT(VEHICLESTAT_W2MODE, this.vehicle) = SBRM_ARTILLERY;
494 CSQCVehicleSetup(this, 0);
495 return true;
496
497 case IMP_weapon_next_byid.impulse:
498 case IMP_weapon_next_bypriority.impulse:
499 case IMP_weapon_next_bygroup.impulse:
500 ++STAT(VEHICLESTAT_W2MODE, this.vehicle);
501 if (STAT(VEHICLESTAT_W2MODE, this.vehicle) > SBRM_LAST)
502 STAT(VEHICLESTAT_W2MODE, this.vehicle) = SBRM_FIRST;
503
504 //centerprint(this, strcat("Rocket mode is ", ftos(STAT(VEHICLESTAT_W2MODE, this.vehicle))));
505 CSQCVehicleSetup(this, 0);
506 return true;
507 case IMP_weapon_last.impulse:
508 case IMP_weapon_prev_byid.impulse:
509 case IMP_weapon_prev_bypriority.impulse:
510 case IMP_weapon_prev_bygroup.impulse:
511 --STAT(VEHICLESTAT_W2MODE, this.vehicle);
512 if (STAT(VEHICLESTAT_W2MODE, this.vehicle) < SBRM_FIRST)
513 STAT(VEHICLESTAT_W2MODE, this.vehicle) = SBRM_LAST;
514
515 //centerprint(this, strcat("Rocket mode is ", ftos(STAT(VEHICLESTAT_W2MODE, this.vehicle))));
516 CSQCVehicleSetup(this, 0);
517 return true;
518
519 /*
520 case IMP_weapon_drop.impulse: // toss gun, could be used to exit?
521 break;
522 case IMP_weapon_reload.impulse: // Manual minigun reload?
523 break;
524 */
525 }
526 return false;
527}
const int SBRM_VOLLY
Definition spiderbot.qc:10
const int SBRM_GUIDE
Definition spiderbot.qc:11
const int SBRM_FIRST
Definition spiderbot.qc:9
const int SBRM_ARTILLERY
Definition spiderbot.qc:12
const int SBRM_LAST
Definition spiderbot.qc:13
void CSQCVehicleSetup(entity own, int vehicle_id)

References CSQCVehicleSetup(), entity(), SBRM_ARTILLERY, SBRM_FIRST, SBRM_GUIDE, SBRM_LAST, SBRM_VOLLY, STAT, and vehicle.

Variable Documentation

◆ autocvar_g_vehicle_spiderbot

bool autocvar_g_vehicle_spiderbot = true

Definition at line 16 of file spiderbot.qc.

Referenced by spawnfunc().

◆ autocvar_g_vehicle_spiderbot_bouncepain

vector autocvar_g_vehicle_spiderbot_bouncepain = '0 0 0'

Definition at line 46 of file spiderbot.qc.

◆ autocvar_g_vehicle_spiderbot_head_pitchlimit_down

float autocvar_g_vehicle_spiderbot_head_pitchlimit_down = -20

Definition at line 32 of file spiderbot.qc.

Referenced by spiderbot_frame().

◆ autocvar_g_vehicle_spiderbot_head_pitchlimit_up

float autocvar_g_vehicle_spiderbot_head_pitchlimit_up = 30

Definition at line 33 of file spiderbot.qc.

Referenced by spiderbot_frame().

◆ autocvar_g_vehicle_spiderbot_head_turnlimit

float autocvar_g_vehicle_spiderbot_head_turnlimit = 90

Definition at line 34 of file spiderbot.qc.

Referenced by spiderbot_frame().

◆ autocvar_g_vehicle_spiderbot_head_turnspeed

float autocvar_g_vehicle_spiderbot_head_turnspeed = 110

Definition at line 35 of file spiderbot.qc.

Referenced by spiderbot_frame().

◆ autocvar_g_vehicle_spiderbot_health

int autocvar_g_vehicle_spiderbot_health = 800

Definition at line 37 of file spiderbot.qc.

Referenced by spiderbot_frame().

◆ autocvar_g_vehicle_spiderbot_health_regen

float autocvar_g_vehicle_spiderbot_health_regen = 10

Definition at line 38 of file spiderbot.qc.

Referenced by spiderbot_frame().

◆ autocvar_g_vehicle_spiderbot_health_regen_pause

float autocvar_g_vehicle_spiderbot_health_regen_pause = 5

Definition at line 39 of file spiderbot.qc.

Referenced by spiderbot_frame().

◆ autocvar_g_vehicle_spiderbot_movement_inertia

float autocvar_g_vehicle_spiderbot_movement_inertia = 0.15

Definition at line 25 of file spiderbot.qc.

Referenced by spiderbot_frame().

◆ autocvar_g_vehicle_spiderbot_respawntime

float autocvar_g_vehicle_spiderbot_respawntime = 45

Definition at line 18 of file spiderbot.qc.

◆ autocvar_g_vehicle_spiderbot_shield

int autocvar_g_vehicle_spiderbot_shield = 200

Definition at line 41 of file spiderbot.qc.

Referenced by spiderbot_frame().

◆ autocvar_g_vehicle_spiderbot_shield_regen

float autocvar_g_vehicle_spiderbot_shield_regen = 25

Definition at line 42 of file spiderbot.qc.

Referenced by spiderbot_frame().

◆ autocvar_g_vehicle_spiderbot_shield_regen_pause

float autocvar_g_vehicle_spiderbot_shield_regen_pause = 0.35

Definition at line 43 of file spiderbot.qc.

Referenced by spiderbot_frame().

◆ autocvar_g_vehicle_spiderbot_speed_stop

float autocvar_g_vehicle_spiderbot_speed_stop = 50

Definition at line 20 of file spiderbot.qc.

Referenced by spiderbot_frame().

◆ autocvar_g_vehicle_spiderbot_speed_strafe

float autocvar_g_vehicle_spiderbot_speed_strafe = 400

Definition at line 21 of file spiderbot.qc.

Referenced by spiderbot_exit(), and spiderbot_frame().

◆ autocvar_g_vehicle_spiderbot_speed_walk

float autocvar_g_vehicle_spiderbot_speed_walk = 500

Definition at line 22 of file spiderbot.qc.

Referenced by spiderbot_frame().

◆ autocvar_g_vehicle_spiderbot_springblend

float autocvar_g_vehicle_spiderbot_springblend = 0.1

Definition at line 29 of file spiderbot.qc.

Referenced by spiderbot_frame().

◆ autocvar_g_vehicle_spiderbot_springlength

float autocvar_g_vehicle_spiderbot_springlength = 150

Definition at line 27 of file spiderbot.qc.

Referenced by spiderbot_frame().

◆ autocvar_g_vehicle_spiderbot_springup

float autocvar_g_vehicle_spiderbot_springup = 20

Definition at line 28 of file spiderbot.qc.

Referenced by spiderbot_frame().

◆ autocvar_g_vehicle_spiderbot_tiltlimit

float autocvar_g_vehicle_spiderbot_tiltlimit = 90

Definition at line 30 of file spiderbot.qc.

Referenced by spiderbot_frame().

◆ autocvar_g_vehicle_spiderbot_turnspeed

float autocvar_g_vehicle_spiderbot_turnspeed = 90

Definition at line 23 of file spiderbot.qc.

Referenced by spiderbot_frame().

◆ autocvar_g_vehicle_spiderbot_turnspeed_strafe

float autocvar_g_vehicle_spiderbot_turnspeed_strafe = 300

Definition at line 24 of file spiderbot.qc.

Referenced by spiderbot_frame().

◆ jump_delay

float jump_delay

Definition at line 48 of file spiderbot.qc.

◆ SBRM_ARTILLERY

const int SBRM_ARTILLERY = 3

Definition at line 12 of file spiderbot.qc.

Referenced by spiderbot_impulse(), and spiderbot_rocket_do().

◆ SBRM_FIRST

const int SBRM_FIRST = 1

Definition at line 9 of file spiderbot.qc.

Referenced by spiderbot_impulse().

◆ SBRM_GUIDE

const int SBRM_GUIDE = 2

Definition at line 11 of file spiderbot.qc.

Referenced by spiderbot_impulse(), and spiderbot_rocket_do().

◆ SBRM_LAST

const int SBRM_LAST = 3

Definition at line 13 of file spiderbot.qc.

Referenced by spiderbot_impulse().

◆ SBRM_VOLLY

const int SBRM_VOLLY = 1

Definition at line 10 of file spiderbot.qc.

Referenced by spiderbot_impulse(), and spiderbot_rocket_do().