1 #ifndef VEHICLE_SPIDERBOT
2 #define VEHICLE_SPIDERBOT
4 #include "spiderbot_weapons.qh"
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;
37 bool autocvar_g_vehicle_spiderbot = true;
39 float autocvar_g_vehicle_spiderbot_respawntime = 45;
41 float autocvar_g_vehicle_spiderbot_speed_stop = 50;
42 float autocvar_g_vehicle_spiderbot_speed_strafe = 400;
43 float autocvar_g_vehicle_spiderbot_speed_walk = 500;
44 float autocvar_g_vehicle_spiderbot_speed_run = 700;
45 float autocvar_g_vehicle_spiderbot_turnspeed = 90;
46 float autocvar_g_vehicle_spiderbot_turnspeed_strafe = 300;
47 float autocvar_g_vehicle_spiderbot_movement_inertia = 0.15;
49 float autocvar_g_vehicle_spiderbot_springlength = 150;
50 float autocvar_g_vehicle_spiderbot_springup = 20;
51 float autocvar_g_vehicle_spiderbot_springblend = 0.1;
52 float autocvar_g_vehicle_spiderbot_tiltlimit = 90;
54 float autocvar_g_vehicle_spiderbot_head_pitchlimit_down = -20;
55 float autocvar_g_vehicle_spiderbot_head_pitchlimit_up = 30;
56 float autocvar_g_vehicle_spiderbot_head_turnlimit = 90;
57 float autocvar_g_vehicle_spiderbot_head_turnspeed = 110;
59 int autocvar_g_vehicle_spiderbot_health = 800;
60 float autocvar_g_vehicle_spiderbot_health_regen = 10;
61 float autocvar_g_vehicle_spiderbot_health_regen_pause = 5;
63 int autocvar_g_vehicle_spiderbot_shield = 200;
64 float autocvar_g_vehicle_spiderbot_shield_regen = 25;
65 float autocvar_g_vehicle_spiderbot_shield_regen_pause = 0.35;
67 // 'minspeed_for_pain speedchange_to_pain_factor max_damage'
68 vector autocvar_g_vehicle_spiderbot_bouncepain = '0 0 0';
71 bool spiderbot_frame(entity this)
73 entity vehic = this.vehicle;
76 if(intermission_running)
78 vehic.velocity = '0 0 0';
79 vehic.avelocity = '0 0 0';
85 vehicles_frame(vehic, this);
87 PHYS_INPUT_BUTTON_ZOOM(this) = false;
88 PHYS_INPUT_BUTTON_CROUCH(this) = false;
89 PS(this).m_switchweapon = WEP_Null;
90 this.vehicle_weapon2mode = vehic.vehicle_weapon2mode;
93 #if 1 // 0 to enable per-gun impact aux crosshairs
94 // Avarage gun impact point's -> aux cross
95 vector ad = gettaginfo(vehic.tur_head, gettagindex(vehic.tur_head, "tag_hardpoint01"));
96 vector vf = v_forward;
97 ad += gettaginfo(vehic.tur_head, gettagindex(vehic.tur_head, "tag_hardpoint02"));
100 v_forward = vf * 0.5;
101 traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, vehic);
102 UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' * (1 - this.vehicle_reload1)), 0);
104 vector ad = gettaginfo(vehic.gun1, gettagindex(vehic.gun1, "barrels"));
105 traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, vehic);
106 UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' * (1 - this.vehicle_reload1)), 0);
108 ad = gettaginfo(vehic.gun2, gettagindex(vehic.gun2, "barrels"));
109 traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, vehic);
110 UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' * (1 - this.vehicle_reload1)), 1);
111 ad = 0.5 * (ad + vf);
114 crosshair_trace(this);
115 ad = vectoangles(normalize(trace_endpos - ad));
116 ad = AnglesTransform_ToAngles(AnglesTransform_LeftDivide(AnglesTransform_FromAngles(vehic.angles), AnglesTransform_FromAngles(ad))) - vehic.tur_head.angles;
117 ad = AnglesTransform_Normalize(ad, true);
118 //UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload2) + ('0 1 0' * (1 - this.vehicle_reload2)), 2);
121 float ftmp = autocvar_g_vehicle_spiderbot_head_turnspeed * sys_frametime;
122 ad_y = bound(-ftmp, ad_y, ftmp);
123 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);
126 ad_x = bound(ftmp * -1, ad_x, ftmp);
127 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);
130 //fixedmakevectors(vehic.angles);
131 makevectors(vehic.angles + '-2 0 0' * vehic.angles_x);
133 movelib_groundalign4point(vehic, autocvar_g_vehicle_spiderbot_springlength, autocvar_g_vehicle_spiderbot_springup, autocvar_g_vehicle_spiderbot_springblend, autocvar_g_vehicle_spiderbot_tiltlimit);
135 if(IS_ONGROUND(vehic))
136 vehic.jump_delay = time; // reset now so movement can begin
138 //if(IS_ONGROUND(vehic))
140 if(IS_ONGROUND(vehic))
141 if(vehic.frame == 4 && vehic.tur_head.wait != 0)
143 sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_LAND, VOL_VEHICLEENGINE, ATTEN_NORM);
147 if (!PHYS_INPUT_BUTTON_JUMP(this))
148 PHYS_INPUT_BUTTON_JUMP(vehic) = false;
150 if((IS_ONGROUND(vehic)) && PHYS_INPUT_BUTTON_JUMP(this) && !PHYS_INPUT_BUTTON_JUMP(vehic) && vehic.tur_head.wait < time)
152 sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_JUMP, VOL_VEHICLEENGINE, ATTEN_NORM);
153 //dprint("spiderbot_jump:", ftos(soundlength("vehicles/spiderbot_jump.wav")), "\n");
156 vehic.tur_head.wait = time + 2;
157 vehic.jump_delay = time + 2;
158 PHYS_INPUT_BUTTON_JUMP(vehic) = true; // set spider's jump
159 //PHYS_INPUT_BUTTON_JUMP(this) = false;
161 vector movefix = '0 0 0';
162 if(this.movement_x > 0) movefix_x = 1;
163 if(this.movement_x < 0) movefix_x = -1;
164 if(this.movement_y > 0) movefix_y = 1;
165 if(this.movement_y < 0) movefix_y = -1;
167 vector rt = movefix_y * v_right;
168 vector sd = movefix_x * v_forward;
169 if(movefix_y == 0 && movefix_x == 0)
170 sd = v_forward; // always do forward
172 UNSET_ONGROUND(vehic);
174 vehic.velocity = sd * 700 + rt * 600 + v_up * 600;
177 else if(time >= vehic.jump_delay)
181 if(IS_ONGROUND(vehic))
183 if(vehic.sound_nexttime < time || vehic.delay != 3)
186 vehic.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_idle.wav");
187 //dprint("spiderbot_idle:", ftos(soundlength("vehicles/spiderbot_idle.wav")), "\n");
188 sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_IDLE, VOL_VEHICLEENGINE, ATTEN_NORM);
190 movelib_brake_simple(vehic, autocvar_g_vehicle_spiderbot_speed_stop);
197 if(this.movement_x == 0 && this.movement_y != 0)
198 ftmp = autocvar_g_vehicle_spiderbot_turnspeed_strafe * sys_frametime;
200 ftmp = autocvar_g_vehicle_spiderbot_turnspeed * sys_frametime;
202 ftmp = bound(-ftmp, vehic.tur_head.angles_y, ftmp);
203 vehic.angles_y = anglemods(vehic.angles_y + ftmp);
204 vehic.tur_head.angles_y -= ftmp;
206 if(this.movement_x != 0)
208 if(this.movement_x > 0)
211 if(IS_ONGROUND(vehic))
214 else if(this.movement_x < 0)
216 this.movement_x = -1;
217 if(IS_ONGROUND(vehic))
221 float oldvelz = vehic.velocity_z;
222 movelib_move_simple(vehic, normalize(v_forward * this.movement_x),((PHYS_INPUT_BUTTON_JUMP(this)) ? autocvar_g_vehicle_spiderbot_speed_run : autocvar_g_vehicle_spiderbot_speed_walk),autocvar_g_vehicle_spiderbot_movement_inertia);
223 vehic.velocity_z = oldvelz;
224 float g = ((autocvar_sv_gameplayfix_gravityunaffectedbyticrate) ? 0.5 : 1);
225 if(vehic.velocity_z <= 20) // not while jumping
226 vehic.velocity_z -= g * sys_frametime * autocvar_sv_gravity;
227 if(IS_ONGROUND(vehic))
228 if(vehic.sound_nexttime < time || vehic.delay != 1)
231 vehic.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_walk.wav");
232 sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_WALK, VOL_VEHICLEENGINE, ATTEN_NORM);
233 //dprint("spiderbot_walk:", ftos(soundlength("vehicles/spiderbot_walk.wav")), "\n");
236 else if(this.movement_y != 0)
238 if(this.movement_y < 0)
240 this.movement_y = -1;
241 if(IS_ONGROUND(vehic))
244 else if(this.movement_y > 0)
247 if(IS_ONGROUND(vehic))
251 float oldvelz = vehic.velocity_z;
252 movelib_move_simple(vehic, normalize(v_right * this.movement_y),autocvar_g_vehicle_spiderbot_speed_strafe,autocvar_g_vehicle_spiderbot_movement_inertia);
253 vehic.velocity_z = oldvelz;
254 float g = ((autocvar_sv_gameplayfix_gravityunaffectedbyticrate) ? 0.5 : 1);
255 if(vehic.velocity_z <= 20) // not while jumping
256 vehic.velocity_z -= g * sys_frametime * autocvar_sv_gravity;
257 if(IS_ONGROUND(vehic))
258 if(vehic.sound_nexttime < time || vehic.delay != 2)
261 vehic.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_strafe.wav");
262 sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_STRAFE, VOL_VEHICLEENGINE, ATTEN_NORM);
263 //dprint("spiderbot_strafe:", ftos(soundlength("vehicles/spiderbot_strafe.wav")), "\n");
270 vehic.angles_x = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, vehic.angles_x, autocvar_g_vehicle_spiderbot_tiltlimit);
271 vehic.angles_z = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, vehic.angles_z, autocvar_g_vehicle_spiderbot_tiltlimit);
273 if(!forbidWeaponUse(this))
274 if(PHYS_INPUT_BUTTON_ATCK(this))
277 if(vehic.vehicle_ammo1 >= autocvar_g_vehicle_spiderbot_minigun_ammo_cost && vehic.tur_head.attack_finished_single[0] <= time)
281 vehic.misc_bulletcounter += 1;
283 gun = (vehic.misc_bulletcounter % 2) ? vehic.gun1 : vehic.gun2;
285 v = gettaginfo(gun, gettagindex(gun, "barrels"));
286 v_forward = normalize(v_forward);
289 WITH(entity, self, this, fireBullet(v, v_forward, autocvar_g_vehicle_spiderbot_minigun_spread, autocvar_g_vehicle_spiderbot_minigun_solidpenetration,
290 autocvar_g_vehicle_spiderbot_minigun_damage, autocvar_g_vehicle_spiderbot_minigun_force, DEATH_VH_SPID_MINIGUN.m_id, 0));
292 sound (gun, CH_WEAPON_A, SND_UZI_FIRE, VOL_BASE, ATTEN_NORM);
293 //trailparticles(self, _particleeffectnum("spiderbot_minigun_trail"), v, trace_endpos);
294 Send_Effect(EFFECT_SPIDERBOT_MINIGUN_MUZZLEFLASH, v, v_forward * 2500, 1);
296 vehic.vehicle_ammo1 -= autocvar_g_vehicle_spiderbot_minigun_ammo_cost;
297 vehic.tur_head.attack_finished_single[0] = time + autocvar_g_vehicle_spiderbot_minigun_refire;
298 this.vehicle_ammo1 = (vehic.vehicle_ammo1 / autocvar_g_vehicle_spiderbot_minigun_ammo_max) * 100;
299 vehic.gun1.angles_z += 45;
300 vehic.gun2.angles_z -= 45;
301 if(vehic.gun1.angles_z >= 360)
303 vehic.gun1.angles_z = 0;
304 vehic.gun2.angles_z = 0;
309 vehicles_regen(vehic, vehic.cnt, vehicle_ammo1, autocvar_g_vehicle_spiderbot_minigun_ammo_max,
310 autocvar_g_vehicle_spiderbot_minigun_ammo_regen_pause,
311 autocvar_g_vehicle_spiderbot_minigun_ammo_regen, frametime, false);
314 WITH(entity, self, vehic, spiderbot_rocket_do());
316 if(vehic.vehicle_flags & VHF_SHIELDREGEN)
317 vehicles_regen(vehic, vehic.dmg_time, vehicle_shield, autocvar_g_vehicle_spiderbot_shield, autocvar_g_vehicle_spiderbot_shield_regen_pause, autocvar_g_vehicle_spiderbot_shield_regen, frametime, true);
319 if(vehic.vehicle_flags & VHF_HEALTHREGEN)
320 vehicles_regen(vehic, vehic.dmg_time, vehicle_health, autocvar_g_vehicle_spiderbot_health, autocvar_g_vehicle_spiderbot_health_regen_pause, autocvar_g_vehicle_spiderbot_health_regen, frametime, false);
322 PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = false;
323 //this.vehicle_ammo2 = vehic.tur_head.frame;
324 this.vehicle_ammo2 = (9 - vehic.tur_head.frame) / 8 * 100; // Percentage, like ammo1
326 if(vehic.gun2.cnt <= time)
327 this.vehicle_reload2 = 100;
329 this.vehicle_reload2 = 100 - ((vehic.gun2.cnt - time) / vehic.attack_finished_single[0]) * 100;
331 setorigin(this, vehic.origin + '0 0 1' * vehic.maxs_z);
332 this.velocity = vehic.velocity;
334 VEHICLE_UPDATE_PLAYER(this, vehic, health, spiderbot);
336 if(vehic.vehicle_flags & VHF_HASSHIELD)
337 VEHICLE_UPDATE_PLAYER(this, vehic, shield, spiderbot);
342 void spiderbot_exit(float eject)
347 e = findchain(classname,"spiderbot_rocket");
350 if(e.owner == self.owner)
352 e.realowner = self.owner;
358 self.think = vehicles_think;
359 self.nextthink = time;
361 self.movetype = MOVETYPE_WALK;
366 makevectors(self.angles);
369 spot = self.origin + v_forward * 100 + '0 0 64';
370 spot = vehicles_findgoodexit(spot);
371 setorigin(self.owner , spot);
372 self.owner.velocity = (v_up + v_forward * 0.25) * 750;
373 self.owner.oldvelocity = self.owner.velocity;
377 if(vdist(self.velocity, >, autocvar_g_vehicle_spiderbot_speed_strafe))
379 self.owner.velocity = normalize(self.velocity) * vlen(self.velocity);
380 self.owner.velocity_z += 200;
381 spot = self.origin + v_forward * 128 + '0 0 64';
382 spot = vehicles_findgoodexit(spot);
386 self.owner.velocity = self.velocity * 0.5;
387 self.owner.velocity_z += 10;
388 spot = self.origin + v_forward * 256 + '0 0 64';
389 spot = vehicles_findgoodexit(spot);
391 self.owner.oldvelocity = self.owner.velocity;
392 setorigin(self.owner , spot);
395 antilag_clear(self.owner, CS(self.owner));
399 void spiderbot_headfade()
401 self.think = spiderbot_headfade;
402 self.nextthink = self.fade_time;
403 self.alpha = 1 - (time - self.fade_time) * self.fade_rate;
405 if(self.cnt < time || self.alpha < 0.1)
409 sound (self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
410 Send_Effect(EFFECT_EXPLOSION_BIG, self.origin + '0 0 100', '0 0 0', 1);
416 void spiderbot_blowup()
422 sound (self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
423 Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (self.origin + '0 0 100'), '0 0 0', 1);
425 self.nextthink = time + 0.1;
435 setmodel(b, MDL_VEH_SPIDERBOT_BODY);
436 setmodel(h, MDL_VEH_SPIDERBOT_TOP);
437 setmodel(g1, MDL_VEH_SPIDERBOT_GUN);
438 setmodel(g2, MDL_VEH_SPIDERBOT_GUN);
440 setorigin(b, self.origin);
442 b.angles = self.angles;
443 setsize(b, self.mins, self.maxs);
445 vector org = gettaginfo(self, gettagindex(self, "tag_head"));
447 h.movetype = MOVETYPE_BOUNCE;
448 h.solid = SOLID_BBOX;
449 h.velocity = v_up * (500 + random() * 500) + randomvec() * 128;
450 h.modelflags = MF_ROCKET;
451 h.effects = EF_FLAME | EF_LOWPRECISION;
452 h.avelocity = randomvec() * 360;
455 h.cnt = time + (3.5 * random());
456 h.fade_rate = 1 / min(self.respawntime, 10);
458 h.think = spiderbot_headfade;
461 org = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_hardpoint01"));
463 g1.movetype = MOVETYPE_TOSS;
464 g1.solid = SOLID_CORPSE;
465 g1.velocity = v_forward * 700 + (randomvec() * 32);
466 g1.avelocity = randomvec() * 180;
468 org = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_hardpoint02"));
470 g2.movetype = MOVETYPE_TOSS;
471 g2.solid = SOLID_CORPSE;
472 g2.velocity = v_forward * 700 + (randomvec() * 32);
473 g2.avelocity = randomvec() * 180;
475 h.colormod = b.colormod = g1.colormod = g2.colormod = '-2 -2 -2';
477 SUB_SetFade(b, time + 5, min(self.respawntime, 1));
478 //SUB_SetFade(h, time, min(self.respawntime, 10));
479 SUB_SetFade(g1, time, min(self.respawntime, 10));
480 SUB_SetFade(g2, time, min(self.respawntime, 10));
482 RadiusDamage (self, self.enemy, 250, 15, 250, world, world, 250, DEATH_VH_SPID_DEATH.m_id, world);
484 self.alpha = self.tur_head.alpha = self.gun1.alpha = self.gun2.alpha = -1;
485 self.movetype = MOVETYPE_NONE;
486 self.deadflag = DEAD_DEAD;
487 self.solid = SOLID_NOT;
488 self.tur_head.effects &= ~EF_FLAME;
489 self.vehicle_hudmodel.viewmodelforclient = self;
492 bool spiderbot_impulse(int _imp)
496 case IMP_weapon_group_1.impulse:
497 self.vehicle.vehicle_weapon2mode = SBRM_VOLLY;
498 CSQCVehicleSetup(self, 0);
500 case IMP_weapon_group_2.impulse:
501 self.vehicle.vehicle_weapon2mode = SBRM_GUIDE;
502 CSQCVehicleSetup(self, 0);
504 case IMP_weapon_group_3.impulse:
505 self.vehicle.vehicle_weapon2mode = SBRM_ARTILLERY;
506 CSQCVehicleSetup(self, 0);
509 case IMP_weapon_next_byid.impulse:
510 case IMP_weapon_next_bypriority.impulse:
511 case IMP_weapon_next_bygroup.impulse:
512 self.vehicle.vehicle_weapon2mode += 1;
513 if(self.vehicle.vehicle_weapon2mode > SBRM_LAST)
514 self.vehicle.vehicle_weapon2mode = SBRM_FIRST;
516 //centerprint(self, strcat("Rocket mode is ", ftos(self.vehicle.vehicle_weapon2mode)));
517 CSQCVehicleSetup(self, 0);
519 case IMP_weapon_last.impulse:
520 case IMP_weapon_prev_byid.impulse:
521 case IMP_weapon_prev_bypriority.impulse:
522 case IMP_weapon_prev_bygroup.impulse:
523 self.vehicle.vehicle_weapon2mode -= 1;
524 if(self.vehicle.vehicle_weapon2mode < SBRM_FIRST)
525 self.vehicle.vehicle_weapon2mode = SBRM_LAST;
527 //centerprint(self, strcat("Rocket mode is ", ftos(self.vehicle.vehicle_weapon2mode)));
528 CSQCVehicleSetup(self, 0);
532 case IMP_weapon_drop.impulse: // toss gun, could be used to exit?
534 case IMP_weapon_reload.impulse: // Manual minigun reload?
541 spawnfunc(vehicle_spiderbot)
543 if(!autocvar_g_vehicle_spiderbot) { remove(self); return; }
544 if(!vehicle_initialize(VEH_SPIDERBOT, false)) { remove(self); return; }
547 METHOD(Spiderbot, vr_impact, void(Spiderbot thisveh, entity instance))
549 if(autocvar_g_vehicle_spiderbot_bouncepain)
550 vehicles_impact(autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z);
552 METHOD(Spiderbot, vr_enter, void(Spiderbot thisveh, entity instance))
555 self.vehicle_weapon2mode = SBRM_GUIDE;
556 self.movetype = MOVETYPE_WALK;
557 CSQCVehicleSetup(self.owner, 0);
558 self.owner.vehicle_health = (self.vehicle_health / autocvar_g_vehicle_spiderbot_health) * 100;
559 self.owner.vehicle_shield = (self.vehicle_shield / autocvar_g_vehicle_spiderbot_shield) * 100;
561 if(self.owner.flagcarried)
563 setattachment(self.owner.flagcarried, self.tur_head, "");
564 setorigin(self.owner.flagcarried, '-20 0 120');
567 METHOD(Spiderbot, vr_think, void(Spiderbot thisveh, entity instance))
570 if(IS_ONGROUND(self))
571 movelib_brake_simple(self, autocvar_g_vehicle_spiderbot_speed_stop);
573 METHOD(Spiderbot, vr_death, void(Spiderbot thisveh, entity instance))
576 instance.event_damage = func_null;
577 instance.takedamage = DAMAGE_NO;
578 instance.touch = func_null;
579 instance.cnt = 3.4 + time + random() * 2;
580 instance.think = spiderbot_blowup;
581 instance.nextthink = time;
582 instance.deadflag = DEAD_DYING;
584 instance.tur_head.effects |= EF_FLAME;
585 instance.colormod = instance.tur_head.colormod = '-1 -1 -1';
587 instance.movetype = MOVETYPE_TOSS;
589 CSQCModel_UnlinkEntity(instance); // networking the death scene would be a nightmare
591 METHOD(Spiderbot, vr_spawn, void(Spiderbot thisveh, entity instance))
596 self.vehicles_impulse = spiderbot_impulse;
599 setmodel(self.gun1, MDL_VEH_SPIDERBOT_GUN);
600 setmodel(self.gun2, MDL_VEH_SPIDERBOT_GUN);
601 setattachment(self.gun1, self.tur_head, "tag_hardpoint01");
602 setattachment(self.gun2, self.tur_head, "tag_hardpoint02");
608 self.tur_head.frame = 1;
609 self.movetype = MOVETYPE_WALK;
610 self.solid = SOLID_SLIDEBOX;
611 self.alpha = self.tur_head.alpha = self.gun1.alpha = self.gun2.alpha = 1;
612 self.tur_head.angles = '0 0 0';
613 self.vehicle_exit = spiderbot_exit;
615 setorigin(self, self.pos1 + '0 0 128');
616 self.angles = self.pos2;
617 self.damageforcescale = 0.03;
618 self.vehicle_health = autocvar_g_vehicle_spiderbot_health;
619 self.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
621 self.PlayerPhysplug = spiderbot_frame;
623 METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh, entity instance))
626 if(autocvar_g_vehicle_spiderbot_shield)
627 self.vehicle_flags |= VHF_HASSHIELD;
629 if(autocvar_g_vehicle_spiderbot_shield_regen)
630 self.vehicle_flags |= VHF_SHIELDREGEN;
632 if(autocvar_g_vehicle_spiderbot_health_regen)
633 self.vehicle_flags |= VHF_HEALTHREGEN;
635 self.respawntime = autocvar_g_vehicle_spiderbot_respawntime;
636 self.vehicle_health = autocvar_g_vehicle_spiderbot_health;
637 self.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
638 self.max_health = self.vehicle_health;
639 self.pushable = true; // spiderbot can use jumppads
644 float autocvar_cl_vehicle_spiderbot_cross_alpha = 0.6;
645 float autocvar_cl_vehicle_spiderbot_cross_size = 1;
647 METHOD(Spiderbot, vr_hud, void(Spiderbot thisveh))
649 Vehicles_drawHUD(VEH_SPIDERBOT.m_icon, "vehicle_spider_weapon1", "vehicle_spider_weapon2",
650 "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
651 "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color);
653 METHOD(Spiderbot, vr_crosshair, void(Spiderbot thisveh))
659 case SBRM_VOLLY: crosshair = vCROSS_BURST; break;
660 case SBRM_GUIDE: crosshair = vCROSS_GUIDE; break;
661 case SBRM_ARTILLERY: crosshair = vCROSS_RAIN; break;
662 default: crosshair = vCROSS_BURST;
665 Vehicles_drawCrosshair(crosshair);
667 METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh, entity instance))
669 AuxiliaryXhair[0].axh_image = vCROSS_HINT; // Minigun1
670 AuxiliaryXhair[1].axh_image = vCROSS_HINT; // Minigun2