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 bool spiderbot_frame(entity this)
75 entity vehic = this.vehicle;
78 if(intermission_running)
80 self.vehicle.velocity = '0 0 0';
81 self.vehicle.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 WITH(entity, self, vehic, movelib_groundalign4point(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);
340 void spiderbot_exit(float eject)
345 e = findchain(classname,"spiderbot_rocket");
348 if(e.owner == self.owner)
350 e.realowner = self.owner;
356 self.think = vehicles_think;
357 self.nextthink = time;
359 self.movetype = MOVETYPE_WALK;
364 makevectors(self.angles);
367 spot = self.origin + v_forward * 100 + '0 0 64';
368 spot = vehicles_findgoodexit(spot);
369 setorigin(self.owner , spot);
370 self.owner.velocity = (v_up + v_forward * 0.25) * 750;
371 self.owner.oldvelocity = self.owner.velocity;
375 if(vdist(self.velocity, >, autocvar_g_vehicle_spiderbot_speed_strafe))
377 self.owner.velocity = normalize(self.velocity) * vlen(self.velocity);
378 self.owner.velocity_z += 200;
379 spot = self.origin + v_forward * 128 + '0 0 64';
380 spot = vehicles_findgoodexit(spot);
384 self.owner.velocity = self.velocity * 0.5;
385 self.owner.velocity_z += 10;
386 spot = self.origin + v_forward * 256 + '0 0 64';
387 spot = vehicles_findgoodexit(spot);
389 self.owner.oldvelocity = self.owner.velocity;
390 setorigin(self.owner , spot);
393 antilag_clear(self.owner, CS(self.owner));
397 void spiderbot_headfade()
399 self.think = spiderbot_headfade;
400 self.nextthink = self.fade_time;
401 self.alpha = 1 - (time - self.fade_time) * self.fade_rate;
403 if(self.cnt < time || self.alpha < 0.1)
407 sound (self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
408 Send_Effect(EFFECT_EXPLOSION_BIG, self.origin + '0 0 100', '0 0 0', 1);
414 void spiderbot_blowup()
420 sound (self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
421 Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (self.origin + '0 0 100'), '0 0 0', 1);
423 self.nextthink = time + 0.1;
433 setmodel(b, MDL_VEH_SPIDERBOT_BODY);
434 setmodel(h, MDL_VEH_SPIDERBOT_TOP);
435 setmodel(g1, MDL_VEH_SPIDERBOT_GUN);
436 setmodel(g2, MDL_VEH_SPIDERBOT_GUN);
438 setorigin(b, self.origin);
440 b.angles = self.angles;
441 setsize(b, self.mins, self.maxs);
443 vector org = gettaginfo(self, gettagindex(self, "tag_head"));
445 h.movetype = MOVETYPE_BOUNCE;
446 h.solid = SOLID_BBOX;
447 h.velocity = v_up * (500 + random() * 500) + randomvec() * 128;
448 h.modelflags = MF_ROCKET;
449 h.effects = EF_FLAME | EF_LOWPRECISION;
450 h.avelocity = randomvec() * 360;
453 h.cnt = time + (3.5 * random());
454 h.fade_rate = 1 / min(self.respawntime, 10);
456 h.think = spiderbot_headfade;
459 org = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_hardpoint01"));
461 g1.movetype = MOVETYPE_TOSS;
462 g1.solid = SOLID_CORPSE;
463 g1.velocity = v_forward * 700 + (randomvec() * 32);
464 g1.avelocity = randomvec() * 180;
466 org = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_hardpoint02"));
468 g2.movetype = MOVETYPE_TOSS;
469 g2.solid = SOLID_CORPSE;
470 g2.velocity = v_forward * 700 + (randomvec() * 32);
471 g2.avelocity = randomvec() * 180;
473 h.colormod = b.colormod = g1.colormod = g2.colormod = '-2 -2 -2';
475 SUB_SetFade(b, time + 5, min(self.respawntime, 1));
476 //SUB_SetFade(h, time, min(self.respawntime, 10));
477 SUB_SetFade(g1, time, min(self.respawntime, 10));
478 SUB_SetFade(g2, time, min(self.respawntime, 10));
480 RadiusDamage (self, self.enemy, 250, 15, 250, world, world, 250, DEATH_VH_SPID_DEATH.m_id, world);
482 self.alpha = self.tur_head.alpha = self.gun1.alpha = self.gun2.alpha = -1;
483 self.movetype = MOVETYPE_NONE;
484 self.deadflag = DEAD_DEAD;
485 self.solid = SOLID_NOT;
486 self.tur_head.effects &= ~EF_FLAME;
487 self.vehicle_hudmodel.viewmodelforclient = self;
490 bool spiderbot_impulse(int _imp)
494 case IMP_weapon_group_1.impulse:
495 self.vehicle.vehicle_weapon2mode = SBRM_VOLLY;
496 CSQCVehicleSetup(self, 0);
498 case IMP_weapon_group_2.impulse:
499 self.vehicle.vehicle_weapon2mode = SBRM_GUIDE;
500 CSQCVehicleSetup(self, 0);
502 case IMP_weapon_group_3.impulse:
503 self.vehicle.vehicle_weapon2mode = SBRM_ARTILLERY;
504 CSQCVehicleSetup(self, 0);
507 case IMP_weapon_next_byid.impulse:
508 case IMP_weapon_next_bypriority.impulse:
509 case IMP_weapon_next_bygroup.impulse:
510 self.vehicle.vehicle_weapon2mode += 1;
511 if(self.vehicle.vehicle_weapon2mode > SBRM_LAST)
512 self.vehicle.vehicle_weapon2mode = SBRM_FIRST;
514 //centerprint(self, strcat("Rocket mode is ", ftos(self.vehicle.vehicle_weapon2mode)));
515 CSQCVehicleSetup(self, 0);
517 case IMP_weapon_last.impulse:
518 case IMP_weapon_prev_byid.impulse:
519 case IMP_weapon_prev_bypriority.impulse:
520 case IMP_weapon_prev_bygroup.impulse:
521 self.vehicle.vehicle_weapon2mode -= 1;
522 if(self.vehicle.vehicle_weapon2mode < SBRM_FIRST)
523 self.vehicle.vehicle_weapon2mode = SBRM_LAST;
525 //centerprint(self, strcat("Rocket mode is ", ftos(self.vehicle.vehicle_weapon2mode)));
526 CSQCVehicleSetup(self, 0);
530 case IMP_weapon_drop.impulse: // toss gun, could be used to exit?
532 case IMP_weapon_reload.impulse: // Manual minigun reload?
539 spawnfunc(vehicle_spiderbot)
541 if(!autocvar_g_vehicle_spiderbot) { remove(self); return; }
542 if(!vehicle_initialize(VEH_SPIDERBOT, false)) { remove(self); return; }
545 METHOD(Spiderbot, vr_impact, void(Spiderbot thisveh, entity instance))
547 if(autocvar_g_vehicle_spiderbot_bouncepain)
548 vehicles_impact(autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z);
550 METHOD(Spiderbot, vr_enter, void(Spiderbot thisveh, entity instance))
553 self.vehicle_weapon2mode = SBRM_GUIDE;
554 self.movetype = MOVETYPE_WALK;
555 CSQCVehicleSetup(self.owner, 0);
556 self.owner.vehicle_health = (self.vehicle_health / autocvar_g_vehicle_spiderbot_health) * 100;
557 self.owner.vehicle_shield = (self.vehicle_shield / autocvar_g_vehicle_spiderbot_shield) * 100;
559 if(self.owner.flagcarried)
561 setattachment(self.owner.flagcarried, self.tur_head, "");
562 setorigin(self.owner.flagcarried, '-20 0 120');
565 METHOD(Spiderbot, vr_think, void(Spiderbot thisveh, entity instance))
568 if(IS_ONGROUND(self))
569 movelib_brake_simple(self, autocvar_g_vehicle_spiderbot_speed_stop);
571 METHOD(Spiderbot, vr_death, void(Spiderbot thisveh, entity instance))
574 instance.event_damage = func_null;
575 instance.takedamage = DAMAGE_NO;
576 instance.touch = func_null;
577 instance.cnt = 3.4 + time + random() * 2;
578 instance.think = spiderbot_blowup;
579 instance.nextthink = time;
580 instance.deadflag = DEAD_DYING;
582 instance.tur_head.effects |= EF_FLAME;
583 instance.colormod = instance.tur_head.colormod = '-1 -1 -1';
585 instance.movetype = MOVETYPE_TOSS;
587 CSQCModel_UnlinkEntity(instance); // networking the death scene would be a nightmare
589 METHOD(Spiderbot, vr_spawn, void(Spiderbot thisveh, entity instance))
594 self.vehicles_impulse = spiderbot_impulse;
597 setmodel(self.gun1, MDL_VEH_SPIDERBOT_GUN);
598 setmodel(self.gun2, MDL_VEH_SPIDERBOT_GUN);
599 setattachment(self.gun1, self.tur_head, "tag_hardpoint01");
600 setattachment(self.gun2, self.tur_head, "tag_hardpoint02");
606 self.tur_head.frame = 1;
607 self.movetype = MOVETYPE_WALK;
608 self.solid = SOLID_SLIDEBOX;
609 self.alpha = self.tur_head.alpha = self.gun1.alpha = self.gun2.alpha = 1;
610 self.tur_head.angles = '0 0 0';
611 self.vehicle_exit = spiderbot_exit;
613 setorigin(self, self.pos1 + '0 0 128');
614 self.angles = self.pos2;
615 self.damageforcescale = 0.03;
616 self.vehicle_health = autocvar_g_vehicle_spiderbot_health;
617 self.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
619 self.PlayerPhysplug = spiderbot_frame;
621 METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh, entity instance))
624 if(autocvar_g_vehicle_spiderbot_shield)
625 self.vehicle_flags |= VHF_HASSHIELD;
627 if(autocvar_g_vehicle_spiderbot_shield_regen)
628 self.vehicle_flags |= VHF_SHIELDREGEN;
630 if(autocvar_g_vehicle_spiderbot_health_regen)
631 self.vehicle_flags |= VHF_HEALTHREGEN;
633 self.respawntime = autocvar_g_vehicle_spiderbot_respawntime;
634 self.vehicle_health = autocvar_g_vehicle_spiderbot_health;
635 self.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
636 self.max_health = self.vehicle_health;
637 self.pushable = true; // spiderbot can use jumppads
642 float autocvar_cl_vehicle_spiderbot_cross_alpha = 0.6;
643 float autocvar_cl_vehicle_spiderbot_cross_size = 1;
645 METHOD(Spiderbot, vr_hud, void(Spiderbot thisveh))
647 Vehicles_drawHUD(VEH_SPIDERBOT.m_icon, "vehicle_spider_weapon1", "vehicle_spider_weapon2",
648 "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
649 "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color);
651 METHOD(Spiderbot, vr_crosshair, void(Spiderbot thisveh))
657 case SBRM_VOLLY: crosshair = vCROSS_BURST; break;
658 case SBRM_GUIDE: crosshair = vCROSS_GUIDE; break;
659 case SBRM_ARTILLERY: crosshair = vCROSS_RAIN; break;
660 default: crosshair = vCROSS_BURST;
663 Vehicles_drawCrosshair(crosshair);
665 METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh, entity instance))
667 AuxiliaryXhair[0].axh_image = vCROSS_HINT; // Minigun1
668 AuxiliaryXhair[1].axh_image = vCROSS_HINT; // Minigun2