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 = true;
41 float autocvar_g_vehicle_spiderbot_respawntime = 45;
43 float autocvar_g_vehicle_spiderbot_speed_stop = 50;
44 float autocvar_g_vehicle_spiderbot_speed_strafe = 400;
45 float autocvar_g_vehicle_spiderbot_speed_walk = 500;
46 float autocvar_g_vehicle_spiderbot_speed_run = 700;
47 float autocvar_g_vehicle_spiderbot_turnspeed = 90;
48 float autocvar_g_vehicle_spiderbot_turnspeed_strafe = 300;
49 float autocvar_g_vehicle_spiderbot_movement_inertia = 0.15;
51 float autocvar_g_vehicle_spiderbot_springlength = 150;
52 float autocvar_g_vehicle_spiderbot_springup = 20;
53 float autocvar_g_vehicle_spiderbot_springblend = 0.1;
54 float autocvar_g_vehicle_spiderbot_tiltlimit = 90;
56 float autocvar_g_vehicle_spiderbot_head_pitchlimit_down = -20;
57 float autocvar_g_vehicle_spiderbot_head_pitchlimit_up = 30;
58 float autocvar_g_vehicle_spiderbot_head_turnlimit = 90;
59 float autocvar_g_vehicle_spiderbot_head_turnspeed = 110;
61 int autocvar_g_vehicle_spiderbot_health = 800;
62 float autocvar_g_vehicle_spiderbot_health_regen = 10;
63 float autocvar_g_vehicle_spiderbot_health_regen_pause = 5;
65 int autocvar_g_vehicle_spiderbot_shield = 200;
66 float autocvar_g_vehicle_spiderbot_shield_regen = 25;
67 float autocvar_g_vehicle_spiderbot_shield_regen_pause = 0.35;
69 // 'minspeed_for_pain speedchange_to_pain_factor max_damage'
70 vector autocvar_g_vehicle_spiderbot_bouncepain = '0 0 0';
73 float spiderbot_frame()
76 entity player, spider;
79 if(intermission_running)
81 self.vehicle.velocity = '0 0 0';
82 self.vehicle.avelocity = '0 0 0';
87 spider = self.vehicle;
89 vehicles_frame(spider, player);
93 PHYS_INPUT_BUTTON_ZOOM(player) = false;
94 PHYS_INPUT_BUTTON_CROUCH(player) = false;
95 PS(player).m_switchweapon = WEP_Null;
96 player.vehicle_weapon2mode = spider.vehicle_weapon2mode;
99 #if 1 // 0 to enable per-gun impact aux crosshairs
100 // Avarage gun impact point's -> aux cross
101 ad = gettaginfo(spider.tur_head, gettagindex(spider.tur_head, "tag_hardpoint01"));
103 ad += gettaginfo(spider.tur_head, gettagindex(spider.tur_head, "tag_hardpoint02"));
106 v_forward = vf * 0.5;
107 traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, spider);
108 UpdateAuxiliaryXhair(player, trace_endpos, ('1 0 0' * player.vehicle_reload1) + ('0 1 0' * (1 - player.vehicle_reload1)), 0);
110 ad = gettaginfo(spider.gun1, gettagindex(spider.gun1, "barrels"));
111 traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, spider);
112 UpdateAuxiliaryXhair(player, trace_endpos, ('1 0 0' * player.vehicle_reload1) + ('0 1 0' * (1 - player.vehicle_reload1)), 0);
114 ad = gettaginfo(spider.gun2, gettagindex(spider.gun2, "barrels"));
115 traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, spider);
116 UpdateAuxiliaryXhair(player, trace_endpos, ('1 0 0' * player.vehicle_reload1) + ('0 1 0' * (1 - player.vehicle_reload1)), 1);
117 ad = 0.5 * (ad + vf);
120 crosshair_trace(player);
121 ad = vectoangles(normalize(trace_endpos - ad));
122 ad = AnglesTransform_ToAngles(AnglesTransform_LeftDivide(AnglesTransform_FromAngles(spider.angles), AnglesTransform_FromAngles(ad))) - spider.tur_head.angles;
123 ad = AnglesTransform_Normalize(ad, true);
124 //UpdateAuxiliaryXhair(player, trace_endpos, ('1 0 0' * player.vehicle_reload2) + ('0 1 0' * (1 - player.vehicle_reload2)), 2);
127 ftmp = autocvar_g_vehicle_spiderbot_head_turnspeed * sys_frametime;
128 ad_y = bound(-ftmp, ad_y, ftmp);
129 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);
132 ad_x = bound(ftmp * -1, ad_x, ftmp);
133 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);
136 //fixedmakevectors(spider.angles);
137 makevectors(spider.angles + '-2 0 0' * spider.angles_x);
139 movelib_groundalign4point(autocvar_g_vehicle_spiderbot_springlength, autocvar_g_vehicle_spiderbot_springup, autocvar_g_vehicle_spiderbot_springblend, autocvar_g_vehicle_spiderbot_tiltlimit);
141 if(IS_ONGROUND(spider))
142 spider.jump_delay = time; // reset now so movement can begin
144 //if(IS_ONGROUND(spider))
146 if(IS_ONGROUND(spider))
147 if(spider.frame == 4 && self.tur_head.wait != 0)
149 sound (self, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_LAND, VOL_VEHICLEENGINE, ATTEN_NORM);
153 if (!PHYS_INPUT_BUTTON_JUMP(player))
154 PHYS_INPUT_BUTTON_JUMP(spider) = false;
156 if((IS_ONGROUND(spider)) && PHYS_INPUT_BUTTON_JUMP(player) && !PHYS_INPUT_BUTTON_JUMP(spider) && self.tur_head.wait < time)
158 sound (self, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_JUMP, VOL_VEHICLEENGINE, ATTEN_NORM);
159 //dprint("spiderbot_jump:", ftos(soundlength("vehicles/spiderbot_jump.wav")), "\n");
162 self.tur_head.wait = time + 2;
163 spider.jump_delay = time + 2;
164 PHYS_INPUT_BUTTON_JUMP(spider) = true; // set spider's jump
165 //PHYS_INPUT_BUTTON_JUMP(player) = false;
167 vector movefix = '0 0 0';
168 if(player.movement_x > 0) movefix_x = 1;
169 if(player.movement_x < 0) movefix_x = -1;
170 if(player.movement_y > 0) movefix_y = 1;
171 if(player.movement_y < 0) movefix_y = -1;
173 vector rt = movefix_y * v_right;
174 vector sd = movefix_x * v_forward;
175 if(movefix_y == 0 && movefix_x == 0)
176 sd = v_forward; // always do forward
178 UNSET_ONGROUND(spider);
180 spider.velocity = sd * 700 + rt * 600 + v_up * 600;
183 else if(time >= spider.jump_delay)
187 if(IS_ONGROUND(spider))
189 if(self.sound_nexttime < time || self.delay != 3)
192 self.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_idle.wav");
193 //dprint("spiderbot_idle:", ftos(soundlength("vehicles/spiderbot_idle.wav")), "\n");
194 sound (self, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_IDLE, VOL_VEHICLEENGINE, ATTEN_NORM);
196 movelib_brake_simple(self, autocvar_g_vehicle_spiderbot_speed_stop);
203 if(player.movement_x == 0 && player.movement_y != 0)
204 ftmp = autocvar_g_vehicle_spiderbot_turnspeed_strafe * sys_frametime;
206 ftmp = autocvar_g_vehicle_spiderbot_turnspeed * sys_frametime;
208 ftmp = bound(-ftmp, spider.tur_head.angles_y, ftmp);
209 spider.angles_y = anglemods(spider.angles_y + ftmp);
210 spider.tur_head.angles_y -= ftmp;
212 if(player.movement_x != 0)
214 if(player.movement_x > 0)
216 player.movement_x = 1;
217 if(IS_ONGROUND(spider))
220 else if(player.movement_x < 0)
222 player.movement_x = -1;
223 if(IS_ONGROUND(spider))
226 player.movement_y = 0;
227 float oldvelz = spider.velocity_z;
228 movelib_move_simple(self, normalize(v_forward * player.movement_x),((PHYS_INPUT_BUTTON_JUMP(player)) ? autocvar_g_vehicle_spiderbot_speed_run : autocvar_g_vehicle_spiderbot_speed_walk),autocvar_g_vehicle_spiderbot_movement_inertia);
229 spider.velocity_z = oldvelz;
230 float g = ((autocvar_sv_gameplayfix_gravityunaffectedbyticrate) ? 0.5 : 1);
231 if(spider.velocity_z <= 20) // not while jumping
232 spider.velocity_z -= g * sys_frametime * autocvar_sv_gravity;
233 if(IS_ONGROUND(spider))
234 if(self.sound_nexttime < time || self.delay != 1)
237 self.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_walk.wav");
238 sound (self, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_WALK, VOL_VEHICLEENGINE, ATTEN_NORM);
239 //dprint("spiderbot_walk:", ftos(soundlength("vehicles/spiderbot_walk.wav")), "\n");
242 else if(player.movement_y != 0)
244 if(player.movement_y < 0)
246 player.movement_y = -1;
247 if(IS_ONGROUND(spider))
250 else if(player.movement_y > 0)
252 player.movement_y = 1;
253 if(IS_ONGROUND(spider))
257 float oldvelz = spider.velocity_z;
258 movelib_move_simple(self, normalize(v_right * player.movement_y),autocvar_g_vehicle_spiderbot_speed_strafe,autocvar_g_vehicle_spiderbot_movement_inertia);
259 spider.velocity_z = oldvelz;
260 float g = ((autocvar_sv_gameplayfix_gravityunaffectedbyticrate) ? 0.5 : 1);
261 if(spider.velocity_z <= 20) // not while jumping
262 spider.velocity_z -= g * sys_frametime * autocvar_sv_gravity;
263 if(IS_ONGROUND(spider))
264 if(self.sound_nexttime < time || self.delay != 2)
267 self.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_strafe.wav");
268 sound (self, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_STRAFE, VOL_VEHICLEENGINE, ATTEN_NORM);
269 //dprint("spiderbot_strafe:", ftos(soundlength("vehicles/spiderbot_strafe.wav")), "\n");
276 self.angles_x = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, self.angles_x, autocvar_g_vehicle_spiderbot_tiltlimit);
277 self.angles_z = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, self.angles_z, autocvar_g_vehicle_spiderbot_tiltlimit);
279 if(!forbidWeaponUse(player))
280 if(PHYS_INPUT_BUTTON_ATCK(player))
283 if(spider.vehicle_ammo1 >= autocvar_g_vehicle_spiderbot_minigun_ammo_cost && spider.tur_head.attack_finished_single[0] <= time)
287 spider.misc_bulletcounter += 1;
291 gun = (spider.misc_bulletcounter % 2) ? spider.gun1 : spider.gun2;
293 v = gettaginfo(gun, gettagindex(gun, "barrels"));
294 v_forward = normalize(v_forward);
297 fireBullet(v, v_forward, autocvar_g_vehicle_spiderbot_minigun_spread, autocvar_g_vehicle_spiderbot_minigun_solidpenetration,
298 autocvar_g_vehicle_spiderbot_minigun_damage, autocvar_g_vehicle_spiderbot_minigun_force, DEATH_VH_SPID_MINIGUN.m_id, 0);
300 sound (gun, CH_WEAPON_A, SND_UZI_FIRE, VOL_BASE, ATTEN_NORM);
301 //trailparticles(self, _particleeffectnum("spiderbot_minigun_trail"), v, trace_endpos);
302 pointparticles(EFFECT_SPIDERBOT_MINIGUN_MUZZLEFLASH, v, v_forward * 2500, 1);
306 spider.vehicle_ammo1 -= autocvar_g_vehicle_spiderbot_minigun_ammo_cost;
307 spider.tur_head.attack_finished_single[0] = time + autocvar_g_vehicle_spiderbot_minigun_refire;
308 player.vehicle_ammo1 = (spider.vehicle_ammo1 / autocvar_g_vehicle_spiderbot_minigun_ammo_max) * 100;
309 spider.gun1.angles_z += 45;
310 spider.gun2.angles_z -= 45;
311 if(spider.gun1.angles_z >= 360)
313 spider.gun1.angles_z = 0;
314 spider.gun2.angles_z = 0;
319 vehicles_regen(spider.cnt, vehicle_ammo1, autocvar_g_vehicle_spiderbot_minigun_ammo_max,
320 autocvar_g_vehicle_spiderbot_minigun_ammo_regen_pause,
321 autocvar_g_vehicle_spiderbot_minigun_ammo_regen, frametime, false);
324 spiderbot_rocket_do();
326 if(self.vehicle_flags & VHF_SHIELDREGEN)
327 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);
329 if(self.vehicle_flags & VHF_HEALTHREGEN)
330 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);
332 PHYS_INPUT_BUTTON_ATCK(player) = PHYS_INPUT_BUTTON_ATCK2(player) = false;
333 //player.vehicle_ammo2 = spider.tur_head.frame;
334 player.vehicle_ammo2 = (9 - spider.tur_head.frame) / 8 * 100; // Percentage, like ammo1
336 if(spider.gun2.cnt <= time)
337 player.vehicle_reload2 = 100;
339 player.vehicle_reload2 = 100 - ((spider.gun2.cnt - time) / spider.attack_finished_single[0]) * 100;
341 setorigin(player, spider.origin + '0 0 1' * spider.maxs_z);
342 player.velocity = spider.velocity;
344 VEHICLE_UPDATE_PLAYER(player, health, spiderbot);
346 if(self.vehicle_flags & VHF_HASSHIELD)
347 VEHICLE_UPDATE_PLAYER(player, shield, spiderbot);
353 void spiderbot_exit(float eject)
358 e = findchain(classname,"spiderbot_rocket");
361 if(e.owner == self.owner)
363 e.realowner = self.owner;
369 self.think = vehicles_think;
370 self.nextthink = time;
372 self.movetype = MOVETYPE_WALK;
377 makevectors(self.angles);
380 spot = self.origin + v_forward * 100 + '0 0 64';
381 spot = vehicles_findgoodexit(spot);
382 setorigin(self.owner , spot);
383 self.owner.velocity = (v_up + v_forward * 0.25) * 750;
384 self.owner.oldvelocity = self.owner.velocity;
388 if(vdist(self.velocity, >, autocvar_g_vehicle_spiderbot_speed_strafe))
390 self.owner.velocity = normalize(self.velocity) * vlen(self.velocity);
391 self.owner.velocity_z += 200;
392 spot = self.origin + v_forward * 128 + '0 0 64';
393 spot = vehicles_findgoodexit(spot);
397 self.owner.velocity = self.velocity * 0.5;
398 self.owner.velocity_z += 10;
399 spot = self.origin + v_forward * 256 + '0 0 64';
400 spot = vehicles_findgoodexit(spot);
402 self.owner.oldvelocity = self.owner.velocity;
403 setorigin(self.owner , spot);
406 antilag_clear(self.owner);
410 void spiderbot_headfade()
412 self.think = spiderbot_headfade;
413 self.nextthink = self.fade_time;
414 self.alpha = 1 - (time - self.fade_time) * self.fade_rate;
416 if(self.cnt < time || self.alpha < 0.1)
420 sound (self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
421 Send_Effect(EFFECT_EXPLOSION_BIG, self.origin + '0 0 100', '0 0 0', 1);
427 void spiderbot_blowup()
433 sound (self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
434 Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (self.origin + '0 0 100'), '0 0 0', 1);
436 self.nextthink = time + 0.1;
446 setmodel(b, MDL_VEH_SPIDERBOT_BODY);
447 setmodel(h, MDL_VEH_SPIDERBOT_TOP);
448 setmodel(g1, MDL_VEH_SPIDERBOT_GUN);
449 setmodel(g2, MDL_VEH_SPIDERBOT_GUN);
451 setorigin(b, self.origin);
453 b.angles = self.angles;
454 setsize(b, self.mins, self.maxs);
456 vector org = gettaginfo(self, gettagindex(self, "tag_head"));
458 h.movetype = MOVETYPE_BOUNCE;
459 h.solid = SOLID_BBOX;
460 h.velocity = v_up * (500 + random() * 500) + randomvec() * 128;
461 h.modelflags = MF_ROCKET;
462 h.effects = EF_FLAME | EF_LOWPRECISION;
463 h.avelocity = randomvec() * 360;
466 h.cnt = time + (3.5 * random());
467 h.fade_rate = 1 / min(self.respawntime, 10);
469 h.think = spiderbot_headfade;
472 org = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_hardpoint01"));
474 g1.movetype = MOVETYPE_TOSS;
475 g1.solid = SOLID_CORPSE;
476 g1.velocity = v_forward * 700 + (randomvec() * 32);
477 g1.avelocity = randomvec() * 180;
479 org = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_hardpoint02"));
481 g2.movetype = MOVETYPE_TOSS;
482 g2.solid = SOLID_CORPSE;
483 g2.velocity = v_forward * 700 + (randomvec() * 32);
484 g2.avelocity = randomvec() * 180;
486 h.colormod = b.colormod = g1.colormod = g2.colormod = '-2 -2 -2';
488 SUB_SetFade(b, time + 5, min(self.respawntime, 1));
489 //SUB_SetFade(h, time, min(self.respawntime, 10));
490 SUB_SetFade(g1, time, min(self.respawntime, 10));
491 SUB_SetFade(g2, time, min(self.respawntime, 10));
493 RadiusDamage (self, self.enemy, 250, 15, 250, world, world, 250, DEATH_VH_SPID_DEATH.m_id, world);
495 self.alpha = self.tur_head.alpha = self.gun1.alpha = self.gun2.alpha = -1;
496 self.movetype = MOVETYPE_NONE;
497 self.deadflag = DEAD_DEAD;
498 self.solid = SOLID_NOT;
499 self.tur_head.effects &= ~EF_FLAME;
500 self.vehicle_hudmodel.viewmodelforclient = self;
503 bool spiderbot_impulse(int _imp)
507 case IMP_weapon_group_1.impulse:
508 self.vehicle.vehicle_weapon2mode = SBRM_VOLLY;
509 CSQCVehicleSetup(self, 0);
511 case IMP_weapon_group_2.impulse:
512 self.vehicle.vehicle_weapon2mode = SBRM_GUIDE;
513 CSQCVehicleSetup(self, 0);
515 case IMP_weapon_group_3.impulse:
516 self.vehicle.vehicle_weapon2mode = SBRM_ARTILLERY;
517 CSQCVehicleSetup(self, 0);
520 case IMP_weapon_next_byid.impulse:
521 case IMP_weapon_next_bypriority.impulse:
522 case IMP_weapon_next_bygroup.impulse:
523 self.vehicle.vehicle_weapon2mode += 1;
524 if(self.vehicle.vehicle_weapon2mode > SBRM_LAST)
525 self.vehicle.vehicle_weapon2mode = SBRM_FIRST;
527 //centerprint(self, strcat("Rocket mode is ", ftos(self.vehicle.vehicle_weapon2mode)));
528 CSQCVehicleSetup(self, 0);
530 case IMP_weapon_last.impulse:
531 case IMP_weapon_prev_byid.impulse:
532 case IMP_weapon_prev_bypriority.impulse:
533 case IMP_weapon_prev_bygroup.impulse:
534 self.vehicle.vehicle_weapon2mode -= 1;
535 if(self.vehicle.vehicle_weapon2mode < SBRM_FIRST)
536 self.vehicle.vehicle_weapon2mode = SBRM_LAST;
538 //centerprint(self, strcat("Rocket mode is ", ftos(self.vehicle.vehicle_weapon2mode)));
539 CSQCVehicleSetup(self, 0);
543 case IMP_weapon_drop.impulse: // toss gun, could be used to exit?
545 case IMP_weapon_reload.impulse: // Manual minigun reload?
552 spawnfunc(vehicle_spiderbot)
554 if(!autocvar_g_vehicle_spiderbot) { remove(self); return; }
555 if(!vehicle_initialize(VEH_SPIDERBOT, false)) { remove(self); return; }
558 METHOD(Spiderbot, vr_impact, void(Spiderbot thisveh, entity instance))
560 if(autocvar_g_vehicle_spiderbot_bouncepain)
561 vehicles_impact(autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z);
563 METHOD(Spiderbot, vr_enter, void(Spiderbot thisveh, entity instance))
565 self.vehicle_weapon2mode = SBRM_GUIDE;
566 self.movetype = MOVETYPE_WALK;
567 CSQCVehicleSetup(self.owner, 0);
568 self.owner.vehicle_health = (self.vehicle_health / autocvar_g_vehicle_spiderbot_health) * 100;
569 self.owner.vehicle_shield = (self.vehicle_shield / autocvar_g_vehicle_spiderbot_shield) * 100;
571 if(self.owner.flagcarried)
573 setattachment(self.owner.flagcarried, self.tur_head, "");
574 setorigin(self.owner.flagcarried, '-20 0 120');
577 METHOD(Spiderbot, vr_think, void(Spiderbot thisveh, entity instance))
579 if(IS_ONGROUND(self))
580 movelib_brake_simple(self, autocvar_g_vehicle_spiderbot_speed_stop);
582 METHOD(Spiderbot, vr_death, void(Spiderbot thisveh, entity instance))
585 instance.event_damage = func_null;
586 instance.takedamage = DAMAGE_NO;
587 instance.touch = func_null;
588 instance.cnt = 3.4 + time + random() * 2;
589 instance.think = spiderbot_blowup;
590 instance.nextthink = time;
591 instance.deadflag = DEAD_DYING;
593 instance.tur_head.effects |= EF_FLAME;
594 instance.colormod = instance.tur_head.colormod = '-1 -1 -1';
596 instance.movetype = MOVETYPE_TOSS;
598 CSQCModel_UnlinkEntity(instance); // networking the death scene would be a nightmare
600 METHOD(Spiderbot, vr_spawn, void(Spiderbot thisveh, entity instance))
604 self.vehicles_impulse = spiderbot_impulse;
607 setmodel(self.gun1, MDL_VEH_SPIDERBOT_GUN);
608 setmodel(self.gun2, MDL_VEH_SPIDERBOT_GUN);
609 setattachment(self.gun1, self.tur_head, "tag_hardpoint01");
610 setattachment(self.gun2, self.tur_head, "tag_hardpoint02");
616 self.tur_head.frame = 1;
617 self.movetype = MOVETYPE_WALK;
618 self.solid = SOLID_SLIDEBOX;
619 self.alpha = self.tur_head.alpha = self.gun1.alpha = self.gun2.alpha = 1;
620 self.tur_head.angles = '0 0 0';
621 self.vehicle_exit = spiderbot_exit;
623 setorigin(self, self.pos1 + '0 0 128');
624 self.angles = self.pos2;
625 self.damageforcescale = 0.03;
626 self.vehicle_health = autocvar_g_vehicle_spiderbot_health;
627 self.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
629 self.PlayerPhysplug = spiderbot_frame;
631 METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh, entity instance))
633 if(autocvar_g_vehicle_spiderbot_shield)
634 self.vehicle_flags |= VHF_HASSHIELD;
636 if(autocvar_g_vehicle_spiderbot_shield_regen)
637 self.vehicle_flags |= VHF_SHIELDREGEN;
639 if(autocvar_g_vehicle_spiderbot_health_regen)
640 self.vehicle_flags |= VHF_HEALTHREGEN;
642 self.respawntime = autocvar_g_vehicle_spiderbot_respawntime;
643 self.vehicle_health = autocvar_g_vehicle_spiderbot_health;
644 self.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
645 self.max_health = self.vehicle_health;
646 self.pushable = true; // spiderbot can use jumppads
651 float autocvar_cl_vehicle_spiderbot_cross_alpha = 0.6;
652 float autocvar_cl_vehicle_spiderbot_cross_size = 1;
654 METHOD(Spiderbot, vr_hud, void(Spiderbot thisveh))
656 Vehicles_drawHUD(VEH_SPIDERBOT.m_icon, "vehicle_spider_weapon1", "vehicle_spider_weapon2",
657 "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
658 "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color);
660 METHOD(Spiderbot, vr_crosshair, void(Spiderbot thisveh))
666 case SBRM_VOLLY: crosshair = vCROSS_BURST; break;
667 case SBRM_GUIDE: crosshair = vCROSS_GUIDE; break;
668 case SBRM_ARTILLERY: crosshair = vCROSS_RAIN; break;
669 default: crosshair = vCROSS_BURST;
672 Vehicles_drawCrosshair(crosshair);
674 METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh, entity instance))
676 AuxiliaryXhair[0].axh_image = vCROSS_HINT; // Minigun1
677 AuxiliaryXhair[1].axh_image = vCROSS_HINT; // Minigun2