9 const int SBRM_FIRST = 1;
10 const int SBRM_VOLLY = 1;
11 const int SBRM_GUIDE = 2;
12 const int SBRM_ARTILLERY = 3;
13 const int SBRM_LAST = 3;
16 bool autocvar_g_vehicle_spiderbot =
true;
18 float autocvar_g_vehicle_spiderbot_respawntime = 45;
20 float autocvar_g_vehicle_spiderbot_speed_stop = 50;
21 float autocvar_g_vehicle_spiderbot_speed_strafe = 400;
22 float autocvar_g_vehicle_spiderbot_speed_walk = 500;
23 float autocvar_g_vehicle_spiderbot_speed_run = 700;
24 float autocvar_g_vehicle_spiderbot_turnspeed = 90;
25 float autocvar_g_vehicle_spiderbot_turnspeed_strafe = 300;
26 float autocvar_g_vehicle_spiderbot_movement_inertia = 0.15;
28 float autocvar_g_vehicle_spiderbot_springlength = 150;
29 float autocvar_g_vehicle_spiderbot_springup = 20;
30 float autocvar_g_vehicle_spiderbot_springblend = 0.1;
31 float autocvar_g_vehicle_spiderbot_tiltlimit = 90;
33 float autocvar_g_vehicle_spiderbot_head_pitchlimit_down = -20;
34 float autocvar_g_vehicle_spiderbot_head_pitchlimit_up = 30;
35 float autocvar_g_vehicle_spiderbot_head_turnlimit = 90;
36 float autocvar_g_vehicle_spiderbot_head_turnspeed = 110;
38 int autocvar_g_vehicle_spiderbot_health = 800;
39 float autocvar_g_vehicle_spiderbot_health_regen = 10;
40 float autocvar_g_vehicle_spiderbot_health_regen_pause = 5;
42 int autocvar_g_vehicle_spiderbot_shield = 200;
43 float autocvar_g_vehicle_spiderbot_shield_regen = 25;
44 float autocvar_g_vehicle_spiderbot_shield_regen_pause = 0.35;
47 vector autocvar_g_vehicle_spiderbot_bouncepain =
'0 0 0';
50 bool spiderbot_frame(
entity this,
float dt)
70 this.(weaponentity).m_switchweapon = WEP_Null;
72 STAT(VEHICLESTAT_W2MODE,
this) = STAT(VEHICLESTAT_W2MODE, vehic);
75 #if 1 // 0 to enable per-gun impact aux crosshairs 103 float ftmp = autocvar_g_vehicle_spiderbot_head_turnspeed * PHYS_INPUT_FRAMETIME;
104 ad_y =
bound(-ftmp, ad_y, ftmp);
105 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);
108 ad_x =
bound(ftmp * -1, ad_x, ftmp);
109 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);
113 makevectors(vehic.angles +
'-2 0 0' * vehic.angles_x);
115 movelib_groundalign4point(vehic, autocvar_g_vehicle_spiderbot_springlength, autocvar_g_vehicle_spiderbot_springup, autocvar_g_vehicle_spiderbot_springblend, autocvar_g_vehicle_spiderbot_tiltlimit);
118 vehic.jump_delay =
time;
123 if(vehic.frame == 4 && vehic.tur_head.wait != 0)
130 vehic.button2 =
false;
138 vehic.tur_head.wait =
time + 2;
139 vehic.jump_delay =
time + 2;
140 vehic.button2 =
true;
144 if(
CS(
this).movement_x > 0) movefix_x = 1;
145 if(
CS(
this).movement_x < 0) movefix_x = -1;
146 if(
CS(
this).movement_y > 0) movefix_y = 1;
147 if(
CS(
this).movement_y < 0) movefix_y = -1;
151 if(movefix_y == 0 && movefix_x == 0)
156 vehic.velocity = sd * 700 + rt * 600 +
v_up * 600;
159 else if(
time >= vehic.jump_delay)
165 if(vehic.sound_nexttime <
time || vehic.delay != 3)
168 vehic.sound_nexttime =
time + 6.486500;
172 movelib_brake_simple(vehic, autocvar_g_vehicle_spiderbot_speed_stop);
179 if(
CS(
this).movement_x == 0 &&
CS(
this).movement_y != 0)
180 ftmp = autocvar_g_vehicle_spiderbot_turnspeed_strafe * PHYS_INPUT_FRAMETIME;
182 ftmp = autocvar_g_vehicle_spiderbot_turnspeed * PHYS_INPUT_FRAMETIME;
184 ftmp =
bound(-ftmp, vehic.tur_head.angles_y, ftmp);
185 vehic.angles_y =
anglemods(vehic.angles_y + ftmp);
186 vehic.tur_head.angles_y -= ftmp;
188 if(
CS(
this).movement_x != 0)
190 if(
CS(
this).movement_x > 0)
192 CS(
this).movement_x = 1;
196 else if(
CS(
this).movement_x < 0)
198 CS(
this).movement_x = -1;
202 CS(
this).movement_y = 0;
203 float oldvelz = vehic.velocity_z;
204 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);
205 vehic.velocity_z = oldvelz;
206 float g = ((autocvar_sv_gameplayfix_gravityunaffectedbyticrate) ? 0.5 : 1);
207 if(vehic.velocity_z <= 20)
208 vehic.velocity_z -= g * PHYS_INPUT_FRAMETIME * autocvar_sv_gravity;
210 if(vehic.sound_nexttime <
time || vehic.delay != 1)
213 vehic.sound_nexttime =
time + 6.486500;
218 else if(
CS(
this).movement_y != 0)
220 if(
CS(
this).movement_y < 0)
222 CS(
this).movement_y = -1;
226 else if(
CS(
this).movement_y > 0)
228 CS(
this).movement_y = 1;
233 float oldvelz = vehic.velocity_z;
234 movelib_move_simple(vehic,
normalize(v_right *
CS(
this).movement_y),autocvar_g_vehicle_spiderbot_speed_strafe,autocvar_g_vehicle_spiderbot_movement_inertia);
235 vehic.velocity_z = oldvelz;
236 float g = ((autocvar_sv_gameplayfix_gravityunaffectedbyticrate) ? 0.5 : 1);
237 if(vehic.velocity_z <= 20)
238 vehic.velocity_z -= g * PHYS_INPUT_FRAMETIME * autocvar_sv_gravity;
240 if(vehic.sound_nexttime <
time || vehic.delay != 2)
243 vehic.sound_nexttime =
time + 6.486500;
252 vehic.angles_x =
bound(-autocvar_g_vehicle_spiderbot_tiltlimit, vehic.angles_x, autocvar_g_vehicle_spiderbot_tiltlimit);
253 vehic.angles_z =
bound(-autocvar_g_vehicle_spiderbot_tiltlimit, vehic.angles_z, autocvar_g_vehicle_spiderbot_tiltlimit);
259 if(vehic.vehicle_ammo1 >= autocvar_g_vehicle_spiderbot_minigun_ammo_cost && vehic.tur_head.attack_finished_single[0] <=
time)
263 vehic.misc_bulletcounter += 1;
265 gun = (vehic.misc_bulletcounter % 2) ? vehic.gun1 : vehic.gun2;
272 fireBullet(
this, weaponentity, v, v_forward, autocvar_g_vehicle_spiderbot_minigun_spread, autocvar_g_vehicle_spiderbot_minigun_solidpenetration,
273 autocvar_g_vehicle_spiderbot_minigun_damage, 0, autocvar_g_vehicle_spiderbot_minigun_force, DEATH_VH_SPID_MINIGUN.m_id, EFFECT_BULLET);
277 Send_Effect(EFFECT_SPIDERBOT_MINIGUN_MUZZLEFLASH, v, v_forward * 2500, 1);
279 vehic.vehicle_ammo1 -= autocvar_g_vehicle_spiderbot_minigun_ammo_cost;
280 vehic.tur_head.attack_finished_single[0] =
time + autocvar_g_vehicle_spiderbot_minigun_refire;
281 this.vehicle_ammo1 = (vehic.vehicle_ammo1 / autocvar_g_vehicle_spiderbot_minigun_ammo_max) * 100;
282 vehic.gun1.angles_z += 45;
283 vehic.gun2.angles_z -= 45;
284 if(vehic.gun1.angles_z >= 360)
286 vehic.gun1.angles_z = 0;
287 vehic.gun2.angles_z = 0;
292 vehicles_regen(vehic, vehic.cnt, vehicle_ammo1, autocvar_g_vehicle_spiderbot_minigun_ammo_max,
293 autocvar_g_vehicle_spiderbot_minigun_ammo_regen_pause,
294 autocvar_g_vehicle_spiderbot_minigun_ammo_regen, dt,
false);
297 spiderbot_rocket_do(vehic);
300 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);
303 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,
RES_HEALTH);
307 this.vehicle_ammo2 = (9 - vehic.tur_head.frame) / 8 * 100;
309 if(vehic.gun2.cnt <=
time)
310 this.vehicle_reload2 = 100;
312 this.vehicle_reload2 = 100 - ((vehic.gun2.cnt -
time) / vehic.attack_finished_single[0]) * 100;
314 setorigin(
this, vehic.origin +
'0 0 1' * vehic.maxs_z);
321 VEHICLE_UPDATE_PLAYER(
this, vehic, shield, spiderbot);
324 void spiderbot_exit(
entity this,
int eject)
330 it.realowner = player;
349 spot = this.
origin + v_forward * 100 +
'0 0 64';
352 player.velocity = (
v_up + v_forward * 0.25) * 750;
353 player.oldvelocity = player.velocity;
357 if(
vdist(this.
velocity, >, autocvar_g_vehicle_spiderbot_speed_strafe))
360 player.velocity_z += 200;
361 spot = this.
origin + v_forward * 128 +
'0 0 64';
366 player.velocity = this.
velocity * 0.5;
367 player.velocity_z += 10;
368 spot = this.
origin + v_forward * 256 +
'0 0 64';
371 player.oldvelocity = player.velocity;
379 void spiderbot_headfade(
entity this)
390 Send_Effect(EFFECT_EXPLOSION_BIG, this.
origin +
'0 0 100',
'0 0 0', 1);
396 void spiderbot_blowup(
entity this)
403 Send_Effect(EFFECT_EXPLOSION_SMALL,
randomvec() * 80 + (this.
origin +
'0 0 100'),
'0 0 0', 1);
409 entity h =
new(spiderbot_top), g1 =
new(spiderbot_gun), g2 =
new(spiderbot_gun), b =
new(spiderbot_body);
411 setmodel(b, MDL_VEH_SPIDERBOT_BODY);
413 setmodel(g1, MDL_VEH_SPIDERBOT_GUN);
414 setmodel(g2, MDL_VEH_SPIDERBOT_GUN);
441 g1.velocity = v_forward * 700 + (
randomvec() * 32);
448 g2.velocity = v_forward * 700 + (
randomvec() * 32);
451 h.colormod = b.colormod = g1.colormod = g2.colormod =
'-2 -2 -2';
458 RadiusDamage (
this, this.
enemy, 250, 15, 250,
NULL,
NULL, 250, DEATH_VH_SPID_DEATH.m_id,
DMG_NOWEP,
NULL);
460 this.
alpha = this.
tur_head.alpha = this.gun1.alpha = this.gun2.alpha = -1;
465 this.vehicle_hudmodel.viewmodelforclient =
this;
468 bool spiderbot_impulse(
entity this,
int _imp)
472 case IMP_weapon_group_1.impulse:
473 STAT(VEHICLESTAT_W2MODE, this.
vehicle) = SBRM_VOLLY;
476 case IMP_weapon_group_2.impulse:
477 STAT(VEHICLESTAT_W2MODE, this.
vehicle) = SBRM_GUIDE;
480 case IMP_weapon_group_3.impulse:
481 STAT(VEHICLESTAT_W2MODE, this.
vehicle) = SBRM_ARTILLERY;
485 case IMP_weapon_next_byid.impulse:
486 case IMP_weapon_next_bypriority.impulse:
487 case IMP_weapon_next_bygroup.impulse:
488 STAT(VEHICLESTAT_W2MODE, this.
vehicle) += 1;
489 if(STAT(VEHICLESTAT_W2MODE, this.
vehicle) > SBRM_LAST)
490 STAT(VEHICLESTAT_W2MODE, this.
vehicle) = SBRM_FIRST;
495 case IMP_weapon_last.impulse:
496 case IMP_weapon_prev_byid.impulse:
497 case IMP_weapon_prev_bypriority.impulse:
498 case IMP_weapon_prev_bygroup.impulse:
499 STAT(VEHICLESTAT_W2MODE, this.
vehicle) -= 1;
500 if(STAT(VEHICLESTAT_W2MODE, this.
vehicle) < SBRM_FIRST)
501 STAT(VEHICLESTAT_W2MODE, this.
vehicle) = SBRM_LAST;
519 if(!autocvar_g_vehicle_spiderbot) {
delete(
this);
return; }
525 if(autocvar_g_vehicle_spiderbot_bouncepain)
526 vehicles_impact(instance, autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z);
530 STAT(VEHICLESTAT_W2MODE, instance) = SBRM_GUIDE;
533 instance.owner.vehicle_health = (
GetResource(instance,
RES_HEALTH) / autocvar_g_vehicle_spiderbot_health) * 100;
534 instance.owner.vehicle_shield = (instance.vehicle_shield / autocvar_g_vehicle_spiderbot_shield) * 100;
536 if(instance.owner.flagcarried)
538 setattachment(instance.owner.flagcarried, instance.tur_head,
"");
539 setorigin(instance.owner.flagcarried,
'-20 0 120');
545 movelib_brake_simple(instance, autocvar_g_vehicle_spiderbot_speed_stop);
554 setthink(instance, spiderbot_blowup);
555 instance.nextthink =
time;
558 instance.tur_head.effects |=
EF_FLAME;
559 instance.colormod = instance.tur_head.colormod =
'-1 -1 -1';
569 instance.vehicles_impulse = spiderbot_impulse;
570 instance.gun1 =
new(spiderbot_gun);
571 instance.gun2 =
new(spiderbot_gun);
572 setmodel(instance.gun1, MDL_VEH_SPIDERBOT_GUN);
573 setmodel(instance.gun2, MDL_VEH_SPIDERBOT_GUN);
574 setattachment(instance.gun1, instance.tur_head,
"tag_hardpoint01");
575 setattachment(instance.gun2, instance.tur_head,
"tag_hardpoint02");
576 instance.gravity = 2;
577 instance.mass = 5000;
581 instance.tur_head.frame = 1;
584 instance.alpha = instance.tur_head.alpha = instance.gun1.alpha = instance.gun2.alpha = 1;
585 instance.tur_head.angles =
'0 0 0';
586 instance.vehicle_exit = spiderbot_exit;
588 setorigin(instance, instance.pos1 +
'0 0 128');
589 instance.angles = instance.pos2;
590 instance.damageforcescale = 0.03;
592 instance.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
594 instance.PlayerPhysplug = spiderbot_frame;
598 if(autocvar_g_vehicle_spiderbot_shield)
601 if(autocvar_g_vehicle_spiderbot_shield_regen)
604 if(autocvar_g_vehicle_spiderbot_health_regen)
607 instance.respawntime = autocvar_g_vehicle_spiderbot_respawntime;
609 instance.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
611 instance.pushable =
true;
621 Vehicles_drawHUD(VEH_SPIDERBOT.m_icon,
"vehicle_spider_weapon1",
"vehicle_spider_weapon2",
633 case SBRM_ARTILLERY: crosshair =
vCROSS_RAIN;
break;
#define PHYS_INPUT_BUTTON_ATCK2(s)
const string vCROSS_BURST
#define PHYS_INPUT_BUTTON_JUMP(s)
#define IL_EACH(this, cond, body)
#define PHYS_INPUT_BUTTON_CROUCH(s)
const float SOLID_SLIDEBOX
const int VHF_HASSHIELD
Indicates vehicle.
void movelib_groundalign4point(entity this, float spring_length, float spring_up, float blendrate, float _max)
void vehicles_regen_resource(entity this, float timer,.float regen_field, float field_max, float rpause, float regen, float delta_time, float _healthscale, Resource resource)
ERASEABLE float anglemods(float v)
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
void Vehicles_drawCrosshair(string crosshair)
bool weaponUseForbidden(entity player)
ClientState CS(Client this)
void Vehicles_drawHUD(string vehicle, string vehicleWeapon1, string vehicleWeapon2, string iconAmmo1, vector colorAmmo1, string iconAmmo2, vector colorAmmo2)
#define PHYS_INPUT_BUTTON_ZOOM(s)
void vehicles_regen(entity this, float timer,.float regen_field, float field_max, float rpause, float regen, float delta_time, float _healthscale)
spawnfunc(info_player_attacker)
void antilag_clear(entity e, entity store)
#define METHOD(cname, name, prototype)
#define UNSET_ONGROUND(s)
void crosshair_trace(entity pl)
#define setmodel(this, m)
void vehicles_impact(entity this, float _minspeed, float _speedfac, float _maxpain)
bool weaponLocked(entity player)
const int VHF_SHIELDREGEN
Vehicle has shileding.
entity AuxiliaryXhair[MAX_AXH]
void fireBullet(entity this,.entity weaponentity, vector start, vector dir, float spread, float max_solid_penetration, float damage, float headshot_multiplier, float force, float dtype, entity tracer_effect)
const int MAX_WEAPONSLOTS
void CSQCVehicleSetup(entity own, int vehicle_id)
void vehicles_think(entity this)
#define PHYS_INPUT_BUTTON_ATCK(s)
void vehicles_frame(entity this, entity actor)
vector autocvar_hud_progressbar_vehicles_ammo1_color
const int CH_TRIGGER_SINGLE
vector(float skel, float bonenum) _skel_get_boneabs_hidden
IntrusiveList g_projectiles
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
const int VHF_HEALTHREGEN
Vehicles shield regenerates.
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
float RadiusDamage(entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype,.entity weaponentity, entity directhitentity)
void CSQCModel_UnlinkEntity(entity e)
vector autocvar_hud_progressbar_vehicles_ammo2_color
float frame
primary framegroup animation (strength = 1 - lerpfrac - lerpfrac3 - lerpfrac4)
entity weaponentities[MAX_WEAPONSLOTS]
void SUB_SetFade(entity ent, float vanish_time, float fading_time)
void UpdateAuxiliaryXhair(entity own, vector loc, vector clr, int axh_id)
#define sound(e, c, s, v, a)
const string vCROSS_GUIDE
bool vehicle_initialize(entity this, Vehicle info, bool nodrop)
void set_movetype(entity this, int mt)
vector vehicles_findgoodexit(entity this, entity player, vector prefer_spot)