1 #include "spiderbot.qh"
3 const int SBRM_FIRST = 1;
4 const int SBRM_VOLLY = 1;
5 const int SBRM_GUIDE = 2;
6 const int SBRM_ARTILLERY = 3;
7 const int SBRM_LAST = 3;
10 bool autocvar_g_vehicle_spiderbot = true;
12 float autocvar_g_vehicle_spiderbot_respawntime = 45;
14 float autocvar_g_vehicle_spiderbot_speed_stop = 50;
15 float autocvar_g_vehicle_spiderbot_speed_strafe = 400;
16 float autocvar_g_vehicle_spiderbot_speed_walk = 500;
17 float autocvar_g_vehicle_spiderbot_speed_run = 700;
18 float autocvar_g_vehicle_spiderbot_turnspeed = 90;
19 float autocvar_g_vehicle_spiderbot_turnspeed_strafe = 300;
20 float autocvar_g_vehicle_spiderbot_movement_inertia = 0.15;
22 float autocvar_g_vehicle_spiderbot_springlength = 150;
23 float autocvar_g_vehicle_spiderbot_springup = 20;
24 float autocvar_g_vehicle_spiderbot_springblend = 0.1;
25 float autocvar_g_vehicle_spiderbot_tiltlimit = 90;
27 float autocvar_g_vehicle_spiderbot_head_pitchlimit_down = -20;
28 float autocvar_g_vehicle_spiderbot_head_pitchlimit_up = 30;
29 float autocvar_g_vehicle_spiderbot_head_turnlimit = 90;
30 float autocvar_g_vehicle_spiderbot_head_turnspeed = 110;
32 int autocvar_g_vehicle_spiderbot_health = 800;
33 float autocvar_g_vehicle_spiderbot_health_regen = 10;
34 float autocvar_g_vehicle_spiderbot_health_regen_pause = 5;
36 int autocvar_g_vehicle_spiderbot_shield = 200;
37 float autocvar_g_vehicle_spiderbot_shield_regen = 25;
38 float autocvar_g_vehicle_spiderbot_shield_regen_pause = 0.35;
40 // 'minspeed_for_pain speedchange_to_pain_factor max_damage'
41 vector autocvar_g_vehicle_spiderbot_bouncepain = '0 0 0';
44 bool spiderbot_frame(entity this, float dt)
46 entity vehic = this.vehicle;
51 vehic.solid = SOLID_NOT;
52 vehic.takedamage = DAMAGE_NO;
53 set_movetype(vehic, MOVETYPE_NONE);
57 vehicles_frame(vehic, this);
59 PHYS_INPUT_BUTTON_ZOOM(this) = false;
60 PHYS_INPUT_BUTTON_CROUCH(this) = false;
61 for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
63 .entity weaponentity = weaponentities[slot];
64 this.(weaponentity).m_switchweapon = WEP_Null;
66 STAT(VEHICLESTAT_W2MODE, this) = STAT(VEHICLESTAT_W2MODE, vehic);
69 #if 1 // 0 to enable per-gun impact aux crosshairs
70 // Avarage gun impact point's -> aux cross
71 vector ad = gettaginfo(vehic.tur_head, gettagindex(vehic.tur_head, "tag_hardpoint01"));
72 vector vf = v_forward;
73 ad += gettaginfo(vehic.tur_head, gettagindex(vehic.tur_head, "tag_hardpoint02"));
77 traceline(ad, ad + v_forward * max_shot_distance, MOVE_NORMAL, vehic);
78 UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' * (1 - this.vehicle_reload1)), 0);
80 vector ad = gettaginfo(vehic.gun1, gettagindex(vehic.gun1, "barrels"));
81 traceline(ad, ad + v_forward * max_shot_distance, MOVE_NORMAL, vehic);
82 UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' * (1 - this.vehicle_reload1)), 0);
84 ad = gettaginfo(vehic.gun2, gettagindex(vehic.gun2, "barrels"));
85 traceline(ad, ad + v_forward * max_shot_distance, MOVE_NORMAL, vehic);
86 UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' * (1 - this.vehicle_reload1)), 1);
90 crosshair_trace(this);
91 ad = vectoangles(normalize(trace_endpos - ad));
92 ad = AnglesTransform_ToAngles(AnglesTransform_LeftDivide(AnglesTransform_FromAngles(vehic.angles), AnglesTransform_FromAngles(ad))) - vehic.tur_head.angles;
93 ad = AnglesTransform_Normalize(ad, true);
94 //UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload2) + ('0 1 0' * (1 - this.vehicle_reload2)), 2);
97 float ftmp = autocvar_g_vehicle_spiderbot_head_turnspeed * PHYS_INPUT_FRAMETIME;
98 ad_y = bound(-ftmp, ad_y, ftmp);
99 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);
102 ad_x = bound(ftmp * -1, ad_x, ftmp);
103 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);
106 //fixedmakevectors(vehic.angles);
107 makevectors(vehic.angles + '-2 0 0' * vehic.angles_x);
109 movelib_groundalign4point(vehic, autocvar_g_vehicle_spiderbot_springlength, autocvar_g_vehicle_spiderbot_springup, autocvar_g_vehicle_spiderbot_springblend, autocvar_g_vehicle_spiderbot_tiltlimit);
111 if(IS_ONGROUND(vehic))
112 vehic.jump_delay = time; // reset now so movement can begin
114 //if(IS_ONGROUND(vehic))
116 if(IS_ONGROUND(vehic))
117 if(vehic.frame == 4 && vehic.tur_head.wait != 0)
119 sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_LAND, VOL_VEHICLEENGINE, ATTEN_NORM);
123 if (!PHYS_INPUT_BUTTON_JUMP(this))
124 vehic.button2 = false;
126 if((IS_ONGROUND(vehic)) && PHYS_INPUT_BUTTON_JUMP(this) && !vehic.button2 && vehic.tur_head.wait < time)
128 sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_JUMP, VOL_VEHICLEENGINE, ATTEN_NORM);
129 //dprint("spiderbot_jump:", ftos(soundlength("vehicles/spiderbot_jump.wav")), "\n");
132 vehic.tur_head.wait = time + 2;
133 vehic.jump_delay = time + 2;
134 vehic.button2 = true; // set spider's jump
135 //PHYS_INPUT_BUTTON_JUMP(this) = false;
137 vector movefix = '0 0 0';
138 if(CS(this).movement_x > 0) movefix_x = 1;
139 if(CS(this).movement_x < 0) movefix_x = -1;
140 if(CS(this).movement_y > 0) movefix_y = 1;
141 if(CS(this).movement_y < 0) movefix_y = -1;
143 vector rt = movefix_y * v_right;
144 vector sd = movefix_x * v_forward;
145 if(movefix_y == 0 && movefix_x == 0)
146 sd = v_forward; // always do forward
148 UNSET_ONGROUND(vehic);
150 vehic.velocity = sd * 700 + rt * 600 + v_up * 600;
153 else if(time >= vehic.jump_delay)
155 if(!CS(this).movement)
157 if(IS_ONGROUND(vehic))
159 if(vehic.sound_nexttime < time || vehic.delay != 3)
162 vehic.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_idle.wav");
163 //dprint("spiderbot_idle:", ftos(soundlength("vehicles/spiderbot_idle.wav")), "\n");
164 sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_IDLE, VOL_VEHICLEENGINE, ATTEN_NORM);
166 movelib_brake_simple(vehic, autocvar_g_vehicle_spiderbot_speed_stop);
173 if(CS(this).movement_x == 0 && CS(this).movement_y != 0)
174 ftmp = autocvar_g_vehicle_spiderbot_turnspeed_strafe * PHYS_INPUT_FRAMETIME;
176 ftmp = autocvar_g_vehicle_spiderbot_turnspeed * PHYS_INPUT_FRAMETIME;
178 ftmp = bound(-ftmp, vehic.tur_head.angles_y, ftmp);
179 vehic.angles_y = anglemods(vehic.angles_y + ftmp);
180 vehic.tur_head.angles_y -= ftmp;
182 if(CS(this).movement_x != 0)
184 if(CS(this).movement_x > 0)
186 CS(this).movement_x = 1;
187 if(IS_ONGROUND(vehic))
190 else if(CS(this).movement_x < 0)
192 CS(this).movement_x = -1;
193 if(IS_ONGROUND(vehic))
196 CS(this).movement_y = 0;
197 float oldvelz = vehic.velocity_z;
198 movelib_move_simple(vehic, normalize(v_forward * CS(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);
199 vehic.velocity_z = oldvelz;
200 float g = ((autocvar_sv_gameplayfix_gravityunaffectedbyticrate) ? 0.5 : 1);
201 if(vehic.velocity_z <= 20) // not while jumping
202 vehic.velocity_z -= g * PHYS_INPUT_FRAMETIME * autocvar_sv_gravity;
203 if(IS_ONGROUND(vehic))
204 if(vehic.sound_nexttime < time || vehic.delay != 1)
207 vehic.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_walk.wav");
208 sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_WALK, VOL_VEHICLEENGINE, ATTEN_NORM);
209 //dprint("spiderbot_walk:", ftos(soundlength("vehicles/spiderbot_walk.wav")), "\n");
212 else if(CS(this).movement_y != 0)
214 if(CS(this).movement_y < 0)
216 CS(this).movement_y = -1;
217 if(IS_ONGROUND(vehic))
220 else if(CS(this).movement_y > 0)
222 CS(this).movement_y = 1;
223 if(IS_ONGROUND(vehic))
227 float oldvelz = vehic.velocity_z;
228 movelib_move_simple(vehic, normalize(v_right * CS(this).movement_y),autocvar_g_vehicle_spiderbot_speed_strafe,autocvar_g_vehicle_spiderbot_movement_inertia);
229 vehic.velocity_z = oldvelz;
230 float g = ((autocvar_sv_gameplayfix_gravityunaffectedbyticrate) ? 0.5 : 1);
231 if(vehic.velocity_z <= 20) // not while jumping
232 vehic.velocity_z -= g * PHYS_INPUT_FRAMETIME * autocvar_sv_gravity;
233 if(IS_ONGROUND(vehic))
234 if(vehic.sound_nexttime < time || vehic.delay != 2)
237 vehic.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_strafe.wav");
238 sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_STRAFE, VOL_VEHICLEENGINE, ATTEN_NORM);
239 //dprint("spiderbot_strafe:", ftos(soundlength("vehicles/spiderbot_strafe.wav")), "\n");
246 vehic.angles_x = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, vehic.angles_x, autocvar_g_vehicle_spiderbot_tiltlimit);
247 vehic.angles_z = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, vehic.angles_z, autocvar_g_vehicle_spiderbot_tiltlimit);
249 if(!forbidWeaponUse(this))
250 if(PHYS_INPUT_BUTTON_ATCK(this))
253 if(vehic.vehicle_ammo1 >= autocvar_g_vehicle_spiderbot_minigun_ammo_cost && vehic.tur_head.attack_finished_single[0] <= time)
257 vehic.misc_bulletcounter += 1;
259 gun = (vehic.misc_bulletcounter % 2) ? vehic.gun1 : vehic.gun2;
261 v = gettaginfo(gun, gettagindex(gun, "barrels"));
262 v_forward = normalize(v_forward);
265 .entity weaponentity = weaponentities[0]; // TODO: unhardcode
266 fireBullet(this, weaponentity, v, v_forward, autocvar_g_vehicle_spiderbot_minigun_spread, autocvar_g_vehicle_spiderbot_minigun_solidpenetration,
267 autocvar_g_vehicle_spiderbot_minigun_damage, autocvar_g_vehicle_spiderbot_minigun_force, DEATH_VH_SPID_MINIGUN.m_id, EFFECT_BULLET);
269 sound (gun, CH_WEAPON_A, SND_UZI_FIRE, VOL_BASE, ATTEN_NORM);
270 //trailparticles(this, _particleeffectnum("spiderbot_minigun_trail"), v, trace_endpos);
271 Send_Effect(EFFECT_SPIDERBOT_MINIGUN_MUZZLEFLASH, v, v_forward * 2500, 1);
273 vehic.vehicle_ammo1 -= autocvar_g_vehicle_spiderbot_minigun_ammo_cost;
274 vehic.tur_head.attack_finished_single[0] = time + autocvar_g_vehicle_spiderbot_minigun_refire;
275 this.vehicle_ammo1 = (vehic.vehicle_ammo1 / autocvar_g_vehicle_spiderbot_minigun_ammo_max) * 100;
276 vehic.gun1.angles_z += 45;
277 vehic.gun2.angles_z -= 45;
278 if(vehic.gun1.angles_z >= 360)
280 vehic.gun1.angles_z = 0;
281 vehic.gun2.angles_z = 0;
286 vehicles_regen(vehic, vehic.cnt, vehicle_ammo1, autocvar_g_vehicle_spiderbot_minigun_ammo_max,
287 autocvar_g_vehicle_spiderbot_minigun_ammo_regen_pause,
288 autocvar_g_vehicle_spiderbot_minigun_ammo_regen, dt, false);
291 spiderbot_rocket_do(vehic);
293 if(vehic.vehicle_flags & VHF_SHIELDREGEN)
294 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, dt, true);
296 if(vehic.vehicle_flags & VHF_HEALTHREGEN)
297 vehicles_regen_resource(vehic, vehic.dmg_time, vehicle_health, autocvar_g_vehicle_spiderbot_health, autocvar_g_vehicle_spiderbot_health_regen_pause, autocvar_g_vehicle_spiderbot_health_regen, dt, false, RESOURCE_HEALTH);
299 PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = false;
300 //this.vehicle_ammo2 = vehic.tur_head.frame;
301 this.vehicle_ammo2 = (9 - vehic.tur_head.frame) / 8 * 100; // Percentage, like ammo1
303 if(vehic.gun2.cnt <= time)
304 this.vehicle_reload2 = 100;
306 this.vehicle_reload2 = 100 - ((vehic.gun2.cnt - time) / vehic.attack_finished_single[0]) * 100;
308 setorigin(this, vehic.origin + '0 0 1' * vehic.maxs_z);
309 this.oldorigin = this.origin; // negate fall damage
310 this.velocity = vehic.velocity;
312 VEHICLE_UPDATE_PLAYER_RESOURCE(this, vehic, health, spiderbot, RESOURCE_HEALTH);
314 if(vehic.vehicle_flags & VHF_HASSHIELD)
315 VEHICLE_UPDATE_PLAYER(this, vehic, shield, spiderbot);
318 void spiderbot_exit(entity this, int eject)
320 entity player = this.owner;
322 IL_EACH(g_projectiles, it.owner == player && it.classname == "spiderbot_rocket",
324 it.realowner = player;
328 setthink(this, vehicles_think);
329 this.nextthink = time;
331 set_movetype(this, MOVETYPE_WALK);
335 this.owner = NULL; // reset owner anyway?
339 makevectors(this.angles);
343 spot = this.origin + v_forward * 100 + '0 0 64';
344 spot = vehicles_findgoodexit(this, player, spot);
345 setorigin(player, spot);
346 player.velocity = (v_up + v_forward * 0.25) * 750;
347 player.oldvelocity = player.velocity;
351 if(vdist(this.velocity, >, autocvar_g_vehicle_spiderbot_speed_strafe))
353 player.velocity = normalize(this.velocity) * vlen(this.velocity);
354 player.velocity_z += 200;
355 spot = this.origin + v_forward * 128 + '0 0 64';
356 spot = vehicles_findgoodexit(this, player, spot);
360 player.velocity = this.velocity * 0.5;
361 player.velocity_z += 10;
362 spot = this.origin + v_forward * 256 + '0 0 64';
363 spot = vehicles_findgoodexit(this, player, spot);
365 player.oldvelocity = player.velocity;
366 setorigin(player, spot);
369 antilag_clear(player, CS(player));
373 void spiderbot_headfade(entity this)
375 setthink(this, spiderbot_headfade);
376 this.nextthink = this.fade_time;
377 this.alpha = 1 - (time - this.fade_time) * this.fade_rate;
379 if(this.cnt < time || this.alpha < 0.1)
383 sound (this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
384 Send_Effect(EFFECT_EXPLOSION_BIG, this.origin + '0 0 100', '0 0 0', 1);
390 void spiderbot_blowup(entity this)
396 sound (this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
397 Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (this.origin + '0 0 100'), '0 0 0', 1);
399 this.nextthink = time + 0.1;
403 entity h = spawn(), g1 = spawn(), g2 = spawn(), b = spawn();
405 setmodel(b, MDL_VEH_SPIDERBOT_BODY);
406 setmodel(h, MDL_VEH_SPIDERBOT_TOP);
407 setmodel(g1, MDL_VEH_SPIDERBOT_GUN);
408 setmodel(g2, MDL_VEH_SPIDERBOT_GUN);
410 setorigin(b, this.origin);
412 b.angles = this.angles;
413 setsize(b, this.mins, this.maxs);
415 vector org = gettaginfo(this, gettagindex(this, "tag_head"));
417 set_movetype(h, MOVETYPE_BOUNCE);
418 h.solid = SOLID_BBOX;
419 h.velocity = v_up * (500 + random() * 500) + randomvec() * 128;
420 h.modelflags = MF_ROCKET;
421 h.effects = EF_FLAME | EF_LOWPRECISION;
422 h.avelocity = randomvec() * 360;
425 h.cnt = time + (3.5 * random());
426 h.fade_rate = 1 / min(this.respawntime, 10);
428 setthink(h, spiderbot_headfade);
431 org = gettaginfo(this.tur_head, gettagindex(this.tur_head, "tag_hardpoint01"));
433 set_movetype(g1, MOVETYPE_TOSS);
434 g1.solid = SOLID_CORPSE;
435 g1.velocity = v_forward * 700 + (randomvec() * 32);
436 g1.avelocity = randomvec() * 180;
438 org = gettaginfo(this.tur_head, gettagindex(this.tur_head, "tag_hardpoint02"));
440 set_movetype(g2, MOVETYPE_TOSS);
441 g2.solid = SOLID_CORPSE;
442 g2.velocity = v_forward * 700 + (randomvec() * 32);
443 g2.avelocity = randomvec() * 180;
445 h.colormod = b.colormod = g1.colormod = g2.colormod = '-2 -2 -2';
447 SUB_SetFade(b, time + 5, min(this.respawntime, 1));
448 //SUB_SetFade(h, time, min(this.respawntime, 10));
449 SUB_SetFade(g1, time, min(this.respawntime, 10));
450 SUB_SetFade(g2, time, min(this.respawntime, 10));
452 RadiusDamage (this, this.enemy, 250, 15, 250, NULL, NULL, 250, DEATH_VH_SPID_DEATH.m_id, DMG_NOWEP, NULL);
454 this.alpha = this.tur_head.alpha = this.gun1.alpha = this.gun2.alpha = -1;
455 set_movetype(this, MOVETYPE_NONE);
456 this.deadflag = DEAD_DEAD;
457 this.solid = SOLID_NOT;
458 this.tur_head.effects &= ~EF_FLAME;
459 this.vehicle_hudmodel.viewmodelforclient = this;
462 bool spiderbot_impulse(entity this, int _imp)
466 case IMP_weapon_group_1.impulse:
467 STAT(VEHICLESTAT_W2MODE, this.vehicle) = SBRM_VOLLY;
468 CSQCVehicleSetup(this, 0);
470 case IMP_weapon_group_2.impulse:
471 STAT(VEHICLESTAT_W2MODE, this.vehicle) = SBRM_GUIDE;
472 CSQCVehicleSetup(this, 0);
474 case IMP_weapon_group_3.impulse:
475 STAT(VEHICLESTAT_W2MODE, this.vehicle) = SBRM_ARTILLERY;
476 CSQCVehicleSetup(this, 0);
479 case IMP_weapon_next_byid.impulse:
480 case IMP_weapon_next_bypriority.impulse:
481 case IMP_weapon_next_bygroup.impulse:
482 STAT(VEHICLESTAT_W2MODE, this.vehicle) += 1;
483 if(STAT(VEHICLESTAT_W2MODE, this.vehicle) > SBRM_LAST)
484 STAT(VEHICLESTAT_W2MODE, this.vehicle) = SBRM_FIRST;
486 //centerprint(this, strcat("Rocket mode is ", ftos(STAT(VEHICLESTAT_W2MODE, this.vehicle))));
487 CSQCVehicleSetup(this, 0);
489 case IMP_weapon_last.impulse:
490 case IMP_weapon_prev_byid.impulse:
491 case IMP_weapon_prev_bypriority.impulse:
492 case IMP_weapon_prev_bygroup.impulse:
493 STAT(VEHICLESTAT_W2MODE, this.vehicle) -= 1;
494 if(STAT(VEHICLESTAT_W2MODE, this.vehicle) < SBRM_FIRST)
495 STAT(VEHICLESTAT_W2MODE, this.vehicle) = SBRM_LAST;
497 //centerprint(this, strcat("Rocket mode is ", ftos(STAT(VEHICLESTAT_W2MODE, this.vehicle))));
498 CSQCVehicleSetup(this, 0);
502 case IMP_weapon_drop.impulse: // toss gun, could be used to exit?
504 case IMP_weapon_reload.impulse: // Manual minigun reload?
511 spawnfunc(vehicle_spiderbot)
513 if(!autocvar_g_vehicle_spiderbot) { delete(this); return; }
514 if(!vehicle_initialize(this, VEH_SPIDERBOT, false)) { delete(this); return; }
517 METHOD(Spiderbot, vr_impact, void(Spiderbot thisveh, entity instance))
519 if(autocvar_g_vehicle_spiderbot_bouncepain)
520 vehicles_impact(instance, autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z);
522 METHOD(Spiderbot, vr_enter, void(Spiderbot thisveh, entity instance))
524 STAT(VEHICLESTAT_W2MODE, instance) = SBRM_GUIDE;
525 set_movetype(instance, MOVETYPE_WALK);
526 CSQCVehicleSetup(instance.owner, 0);
527 instance.owner.vehicle_health = (GetResourceAmount(instance, RESOURCE_HEALTH) / autocvar_g_vehicle_spiderbot_health) * 100;
528 instance.owner.vehicle_shield = (instance.vehicle_shield / autocvar_g_vehicle_spiderbot_shield) * 100;
530 if(instance.owner.flagcarried)
532 setattachment(instance.owner.flagcarried, instance.tur_head, "");
533 setorigin(instance.owner.flagcarried, '-20 0 120');
536 METHOD(Spiderbot, vr_think, void(Spiderbot thisveh, entity instance))
538 if(IS_ONGROUND(instance))
539 movelib_brake_simple(instance, autocvar_g_vehicle_spiderbot_speed_stop);
541 METHOD(Spiderbot, vr_death, void(Spiderbot thisveh, entity instance))
543 SetResourceAmountExplicit(instance, RESOURCE_HEALTH, 0);
544 instance.event_damage = func_null;
545 instance.takedamage = DAMAGE_NO;
546 settouch(instance, func_null);
547 instance.cnt = 3.4 + time + random() * 2;
548 setthink(instance, spiderbot_blowup);
549 instance.nextthink = time;
550 instance.deadflag = DEAD_DYING;
552 instance.tur_head.effects |= EF_FLAME;
553 instance.colormod = instance.tur_head.colormod = '-1 -1 -1';
555 set_movetype(instance, MOVETYPE_TOSS);
557 CSQCModel_UnlinkEntity(instance); // networking the death scene would be a nightmare
559 METHOD(Spiderbot, vr_spawn, void(Spiderbot thisveh, entity instance))
563 instance.vehicles_impulse = spiderbot_impulse;
564 instance.gun1 = spawn();
565 instance.gun2 = spawn();
566 setmodel(instance.gun1, MDL_VEH_SPIDERBOT_GUN);
567 setmodel(instance.gun2, MDL_VEH_SPIDERBOT_GUN);
568 setattachment(instance.gun1, instance.tur_head, "tag_hardpoint01");
569 setattachment(instance.gun2, instance.tur_head, "tag_hardpoint02");
570 instance.gravity = 2;
571 instance.mass = 5000;
575 instance.tur_head.frame = 1;
576 set_movetype(instance, MOVETYPE_WALK);
577 instance.solid = SOLID_SLIDEBOX;
578 instance.alpha = instance.tur_head.alpha = instance.gun1.alpha = instance.gun2.alpha = 1;
579 instance.tur_head.angles = '0 0 0';
580 instance.vehicle_exit = spiderbot_exit;
582 setorigin(instance, instance.pos1 + '0 0 128');
583 instance.angles = instance.pos2;
584 instance.damageforcescale = 0.03;
585 SetResourceAmountExplicit(instance, RESOURCE_HEALTH, autocvar_g_vehicle_spiderbot_health);
586 instance.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
588 instance.PlayerPhysplug = spiderbot_frame;
590 METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh, entity instance))
592 if(autocvar_g_vehicle_spiderbot_shield)
593 instance.vehicle_flags |= VHF_HASSHIELD;
595 if(autocvar_g_vehicle_spiderbot_shield_regen)
596 instance.vehicle_flags |= VHF_SHIELDREGEN;
598 if(autocvar_g_vehicle_spiderbot_health_regen)
599 instance.vehicle_flags |= VHF_HEALTHREGEN;
601 instance.respawntime = autocvar_g_vehicle_spiderbot_respawntime;
602 SetResourceAmountExplicit(instance, RESOURCE_HEALTH, autocvar_g_vehicle_spiderbot_health);
603 instance.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
604 instance.max_health = GetResourceAmount(instance, RESOURCE_HEALTH);
605 instance.pushable = true; // spiderbot can use jumppads
610 //float autocvar_cl_vehicle_spiderbot_cross_alpha = 0.6;
611 //float autocvar_cl_vehicle_spiderbot_cross_size = 1;
613 METHOD(Spiderbot, vr_hud, void(Spiderbot thisveh))
615 Vehicles_drawHUD(VEH_SPIDERBOT.m_icon, "vehicle_spider_weapon1", "vehicle_spider_weapon2",
616 "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
617 "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color);
619 METHOD(Spiderbot, vr_crosshair, void(Spiderbot thisveh, entity player))
625 case SBRM_VOLLY: crosshair = vCROSS_BURST; break;
626 case SBRM_GUIDE: crosshair = vCROSS_GUIDE; break;
627 case SBRM_ARTILLERY: crosshair = vCROSS_RAIN; break;
628 default: crosshair = vCROSS_BURST;
631 Vehicles_drawCrosshair(crosshair);
633 METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh, entity instance))
635 AuxiliaryXhair[0].axh_image = vCROSS_HINT; // Minigun1
636 AuxiliaryXhair[1].axh_image = vCROSS_HINT; // Minigun2