11 bool autocvar_g_vehicle_raptor =
true;
13 float autocvar_g_vehicle_raptor_respawntime = 40;
14 float autocvar_g_vehicle_raptor_takeofftime = 1.5;
18 int autocvar_g_vehicle_raptor_movestyle = 1;
19 float autocvar_g_vehicle_raptor_turnspeed = 200;
20 float autocvar_g_vehicle_raptor_pitchspeed = 50;
21 float autocvar_g_vehicle_raptor_pitchlimit = 45;
23 float autocvar_g_vehicle_raptor_speed_forward = 1700;
24 float autocvar_g_vehicle_raptor_speed_strafe = 2200;
25 float autocvar_g_vehicle_raptor_speed_up = 2300;
26 float autocvar_g_vehicle_raptor_speed_down = 2000;
27 float autocvar_g_vehicle_raptor_friction = 2;
29 bool autocvar_g_vehicle_raptor_swim =
false;
31 float autocvar_g_vehicle_raptor_cannon_turnspeed = 120;
32 float autocvar_g_vehicle_raptor_cannon_turnlimit = 20;
33 float autocvar_g_vehicle_raptor_cannon_pitchlimit_up = 12;
34 float autocvar_g_vehicle_raptor_cannon_pitchlimit_down = 32;
36 bool autocvar_g_vehicle_raptor_cannon_locktarget =
true;
37 float autocvar_g_vehicle_raptor_cannon_locking_time = 0.2;
38 float autocvar_g_vehicle_raptor_cannon_locking_releasetime = 0.45;
39 float autocvar_g_vehicle_raptor_cannon_locked_time = 1;
40 float autocvar_g_vehicle_raptor_cannon_predicttarget = 1;
42 float autocvar_g_vehicle_raptor_energy = 100;
43 float autocvar_g_vehicle_raptor_energy_regen = 25;
44 float autocvar_g_vehicle_raptor_energy_regen_pause = 0.25;
46 float autocvar_g_vehicle_raptor_health = 250;
47 float autocvar_g_vehicle_raptor_health_regen = 0;
48 float autocvar_g_vehicle_raptor_health_regen_pause = 0;
50 float autocvar_g_vehicle_raptor_shield = 200;
51 float autocvar_g_vehicle_raptor_shield_regen = 25;
52 float autocvar_g_vehicle_raptor_shield_regen_pause = 1.5;
54 float autocvar_g_vehicle_raptor_bouncefactor = 0.2;
55 float autocvar_g_vehicle_raptor_bouncestop = 0;
56 vector autocvar_g_vehicle_raptor_bouncepain =
'1 4 1000';
61 void raptor_land(
entity this)
65 hgt = vehicle_altitude(
this, 512);
66 this.
velocity = (this.
velocity * 0.9) + (
'0 0 -1800' * (hgt / 256) * PHYS_INPUT_FRAMETIME);
67 this.angles_x *= 0.95;
68 this.angles_z *= 0.95;
70 if(hgt < 128 && hgt > 0)
71 this.
frame = (hgt / 128) * 25;
73 this.bomb1.gun1.avelocity_y = 90 + ((this.
frame / 25) * 2000);
74 this.bomb1.gun2.avelocity_y = -this.bomb1.gun1.avelocity_y;
85 CSQCMODEL_AUTOUPDATE(
this);
88 void raptor_exit(
entity this,
int eject)
110 player.velocity = (
v_up + v_forward * 0.25) * 750;
111 player.oldvelocity = player.velocity;
118 player.velocity_z += 200;
124 player.velocity = this.
velocity * 0.5;
125 player.velocity_z += 10;
129 player.oldvelocity = player.velocity;
137 bool raptor_frame(
entity this,
float dt)
160 if(vehic.sound_nexttime <
time)
162 vehic.sound_nexttime =
time + 7.955812;
185 if(vehic.angles_z > 50 || vehic.angles_z < -50)
200 if(df_x > 180) df_x -= 360;
201 if(df_x < -180) df_x += 360;
202 if(df_y > 180) df_y -= 360;
203 if(df_y < -180) df_y += 360;
205 float ftmp =
shortangle_f(this.v_angle_y - vang_y, vang_y);
206 if(ftmp > 180) ftmp -= 360;
if(ftmp < -180) ftmp += 360;
207 vehic.avelocity_y =
bound(-autocvar_g_vehicle_raptor_turnspeed, ftmp + vehic.avelocity_y * 0.9, autocvar_g_vehicle_raptor_turnspeed);
211 if(
CS(
this).movement_x > 0 && vang_x < autocvar_g_vehicle_raptor_pitchlimit) ftmp = 5;
212 else if(
CS(
this).movement_x < 0 && vang_x > -autocvar_g_vehicle_raptor_pitchlimit) ftmp = -20;
214 df_x =
bound(-autocvar_g_vehicle_raptor_pitchlimit, df_x , autocvar_g_vehicle_raptor_pitchlimit);
215 ftmp = vang_x -
bound(-autocvar_g_vehicle_raptor_pitchlimit, df_x + ftmp, autocvar_g_vehicle_raptor_pitchlimit);
216 vehic.avelocity_x =
bound(-autocvar_g_vehicle_raptor_pitchspeed, ftmp + vehic.avelocity_x * 0.9, autocvar_g_vehicle_raptor_pitchspeed);
218 vehic.angles_x =
anglemods(vehic.angles_x);
219 vehic.angles_y =
anglemods(vehic.angles_y);
220 vehic.angles_z =
anglemods(vehic.angles_z);
222 if(autocvar_g_vehicle_raptor_movestyle == 1)
227 df = vehic.velocity * -autocvar_g_vehicle_raptor_friction;
229 if(
CS(
this).movement_x != 0)
231 if(
CS(
this).movement_x > 0)
232 df +=
v_forward * autocvar_g_vehicle_raptor_speed_forward;
233 else if(
CS(
this).movement_x < 0)
234 df -=
v_forward * autocvar_g_vehicle_raptor_speed_forward;
237 if(
CS(
this).movement_y != 0)
239 if(
CS(
this).movement_y < 0)
240 df -=
v_right * autocvar_g_vehicle_raptor_speed_strafe;
241 else if(
CS(
this).movement_y > 0)
242 df +=
v_right * autocvar_g_vehicle_raptor_speed_strafe;
244 vehic.angles_z =
bound(-30,vehic.angles_z + (
CS(
this).movement_y / autocvar_g_vehicle_raptor_speed_strafe),30);
248 vehic.angles_z *= 0.95;
249 if(vehic.angles_z >= -1 && vehic.angles_z <= -1)
254 df -=
v_up * autocvar_g_vehicle_raptor_speed_down;
256 df +=
v_up * autocvar_g_vehicle_raptor_speed_up;
258 vehic.velocity += df * dt;
259 this.
velocity =
CS(
this).movement = vehic.velocity;
260 setorigin(
this, vehic.origin +
'0 0 32');
263 STAT(VEHICLESTAT_W2MODE,
this) = STAT(VEHICLESTAT_W2MODE, vehic);
267 if(autocvar_g_vehicle_raptor_cannon_locktarget == 2)
269 if(vehic.gun1.lock_time <
time ||
IS_DEAD(vehic.gun1.enemy) || STAT(FROZEN, vehic.gun1.enemy))
270 vehic.gun1.enemy =
NULL;
282 vehic.gun1.lock_time =
time + 5;
288 vehic.gun1.lock_time =
time + 0.5;
294 float distance, impact_time;
296 vf = real_origin(vehic.gun1.enemy);
298 vector _vel = vehic.gun1.enemy.velocity;
302 if(autocvar_g_vehicle_raptor_cannon_predicttarget)
306 impact_time = distance / autocvar_g_vehicle_raptor_cannon_speed;
307 ad = vf + _vel * impact_time;
314 else if(autocvar_g_vehicle_raptor_cannon_locktarget == 1)
318 (1 / autocvar_g_vehicle_raptor_cannon_locking_releasetime) * dt,
319 autocvar_g_vehicle_raptor_cannon_locked_time);
321 if(vehic.lock_target !=
NULL)
322 if(autocvar_g_vehicle_raptor_cannon_predicttarget)
323 if(vehic.lock_strength == 1)
325 float i, distance, impact_time;
327 vf = real_origin(vehic.lock_target);
329 for(i = 0; i < 4; ++i)
331 distance =
vlen(ad - vehic.origin);
332 impact_time = distance / autocvar_g_vehicle_raptor_cannon_speed;
333 ad = vf + vehic.lock_target.velocity * impact_time;
338 if(vehic.lock_target)
340 if(vehic.lock_strength == 1)
342 else if(vehic.lock_strength > 0.5)
344 else if(vehic.lock_strength < 0.5)
351 autocvar_g_vehicle_raptor_cannon_pitchlimit_down * -1, autocvar_g_vehicle_raptor_cannon_pitchlimit_up,
352 autocvar_g_vehicle_raptor_cannon_turnlimit * -1, autocvar_g_vehicle_raptor_cannon_turnlimit, autocvar_g_vehicle_raptor_cannon_turnspeed, dt);
355 autocvar_g_vehicle_raptor_cannon_pitchlimit_down * -1, autocvar_g_vehicle_raptor_cannon_pitchlimit_up,
356 autocvar_g_vehicle_raptor_cannon_turnlimit * -1, autocvar_g_vehicle_raptor_cannon_turnlimit, autocvar_g_vehicle_raptor_cannon_turnspeed, dt);
369 if (wep1.wr_checkammo1(wep1, vehic, weaponentity))
371 wep1.wr_think(wep1, vehic, weaponentity, 1);
375 vehicles_regen(vehic, vehic.dmg_time, vehicle_shield, autocvar_g_vehicle_raptor_shield, autocvar_g_vehicle_raptor_shield_regen_pause, autocvar_g_vehicle_raptor_shield_regen, dt,
true);
378 vehicles_regen_resource(vehic, vehic.dmg_time, vehicle_health, autocvar_g_vehicle_raptor_health, autocvar_g_vehicle_raptor_health_regen_pause, autocvar_g_vehicle_raptor_health_regen, dt,
false,
RES_HEALTH);
381 vehicles_regen(vehic, vehic.cnt, vehicle_energy, autocvar_g_vehicle_raptor_energy, autocvar_g_vehicle_raptor_energy_regen_pause, autocvar_g_vehicle_raptor_energy_regen, dt,
false);
383 Weapon wep2a = WEP_RAPTOR_BOMB;
385 if(STAT(VEHICLESTAT_W2MODE, vehic) ==
RSM_BOMB)
387 if(
time > vehic.lip + autocvar_g_vehicle_raptor_bombs_refire)
391 wep2a.wr_think(wep2a, vehic, weaponentity, 2);
392 vehic.delay =
time + autocvar_g_vehicle_raptor_bombs_refire;
398 Weapon wep2b = WEP_RAPTOR_FLARE;
399 if(
time > vehic.lip + autocvar_g_vehicle_raptor_flare_refire)
403 wep2b.wr_think(wep2b, vehic, weaponentity, 2);
404 vehic.delay =
time + autocvar_g_vehicle_raptor_flare_refire;
409 vehic.bomb1.alpha = vehic.bomb2.alpha = (
time - vehic.lip) / (vehic.delay - vehic.lip);
410 this.vehicle_reload2 =
bound(0, vehic.bomb1.alpha * 100, 100);
411 this.vehicle_ammo2 = (this.vehicle_reload2 == 100) ? 100 : 0;
413 if(vehic.bomb1.cnt <
time)
415 bool incoming =
false;
418 if(it.missile_flags & MIF_GUIDED_TRACKING)
419 if(vdist(vehic.origin - it.origin, <, 2 * autocvar_g_vehicle_raptor_flare_range))
432 vehic.bomb1.cnt =
time + 1;
437 VEHICLE_UPDATE_PLAYER(
this, vehic, energy, raptor);
439 VEHICLE_UPDATE_PLAYER(
this, vehic, shield, raptor);
444 bool raptor_takeoff(
entity this,
float dt)
449 vehic.nextthink =
time;
450 CSQCMODEL_AUTOUPDATE(vehic);
453 if(vehic.sound_nexttime <
time)
455 vehic.sound_nexttime =
time + 7.955812;
462 vehic.frame += 25 / (autocvar_g_vehicle_raptor_takeofftime / dt);
463 vehic.velocity_z =
min(vehic.velocity_z * 1.5, 256);
464 vehic.bomb1.gun1.avelocity_y = 90 + ((vehic.frame / 25) * 25000);
465 vehic.bomb1.gun2.avelocity_y = -vehic.bomb1.gun1.avelocity_y;
468 setorigin(
this, vehic.origin +
'0 0 32');
472 this.PlayerPhysplug = raptor_frame;
474 STAT(VEHICLESTAT_W2MODE,
this) = STAT(VEHICLESTAT_W2MODE, vehic);
477 vehicles_regen(vehic, vehic.dmg_time, vehicle_shield, autocvar_g_vehicle_raptor_shield, autocvar_g_vehicle_raptor_shield_regen_pause, autocvar_g_vehicle_raptor_shield_regen, dt,
true);
480 vehicles_regen_resource(vehic, vehic.dmg_time, vehicle_health, autocvar_g_vehicle_raptor_health, autocvar_g_vehicle_raptor_health_regen_pause, autocvar_g_vehicle_raptor_health_regen, dt,
false,
RES_HEALTH);
483 vehicles_regen(vehic, vehic.cnt, vehicle_energy, autocvar_g_vehicle_raptor_energy, autocvar_g_vehicle_raptor_energy_regen_pause, autocvar_g_vehicle_raptor_energy_regen, dt,
false);
486 vehic.bomb1.alpha = vehic.bomb2.alpha = (
time - vehic.lip) / (vehic.delay - vehic.lip);
487 this.vehicle_reload2 =
bound(0, vehic.bomb1.alpha * 100, 100);
488 this.vehicle_ammo2 = (this.vehicle_reload2 == 100) ? 100 : 0;
491 VEHICLE_UPDATE_PLAYER(
this, vehic, energy, raptor);
493 VEHICLE_UPDATE_PLAYER(
this, vehic, shield, raptor);
501 this.vehicle_exit(
this, VHEF_NORMAL);
502 RadiusDamage (
this, this.
enemy, 250, 15, 250,
NULL,
NULL, 250, DEATH_VH_RAPT_DEATH.m_id,
DMG_NOWEP,
NULL);
516 void raptor_diethink(
entity this)
520 raptor_blowup(
this,
NULL);
527 Send_Effect(EFFECT_EXPLOSION_SMALL,
randomvec() * 80 + (this.
origin +
'0 0 100'),
'0 0 0', 1);
531 CSQCMODEL_AUTOUPDATE(
this);
536 void raptor_rotor_anglefix(
entity this)
538 this.gun1.angles_y =
anglemods(this.gun1.angles_y);
539 this.gun2.angles_y =
anglemods(this.gun2.angles_y);
543 bool raptor_impulse(
entity this,
int _imp)
547 case IMP_weapon_group_1.impulse:
551 case IMP_weapon_group_2.impulse:
556 case IMP_weapon_next_byid.impulse:
557 case IMP_weapon_next_bypriority.impulse:
558 case IMP_weapon_next_bygroup.impulse:
559 STAT(VEHICLESTAT_W2MODE, this.
vehicle) += 1;
565 case IMP_weapon_last.impulse:
566 case IMP_weapon_prev_byid.impulse:
567 case IMP_weapon_prev_bypriority.impulse:
568 case IMP_weapon_prev_bygroup.impulse:
569 STAT(VEHICLESTAT_W2MODE, this.
vehicle) -= 1;
588 if(!autocvar_g_vehicle_raptor) {
delete(
this);
return; }
594 if(autocvar_g_vehicle_raptor_bouncepain)
595 vehicles_impact(instance, autocvar_g_vehicle_raptor_bouncepain_x, autocvar_g_vehicle_raptor_bouncepain_y, autocvar_g_vehicle_raptor_bouncepain_z);
599 STAT(VEHICLESTAT_W2MODE, instance) =
RSM_BOMB;
600 instance.owner.PlayerPhysplug = raptor_takeoff;
603 instance.owner.vehicle_health = (
GetResource(instance,
RES_HEALTH) / autocvar_g_vehicle_raptor_health) * 100;
604 instance.owner.vehicle_shield = (instance.vehicle_shield / autocvar_g_vehicle_raptor_shield) * 100;
605 instance.velocity =
'0 0 1';
606 instance.tur_head.exteriormodeltoclient = instance.owner;
608 instance.delay =
time + autocvar_g_vehicle_raptor_bombs_refire;
611 if(instance.owner.flagcarried)
612 setorigin(instance.owner.flagcarried,
'-20 0 96');
624 setthink(instance, raptor_diethink);
625 instance.nextthink =
time;
628 Send_Effect(EFFECT_EXPLOSION_MEDIUM, findbetterlocation (instance.origin, 16),
'0 0 0', 1);
630 instance.velocity_z += 600;
632 instance.avelocity =
'0 0.5 1' * (
random() * 400);
633 instance.avelocity -=
'0 0.5 1' * (
random() * 400);
635 instance.colormod =
'-0.5 -0.5 -0.5';
636 settouch(instance, raptor_blowup);
648 instance.vehicles_impulse = raptor_impulse;
652 instance.bomb1 =
new(raptor_bomb);
653 instance.bomb2 =
new(raptor_bomb);
654 instance.gun1 =
new(raptor_gun);
655 instance.gun2 =
new(raptor_gun);
657 setmodel(instance.bomb1, MDL_VEH_RAPTOR_CB_FOLDED);
658 setmodel(instance.bomb2, MDL_VEH_RAPTOR_CB_FOLDED);
659 setmodel(instance.gun1, MDL_VEH_RAPTOR_GUN);
660 setmodel(instance.gun2, MDL_VEH_RAPTOR_GUN);
661 setmodel(instance.tur_head, MDL_VEH_RAPTOR_TAIL);
663 setattachment(instance.bomb1, instance,
"bombmount_left");
664 setattachment(instance.bomb2, instance,
"bombmount_right");
665 setattachment(instance.tur_head, instance,
"root");
668 instance.bomb1.angles = instance.angles;
669 instance.angles =
'0 0 0';
673 ofs -= instance.origin;
674 setattachment(instance.gun1, instance,
"");
679 ofs -= instance.origin;
680 setattachment(instance.gun2, instance,
"");
683 instance.angles = instance.bomb1.angles;
684 instance.bomb1.angles =
'0 0 0';
686 spinner =
new(raptor_spinner);
687 spinner.owner = instance;
688 setmodel(spinner, MDL_VEH_RAPTOR_PROP);
689 setattachment(spinner, instance,
"engine_left");
691 spinner.avelocity =
'0 90 0';
692 instance.bomb1.gun1 = spinner;
694 spinner =
new(raptor_spinner);
695 spinner.owner = instance;
696 setmodel(spinner, MDL_VEH_RAPTOR_PROP);
697 setattachment(spinner, instance,
"engine_right");
699 spinner.avelocity =
'0 -90 0';
700 instance.bomb1.gun2 = spinner;
703 setthink(instance.bomb1, raptor_rotor_anglefix);
704 instance.bomb1.nextthink =
time;
711 instance.vehicle_shield = autocvar_g_vehicle_raptor_shield;
714 instance.vehicle_energy = 1;
716 if(!autocvar_g_vehicle_raptor_swim)
719 instance.PlayerPhysplug = raptor_frame;
721 instance.bomb1.gun1.avelocity_y = 90;
722 instance.bomb1.gun2.avelocity_y = -90;
724 instance.delay =
time;
726 instance.bouncefactor = autocvar_g_vehicle_raptor_bouncefactor;
727 instance.bouncestop = autocvar_g_vehicle_raptor_bouncestop;
728 instance.damageforcescale = 0.25;
730 instance.vehicle_shield = autocvar_g_vehicle_raptor_shield;
734 if(autocvar_g_vehicle_raptor_shield)
737 if(autocvar_g_vehicle_raptor_shield_regen)
740 if(autocvar_g_vehicle_raptor_health_regen)
743 if(autocvar_g_vehicle_raptor_energy_regen)
746 instance.vehicle_exit = raptor_exit;
747 instance.respawntime = autocvar_g_vehicle_raptor_respawntime;
749 instance.vehicle_shield = autocvar_g_vehicle_raptor_shield;
752 if(!autocvar_g_vehicle_raptor_swim)
761 Vehicles_drawHUD(VEH_RAPTOR.m_icon,
"vehicle_raptor_weapon1",
"vehicle_raptor_weapon2",
791 float reload2 = STAT(VEHICLESTAT_RELOAD2) * 0.01;
805 where.x -= tmpSize.x * 0.5;
806 where.y -= tmpSize.y * 0.5;
822 where.x -= tmpSize.x * 0.5;
823 where.y -= tmpSize.y * 0.5;
#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 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)
vector project_3d_to_2d(vector vec)
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)
float autocvar_crosshair_alpha
ClientState CS(Client this)
float MOVETYPE_BOUNCEMISSILE
void Vehicles_drawHUD(string vehicle, string vehicleWeapon1, string vehicleWeapon2, string iconAmmo1, vector colorAmmo1, string iconAmmo2, vector colorAmmo2)
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)
void crosshair_trace(entity pl)
#define setmodel(this, m)
void vehicles_impact(entity this, float _minspeed, float _speedfac, float _maxpain)
const float DRAWFLAG_ADDITIVE
bool weaponLocked(entity player)
const int VHF_SHIELDREGEN
Vehicle has shileding.
entity AuxiliaryXhair[MAX_AXH]
void CSQCVehicleSetup(entity own, int vehicle_id)
vector vehicle_aimturret(entity _vehic, vector _target, entity _turrret, string _tagname, float _pichlimit_min, float _pichlimit_max, float _rotlimit_min, float _rotlimit_max, float _aimspeed, float dt)
void vehicles_think(entity this)
const float DRAWFLAG_NORMAL
ERASEABLE float shortangle_f(float ang1, float ang2)
#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.
void vehicles_locktarget(entity this, float incr, float decr, float _lock_time)
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
const int VHF_ENERGYREGEN
Vehicles health regenerates.
float RadiusDamage(entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype,.entity weaponentity, entity directhitentity)
vector autocvar_hud_progressbar_vehicles_ammo2_color
float frame
primary framegroup animation (strength = 1 - lerpfrac - lerpfrac3 - lerpfrac4)
entity weaponentities[MAX_WEAPONSLOTS]
void UpdateAuxiliaryXhair(entity own, vector loc, vector clr, int axh_id)
float DPCONTENTS_LIQUIDSMASK
#define sound(e, c, s, v, a)
fields which are explicitly/manually set are marked with "M", fields set automatically are marked wit...
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)
float autocvar_cl_vehicles_crosshair_size