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 /* model */ ATTRIB(Spiderbot, mdl, string, "models/vehicles/spiderbot.dpm");
11 /* model */ ATTRIB(Spiderbot, model, string, "models/vehicles/spiderbot.dpm");
12 /* head_model */ ATTRIB(Spiderbot, head_model, string, "models/vehicles/spiderbot_top.dpm");
13 /* hud_model */ ATTRIB(Spiderbot, hud_model, string, "models/vehicles/spiderbot_cockpit.dpm");
14 /* tags */ ATTRIB(Spiderbot, tag_head, string, "tag_head");
15 /* tags */ ATTRIB(Spiderbot, tag_hud, string, "tag_hud");
16 /* tags */ ATTRIB(Spiderbot, tag_view, string, "");
17 /* netname */ ATTRIB(Spiderbot, netname, string, "spiderbot");
18 /* fullname */ ATTRIB(Spiderbot, vehicle_name, string, _("Spiderbot"));
19 /* icon */ ATTRIB(Spiderbot, m_icon, string, "vehicle_spider");
22 REGISTER_VEHICLE(SPIDERBOT, NEW(Spiderbot));
28 const int SBRM_FIRST = 1;
29 const int SBRM_VOLLY = 1;
30 const int SBRM_GUIDE = 2;
31 const int SBRM_ARTILLERY = 3;
32 const int SBRM_LAST = 3;
34 #include "spiderbot_weapons.qc"
37 bool autocvar_g_vehicle_spiderbot;
39 float autocvar_g_vehicle_spiderbot_respawntime;
41 float autocvar_g_vehicle_spiderbot_speed_stop;
42 float autocvar_g_vehicle_spiderbot_speed_strafe;
43 float autocvar_g_vehicle_spiderbot_speed_walk;
44 float autocvar_g_vehicle_spiderbot_speed_run = 700;
45 float autocvar_g_vehicle_spiderbot_turnspeed;
46 float autocvar_g_vehicle_spiderbot_turnspeed_strafe;
47 float autocvar_g_vehicle_spiderbot_movement_inertia;
49 float autocvar_g_vehicle_spiderbot_springlength;
50 float autocvar_g_vehicle_spiderbot_springup;
51 float autocvar_g_vehicle_spiderbot_springblend;
52 float autocvar_g_vehicle_spiderbot_tiltlimit;
54 float autocvar_g_vehicle_spiderbot_head_pitchlimit_down;
55 float autocvar_g_vehicle_spiderbot_head_pitchlimit_up;
56 float autocvar_g_vehicle_spiderbot_head_turnlimit;
57 float autocvar_g_vehicle_spiderbot_head_turnspeed;
59 int autocvar_g_vehicle_spiderbot_health;
60 float autocvar_g_vehicle_spiderbot_health_regen;
61 float autocvar_g_vehicle_spiderbot_health_regen_pause;
63 int autocvar_g_vehicle_spiderbot_shield;
64 float autocvar_g_vehicle_spiderbot_shield_regen;
65 float autocvar_g_vehicle_spiderbot_shield_regen_pause;
67 vector autocvar_g_vehicle_spiderbot_bouncepain;
70 float spiderbot_frame()
73 entity player, spider;
76 if(intermission_running)
78 self.vehicle.velocity = '0 0 0';
79 self.vehicle.avelocity = '0 0 0';
84 spider = self.vehicle;
86 vehicles_frame(spider, player);
90 player.BUTTON_ZOOM = 0;
91 player.BUTTON_CROUCH = 0;
92 PS(player).m_switchweapon = WEP_Null;
93 player.vehicle_weapon2mode = spider.vehicle_weapon2mode;
96 #if 1 // 0 to enable per-gun impact aux crosshairs
97 // Avarage gun impact point's -> aux cross
98 ad = gettaginfo(spider.tur_head, gettagindex(spider.tur_head, "tag_hardpoint01"));
100 ad += gettaginfo(spider.tur_head, gettagindex(spider.tur_head, "tag_hardpoint02"));
103 v_forward = vf * 0.5;
104 traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, spider);
105 UpdateAuxiliaryXhair(player, trace_endpos, ('1 0 0' * player.vehicle_reload1) + ('0 1 0' * (1 - player.vehicle_reload1)), 0);
107 ad = gettaginfo(spider.gun1, gettagindex(spider.gun1, "barrels"));
108 traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, spider);
109 UpdateAuxiliaryXhair(player, trace_endpos, ('1 0 0' * player.vehicle_reload1) + ('0 1 0' * (1 - player.vehicle_reload1)), 0);
111 ad = gettaginfo(spider.gun2, gettagindex(spider.gun2, "barrels"));
112 traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, spider);
113 UpdateAuxiliaryXhair(player, trace_endpos, ('1 0 0' * player.vehicle_reload1) + ('0 1 0' * (1 - player.vehicle_reload1)), 1);
114 ad = 0.5 * (ad + vf);
117 crosshair_trace(player);
118 ad = vectoangles(normalize(trace_endpos - ad));
119 ad = AnglesTransform_ToAngles(AnglesTransform_LeftDivide(AnglesTransform_FromAngles(spider.angles), AnglesTransform_FromAngles(ad))) - spider.tur_head.angles;
120 ad = AnglesTransform_Normalize(ad, true);
121 //UpdateAuxiliaryXhair(player, trace_endpos, ('1 0 0' * player.vehicle_reload2) + ('0 1 0' * (1 - player.vehicle_reload2)), 2);
124 ftmp = autocvar_g_vehicle_spiderbot_head_turnspeed * sys_frametime;
125 ad_y = bound(-ftmp, ad_y, ftmp);
126 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);
129 ad_x = bound(ftmp * -1, ad_x, ftmp);
130 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);
133 //fixedmakevectors(spider.angles);
134 makevectors(spider.angles + '-2 0 0' * spider.angles_x);
136 movelib_groundalign4point(autocvar_g_vehicle_spiderbot_springlength, autocvar_g_vehicle_spiderbot_springup, autocvar_g_vehicle_spiderbot_springblend, autocvar_g_vehicle_spiderbot_tiltlimit);
138 if(IS_ONGROUND(spider))
139 spider.jump_delay = time; // reset now so movement can begin
141 //if(IS_ONGROUND(spider))
143 if(IS_ONGROUND(spider))
144 if(spider.frame == 4 && self.tur_head.wait != 0)
146 sound (self, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_LAND, VOL_VEHICLEENGINE, ATTEN_NORM);
150 if(!player.BUTTON_JUMP)
151 spider.BUTTON_JUMP = 0;
153 if((IS_ONGROUND(spider)) && player.BUTTON_JUMP && !spider.BUTTON_JUMP && self.tur_head.wait < time)
155 sound (self, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_JUMP, VOL_VEHICLEENGINE, ATTEN_NORM);
156 //dprint("spiderbot_jump:", ftos(soundlength("vehicles/spiderbot_jump.wav")), "\n");
159 self.tur_head.wait = time + 2;
160 spider.jump_delay = time + 2;
161 spider.BUTTON_JUMP = 1; // set spider's jump
162 //player.BUTTON_JUMP = 0;
164 vector movefix = '0 0 0';
165 if(player.movement_x > 0) movefix_x = 1;
166 if(player.movement_x < 0) movefix_x = -1;
167 if(player.movement_y > 0) movefix_y = 1;
168 if(player.movement_y < 0) movefix_y = -1;
170 vector rt = movefix_y * v_right;
171 vector sd = movefix_x * v_forward;
172 if(movefix_y == 0 && movefix_x == 0)
173 sd = v_forward; // always do forward
175 UNSET_ONGROUND(spider);
177 spider.velocity = sd * 700 + rt * 600 + v_up * 600;
180 else if(time >= spider.jump_delay)
182 if(vlen(player.movement) == 0)
184 if(IS_ONGROUND(spider))
186 if(self.sound_nexttime < time || self.delay != 3)
189 self.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_idle.wav");
190 //dprint("spiderbot_idle:", ftos(soundlength("vehicles/spiderbot_idle.wav")), "\n");
191 sound (self, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_IDLE, VOL_VEHICLEENGINE, ATTEN_NORM);
193 movelib_brake_simple(autocvar_g_vehicle_spiderbot_speed_stop);
200 if(player.movement_x == 0 && player.movement_y != 0)
201 ftmp = autocvar_g_vehicle_spiderbot_turnspeed_strafe * sys_frametime;
203 ftmp = autocvar_g_vehicle_spiderbot_turnspeed * sys_frametime;
205 ftmp = bound(-ftmp, spider.tur_head.angles_y, ftmp);
206 spider.angles_y = anglemods(spider.angles_y + ftmp);
207 spider.tur_head.angles_y -= ftmp;
209 if(player.movement_x != 0)
211 if(player.movement_x > 0)
213 player.movement_x = 1;
214 if(IS_ONGROUND(spider))
217 else if(player.movement_x < 0)
219 player.movement_x = -1;
220 if(IS_ONGROUND(spider))
223 player.movement_y = 0;
224 float oldvelz = spider.velocity_z;
225 movelib_move_simple(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);
226 spider.velocity_z = oldvelz;
227 float g = ((autocvar_sv_gameplayfix_gravityunaffectedbyticrate) ? 0.5 : 1);
228 if(spider.velocity_z <= 20) // not while jumping
229 spider.velocity_z -= g * sys_frametime * autocvar_sv_gravity;
230 if(IS_ONGROUND(spider))
231 if(self.sound_nexttime < time || self.delay != 1)
234 self.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_walk.wav");
235 sound (self, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_WALK, VOL_VEHICLEENGINE, ATTEN_NORM);
236 //dprint("spiderbot_walk:", ftos(soundlength("vehicles/spiderbot_walk.wav")), "\n");
239 else if(player.movement_y != 0)
241 if(player.movement_y < 0)
243 player.movement_y = -1;
244 if(IS_ONGROUND(spider))
247 else if(player.movement_y > 0)
249 player.movement_y = 1;
250 if(IS_ONGROUND(spider))
254 float oldvelz = spider.velocity_z;
255 movelib_move_simple(normalize(v_right * player.movement_y),autocvar_g_vehicle_spiderbot_speed_strafe,autocvar_g_vehicle_spiderbot_movement_inertia);
256 spider.velocity_z = oldvelz;
257 float g = ((autocvar_sv_gameplayfix_gravityunaffectedbyticrate) ? 0.5 : 1);
258 if(spider.velocity_z <= 20) // not while jumping
259 spider.velocity_z -= g * sys_frametime * autocvar_sv_gravity;
260 if(IS_ONGROUND(spider))
261 if(self.sound_nexttime < time || self.delay != 2)
264 self.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_strafe.wav");
265 sound (self, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_STRAFE, VOL_VEHICLEENGINE, ATTEN_NORM);
266 //dprint("spiderbot_strafe:", ftos(soundlength("vehicles/spiderbot_strafe.wav")), "\n");
273 self.angles_x = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, self.angles_x, autocvar_g_vehicle_spiderbot_tiltlimit);
274 self.angles_z = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, self.angles_z, autocvar_g_vehicle_spiderbot_tiltlimit);
276 if(!forbidWeaponUse(player))
277 if(player.BUTTON_ATCK)
280 if(spider.vehicle_ammo1 >= autocvar_g_vehicle_spiderbot_minigun_ammo_cost && spider.tur_head.attack_finished_single[0] <= time)
284 spider.misc_bulletcounter += 1;
288 gun = (spider.misc_bulletcounter % 2) ? spider.gun1 : spider.gun2;
290 v = gettaginfo(gun, gettagindex(gun, "barrels"));
291 v_forward = normalize(v_forward);
294 fireBullet(v, v_forward, autocvar_g_vehicle_spiderbot_minigun_spread, autocvar_g_vehicle_spiderbot_minigun_solidpenetration,
295 autocvar_g_vehicle_spiderbot_minigun_damage, autocvar_g_vehicle_spiderbot_minigun_force, DEATH_VH_SPID_MINIGUN.m_id, 0);
297 sound (gun, CH_WEAPON_A, SND_UZI_FIRE, VOL_BASE, ATTEN_NORM);
298 //trailparticles(self, _particleeffectnum("spiderbot_minigun_trail"), v, trace_endpos);
299 pointparticles(EFFECT_SPIDERBOT_MINIGUN_MUZZLEFLASH, v, v_forward * 2500, 1);
303 spider.vehicle_ammo1 -= autocvar_g_vehicle_spiderbot_minigun_ammo_cost;
304 spider.tur_head.attack_finished_single[0] = time + autocvar_g_vehicle_spiderbot_minigun_refire;
305 player.vehicle_ammo1 = (spider.vehicle_ammo1 / autocvar_g_vehicle_spiderbot_minigun_ammo_max) * 100;
306 spider.gun1.angles_z += 45;
307 spider.gun2.angles_z -= 45;
308 if(spider.gun1.angles_z >= 360)
310 spider.gun1.angles_z = 0;
311 spider.gun2.angles_z = 0;
316 vehicles_regen(spider.cnt, vehicle_ammo1, autocvar_g_vehicle_spiderbot_minigun_ammo_max,
317 autocvar_g_vehicle_spiderbot_minigun_ammo_regen_pause,
318 autocvar_g_vehicle_spiderbot_minigun_ammo_regen, frametime, false);
321 spiderbot_rocket_do();
323 if(self.vehicle_flags & VHF_SHIELDREGEN)
324 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);
326 if(self.vehicle_flags & VHF_HEALTHREGEN)
327 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);
329 player.BUTTON_ATCK = player.BUTTON_ATCK2 = 0;
330 //player.vehicle_ammo2 = spider.tur_head.frame;
331 player.vehicle_ammo2 = (9 - spider.tur_head.frame) / 8 * 100; // Percentage, like ammo1
333 if(spider.gun2.cnt <= time)
334 player.vehicle_reload2 = 100;
336 player.vehicle_reload2 = 100 - ((spider.gun2.cnt - time) / spider.attack_finished_single[0]) * 100;
338 setorigin(player, spider.origin + '0 0 1' * spider.maxs_z);
339 player.velocity = spider.velocity;
341 VEHICLE_UPDATE_PLAYER(player, health, spiderbot);
343 if(self.vehicle_flags & VHF_HASSHIELD)
344 VEHICLE_UPDATE_PLAYER(player, shield, spiderbot);
350 void spiderbot_exit(float eject)
355 e = findchain(classname,"spiderbot_rocket");
358 if(e.owner == self.owner)
360 e.realowner = self.owner;
366 self.think = vehicles_think;
367 self.nextthink = time;
369 self.movetype = MOVETYPE_WALK;
374 makevectors(self.angles);
377 spot = self.origin + v_forward * 100 + '0 0 64';
378 spot = vehicles_findgoodexit(spot);
379 setorigin(self.owner , spot);
380 self.owner.velocity = (v_up + v_forward * 0.25) * 750;
381 self.owner.oldvelocity = self.owner.velocity;
385 if(vlen(self.velocity) > autocvar_g_vehicle_spiderbot_speed_strafe)
387 self.owner.velocity = normalize(self.velocity) * vlen(self.velocity);
388 self.owner.velocity_z += 200;
389 spot = self.origin + v_forward * 128 + '0 0 64';
390 spot = vehicles_findgoodexit(spot);
394 self.owner.velocity = self.velocity * 0.5;
395 self.owner.velocity_z += 10;
396 spot = self.origin + v_forward * 256 + '0 0 64';
397 spot = vehicles_findgoodexit(spot);
399 self.owner.oldvelocity = self.owner.velocity;
400 setorigin(self.owner , spot);
403 antilag_clear(self.owner);
407 void spiderbot_headfade()
409 self.think = spiderbot_headfade;
410 self.nextthink = self.fade_time;
411 self.alpha = 1 - (time - self.fade_time) * self.fade_rate;
413 if(self.cnt < time || self.alpha < 0.1)
417 sound (self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
418 Send_Effect(EFFECT_EXPLOSION_BIG, self.origin + '0 0 100', '0 0 0', 1);
424 void spiderbot_blowup()
430 sound (self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
431 Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (self.origin + '0 0 100'), '0 0 0', 1);
433 self.nextthink = time + 0.1;
443 setmodel(b, MDL_VEH_SPIDERBOT_BODY);
444 setmodel(h, MDL_VEH_SPIDERBOT_TOP);
445 setmodel(g1, MDL_VEH_SPIDERBOT_GUN);
446 setmodel(g2, MDL_VEH_SPIDERBOT_GUN);
448 setorigin(b, self.origin);
450 b.angles = self.angles;
451 setsize(b, self.mins, self.maxs);
453 vector org = gettaginfo(self, gettagindex(self, "tag_head"));
455 h.movetype = MOVETYPE_BOUNCE;
456 h.solid = SOLID_BBOX;
457 h.velocity = v_up * (500 + random() * 500) + randomvec() * 128;
458 h.modelflags = MF_ROCKET;
459 h.effects = EF_FLAME | EF_LOWPRECISION;
460 h.avelocity = randomvec() * 360;
463 h.cnt = time + (3.5 * random());
464 h.fade_rate = 1 / min(self.respawntime, 10);
466 h.think = spiderbot_headfade;
469 org = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_hardpoint01"));
471 g1.movetype = MOVETYPE_TOSS;
472 g1.solid = SOLID_CORPSE;
473 g1.velocity = v_forward * 700 + (randomvec() * 32);
474 g1.avelocity = randomvec() * 180;
476 org = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_hardpoint02"));
478 g2.movetype = MOVETYPE_TOSS;
479 g2.solid = SOLID_CORPSE;
480 g2.velocity = v_forward * 700 + (randomvec() * 32);
481 g2.avelocity = randomvec() * 180;
483 h.colormod = b.colormod = g1.colormod = g2.colormod = '-2 -2 -2';
485 SUB_SetFade(b, time + 5, min(self.respawntime, 1));
486 //SUB_SetFade(h, time, min(self.respawntime, 10));
487 SUB_SetFade(g1, time, min(self.respawntime, 10));
488 SUB_SetFade(g2, time, min(self.respawntime, 10));
490 RadiusDamage (self, self.enemy, 250, 15, 250, world, world, 250, DEATH_VH_SPID_DEATH.m_id, world);
492 self.alpha = self.tur_head.alpha = self.gun1.alpha = self.gun2.alpha = -1;
493 self.movetype = MOVETYPE_NONE;
494 self.deadflag = DEAD_DEAD;
495 self.solid = SOLID_NOT;
496 self.tur_head.effects &= ~EF_FLAME;
497 self.vehicle_hudmodel.viewmodelforclient = self;
500 bool spiderbot_impulse(int _imp)
504 case IMP_weapon_group_1.impulse:
505 self.vehicle.vehicle_weapon2mode = SBRM_VOLLY;
506 CSQCVehicleSetup(self, 0);
508 case IMP_weapon_group_2.impulse:
509 self.vehicle.vehicle_weapon2mode = SBRM_GUIDE;
510 CSQCVehicleSetup(self, 0);
512 case IMP_weapon_group_3.impulse:
513 self.vehicle.vehicle_weapon2mode = SBRM_ARTILLERY;
514 CSQCVehicleSetup(self, 0);
517 case IMP_weapon_next_byid.impulse:
518 case IMP_weapon_next_bypriority.impulse:
519 case IMP_weapon_next_bygroup.impulse:
520 self.vehicle.vehicle_weapon2mode += 1;
521 if(self.vehicle.vehicle_weapon2mode > SBRM_LAST)
522 self.vehicle.vehicle_weapon2mode = SBRM_FIRST;
524 //centerprint(self, strcat("Rocket mode is ", ftos(self.vehicle.vehicle_weapon2mode)));
525 CSQCVehicleSetup(self, 0);
527 case IMP_weapon_last.impulse:
528 case IMP_weapon_prev_byid.impulse:
529 case IMP_weapon_prev_bypriority.impulse:
530 case IMP_weapon_prev_bygroup.impulse:
531 self.vehicle.vehicle_weapon2mode -= 1;
532 if(self.vehicle.vehicle_weapon2mode < SBRM_FIRST)
533 self.vehicle.vehicle_weapon2mode = SBRM_LAST;
535 //centerprint(self, strcat("Rocket mode is ", ftos(self.vehicle.vehicle_weapon2mode)));
536 CSQCVehicleSetup(self, 0);
540 case IMP_weapon_drop.impulse: // toss gun, could be used to exit?
542 case IMP_weapon_reload.impulse: // Manual minigun reload?
549 spawnfunc(vehicle_spiderbot)
551 if(!autocvar_g_vehicle_spiderbot) { remove(self); return; }
552 if(!vehicle_initialize(VEH_SPIDERBOT, false)) { remove(self); return; }
555 METHOD(Spiderbot, vr_impact, void(Spiderbot thisveh))
557 if(autocvar_g_vehicle_spiderbot_bouncepain)
558 vehicles_impact(autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z);
560 METHOD(Spiderbot, vr_enter, void(Spiderbot thisveh))
562 self.vehicle_weapon2mode = SBRM_GUIDE;
563 self.movetype = MOVETYPE_WALK;
564 CSQCVehicleSetup(self.owner, 0);
565 self.owner.vehicle_health = (self.vehicle_health / autocvar_g_vehicle_spiderbot_health) * 100;
566 self.owner.vehicle_shield = (self.vehicle_shield / autocvar_g_vehicle_spiderbot_shield) * 100;
568 if(self.owner.flagcarried)
570 setattachment(self.owner.flagcarried, self.tur_head, "");
571 setorigin(self.owner.flagcarried, '-20 0 120');
574 METHOD(Spiderbot, vr_think, void(Spiderbot thisveh))
576 if(IS_ONGROUND(self))
577 movelib_brake_simple(autocvar_g_vehicle_spiderbot_speed_stop);
579 METHOD(Spiderbot, vr_death, void(Spiderbot thisveh))
582 self.event_damage = func_null;
583 self.takedamage = DAMAGE_NO;
584 self.touch = func_null;
585 self.cnt = 3.4 + time + random() * 2;
586 self.think = spiderbot_blowup;
587 self.nextthink = time;
588 self.deadflag = DEAD_DYING;
590 self.tur_head.effects |= EF_FLAME;
591 self.colormod = self.tur_head.colormod = '-1 -1 -1';
593 self.movetype = MOVETYPE_TOSS;
595 CSQCModel_UnlinkEntity(self); // networking the death scene would be a nightmare
597 METHOD(Spiderbot, vr_spawn, void(Spiderbot thisveh))
601 self.vehicles_impulse = spiderbot_impulse;
604 setmodel(self.gun1, MDL_VEH_SPIDERBOT_GUN);
605 setmodel(self.gun2, MDL_VEH_SPIDERBOT_GUN);
606 setattachment(self.gun1, self.tur_head, "tag_hardpoint01");
607 setattachment(self.gun2, self.tur_head, "tag_hardpoint02");
613 self.tur_head.frame = 1;
614 self.movetype = MOVETYPE_WALK;
615 self.solid = SOLID_SLIDEBOX;
616 self.alpha = self.tur_head.alpha = self.gun1.alpha = self.gun2.alpha = 1;
617 self.tur_head.angles = '0 0 0';
618 self.vehicle_exit = spiderbot_exit;
620 setorigin(self, self.pos1 + '0 0 128');
621 self.angles = self.pos2;
622 self.damageforcescale = 0.03;
623 self.vehicle_health = autocvar_g_vehicle_spiderbot_health;
624 self.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
626 self.PlayerPhysplug = spiderbot_frame;
628 METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh))
630 if(autocvar_g_vehicle_spiderbot_shield)
631 self.vehicle_flags |= VHF_HASSHIELD;
633 if(autocvar_g_vehicle_spiderbot_shield_regen)
634 self.vehicle_flags |= VHF_SHIELDREGEN;
636 if(autocvar_g_vehicle_spiderbot_health_regen)
637 self.vehicle_flags |= VHF_HEALTHREGEN;
639 self.respawntime = autocvar_g_vehicle_spiderbot_respawntime;
640 self.vehicle_health = autocvar_g_vehicle_spiderbot_health;
641 self.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
642 self.max_health = self.vehicle_health;
643 self.pushable = true; // spiderbot can use jumppads
648 float autocvar_cl_vehicle_spiderbot_cross_alpha = 0.6;
649 float autocvar_cl_vehicle_spiderbot_cross_size = 1;
651 METHOD(Spiderbot, vr_hud, void(Spiderbot thisveh))
653 Vehicles_drawHUD(VEH_SPIDERBOT.m_icon, "vehicle_spider_weapon1", "vehicle_spider_weapon2",
654 "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
655 "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color);
657 METHOD(Spiderbot, vr_crosshair, void(Spiderbot thisveh))
663 case SBRM_VOLLY: crosshair = vCROSS_BURST; break;
664 case SBRM_GUIDE: crosshair = vCROSS_GUIDE; break;
665 case SBRM_ARTILLERY: crosshair = vCROSS_RAIN; break;
666 default: crosshair = vCROSS_BURST;
669 Vehicles_drawCrosshair(crosshair);
671 METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh))
673 AuxiliaryXhair[0].axh_image = vCROSS_HINT; // Minigun1
674 AuxiliaryXhair[1].axh_image = vCROSS_HINT; // Minigun2