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 518 of file spiderbot.qc.

519{
520 if(!autocvar_g_vehicle_spiderbot) { delete(this); return; }
521 if(!vehicle_initialize(this, VEH_SPIDERBOT, false)) { delete(this); return; }
522}
bool autocvar_g_vehicle_spiderbot
Definition spiderbot.qc:18
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 397 of file spiderbot.qc.

398{
399 if(this.cnt > time)
400 {
401 if(random() < 0.1)
402 {
403 sound (this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
404 Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (this.origin + '0 0 100'), '0 0 0', 1);
405 }
406 this.nextthink = time + 0.1;
407 return;
408 }
409
410 entity h = new(spiderbot_top), g1 = new(spiderbot_gun), g2 = new(spiderbot_gun), b = new(spiderbot_body);
411
412 setmodel(b, MDL_VEH_SPIDERBOT_BODY);
413 setmodel(h, MDL_VEH_SPIDERBOT_TOP);
414 setmodel(g1, MDL_VEH_SPIDERBOT_GUN);
415 setmodel(g2, MDL_VEH_SPIDERBOT_GUN);
416
417 setorigin(b, this.origin);
418 b.frame = 11;
419 b.angles = this.angles;
420 setsize(b, this.mins, this.maxs);
421
422 h.solid = SOLID_BBOX; // before setorigin for immediate area grid linking
423 vector org = gettaginfo(this, gettagindex(this, "tag_head"));
424 setorigin(h, org);
426 h.velocity = v_up * (500 + random() * 500) + randomvec() * 128;
427 h.modelflags = MF_ROCKET;
428 h.effects = EF_FLAME | EF_LOWPRECISION;
429 h.avelocity = randomvec() * 360;
430
431 h.alpha = 1;
432 h.cnt = time + (3.5 * random());
433 h.fade_rate = 1 / min(this.respawntime, 10);
434 h.fade_time = time;
436 h.nextthink = time;
437
438 g1.solid = SOLID_CORPSE; // before setorigin for immediate area grid linking
439 org = gettaginfo(this.tur_head, gettagindex(this.tur_head, "tag_hardpoint01"));
440 setorigin(g1, org);
442 g1.velocity = v_forward * 700 + (randomvec() * 32);
443 g1.avelocity = randomvec() * 180;
444
445 g2.solid = SOLID_CORPSE; // before setorigin for immediate area grid linking
446 org = gettaginfo(this.tur_head, gettagindex(this.tur_head, "tag_hardpoint02"));
447 setorigin(g2, org);
449 g2.velocity = v_forward * 700 + (randomvec() * 32);
450 g2.avelocity = randomvec() * 180;
451
452 h.colormod = b.colormod = g1.colormod = g2.colormod = '-2 -2 -2';
453
454 SUB_SetFade(b, time + 5, min(this.respawntime, 1));
455 //SUB_SetFade(h, time, min(this.respawntime, 10));
456 SUB_SetFade(g1, time, min(this.respawntime, 10));
457 SUB_SetFade(g2, time, min(this.respawntime, 10));
458
459 RadiusDamage (this, this.enemy, 250, 15, 250, NULL, NULL, 250, DEATH_VH_SPID_DEATH.m_id, DMG_NOWEP, NULL);
460
461 this.alpha = this.tur_head.alpha = this.gun1.alpha = this.gun2.alpha = -1;
463 this.deadflag = DEAD_DEAD;
464 this.solid = SOLID_NOT;
465 this.tur_head.effects &= ~EF_FLAME;
466 this.vehicle_hudmodel.viewmodelforclient = this;
467}
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:981
#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:124
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:30
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:380
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 325 of file spiderbot.qc.

326{
327 entity player = this.owner;
328
329 IL_EACH(g_projectiles, it.owner == player && it.classname == "spiderbot_rocket",
330 {
331 it.realowner = player;
332 it.owner = NULL;
333 });
334
336 this.nextthink = time;
337 this.frame = 5;
339
340 if(!player)
341 {
342 this.owner = NULL; // reset owner anyway?
343 return;
344 }
345
346 makevectors(this.angles);
347 vector spot;
348 if(eject)
349 {
350 spot = this.origin + v_forward * 100 + '0 0 64';
351 spot = vehicles_findgoodexit(this, player, spot);
352 setorigin(player, spot);
353 player.velocity = (v_up + v_forward * 0.25) * 750;
354 player.oldvelocity = player.velocity;
355 }
356 else
357 {
359 {
360 player.velocity = normalize(this.velocity) * vlen(this.velocity);
361 player.velocity_z += 200;
362 spot = this.origin + v_forward * 128 + '0 0 64';
363 spot = vehicles_findgoodexit(this, player, spot);
364 }
365 else
366 {
367 player.velocity = this.velocity * 0.5;
368 player.velocity_z += 10;
369 spot = this.origin + v_forward * 256 + '0 0 64';
370 spot = vehicles_findgoodexit(this, player, spot);
371 }
372 player.oldvelocity = player.velocity;
373 setorigin(player, spot);
374 }
375
376 antilag_clear(player, CS(player));
377 this.owner = NULL;
378}
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:23
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 51 of file spiderbot.qc.

52{
53 entity vehic = this.vehicle;
54 return = true;
55
56 if(game_stopped)
57 {
58 vehic.solid = SOLID_NOT;
59 vehic.takedamage = DAMAGE_NO;
61 return;
62 }
63
64 vehicles_frame(vehic, this);
65
66 PHYS_INPUT_BUTTON_ZOOM(this) = false;
67 PHYS_INPUT_BUTTON_CROUCH(this) = false;
68 for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
69 {
70 .entity weaponentity = weaponentities[slot];
71 this.(weaponentity).m_switchweapon = WEP_Null;
72 }
73 STAT(VEHICLESTAT_W2MODE, this) = STAT(VEHICLESTAT_W2MODE, vehic);
74
75
76#if 1 // 0 to enable per-gun impact aux crosshairs
77 // Avarage gun impact point's -> aux cross
78 vector ad = gettaginfo(vehic.tur_head, gettagindex(vehic.tur_head, "tag_hardpoint01"));
79 vector vf = v_forward;
80 ad += gettaginfo(vehic.tur_head, gettagindex(vehic.tur_head, "tag_hardpoint02"));
81 vf += v_forward;
82 ad = ad * 0.5;
83 v_forward = vf * 0.5;
84 traceline(ad, ad + v_forward * max_shot_distance, MOVE_NORMAL, vehic);
85 UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' * (1 - this.vehicle_reload1)), 0);
86#else
87 vector ad = gettaginfo(vehic.gun1, gettagindex(vehic.gun1, "barrels"));
88 traceline(ad, ad + v_forward * max_shot_distance, MOVE_NORMAL, vehic);
89 UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' * (1 - this.vehicle_reload1)), 0);
90 vector vf = ad;
91 ad = gettaginfo(vehic.gun2, gettagindex(vehic.gun2, "barrels"));
92 traceline(ad, ad + v_forward * max_shot_distance, MOVE_NORMAL, vehic);
93 UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' * (1 - this.vehicle_reload1)), 1);
94 ad = 0.5 * (ad + vf);
95#endif
96
97 crosshair_trace(this);
100 ad = AnglesTransform_Normalize(ad, true);
101 //UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload2) + ('0 1 0' * (1 - this.vehicle_reload2)), 2);
102
103 // Rotate head
105 ad_y = bound(-ftmp, ad_y, ftmp);
106 vehic.tur_head.angles_y = bound(autocvar_g_vehicle_spiderbot_head_turnlimit * -1, vehic.tur_head.angles_y + ad_y, autocvar_g_vehicle_spiderbot_head_turnlimit);
107
108 // Pitch head
109 ad_x = bound(ftmp * -1, ad_x, ftmp);
110 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);
111
112
113 //fixedmakevectors(vehic.angles);
114 makevectors(vehic.angles + '-2 0 0' * vehic.angles_x);
115
117
118 if(IS_ONGROUND(vehic))
119 vehic.jump_delay = time; // reset now so movement can begin
120
121 //if(IS_ONGROUND(vehic))
122 {
123 if(IS_ONGROUND(vehic))
124 if(vehic.frame == 4 && vehic.tur_head.wait != 0)
125 {
126 sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_LAND, VOL_VEHICLEENGINE, ATTEN_NORM);
127 vehic.frame = 5;
128 }
129
130 if (!PHYS_INPUT_BUTTON_JUMP(this))
131 vehic.button2 = false;
132
133 if((IS_ONGROUND(vehic)) && PHYS_INPUT_BUTTON_JUMP(this) && !vehic.button2 && vehic.tur_head.wait < time)
134 {
135 sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_JUMP, VOL_VEHICLEENGINE, ATTEN_NORM);
136 //dprint("spiderbot_jump:", ftos(soundlength("vehicles/spiderbot_jump.wav")), "\n");
137 vehic.delay = 0;
138
139 vehic.tur_head.wait = time + 2;
140 vehic.jump_delay = time + 2;
141 vehic.button2 = true; // set spider's jump
142 //PHYS_INPUT_BUTTON_JUMP(this) = false;
143
144 vector movefix = '0 0 0';
145 if(CS(this).movement_x > 0) movefix_x = 1;
146 if(CS(this).movement_x < 0) movefix_x = -1;
147 if(CS(this).movement_y > 0) movefix_y = 1;
148 if(CS(this).movement_y < 0) movefix_y = -1;
149
150 vector rt = movefix_y * v_right;
151 vector sd = movefix_x * v_forward;
152 if(movefix_y == 0 && movefix_x == 0)
153 sd = v_forward; // always do forward
154
155 UNSET_ONGROUND(vehic);
156
157 vehic.velocity = sd * 700 + rt * 600 + v_up * 600;
158 vehic.frame = 4;
159 }
160 else if(time >= vehic.jump_delay)
161 {
162 if(!CS(this).movement)
163 {
164 if(IS_ONGROUND(vehic))
165 {
166 if(vehic.sound_nexttime < time || vehic.delay != 3)
167 {
168 vehic.delay = 3;
169 vehic.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_idle.wav");
170 //dprint("spiderbot_idle:", ftos(soundlength("vehicles/spiderbot_idle.wav")), "\n");
171 sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_IDLE, VOL_VEHICLEENGINE, ATTEN_NORM);
172 }
174 vehic.frame = 5;
175 }
176 }
177 else
178 {
179 // Turn Body
180 if(CS(this).movement_x == 0 && CS(this).movement_y != 0)
182 else
184
185 ftmp = bound(-ftmp, vehic.tur_head.angles_y, ftmp);
186 vehic.angles_y = anglemods(vehic.angles_y + ftmp);
187 vehic.tur_head.angles_y -= ftmp;
188
189 if(CS(this).movement_x != 0)
190 {
191 if(CS(this).movement_x > 0)
192 {
193 CS(this).movement_x = 1;
194 if(IS_ONGROUND(vehic))
195 vehic.frame = 0;
196 }
197 else if(CS(this).movement_x < 0)
198 {
199 CS(this).movement_x = -1;
200 if(IS_ONGROUND(vehic))
201 vehic.frame = 1;
202 }
203 CS(this).movement_y = 0;
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 * autocvar_sv_gravity;
210 if(IS_ONGROUND(vehic))
211 if(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 * autocvar_sv_gravity;
240 if(IS_ONGROUND(vehic))
241 if(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 if(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 entity gun;
263 vector v;
264 vehic.misc_bulletcounter += 1;
265
266 gun = (vehic.misc_bulletcounter % 2) ? vehic.gun1 : vehic.gun2;
267
268 v = gettaginfo(gun, gettagindex(gun, "barrels"));
270 v += v_forward * 50;
271
272 .entity weaponentity = weaponentities[0]; // TODO: unhardcode
275
276 sound (gun, CH_WEAPON_A, SND_VEH_SPIDERBOT_MINIGUN_FIRE, VOL_BASE, ATTEN_NORM);
277 //trailparticles(this, _particleeffectnum("spiderbot_minigun_trail"), v, trace_endpos);
278 Send_Effect(EFFECT_SPIDERBOT_MINIGUN_MUZZLEFLASH, v, v_forward * 2500, 1);
279
281 vehic.tur_head.attack_finished_single[0] = time + autocvar_g_vehicle_spiderbot_minigun_refire;
282 this.vehicle_ammo1 = (vehic.vehicle_ammo1 / autocvar_g_vehicle_spiderbot_minigun_ammo_max) * 100;
283 vehic.gun1.angles_z += 45;
284 vehic.gun2.angles_z -= 45;
285 if(vehic.gun1.angles_z >= 360)
286 {
287 vehic.gun1.angles_z = 0;
288 vehic.gun2.angles_z = 0;
289 }
290 }
291 }
292 else
296
297
298 spiderbot_rocket_do(vehic);
299
300 if(vehic.vehicle_flags & VHF_SHIELDREGEN)
302
303 if(vehic.vehicle_flags & VHF_HEALTHREGEN)
305
307 //this.vehicle_ammo2 = vehic.tur_head.frame;
308 this.vehicle_ammo2 = (9 - vehic.tur_head.frame) / 8 * 100; // Percentage, like ammo1
309
310 if(vehic.gun2.cnt <= time)
311 this.vehicle_reload2 = 100;
312 else
313 this.vehicle_reload2 = 100 - ((vehic.gun2.cnt - time) / vehic.attack_finished_single[0]) * 100;
314
315 setorigin(this, vehic.origin + '0 0 1' * vehic.maxs_z);
316 this.oldorigin = this.origin; // negate fall damage
317 this.velocity = vehic.velocity;
318
319 VEHICLE_UPDATE_PLAYER_RESOURCE(this, vehic, health, spiderbot, RES_HEALTH);
320
321 if(vehic.vehicle_flags & VHF_HASSHIELD)
322 VEHICLE_UPDATE_PLAYER(this, vehic, shield, spiderbot);
323}
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:154
vector movement
Definition player.qh:229
#define PHYS_INPUT_BUTTON_JUMP(s)
Definition player.qh:151
#define PHYS_INPUT_FRAMETIME
Definition player.qh:255
#define PHYS_INPUT_BUTTON_ATCK(s)
Definition player.qh:150
#define PHYS_INPUT_BUTTON_ZOOM(s)
Definition player.qh:153
#define PHYS_INPUT_BUTTON_ATCK2(s)
Definition player.qh:152
#define autocvar_sv_gravity
Definition stats.qh:421
float game_stopped
Definition stats.qh:81
bool autocvar_sv_gameplayfix_gravityunaffectedbyticrate
Definition stats.qh:396
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:186
void movelib_brake_simple(entity this, float force)
Definition movelib.qc:167
#define movelib_move_simple(e, newdir, velo, blendrate)
Definition movelib.qh:36
#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:31
float autocvar_g_vehicle_spiderbot_shield_regen
Definition spiderbot.qc:44
float autocvar_g_vehicle_spiderbot_turnspeed_strafe
Definition spiderbot.qc:26
float autocvar_g_vehicle_spiderbot_health_regen
Definition spiderbot.qc:40
int autocvar_g_vehicle_spiderbot_shield
Definition spiderbot.qc:43
float autocvar_g_vehicle_spiderbot_speed_stop
Definition spiderbot.qc:22
float autocvar_g_vehicle_spiderbot_turnspeed
Definition spiderbot.qc:25
float autocvar_g_vehicle_spiderbot_head_turnlimit
Definition spiderbot.qc:36
int autocvar_g_vehicle_spiderbot_health
Definition spiderbot.qc:39
float autocvar_g_vehicle_spiderbot_head_turnspeed
Definition spiderbot.qc:37
float autocvar_g_vehicle_spiderbot_health_regen_pause
Definition spiderbot.qc:41
float autocvar_g_vehicle_spiderbot_speed_walk
Definition spiderbot.qc:24
float autocvar_g_vehicle_spiderbot_movement_inertia
Definition spiderbot.qc:27
float autocvar_g_vehicle_spiderbot_shield_regen_pause
Definition spiderbot.qc:45
float autocvar_g_vehicle_spiderbot_head_pitchlimit_down
Definition spiderbot.qc:34
float autocvar_g_vehicle_spiderbot_springlength
Definition spiderbot.qc:29
float autocvar_g_vehicle_spiderbot_head_pitchlimit_up
Definition spiderbot.qc:35
float autocvar_g_vehicle_spiderbot_tiltlimit
Definition spiderbot.qc:32
float autocvar_g_vehicle_spiderbot_springup
Definition spiderbot.qc:30
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 energy left on vehicle. If ent is vehicle,...
const float vehicle_reload2
If ent is player this is 0..100 indicating percentage of secondary ammo left. If ent is vehicle,...
const float vehicle_ammo1
If ent is player this is 0..100 indicating precentage of shield left on vehicle. If ent is vehicle,...
const float vehicle_health
#define VEHICLE_UPDATE_PLAYER(ply, vehi, fld, vhname)
const float VOL_VEHICLEENGINE
#define VEHICLE_UPDATE_PLAYER_RESOURCE(ply, vehi, fld, vhname, res)
entity vehicle
Entity to disply the shild effect on damage.
const float vehicle_ammo2
If ent is player this is 0..100 indicating percentage of primary reload status. If ent is vehicle,...
const float vehicle_reload1
If ent is player this is 0..100 indicating percentage of primary ammo left UNLESS value is already st...
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:544
void crosshair_trace(entity pl)
Definition tracing.qc:549
const int VHF_HASSHIELD
Indicates vehicle.
Definition vehicle.qh:85
const int VHF_HEALTHREGEN
Vehicles shield regenerates.
Definition vehicle.qh:87
const int VHF_SHIELDREGEN
Vehicle has shileding.
Definition vehicle.qh:86
const int MAX_WEAPONSLOTS
Definition weapon.qh:16
int max_shot_distance
Definition weapon.qh:203
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, autocvar_sv_gravity, 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(), oldorigin, origin, 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 380 of file spiderbot.qc.

381{
383 this.nextthink = this.fade_time;
384 this.alpha = 1 - (time - this.fade_time) * this.fade_rate;
385
386 if(this.cnt < time || this.alpha < 0.1)
387 {
388 if(this.alpha > 0.1)
389 {
390 sound (this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
391 Send_Effect(EFFECT_EXPLOSION_BIG, this.origin + '0 0 100', '0 0 0', 1);
392 }
393 delete(this);
394 }
395}
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 469 of file spiderbot.qc.

470{
471 switch(_imp)
472 {
473 case IMP_weapon_group_1.impulse:
474 STAT(VEHICLESTAT_W2MODE, this.vehicle) = SBRM_VOLLY;
475 CSQCVehicleSetup(this, 0);
476 return true;
477 case IMP_weapon_group_2.impulse:
478 STAT(VEHICLESTAT_W2MODE, this.vehicle) = SBRM_GUIDE;
479 CSQCVehicleSetup(this, 0);
480 return true;
481 case IMP_weapon_group_3.impulse:
482 STAT(VEHICLESTAT_W2MODE, this.vehicle) = SBRM_ARTILLERY;
483 CSQCVehicleSetup(this, 0);
484 return true;
485
486 case IMP_weapon_next_byid.impulse:
487 case IMP_weapon_next_bypriority.impulse:
488 case IMP_weapon_next_bygroup.impulse:
489 STAT(VEHICLESTAT_W2MODE, this.vehicle) += 1;
490 if(STAT(VEHICLESTAT_W2MODE, this.vehicle) > SBRM_LAST)
491 STAT(VEHICLESTAT_W2MODE, this.vehicle) = SBRM_FIRST;
492
493 //centerprint(this, strcat("Rocket mode is ", ftos(STAT(VEHICLESTAT_W2MODE, this.vehicle))));
494 CSQCVehicleSetup(this, 0);
495 return true;
496 case IMP_weapon_last.impulse:
497 case IMP_weapon_prev_byid.impulse:
498 case IMP_weapon_prev_bypriority.impulse:
499 case IMP_weapon_prev_bygroup.impulse:
500 STAT(VEHICLESTAT_W2MODE, this.vehicle) -= 1;
501 if(STAT(VEHICLESTAT_W2MODE, this.vehicle) < SBRM_FIRST)
502 STAT(VEHICLESTAT_W2MODE, this.vehicle) = SBRM_LAST;
503
504 //centerprint(this, strcat("Rocket mode is ", ftos(STAT(VEHICLESTAT_W2MODE, this.vehicle))));
505 CSQCVehicleSetup(this, 0);
506 return true;
507
508 /*
509 case IMP_weapon_drop.impulse: // toss gun, could be used to exit?
510 break;
511 case IMP_weapon_reload.impulse: // Manual minigun reload?
512 break;
513 */
514 }
515 return false;
516}
const int SBRM_VOLLY
Definition spiderbot.qc:12
const int SBRM_GUIDE
Definition spiderbot.qc:13
const int SBRM_FIRST
Definition spiderbot.qc:11
const int SBRM_ARTILLERY
Definition spiderbot.qc:14
const int SBRM_LAST
Definition spiderbot.qc:15
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 18 of file spiderbot.qc.

Referenced by spawnfunc().

◆ autocvar_g_vehicle_spiderbot_bouncepain

vector autocvar_g_vehicle_spiderbot_bouncepain = '0 0 0'

Definition at line 48 of file spiderbot.qc.

◆ autocvar_g_vehicle_spiderbot_head_pitchlimit_down

float autocvar_g_vehicle_spiderbot_head_pitchlimit_down = -20

Definition at line 34 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 35 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 36 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 37 of file spiderbot.qc.

Referenced by spiderbot_frame().

◆ autocvar_g_vehicle_spiderbot_health

int autocvar_g_vehicle_spiderbot_health = 800

Definition at line 39 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 40 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 41 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 27 of file spiderbot.qc.

Referenced by spiderbot_frame().

◆ autocvar_g_vehicle_spiderbot_respawntime

float autocvar_g_vehicle_spiderbot_respawntime = 45

Definition at line 20 of file spiderbot.qc.

◆ autocvar_g_vehicle_spiderbot_shield

int autocvar_g_vehicle_spiderbot_shield = 200

Definition at line 43 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 44 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 45 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 22 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 23 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 24 of file spiderbot.qc.

Referenced by spiderbot_frame().

◆ autocvar_g_vehicle_spiderbot_springblend

float autocvar_g_vehicle_spiderbot_springblend = 0.1

Definition at line 31 of file spiderbot.qc.

Referenced by spiderbot_frame().

◆ autocvar_g_vehicle_spiderbot_springlength

float autocvar_g_vehicle_spiderbot_springlength = 150

Definition at line 29 of file spiderbot.qc.

Referenced by spiderbot_frame().

◆ autocvar_g_vehicle_spiderbot_springup

float autocvar_g_vehicle_spiderbot_springup = 20

Definition at line 30 of file spiderbot.qc.

Referenced by spiderbot_frame().

◆ autocvar_g_vehicle_spiderbot_tiltlimit

float autocvar_g_vehicle_spiderbot_tiltlimit = 90

Definition at line 32 of file spiderbot.qc.

Referenced by spiderbot_frame().

◆ autocvar_g_vehicle_spiderbot_turnspeed

float autocvar_g_vehicle_spiderbot_turnspeed = 90

Definition at line 25 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 26 of file spiderbot.qc.

Referenced by spiderbot_frame().

◆ jump_delay

float jump_delay

Definition at line 50 of file spiderbot.qc.

◆ SBRM_ARTILLERY

const int SBRM_ARTILLERY = 3

Definition at line 14 of file spiderbot.qc.

Referenced by spiderbot_impulse(), and spiderbot_rocket_do().

◆ SBRM_FIRST

const int SBRM_FIRST = 1

Definition at line 11 of file spiderbot.qc.

Referenced by spiderbot_impulse().

◆ SBRM_GUIDE

const int SBRM_GUIDE = 2

Definition at line 13 of file spiderbot.qc.

Referenced by spiderbot_impulse(), and spiderbot_rocket_do().

◆ SBRM_LAST

const int SBRM_LAST = 3

Definition at line 15 of file spiderbot.qc.

Referenced by spiderbot_impulse().

◆ SBRM_VOLLY

const int SBRM_VOLLY = 1

Definition at line 12 of file spiderbot.qc.

Referenced by spiderbot_impulse(), and spiderbot_rocket_do().