Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
spiderbot.qc
Go to the documentation of this file.
1#include "spiderbot.qh"
2
3#if defined(SVQC)
5#elif defined(MENUQC)
6 #include "raptor.qh"
7#endif
8
9#ifdef GAMEQC
10
11const int SBRM_FIRST = 1;
12const int SBRM_VOLLY = 1;
13const int SBRM_GUIDE = 2;
14const int SBRM_ARTILLERY = 3;
15const int SBRM_LAST = 3;
16
17#ifdef SVQC
19
21
28
33
38
42
46
47// 'minspeed_for_pain speedchange_to_pain_factor max_damage'
49
51bool spiderbot_frame(entity this, float dt)
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}
324
325void spiderbot_exit(entity this, int eject)
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}
379
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}
396
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}
468
469bool spiderbot_impulse(entity this, int _imp)
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}
517
518spawnfunc(vehicle_spiderbot)
519{
520 if(!autocvar_g_vehicle_spiderbot) { delete(this); return; }
521 if(!vehicle_initialize(this, VEH_SPIDERBOT, false)) { delete(this); return; }
522}
523
524METHOD(Spiderbot, vr_impact, void(Spiderbot thisveh, entity instance))
525{
527 vehicles_impact(instance, autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z);
528}
529METHOD(Spiderbot, vr_enter, void(Spiderbot thisveh, entity instance))
530{
531 STAT(VEHICLESTAT_W2MODE, instance) = SBRM_GUIDE;
532 set_movetype(instance, MOVETYPE_WALK);
533 CSQCVehicleSetup(instance.owner, 0);
534 instance.owner.vehicle_health = (GetResource(instance, RES_HEALTH) / autocvar_g_vehicle_spiderbot_health) * 100;
535 instance.owner.vehicle_shield = (instance.vehicle_shield / autocvar_g_vehicle_spiderbot_shield) * 100;
536
537 if(instance.owner.flagcarried)
538 {
539 setattachment(instance.owner.flagcarried, instance.tur_head, "");
540 setorigin(instance.owner.flagcarried, '-20 0 120');
541 }
542}
543METHOD(Spiderbot, vr_think, void(Spiderbot thisveh, entity instance))
544{
545 if(IS_ONGROUND(instance))
547}
548METHOD(Spiderbot, vr_death, void(Spiderbot thisveh, entity instance))
549{
550 SetResourceExplicit(instance, RES_HEALTH, 0);
551 instance.event_damage = func_null;
552 instance.takedamage = DAMAGE_NO;
553 settouch(instance, func_null);
554 instance.cnt = 3.4 + time + random() * 2;
555 setthink(instance, spiderbot_blowup);
556 instance.nextthink = time;
557 instance.deadflag = DEAD_DYING;
558 instance.frame = 5;
559 instance.tur_head.effects |= EF_FLAME;
560 instance.colormod = instance.tur_head.colormod = '-1 -1 -1';
561 instance.frame = 10;
562 set_movetype(instance, MOVETYPE_TOSS);
563
564 CSQCModel_UnlinkEntity(instance); // networking the death scene would be a nightmare
565}
566METHOD(Spiderbot, vr_spawn, void(Spiderbot thisveh, entity instance))
567{
568 if(!instance.gun1)
569 {
570 instance.vehicles_impulse = spiderbot_impulse;
571 instance.gun1 = new(spiderbot_gun);
572 instance.gun2 = new(spiderbot_gun);
573 setmodel(instance.gun1, MDL_VEH_SPIDERBOT_GUN);
574 setmodel(instance.gun2, MDL_VEH_SPIDERBOT_GUN);
575 setattachment(instance.gun1, instance.tur_head, "tag_hardpoint01");
576 setattachment(instance.gun2, instance.tur_head, "tag_hardpoint02");
577 instance.gravity = 2;
578 instance.mass = 5000;
579 }
580
581 instance.frame = 5;
582 instance.tur_head.frame = 1;
583 set_movetype(instance, MOVETYPE_WALK);
584 instance.solid = SOLID_SLIDEBOX;
585 instance.alpha = instance.tur_head.alpha = instance.gun1.alpha = instance.gun2.alpha = 1;
586 instance.tur_head.angles = '0 0 0';
587 instance.vehicle_exit = spiderbot_exit;
588
589 setorigin(instance, instance.pos1 + '0 0 128');
590 instance.angles = instance.pos2;
591 instance.damageforcescale = 0.03;
593 instance.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
594
595 instance.PlayerPhysplug = spiderbot_frame;
596}
597METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh, entity instance))
598{
600 instance.vehicle_flags |= VHF_HASSHIELD;
601
603 instance.vehicle_flags |= VHF_SHIELDREGEN;
604
606 instance.vehicle_flags |= VHF_HEALTHREGEN;
607
608 instance.respawntime = autocvar_g_vehicle_spiderbot_respawntime;
610 instance.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
611 instance.max_health = GetResource(instance, RES_HEALTH);
612 instance.pushable = true; // spiderbot can use jumppads
613}
614
615#endif // SVQC
616#ifdef CSQC
617//float autocvar_cl_vehicle_spiderbot_cross_alpha = 0.6;
618//float autocvar_cl_vehicle_spiderbot_cross_size = 1;
619
620METHOD(Spiderbot, vr_hud, void(Spiderbot thisveh))
621{
622 Vehicles_drawHUD(VEH_SPIDERBOT.m_icon, "vehicle_spider_weapon1", "vehicle_spider_weapon2",
625}
626METHOD(Spiderbot, vr_crosshair, void(Spiderbot thisveh, entity player))
627{
628 string crosshair;
629
630 switch(weapon2mode)
631 {
632 case SBRM_VOLLY: crosshair = vCROSS_BURST; break;
633 case SBRM_GUIDE: crosshair = vCROSS_GUIDE; break;
634 case SBRM_ARTILLERY: crosshair = vCROSS_RAIN; break;
635 default: crosshair = vCROSS_BURST;
636 }
637
638 Vehicles_drawCrosshair(crosshair);
639}
640METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh, entity instance))
641{
642 AuxiliaryXhair[0].axh_image = vCROSS_HINT; // Minigun1
643 AuxiliaryXhair[1].axh_image = vCROSS_HINT; // Minigun2
644}
645
646#endif
647
648#endif
649#ifdef MENUQC
650
651METHOD(Spiderbot, describe, string(Spiderbot this))
652{
653 TC(Spiderbot, this);
655 PAR(_("The %s vehicle walks and jumps around, and takes only one rider."), COLORED_NAME(this));
656 PAR(_("It can jump from very high altitudes while protecting the rider."));
657 PAR(_("It has two weapons the rider can control, which have different reticles for them similar to the %s. "
658 "The primary weapon is a machine gun, and is shot toward the green reticle. "
659 "The secondary weapon shoots rockets towards the white reticle. "
660 "The white reticle points to the front of the vehicle, while the green reticle also points to the front but with a bit of delay when the %s rotates."), COLORED_NAME(VEH_RAPTOR), COLORED_NAME(this));
661 return PAGE_TEXT;
662}
663
664#endif
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)
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
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
void Vehicles_drawCrosshair(string crosshair)
void Vehicles_drawHUD(string vehicle, string vehicleWeapon1, string vehicleWeapon2, string iconAmmo1, vector colorAmmo1, string iconAmmo2, vector colorAmmo2)
vector autocvar_hud_progressbar_vehicles_ammo2_color
const string vCROSS_GUIDE
vector autocvar_hud_progressbar_vehicles_ammo1_color
const string vCROSS_BURST
const string vCROSS_HINT
#define weapon2mode
const string vCROSS_RAIN
entity AuxiliaryXhair[MAX_AXH]
float cnt
Definition powerups.qc:24
float alpha
Definition items.qc:13
entity owner
Definition main.qh:87
#define COLORED_NAME(this)
Definition color.qh:195
#define setmodel(this, m)
Definition model.qh:26
#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
vector v_up
const float SOLID_SLIDEBOX
const float MOVE_NORMAL
vector mins
const float SOLID_CORPSE
vector velocity
const float SOLID_BBOX
const float SOLID_NOT
float time
vector v_right
vector trace_endpos
vector maxs
const float EF_FLAME
float nextthink
vector v_forward
vector origin
vector oldorigin
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
#define IL_EACH(this, cond, body)
#define TC(T, sym)
Definition _all.inc:82
#define STAT(...)
Definition stats.qh:82
float bound(float min, float value, float max)
float random(void)
float vlen(vector v)
vector vectoangles(vector v)
vector randomvec(void)
float min(float f,...)
vector normalize(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
void set_movetype(entity this, int mt)
Definition movetypes.qc:4
const int MOVETYPE_WALK
Definition movetypes.qh:132
const int MOVETYPE_NONE
Definition movetypes.qh:129
#define UNSET_ONGROUND(s)
Definition movetypes.qh:18
const int MOVETYPE_TOSS
Definition movetypes.qh:135
const int MOVETYPE_BOUNCE
Definition movetypes.qh:139
#define IS_ONGROUND(s)
Definition movetypes.qh:16
var void func_null()
#define METHOD(cname, name, prototype)
Definition oo.qh:269
#define NULL
Definition post.qh:14
#define makevectors
Definition post.qh:21
#define gettaginfo
Definition post.qh:32
float DEAD_DYING
Definition progsdefs.qc:275
float deadflag
Definition progsdefs.qc:149
float DEAD_DEAD
Definition progsdefs.qc:276
fade_rate
Definition projectile.qh:14
float health
Legacy fields for the resources. To be removed.
Definition resources.qh:9
#define setthink(e, f)
vector
Definition self.qh:92
vector org
Definition self.qh:92
#define settouch(e, f)
Definition self.qh:73
float respawntime
Definition items.qh:30
float fade_time
Definition common.qh:23
IntrusiveList g_projectiles
Definition common.qh:58
const int CH_TRIGGER_SINGLE
Definition sound.qh:13
const float VOL_BASE
Definition sound.qh:36
const int CH_SHOTS
Definition sound.qh:14
const int CH_WEAPON_A
Definition sound.qh:7
const float ATTEN_NORM
Definition sound.qh:30
#define sound(e, c, s, v, a)
Definition sound.qh:52
#define spawnfunc(id)
Definition spawnfunc.qh:96
float autocvar_g_vehicle_spiderbot_springblend
Definition spiderbot.qc:31
const int SBRM_VOLLY
Definition spiderbot.qc:12
bool autocvar_g_vehicle_spiderbot
Definition spiderbot.qc:18
const int SBRM_GUIDE
Definition spiderbot.qc:13
float autocvar_g_vehicle_spiderbot_shield_regen
Definition spiderbot.qc:44
float autocvar_g_vehicle_spiderbot_turnspeed_strafe
Definition spiderbot.qc:26
void spiderbot_headfade(entity this)
Definition spiderbot.qc:380
bool spiderbot_impulse(entity this, int _imp)
Definition spiderbot.qc:469
float autocvar_g_vehicle_spiderbot_health_regen
Definition spiderbot.qc:40
int autocvar_g_vehicle_spiderbot_shield
Definition spiderbot.qc:43
float jump_delay
Definition spiderbot.qc:50
void spiderbot_exit(entity this, int eject)
Definition spiderbot.qc:325
float autocvar_g_vehicle_spiderbot_speed_stop
Definition spiderbot.qc:22
float autocvar_g_vehicle_spiderbot_turnspeed
Definition spiderbot.qc:25
vector autocvar_g_vehicle_spiderbot_bouncepain
Definition spiderbot.qc:48
float autocvar_g_vehicle_spiderbot_head_turnlimit
Definition spiderbot.qc:36
int autocvar_g_vehicle_spiderbot_health
Definition spiderbot.qc:39
void spiderbot_blowup(entity this)
Definition spiderbot.qc:397
const int SBRM_FIRST
Definition spiderbot.qc:11
float autocvar_g_vehicle_spiderbot_head_turnspeed
Definition spiderbot.qc:37
float autocvar_g_vehicle_spiderbot_health_regen_pause
Definition spiderbot.qc:41
const int SBRM_ARTILLERY
Definition spiderbot.qc:14
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_respawntime
Definition spiderbot.qc:20
float autocvar_g_vehicle_spiderbot_shield_regen_pause
Definition spiderbot.qc:45
float autocvar_g_vehicle_spiderbot_head_pitchlimit_down
Definition spiderbot.qc:34
const int SBRM_LAST
Definition spiderbot.qc:15
float autocvar_g_vehicle_spiderbot_springlength
Definition spiderbot.qc:29
float autocvar_g_vehicle_spiderbot_head_pitchlimit_up
Definition spiderbot.qc:35
bool spiderbot_frame(entity this, float dt)
Definition spiderbot.qc:51
float autocvar_g_vehicle_spiderbot_tiltlimit
Definition spiderbot.qc:32
float autocvar_g_vehicle_spiderbot_springup
Definition spiderbot.qc:30
float autocvar_g_vehicle_spiderbot_speed_strafe
Definition spiderbot.qc:23
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
ClientState CS(Client this)
Definition state.qh:47
#define PAGE_TEXT
Definition string.qh:643
#define PAR(...)
Adds an individually translatable paragraph to PAGE_TEXT without having to deal with strcat and sprin...
Definition string.qh:649
#define PAGE_TEXT_INIT()
Definition string.qh:642
void SUB_SetFade(entity ent, float vanish_time, float fading_time)
Definition subs.qc:77
const int DAMAGE_NO
Definition subs.qh:79
entity enemy
Definition sv_ctf.qh:153
void CSQCModel_UnlinkEntity(entity e)
Definition sv_model.qc:129
entity tur_head
Definition sv_turrets.qh:28
void vehicles_impact(entity this, float _minspeed, float _speedfac, float _maxpain)
bool vehicle_initialize(entity this, Vehicle info, bool nodrop)
void vehicles_regen(entity this, float timer,.float regen_field, float field_max, float rpause, float regen, float delta_time, float _healthscale)
vector vehicles_findgoodexit(entity this, entity player, vector prefer_spot)
void UpdateAuxiliaryXhair(entity own, vector loc, vector clr, int axh_id)
void vehicles_think(entity this)
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 CSQCVehicleSetup(entity own, int vehicle_id)
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 gun1
entity vehicle
Entity to disply the shild effect on damage.
entity gun2
entity vehicle_hudmodel
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
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
Definition vector.qh:8
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