1 #ifndef VEHICLE_SPIDERBOT
2 #define VEHICLE_SPIDERBOT
4 #include "spiderbot_weapons.qc"
6 CLASS(Spiderbot, Vehicle)
7 /* spawnflags */ ATTRIB(Spiderbot, spawnflags, int, VHF_DMGSHAKE);
8 /* mins */ ATTRIB(Spiderbot, mins, vector, '-75 -75 10');
9 /* maxs */ ATTRIB(Spiderbot, maxs, vector, '75 75 125');
10 /* view offset*/ ATTRIB(Spiderbot, view_ofs, vector, '0 0 70');
11 /* view dist */ ATTRIB(Spiderbot, height, float, 170);
12 /* model */ ATTRIB(Spiderbot, mdl, string, "models/vehicles/spiderbot.dpm");
13 /* model */ ATTRIB(Spiderbot, model, string, "models/vehicles/spiderbot.dpm");
14 /* head_model */ ATTRIB(Spiderbot, head_model, string, "models/vehicles/spiderbot_top.dpm");
15 /* hud_model */ ATTRIB(Spiderbot, hud_model, string, "models/vehicles/spiderbot_cockpit.dpm");
16 /* tags */ ATTRIB(Spiderbot, tag_head, string, "tag_head");
17 /* tags */ ATTRIB(Spiderbot, tag_hud, string, "tag_hud");
18 /* tags */ ATTRIB(Spiderbot, tag_view, string, "");
19 /* netname */ ATTRIB(Spiderbot, netname, string, "spiderbot");
20 /* fullname */ ATTRIB(Spiderbot, vehicle_name, string, _("Spiderbot"));
21 /* icon */ ATTRIB(Spiderbot, m_icon, string, "vehicle_spider");
24 REGISTER_VEHICLE(SPIDERBOT, NEW(Spiderbot));
30 const int SBRM_FIRST = 1;
31 const int SBRM_VOLLY = 1;
32 const int SBRM_GUIDE = 2;
33 const int SBRM_ARTILLERY = 3;
34 const int SBRM_LAST = 3;
36 #include "spiderbot_weapons.qc"
39 bool autocvar_g_vehicle_spiderbot;
41 float autocvar_g_vehicle_spiderbot_respawntime;
43 float autocvar_g_vehicle_spiderbot_speed_stop;
44 float autocvar_g_vehicle_spiderbot_speed_strafe;
45 float autocvar_g_vehicle_spiderbot_speed_walk;
46 float autocvar_g_vehicle_spiderbot_speed_run = 700;
47 float autocvar_g_vehicle_spiderbot_turnspeed;
48 float autocvar_g_vehicle_spiderbot_turnspeed_strafe;
49 float autocvar_g_vehicle_spiderbot_movement_inertia;
51 float autocvar_g_vehicle_spiderbot_springlength;
52 float autocvar_g_vehicle_spiderbot_springup;
53 float autocvar_g_vehicle_spiderbot_springblend;
54 float autocvar_g_vehicle_spiderbot_tiltlimit;
56 float autocvar_g_vehicle_spiderbot_head_pitchlimit_down;
57 float autocvar_g_vehicle_spiderbot_head_pitchlimit_up;
58 float autocvar_g_vehicle_spiderbot_head_turnlimit;
59 float autocvar_g_vehicle_spiderbot_head_turnspeed;
61 int autocvar_g_vehicle_spiderbot_health;
62 float autocvar_g_vehicle_spiderbot_health_regen;
63 float autocvar_g_vehicle_spiderbot_health_regen_pause;
65 int autocvar_g_vehicle_spiderbot_shield;
66 float autocvar_g_vehicle_spiderbot_shield_regen;
67 float autocvar_g_vehicle_spiderbot_shield_regen_pause;
69 vector autocvar_g_vehicle_spiderbot_bouncepain;
72 float spiderbot_frame()
75 entity player, spider;
78 if(intermission_running)
80 self.vehicle.velocity = '0 0 0';
81 self.vehicle.avelocity = '0 0 0';
86 spider = self.vehicle;
88 vehicles_frame(spider, player);
92 player.BUTTON_ZOOM = 0;
93 player.BUTTON_CROUCH = 0;
94 PS(player).m_switchweapon = WEP_Null;
95 player.vehicle_weapon2mode = spider.vehicle_weapon2mode;
98 #if 1 // 0 to enable per-gun impact aux crosshairs
99 // Avarage gun impact point's -> aux cross
100 ad = gettaginfo(spider.tur_head, gettagindex(spider.tur_head, "tag_hardpoint01"));
102 ad += gettaginfo(spider.tur_head, gettagindex(spider.tur_head, "tag_hardpoint02"));
105 v_forward = vf * 0.5;
106 traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, spider);
107 UpdateAuxiliaryXhair(player, trace_endpos, ('1 0 0' * player.vehicle_reload1) + ('0 1 0' * (1 - player.vehicle_reload1)), 0);
109 ad = gettaginfo(spider.gun1, gettagindex(spider.gun1, "barrels"));
110 traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, spider);
111 UpdateAuxiliaryXhair(player, trace_endpos, ('1 0 0' * player.vehicle_reload1) + ('0 1 0' * (1 - player.vehicle_reload1)), 0);
113 ad = gettaginfo(spider.gun2, gettagindex(spider.gun2, "barrels"));
114 traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, spider);
115 UpdateAuxiliaryXhair(player, trace_endpos, ('1 0 0' * player.vehicle_reload1) + ('0 1 0' * (1 - player.vehicle_reload1)), 1);
116 ad = 0.5 * (ad + vf);
119 crosshair_trace(player);
120 ad = vectoangles(normalize(trace_endpos - ad));
121 ad = AnglesTransform_ToAngles(AnglesTransform_LeftDivide(AnglesTransform_FromAngles(spider.angles), AnglesTransform_FromAngles(ad))) - spider.tur_head.angles;
122 ad = AnglesTransform_Normalize(ad, true);
123 //UpdateAuxiliaryXhair(player, trace_endpos, ('1 0 0' * player.vehicle_reload2) + ('0 1 0' * (1 - player.vehicle_reload2)), 2);
126 ftmp = autocvar_g_vehicle_spiderbot_head_turnspeed * sys_frametime;
127 ad_y = bound(-ftmp, ad_y, ftmp);
128 spider.tur_head.angles_y = bound(autocvar_g_vehicle_spiderbot_head_turnlimit * -1, spider.tur_head.angles_y + ad_y, autocvar_g_vehicle_spiderbot_head_turnlimit);
131 ad_x = bound(ftmp * -1, ad_x, ftmp);
132 spider.tur_head.angles_x = bound(autocvar_g_vehicle_spiderbot_head_pitchlimit_down, spider.tur_head.angles_x + ad_x, autocvar_g_vehicle_spiderbot_head_pitchlimit_up);
135 //fixedmakevectors(spider.angles);
136 makevectors(spider.angles + '-2 0 0' * spider.angles_x);
138 movelib_groundalign4point(autocvar_g_vehicle_spiderbot_springlength, autocvar_g_vehicle_spiderbot_springup, autocvar_g_vehicle_spiderbot_springblend, autocvar_g_vehicle_spiderbot_tiltlimit);
140 if(IS_ONGROUND(spider))
141 spider.jump_delay = time; // reset now so movement can begin
143 //if(IS_ONGROUND(spider))
145 if(IS_ONGROUND(spider))
146 if(spider.frame == 4 && self.tur_head.wait != 0)
148 sound (self, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_LAND, VOL_VEHICLEENGINE, ATTEN_NORM);
152 if(!player.BUTTON_JUMP)
153 spider.BUTTON_JUMP = 0;
155 if((IS_ONGROUND(spider)) && player.BUTTON_JUMP && !spider.BUTTON_JUMP && self.tur_head.wait < time)
157 sound (self, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_JUMP, VOL_VEHICLEENGINE, ATTEN_NORM);
158 //dprint("spiderbot_jump:", ftos(soundlength("vehicles/spiderbot_jump.wav")), "\n");
161 self.tur_head.wait = time + 2;
162 spider.jump_delay = time + 2;
163 spider.BUTTON_JUMP = 1; // set spider's jump
164 //player.BUTTON_JUMP = 0;
166 vector movefix = '0 0 0';
167 if(player.movement_x > 0) movefix_x = 1;
168 if(player.movement_x < 0) movefix_x = -1;
169 if(player.movement_y > 0) movefix_y = 1;
170 if(player.movement_y < 0) movefix_y = -1;
172 vector rt = movefix_y * v_right;
173 vector sd = movefix_x * v_forward;
174 if(movefix_y == 0 && movefix_x == 0)
175 sd = v_forward; // always do forward
177 UNSET_ONGROUND(spider);
179 spider.velocity = sd * 700 + rt * 600 + v_up * 600;
182 else if(time >= spider.jump_delay)
186 if(IS_ONGROUND(spider))
188 if(self.sound_nexttime < time || self.delay != 3)
191 self.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_idle.wav");
192 //dprint("spiderbot_idle:", ftos(soundlength("vehicles/spiderbot_idle.wav")), "\n");
193 sound (self, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_IDLE, VOL_VEHICLEENGINE, ATTEN_NORM);
195 movelib_brake_simple(self, autocvar_g_vehicle_spiderbot_speed_stop);
202 if(player.movement_x == 0 && player.movement_y != 0)
203 ftmp = autocvar_g_vehicle_spiderbot_turnspeed_strafe * sys_frametime;
205 ftmp = autocvar_g_vehicle_spiderbot_turnspeed * sys_frametime;
207 ftmp = bound(-ftmp, spider.tur_head.angles_y, ftmp);
208 spider.angles_y = anglemods(spider.angles_y + ftmp);
209 spider.tur_head.angles_y -= ftmp;
211 if(player.movement_x != 0)
213 if(player.movement_x > 0)
215 player.movement_x = 1;
216 if(IS_ONGROUND(spider))
219 else if(player.movement_x < 0)
221 player.movement_x = -1;
222 if(IS_ONGROUND(spider))
225 player.movement_y = 0;
226 float oldvelz = spider.velocity_z;
227 movelib_move_simple(self, normalize(v_forward * player.movement_x),((player.BUTTON_JUMP) ? autocvar_g_vehicle_spiderbot_speed_run : autocvar_g_vehicle_spiderbot_speed_walk),autocvar_g_vehicle_spiderbot_movement_inertia);
228 spider.velocity_z = oldvelz;
229 float g = ((autocvar_sv_gameplayfix_gravityunaffectedbyticrate) ? 0.5 : 1);
230 if(spider.velocity_z <= 20) // not while jumping
231 spider.velocity_z -= g * sys_frametime * autocvar_sv_gravity;
232 if(IS_ONGROUND(spider))
233 if(self.sound_nexttime < time || self.delay != 1)
236 self.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_walk.wav");
237 sound (self, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_WALK, VOL_VEHICLEENGINE, ATTEN_NORM);
238 //dprint("spiderbot_walk:", ftos(soundlength("vehicles/spiderbot_walk.wav")), "\n");
241 else if(player.movement_y != 0)
243 if(player.movement_y < 0)
245 player.movement_y = -1;
246 if(IS_ONGROUND(spider))
249 else if(player.movement_y > 0)
251 player.movement_y = 1;
252 if(IS_ONGROUND(spider))
256 float oldvelz = spider.velocity_z;
257 movelib_move_simple(self, normalize(v_right * player.movement_y),autocvar_g_vehicle_spiderbot_speed_strafe,autocvar_g_vehicle_spiderbot_movement_inertia);
258 spider.velocity_z = oldvelz;
259 float g = ((autocvar_sv_gameplayfix_gravityunaffectedbyticrate) ? 0.5 : 1);
260 if(spider.velocity_z <= 20) // not while jumping
261 spider.velocity_z -= g * sys_frametime * autocvar_sv_gravity;
262 if(IS_ONGROUND(spider))
263 if(self.sound_nexttime < time || self.delay != 2)
266 self.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_strafe.wav");
267 sound (self, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_STRAFE, VOL_VEHICLEENGINE, ATTEN_NORM);
268 //dprint("spiderbot_strafe:", ftos(soundlength("vehicles/spiderbot_strafe.wav")), "\n");
275 self.angles_x = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, self.angles_x, autocvar_g_vehicle_spiderbot_tiltlimit);
276 self.angles_z = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, self.angles_z, autocvar_g_vehicle_spiderbot_tiltlimit);
278 if(!forbidWeaponUse(player))
279 if(player.BUTTON_ATCK)
282 if(spider.vehicle_ammo1 >= autocvar_g_vehicle_spiderbot_minigun_ammo_cost && spider.tur_head.attack_finished_single[0] <= time)
286 spider.misc_bulletcounter += 1;
290 gun = (spider.misc_bulletcounter % 2) ? spider.gun1 : spider.gun2;
292 v = gettaginfo(gun, gettagindex(gun, "barrels"));
293 v_forward = normalize(v_forward);
296 fireBullet(v, v_forward, autocvar_g_vehicle_spiderbot_minigun_spread, autocvar_g_vehicle_spiderbot_minigun_solidpenetration,
297 autocvar_g_vehicle_spiderbot_minigun_damage, autocvar_g_vehicle_spiderbot_minigun_force, DEATH_VH_SPID_MINIGUN.m_id, 0);
299 sound (gun, CH_WEAPON_A, SND_UZI_FIRE, VOL_BASE, ATTEN_NORM);
300 //trailparticles(self, _particleeffectnum("spiderbot_minigun_trail"), v, trace_endpos);
301 pointparticles(EFFECT_SPIDERBOT_MINIGUN_MUZZLEFLASH, v, v_forward * 2500, 1);
305 spider.vehicle_ammo1 -= autocvar_g_vehicle_spiderbot_minigun_ammo_cost;
306 spider.tur_head.attack_finished_single[0] = time + autocvar_g_vehicle_spiderbot_minigun_refire;
307 player.vehicle_ammo1 = (spider.vehicle_ammo1 / autocvar_g_vehicle_spiderbot_minigun_ammo_max) * 100;
308 spider.gun1.angles_z += 45;
309 spider.gun2.angles_z -= 45;
310 if(spider.gun1.angles_z >= 360)
312 spider.gun1.angles_z = 0;
313 spider.gun2.angles_z = 0;
318 vehicles_regen(spider.cnt, vehicle_ammo1, autocvar_g_vehicle_spiderbot_minigun_ammo_max,
319 autocvar_g_vehicle_spiderbot_minigun_ammo_regen_pause,
320 autocvar_g_vehicle_spiderbot_minigun_ammo_regen, frametime, false);
323 spiderbot_rocket_do();
325 if(self.vehicle_flags & VHF_SHIELDREGEN)
326 vehicles_regen(spider.dmg_time, vehicle_shield, autocvar_g_vehicle_spiderbot_shield, autocvar_g_vehicle_spiderbot_shield_regen_pause, autocvar_g_vehicle_spiderbot_shield_regen, frametime, true);
328 if(self.vehicle_flags & VHF_HEALTHREGEN)
329 vehicles_regen(spider.dmg_time, vehicle_health, autocvar_g_vehicle_spiderbot_health, autocvar_g_vehicle_spiderbot_health_regen_pause, autocvar_g_vehicle_spiderbot_health_regen, frametime, false);
331 player.BUTTON_ATCK = player.BUTTON_ATCK2 = 0;
332 //player.vehicle_ammo2 = spider.tur_head.frame;
333 player.vehicle_ammo2 = (9 - spider.tur_head.frame) / 8 * 100; // Percentage, like ammo1
335 if(spider.gun2.cnt <= time)
336 player.vehicle_reload2 = 100;
338 player.vehicle_reload2 = 100 - ((spider.gun2.cnt - time) / spider.attack_finished_single[0]) * 100;
340 setorigin(player, spider.origin + '0 0 1' * spider.maxs_z);
341 player.velocity = spider.velocity;
343 VEHICLE_UPDATE_PLAYER(player, health, spiderbot);
345 if(self.vehicle_flags & VHF_HASSHIELD)
346 VEHICLE_UPDATE_PLAYER(player, shield, spiderbot);
352 void spiderbot_exit(float eject)
357 e = findchain(classname,"spiderbot_rocket");
360 if(e.owner == self.owner)
362 e.realowner = self.owner;
368 self.think = vehicles_think;
369 self.nextthink = time;
371 self.movetype = MOVETYPE_WALK;
376 makevectors(self.angles);
379 spot = self.origin + v_forward * 100 + '0 0 64';
380 spot = vehicles_findgoodexit(spot);
381 setorigin(self.owner , spot);
382 self.owner.velocity = (v_up + v_forward * 0.25) * 750;
383 self.owner.oldvelocity = self.owner.velocity;
387 if(vdist(self.velocity, >, autocvar_g_vehicle_spiderbot_speed_strafe))
389 self.owner.velocity = normalize(self.velocity) * vlen(self.velocity);
390 self.owner.velocity_z += 200;
391 spot = self.origin + v_forward * 128 + '0 0 64';
392 spot = vehicles_findgoodexit(spot);
396 self.owner.velocity = self.velocity * 0.5;
397 self.owner.velocity_z += 10;
398 spot = self.origin + v_forward * 256 + '0 0 64';
399 spot = vehicles_findgoodexit(spot);
401 self.owner.oldvelocity = self.owner.velocity;
402 setorigin(self.owner , spot);
405 antilag_clear(self.owner);
409 void spiderbot_headfade()
411 self.think = spiderbot_headfade;
412 self.nextthink = self.fade_time;
413 self.alpha = 1 - (time - self.fade_time) * self.fade_rate;
415 if(self.cnt < time || self.alpha < 0.1)
419 sound (self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
420 Send_Effect(EFFECT_EXPLOSION_BIG, self.origin + '0 0 100', '0 0 0', 1);
426 void spiderbot_blowup()
432 sound (self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
433 Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (self.origin + '0 0 100'), '0 0 0', 1);
435 self.nextthink = time + 0.1;
445 setmodel(b, MDL_VEH_SPIDERBOT_BODY);
446 setmodel(h, MDL_VEH_SPIDERBOT_TOP);
447 setmodel(g1, MDL_VEH_SPIDERBOT_GUN);
448 setmodel(g2, MDL_VEH_SPIDERBOT_GUN);
450 setorigin(b, self.origin);
452 b.angles = self.angles;
453 setsize(b, self.mins, self.maxs);
455 vector org = gettaginfo(self, gettagindex(self, "tag_head"));
457 h.movetype = MOVETYPE_BOUNCE;
458 h.solid = SOLID_BBOX;
459 h.velocity = v_up * (500 + random() * 500) + randomvec() * 128;
460 h.modelflags = MF_ROCKET;
461 h.effects = EF_FLAME | EF_LOWPRECISION;
462 h.avelocity = randomvec() * 360;
465 h.cnt = time + (3.5 * random());
466 h.fade_rate = 1 / min(self.respawntime, 10);
468 h.think = spiderbot_headfade;
471 org = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_hardpoint01"));
473 g1.movetype = MOVETYPE_TOSS;
474 g1.solid = SOLID_CORPSE;
475 g1.velocity = v_forward * 700 + (randomvec() * 32);
476 g1.avelocity = randomvec() * 180;
478 org = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_hardpoint02"));
480 g2.movetype = MOVETYPE_TOSS;
481 g2.solid = SOLID_CORPSE;
482 g2.velocity = v_forward * 700 + (randomvec() * 32);
483 g2.avelocity = randomvec() * 180;
485 h.colormod = b.colormod = g1.colormod = g2.colormod = '-2 -2 -2';
487 SUB_SetFade(b, time + 5, min(self.respawntime, 1));
488 //SUB_SetFade(h, time, min(self.respawntime, 10));
489 SUB_SetFade(g1, time, min(self.respawntime, 10));
490 SUB_SetFade(g2, time, min(self.respawntime, 10));
492 RadiusDamage (self, self.enemy, 250, 15, 250, world, world, 250, DEATH_VH_SPID_DEATH.m_id, world);
494 self.alpha = self.tur_head.alpha = self.gun1.alpha = self.gun2.alpha = -1;
495 self.movetype = MOVETYPE_NONE;
496 self.deadflag = DEAD_DEAD;
497 self.solid = SOLID_NOT;
498 self.tur_head.effects &= ~EF_FLAME;
499 self.vehicle_hudmodel.viewmodelforclient = self;
502 bool spiderbot_impulse(int _imp)
506 case IMP_weapon_group_1.impulse:
507 self.vehicle.vehicle_weapon2mode = SBRM_VOLLY;
508 CSQCVehicleSetup(self, 0);
510 case IMP_weapon_group_2.impulse:
511 self.vehicle.vehicle_weapon2mode = SBRM_GUIDE;
512 CSQCVehicleSetup(self, 0);
514 case IMP_weapon_group_3.impulse:
515 self.vehicle.vehicle_weapon2mode = SBRM_ARTILLERY;
516 CSQCVehicleSetup(self, 0);
519 case IMP_weapon_next_byid.impulse:
520 case IMP_weapon_next_bypriority.impulse:
521 case IMP_weapon_next_bygroup.impulse:
522 self.vehicle.vehicle_weapon2mode += 1;
523 if(self.vehicle.vehicle_weapon2mode > SBRM_LAST)
524 self.vehicle.vehicle_weapon2mode = SBRM_FIRST;
526 //centerprint(self, strcat("Rocket mode is ", ftos(self.vehicle.vehicle_weapon2mode)));
527 CSQCVehicleSetup(self, 0);
529 case IMP_weapon_last.impulse:
530 case IMP_weapon_prev_byid.impulse:
531 case IMP_weapon_prev_bypriority.impulse:
532 case IMP_weapon_prev_bygroup.impulse:
533 self.vehicle.vehicle_weapon2mode -= 1;
534 if(self.vehicle.vehicle_weapon2mode < SBRM_FIRST)
535 self.vehicle.vehicle_weapon2mode = SBRM_LAST;
537 //centerprint(self, strcat("Rocket mode is ", ftos(self.vehicle.vehicle_weapon2mode)));
538 CSQCVehicleSetup(self, 0);
542 case IMP_weapon_drop.impulse: // toss gun, could be used to exit?
544 case IMP_weapon_reload.impulse: // Manual minigun reload?
551 spawnfunc(vehicle_spiderbot)
553 if(!autocvar_g_vehicle_spiderbot) { remove(self); return; }
554 if(!vehicle_initialize(VEH_SPIDERBOT, false)) { remove(self); return; }
557 METHOD(Spiderbot, vr_impact, void(Spiderbot thisveh, entity instance))
559 if(autocvar_g_vehicle_spiderbot_bouncepain)
560 vehicles_impact(autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z);
562 METHOD(Spiderbot, vr_enter, void(Spiderbot thisveh, entity instance))
564 self.vehicle_weapon2mode = SBRM_GUIDE;
565 self.movetype = MOVETYPE_WALK;
566 CSQCVehicleSetup(self.owner, 0);
567 self.owner.vehicle_health = (self.vehicle_health / autocvar_g_vehicle_spiderbot_health) * 100;
568 self.owner.vehicle_shield = (self.vehicle_shield / autocvar_g_vehicle_spiderbot_shield) * 100;
570 if(self.owner.flagcarried)
572 setattachment(self.owner.flagcarried, self.tur_head, "");
573 setorigin(self.owner.flagcarried, '-20 0 120');
576 METHOD(Spiderbot, vr_think, void(Spiderbot thisveh, entity instance))
578 if(IS_ONGROUND(self))
579 movelib_brake_simple(self, autocvar_g_vehicle_spiderbot_speed_stop);
581 METHOD(Spiderbot, vr_death, void(Spiderbot thisveh, entity instance))
584 instance.event_damage = func_null;
585 instance.takedamage = DAMAGE_NO;
586 instance.touch = func_null;
587 instance.cnt = 3.4 + time + random() * 2;
588 instance.think = spiderbot_blowup;
589 instance.nextthink = time;
590 instance.deadflag = DEAD_DYING;
592 instance.tur_head.effects |= EF_FLAME;
593 instance.colormod = instance.tur_head.colormod = '-1 -1 -1';
595 instance.movetype = MOVETYPE_TOSS;
597 CSQCModel_UnlinkEntity(instance); // networking the death scene would be a nightmare
599 METHOD(Spiderbot, vr_spawn, void(Spiderbot thisveh, entity instance))
603 self.vehicles_impulse = spiderbot_impulse;
606 setmodel(self.gun1, MDL_VEH_SPIDERBOT_GUN);
607 setmodel(self.gun2, MDL_VEH_SPIDERBOT_GUN);
608 setattachment(self.gun1, self.tur_head, "tag_hardpoint01");
609 setattachment(self.gun2, self.tur_head, "tag_hardpoint02");
615 self.tur_head.frame = 1;
616 self.movetype = MOVETYPE_WALK;
617 self.solid = SOLID_SLIDEBOX;
618 self.alpha = self.tur_head.alpha = self.gun1.alpha = self.gun2.alpha = 1;
619 self.tur_head.angles = '0 0 0';
620 self.vehicle_exit = spiderbot_exit;
622 setorigin(self, self.pos1 + '0 0 128');
623 self.angles = self.pos2;
624 self.damageforcescale = 0.03;
625 self.vehicle_health = autocvar_g_vehicle_spiderbot_health;
626 self.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
628 self.PlayerPhysplug = spiderbot_frame;
630 METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh, entity instance))
632 if(autocvar_g_vehicle_spiderbot_shield)
633 self.vehicle_flags |= VHF_HASSHIELD;
635 if(autocvar_g_vehicle_spiderbot_shield_regen)
636 self.vehicle_flags |= VHF_SHIELDREGEN;
638 if(autocvar_g_vehicle_spiderbot_health_regen)
639 self.vehicle_flags |= VHF_HEALTHREGEN;
641 self.respawntime = autocvar_g_vehicle_spiderbot_respawntime;
642 self.vehicle_health = autocvar_g_vehicle_spiderbot_health;
643 self.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
644 self.max_health = self.vehicle_health;
645 self.pushable = true; // spiderbot can use jumppads
650 float autocvar_cl_vehicle_spiderbot_cross_alpha = 0.6;
651 float autocvar_cl_vehicle_spiderbot_cross_size = 1;
653 METHOD(Spiderbot, vr_hud, void(Spiderbot thisveh))
655 Vehicles_drawHUD(VEH_SPIDERBOT.m_icon, "vehicle_spider_weapon1", "vehicle_spider_weapon2",
656 "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
657 "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color);
659 METHOD(Spiderbot, vr_crosshair, void(Spiderbot thisveh))
665 case SBRM_VOLLY: crosshair = vCROSS_BURST; break;
666 case SBRM_GUIDE: crosshair = vCROSS_GUIDE; break;
667 case SBRM_ARTILLERY: crosshair = vCROSS_RAIN; break;
668 default: crosshair = vCROSS_BURST;
671 Vehicles_drawCrosshair(crosshair);
673 METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh, entity instance))
675 AuxiliaryXhair[0].axh_image = vCROSS_HINT; // Minigun1
676 AuxiliaryXhair[1].axh_image = vCROSS_HINT; // Minigun2