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';
83 vehicles_frame(vehic, this);
85 PHYS_INPUT_BUTTON_ZOOM(this) = false;
86 PHYS_INPUT_BUTTON_CROUCH(this) = false;
87 PS(this).m_switchweapon = WEP_Null;
88 this.vehicle_weapon2mode = vehic.vehicle_weapon2mode;
91 #if 1 // 0 to enable per-gun impact aux crosshairs
92 // Avarage gun impact point's -> aux cross
93 vector ad = gettaginfo(vehic.tur_head, gettagindex(vehic.tur_head, "tag_hardpoint01"));
94 vector vf = v_forward;
95 ad += gettaginfo(vehic.tur_head, gettagindex(vehic.tur_head, "tag_hardpoint02"));
99 traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, vehic);
100 UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' * (1 - this.vehicle_reload1)), 0);
102 vector ad = gettaginfo(vehic.gun1, gettagindex(vehic.gun1, "barrels"));
103 traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, vehic);
104 UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' * (1 - this.vehicle_reload1)), 0);
106 ad = gettaginfo(vehic.gun2, gettagindex(vehic.gun2, "barrels"));
107 traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, vehic);
108 UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' * (1 - this.vehicle_reload1)), 1);
109 ad = 0.5 * (ad + vf);
112 crosshair_trace(this);
113 ad = vectoangles(normalize(trace_endpos - ad));
114 ad = AnglesTransform_ToAngles(AnglesTransform_LeftDivide(AnglesTransform_FromAngles(vehic.angles), AnglesTransform_FromAngles(ad))) - vehic.tur_head.angles;
115 ad = AnglesTransform_Normalize(ad, true);
116 //UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload2) + ('0 1 0' * (1 - this.vehicle_reload2)), 2);
119 float ftmp = autocvar_g_vehicle_spiderbot_head_turnspeed * sys_frametime;
120 ad_y = bound(-ftmp, ad_y, ftmp);
121 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);
124 ad_x = bound(ftmp * -1, ad_x, ftmp);
125 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);
128 //fixedmakevectors(vehic.angles);
129 makevectors(vehic.angles + '-2 0 0' * vehic.angles_x);
131 movelib_groundalign4point(vehic, autocvar_g_vehicle_spiderbot_springlength, autocvar_g_vehicle_spiderbot_springup, autocvar_g_vehicle_spiderbot_springblend, autocvar_g_vehicle_spiderbot_tiltlimit);
133 if(IS_ONGROUND(vehic))
134 vehic.jump_delay = time; // reset now so movement can begin
136 //if(IS_ONGROUND(vehic))
138 if(IS_ONGROUND(vehic))
139 if(vehic.frame == 4 && vehic.tur_head.wait != 0)
141 sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_LAND, VOL_VEHICLEENGINE, ATTEN_NORM);
145 if (!PHYS_INPUT_BUTTON_JUMP(this))
146 PHYS_INPUT_BUTTON_JUMP(vehic) = false;
148 if((IS_ONGROUND(vehic)) && PHYS_INPUT_BUTTON_JUMP(this) && !PHYS_INPUT_BUTTON_JUMP(vehic) && vehic.tur_head.wait < time)
150 sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_JUMP, VOL_VEHICLEENGINE, ATTEN_NORM);
151 //dprint("spiderbot_jump:", ftos(soundlength("vehicles/spiderbot_jump.wav")), "\n");
154 vehic.tur_head.wait = time + 2;
155 vehic.jump_delay = time + 2;
156 PHYS_INPUT_BUTTON_JUMP(vehic) = true; // set spider's jump
157 //PHYS_INPUT_BUTTON_JUMP(this) = false;
159 vector movefix = '0 0 0';
160 if(this.movement_x > 0) movefix_x = 1;
161 if(this.movement_x < 0) movefix_x = -1;
162 if(this.movement_y > 0) movefix_y = 1;
163 if(this.movement_y < 0) movefix_y = -1;
165 vector rt = movefix_y * v_right;
166 vector sd = movefix_x * v_forward;
167 if(movefix_y == 0 && movefix_x == 0)
168 sd = v_forward; // always do forward
170 UNSET_ONGROUND(vehic);
172 vehic.velocity = sd * 700 + rt * 600 + v_up * 600;
175 else if(time >= vehic.jump_delay)
179 if(IS_ONGROUND(vehic))
181 if(vehic.sound_nexttime < time || vehic.delay != 3)
184 vehic.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_idle.wav");
185 //dprint("spiderbot_idle:", ftos(soundlength("vehicles/spiderbot_idle.wav")), "\n");
186 sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_IDLE, VOL_VEHICLEENGINE, ATTEN_NORM);
188 movelib_brake_simple(vehic, autocvar_g_vehicle_spiderbot_speed_stop);
195 if(this.movement_x == 0 && this.movement_y != 0)
196 ftmp = autocvar_g_vehicle_spiderbot_turnspeed_strafe * sys_frametime;
198 ftmp = autocvar_g_vehicle_spiderbot_turnspeed * sys_frametime;
200 ftmp = bound(-ftmp, vehic.tur_head.angles_y, ftmp);
201 vehic.angles_y = anglemods(vehic.angles_y + ftmp);
202 vehic.tur_head.angles_y -= ftmp;
204 if(this.movement_x != 0)
206 if(this.movement_x > 0)
209 if(IS_ONGROUND(vehic))
212 else if(this.movement_x < 0)
214 this.movement_x = -1;
215 if(IS_ONGROUND(vehic))
219 float oldvelz = vehic.velocity_z;
220 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);
221 vehic.velocity_z = oldvelz;
222 float g = ((autocvar_sv_gameplayfix_gravityunaffectedbyticrate) ? 0.5 : 1);
223 if(vehic.velocity_z <= 20) // not while jumping
224 vehic.velocity_z -= g * sys_frametime * autocvar_sv_gravity;
225 if(IS_ONGROUND(vehic))
226 if(vehic.sound_nexttime < time || vehic.delay != 1)
229 vehic.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_walk.wav");
230 sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_WALK, VOL_VEHICLEENGINE, ATTEN_NORM);
231 //dprint("spiderbot_walk:", ftos(soundlength("vehicles/spiderbot_walk.wav")), "\n");
234 else if(this.movement_y != 0)
236 if(this.movement_y < 0)
238 this.movement_y = -1;
239 if(IS_ONGROUND(vehic))
242 else if(this.movement_y > 0)
245 if(IS_ONGROUND(vehic))
249 float oldvelz = vehic.velocity_z;
250 movelib_move_simple(vehic, normalize(v_right * this.movement_y),autocvar_g_vehicle_spiderbot_speed_strafe,autocvar_g_vehicle_spiderbot_movement_inertia);
251 vehic.velocity_z = oldvelz;
252 float g = ((autocvar_sv_gameplayfix_gravityunaffectedbyticrate) ? 0.5 : 1);
253 if(vehic.velocity_z <= 20) // not while jumping
254 vehic.velocity_z -= g * sys_frametime * autocvar_sv_gravity;
255 if(IS_ONGROUND(vehic))
256 if(vehic.sound_nexttime < time || vehic.delay != 2)
259 vehic.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_strafe.wav");
260 sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_STRAFE, VOL_VEHICLEENGINE, ATTEN_NORM);
261 //dprint("spiderbot_strafe:", ftos(soundlength("vehicles/spiderbot_strafe.wav")), "\n");
268 vehic.angles_x = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, vehic.angles_x, autocvar_g_vehicle_spiderbot_tiltlimit);
269 vehic.angles_z = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, vehic.angles_z, autocvar_g_vehicle_spiderbot_tiltlimit);
271 if(!forbidWeaponUse(this))
272 if(PHYS_INPUT_BUTTON_ATCK(this))
275 if(vehic.vehicle_ammo1 >= autocvar_g_vehicle_spiderbot_minigun_ammo_cost && vehic.tur_head.attack_finished_single[0] <= time)
279 vehic.misc_bulletcounter += 1;
281 gun = (vehic.misc_bulletcounter % 2) ? vehic.gun1 : vehic.gun2;
283 v = gettaginfo(gun, gettagindex(gun, "barrels"));
284 v_forward = normalize(v_forward);
287 fireBullet(this, v, v_forward, autocvar_g_vehicle_spiderbot_minigun_spread, autocvar_g_vehicle_spiderbot_minigun_solidpenetration,
288 autocvar_g_vehicle_spiderbot_minigun_damage, autocvar_g_vehicle_spiderbot_minigun_force, DEATH_VH_SPID_MINIGUN.m_id, 0);
290 sound (gun, CH_WEAPON_A, SND_UZI_FIRE, VOL_BASE, ATTEN_NORM);
291 //trailparticles(this, _particleeffectnum("spiderbot_minigun_trail"), v, trace_endpos);
292 Send_Effect(EFFECT_SPIDERBOT_MINIGUN_MUZZLEFLASH, v, v_forward * 2500, 1);
294 vehic.vehicle_ammo1 -= autocvar_g_vehicle_spiderbot_minigun_ammo_cost;
295 vehic.tur_head.attack_finished_single[0] = time + autocvar_g_vehicle_spiderbot_minigun_refire;
296 this.vehicle_ammo1 = (vehic.vehicle_ammo1 / autocvar_g_vehicle_spiderbot_minigun_ammo_max) * 100;
297 vehic.gun1.angles_z += 45;
298 vehic.gun2.angles_z -= 45;
299 if(vehic.gun1.angles_z >= 360)
301 vehic.gun1.angles_z = 0;
302 vehic.gun2.angles_z = 0;
307 vehicles_regen(vehic, vehic.cnt, vehicle_ammo1, autocvar_g_vehicle_spiderbot_minigun_ammo_max,
308 autocvar_g_vehicle_spiderbot_minigun_ammo_regen_pause,
309 autocvar_g_vehicle_spiderbot_minigun_ammo_regen, frametime, false);
312 spiderbot_rocket_do(vehic);
314 if(vehic.vehicle_flags & VHF_SHIELDREGEN)
315 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);
317 if(vehic.vehicle_flags & VHF_HEALTHREGEN)
318 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);
320 PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = false;
321 //this.vehicle_ammo2 = vehic.tur_head.frame;
322 this.vehicle_ammo2 = (9 - vehic.tur_head.frame) / 8 * 100; // Percentage, like ammo1
324 if(vehic.gun2.cnt <= time)
325 this.vehicle_reload2 = 100;
327 this.vehicle_reload2 = 100 - ((vehic.gun2.cnt - time) / vehic.attack_finished_single[0]) * 100;
329 setorigin(this, vehic.origin + '0 0 1' * vehic.maxs_z);
330 this.velocity = vehic.velocity;
332 VEHICLE_UPDATE_PLAYER(this, vehic, health, spiderbot);
334 if(vehic.vehicle_flags & VHF_HASSHIELD)
335 VEHICLE_UPDATE_PLAYER(this, vehic, shield, spiderbot);
338 void spiderbot_exit(entity this, int eject)
343 e = findchain(classname,"spiderbot_rocket");
346 if(e.owner == this.owner)
348 e.realowner = this.owner;
354 setthink(this, vehicles_think);
355 this.nextthink = time;
357 this.movetype = MOVETYPE_WALK;
362 makevectors(this.angles);
365 spot = this.origin + v_forward * 100 + '0 0 64';
366 spot = vehicles_findgoodexit(this, spot);
367 setorigin(this.owner , spot);
368 this.owner.velocity = (v_up + v_forward * 0.25) * 750;
369 this.owner.oldvelocity = this.owner.velocity;
373 if(vdist(this.velocity, >, autocvar_g_vehicle_spiderbot_speed_strafe))
375 this.owner.velocity = normalize(this.velocity) * vlen(this.velocity);
376 this.owner.velocity_z += 200;
377 spot = this.origin + v_forward * 128 + '0 0 64';
378 spot = vehicles_findgoodexit(this, spot);
382 this.owner.velocity = this.velocity * 0.5;
383 this.owner.velocity_z += 10;
384 spot = this.origin + v_forward * 256 + '0 0 64';
385 spot = vehicles_findgoodexit(this, spot);
387 this.owner.oldvelocity = this.owner.velocity;
388 setorigin(this.owner , spot);
391 antilag_clear(this.owner, CS(this.owner));
395 void spiderbot_headfade(entity this)
397 setthink(this, spiderbot_headfade);
398 this.nextthink = this.fade_time;
399 this.alpha = 1 - (time - this.fade_time) * this.fade_rate;
401 if(this.cnt < time || this.alpha < 0.1)
405 sound (this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
406 Send_Effect(EFFECT_EXPLOSION_BIG, this.origin + '0 0 100', '0 0 0', 1);
412 void spiderbot_blowup(entity this)
418 sound (this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
419 Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (this.origin + '0 0 100'), '0 0 0', 1);
421 this.nextthink = time + 0.1;
431 setmodel(b, MDL_VEH_SPIDERBOT_BODY);
432 setmodel(h, MDL_VEH_SPIDERBOT_TOP);
433 setmodel(g1, MDL_VEH_SPIDERBOT_GUN);
434 setmodel(g2, MDL_VEH_SPIDERBOT_GUN);
436 setorigin(b, this.origin);
438 b.angles = this.angles;
439 setsize(b, this.mins, this.maxs);
441 vector org = gettaginfo(this, gettagindex(this, "tag_head"));
443 h.movetype = MOVETYPE_BOUNCE;
444 h.solid = SOLID_BBOX;
445 h.velocity = v_up * (500 + random() * 500) + randomvec() * 128;
446 h.modelflags = MF_ROCKET;
447 h.effects = EF_FLAME | EF_LOWPRECISION;
448 h.avelocity = randomvec() * 360;
451 h.cnt = time + (3.5 * random());
452 h.fade_rate = 1 / min(this.respawntime, 10);
454 setthink(h, spiderbot_headfade);
457 org = gettaginfo(this.tur_head, gettagindex(this.tur_head, "tag_hardpoint01"));
459 g1.movetype = MOVETYPE_TOSS;
460 g1.solid = SOLID_CORPSE;
461 g1.velocity = v_forward * 700 + (randomvec() * 32);
462 g1.avelocity = randomvec() * 180;
464 org = gettaginfo(this.tur_head, gettagindex(this.tur_head, "tag_hardpoint02"));
466 g2.movetype = MOVETYPE_TOSS;
467 g2.solid = SOLID_CORPSE;
468 g2.velocity = v_forward * 700 + (randomvec() * 32);
469 g2.avelocity = randomvec() * 180;
471 h.colormod = b.colormod = g1.colormod = g2.colormod = '-2 -2 -2';
473 SUB_SetFade(b, time + 5, min(this.respawntime, 1));
474 //SUB_SetFade(h, time, min(this.respawntime, 10));
475 SUB_SetFade(g1, time, min(this.respawntime, 10));
476 SUB_SetFade(g2, time, min(this.respawntime, 10));
478 RadiusDamage (this, this.enemy, 250, 15, 250, NULL, NULL, 250, DEATH_VH_SPID_DEATH.m_id, NULL);
480 this.alpha = this.tur_head.alpha = this.gun1.alpha = this.gun2.alpha = -1;
481 this.movetype = MOVETYPE_NONE;
482 this.deadflag = DEAD_DEAD;
483 this.solid = SOLID_NOT;
484 this.tur_head.effects &= ~EF_FLAME;
485 this.vehicle_hudmodel.viewmodelforclient = this;
488 bool spiderbot_impulse(entity this, int _imp)
492 case IMP_weapon_group_1.impulse:
493 this.vehicle.vehicle_weapon2mode = SBRM_VOLLY;
494 CSQCVehicleSetup(this, 0);
496 case IMP_weapon_group_2.impulse:
497 this.vehicle.vehicle_weapon2mode = SBRM_GUIDE;
498 CSQCVehicleSetup(this, 0);
500 case IMP_weapon_group_3.impulse:
501 this.vehicle.vehicle_weapon2mode = SBRM_ARTILLERY;
502 CSQCVehicleSetup(this, 0);
505 case IMP_weapon_next_byid.impulse:
506 case IMP_weapon_next_bypriority.impulse:
507 case IMP_weapon_next_bygroup.impulse:
508 this.vehicle.vehicle_weapon2mode += 1;
509 if(this.vehicle.vehicle_weapon2mode > SBRM_LAST)
510 this.vehicle.vehicle_weapon2mode = SBRM_FIRST;
512 //centerprint(this, strcat("Rocket mode is ", ftos(this.vehicle.vehicle_weapon2mode)));
513 CSQCVehicleSetup(this, 0);
515 case IMP_weapon_last.impulse:
516 case IMP_weapon_prev_byid.impulse:
517 case IMP_weapon_prev_bypriority.impulse:
518 case IMP_weapon_prev_bygroup.impulse:
519 this.vehicle.vehicle_weapon2mode -= 1;
520 if(this.vehicle.vehicle_weapon2mode < SBRM_FIRST)
521 this.vehicle.vehicle_weapon2mode = SBRM_LAST;
523 //centerprint(this, strcat("Rocket mode is ", ftos(this.vehicle.vehicle_weapon2mode)));
524 CSQCVehicleSetup(this, 0);
528 case IMP_weapon_drop.impulse: // toss gun, could be used to exit?
530 case IMP_weapon_reload.impulse: // Manual minigun reload?
537 spawnfunc(vehicle_spiderbot)
539 if(!autocvar_g_vehicle_spiderbot) { remove(this); return; }
540 if(!vehicle_initialize(this, VEH_SPIDERBOT, false)) { remove(this); return; }
543 METHOD(Spiderbot, vr_impact, void(Spiderbot thisveh, entity instance))
545 if(autocvar_g_vehicle_spiderbot_bouncepain)
546 vehicles_impact(instance, autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z);
548 METHOD(Spiderbot, vr_enter, void(Spiderbot thisveh, entity instance))
550 instance.vehicle_weapon2mode = SBRM_GUIDE;
551 instance.movetype = MOVETYPE_WALK;
552 CSQCVehicleSetup(instance.owner, 0);
553 instance.owner.vehicle_health = (instance.vehicle_health / autocvar_g_vehicle_spiderbot_health) * 100;
554 instance.owner.vehicle_shield = (instance.vehicle_shield / autocvar_g_vehicle_spiderbot_shield) * 100;
556 if(instance.owner.flagcarried)
558 setattachment(instance.owner.flagcarried, instance.tur_head, "");
559 setorigin(instance.owner.flagcarried, '-20 0 120');
562 METHOD(Spiderbot, vr_think, void(Spiderbot thisveh, entity instance))
564 if(IS_ONGROUND(instance))
565 movelib_brake_simple(instance, autocvar_g_vehicle_spiderbot_speed_stop);
567 METHOD(Spiderbot, vr_death, void(Spiderbot thisveh, entity instance))
570 instance.event_damage = func_null;
571 instance.takedamage = DAMAGE_NO;
572 settouch(instance, func_null);
573 instance.cnt = 3.4 + time + random() * 2;
574 setthink(instance, spiderbot_blowup);
575 instance.nextthink = time;
576 instance.deadflag = DEAD_DYING;
578 instance.tur_head.effects |= EF_FLAME;
579 instance.colormod = instance.tur_head.colormod = '-1 -1 -1';
581 instance.movetype = MOVETYPE_TOSS;
583 CSQCModel_UnlinkEntity(instance); // networking the death scene would be a nightmare
585 METHOD(Spiderbot, vr_spawn, void(Spiderbot thisveh, entity instance))
589 instance.vehicles_impulse = spiderbot_impulse;
590 instance.gun1 = spawn();
591 instance.gun2 = spawn();
592 setmodel(instance.gun1, MDL_VEH_SPIDERBOT_GUN);
593 setmodel(instance.gun2, MDL_VEH_SPIDERBOT_GUN);
594 setattachment(instance.gun1, instance.tur_head, "tag_hardpoint01");
595 setattachment(instance.gun2, instance.tur_head, "tag_hardpoint02");
596 instance.gravity = 2;
597 instance.mass = 5000;
601 instance.tur_head.frame = 1;
602 instance.movetype = MOVETYPE_WALK;
603 instance.solid = SOLID_SLIDEBOX;
604 instance.alpha = instance.tur_head.alpha = instance.gun1.alpha = instance.gun2.alpha = 1;
605 instance.tur_head.angles = '0 0 0';
606 instance.vehicle_exit = spiderbot_exit;
608 setorigin(instance, instance.pos1 + '0 0 128');
609 instance.angles = instance.pos2;
610 instance.damageforcescale = 0.03;
611 instance.vehicle_health = autocvar_g_vehicle_spiderbot_health;
612 instance.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
614 instance.PlayerPhysplug = spiderbot_frame;
616 METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh, entity instance))
618 if(autocvar_g_vehicle_spiderbot_shield)
619 instance.vehicle_flags |= VHF_HASSHIELD;
621 if(autocvar_g_vehicle_spiderbot_shield_regen)
622 instance.vehicle_flags |= VHF_SHIELDREGEN;
624 if(autocvar_g_vehicle_spiderbot_health_regen)
625 instance.vehicle_flags |= VHF_HEALTHREGEN;
627 instance.respawntime = autocvar_g_vehicle_spiderbot_respawntime;
628 instance.vehicle_health = autocvar_g_vehicle_spiderbot_health;
629 instance.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
630 instance.max_health = instance.vehicle_health;
631 instance.pushable = true; // spiderbot can use jumppads
636 float autocvar_cl_vehicle_spiderbot_cross_alpha = 0.6;
637 float autocvar_cl_vehicle_spiderbot_cross_size = 1;
639 METHOD(Spiderbot, vr_hud, void(Spiderbot thisveh))
641 Vehicles_drawHUD(VEH_SPIDERBOT.m_icon, "vehicle_spider_weapon1", "vehicle_spider_weapon2",
642 "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
643 "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color);
645 METHOD(Spiderbot, vr_crosshair, void(Spiderbot thisveh, entity player))
651 case SBRM_VOLLY: crosshair = vCROSS_BURST; break;
652 case SBRM_GUIDE: crosshair = vCROSS_GUIDE; break;
653 case SBRM_ARTILLERY: crosshair = vCROSS_RAIN; break;
654 default: crosshair = vCROSS_BURST;
657 Vehicles_drawCrosshair(crosshair);
659 METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh, entity instance))
661 AuxiliaryXhair[0].axh_image = vCROSS_HINT; // Minigun1
662 AuxiliaryXhair[1].axh_image = vCROSS_HINT; // Minigun2