2 #define RAPTOR_MIN '-80 -80 0'
3 #define RAPTOR_MAX '80 80 70'
5 float autocvar_g_vehicle_raptor_respawntime;
7 float autocvar_g_vehicle_raptor_movestyle;
8 float autocvar_g_vehicle_raptor_turnspeed;
9 float autocvar_g_vehicle_raptor_pitchspeed;
10 float autocvar_g_vehicle_raptor_pitchlimit;
12 float autocvar_g_vehicle_raptor_speed_forward;
13 float autocvar_g_vehicle_raptor_speed_strafe;
14 float autocvar_g_vehicle_raptor_speed_up;
15 float autocvar_g_vehicle_raptor_speed_down;
16 float autocvar_g_vehicle_raptor_friction;
18 float autocvar_g_vehicle_raptor_bomblets;
19 float autocvar_g_vehicle_raptor_bomblet_alt;
20 float autocvar_g_vehicle_raptor_bomblet_time;
21 float autocvar_g_vehicle_raptor_bomblet_damage;
22 float autocvar_g_vehicle_raptor_bomblet_spread;
23 float autocvar_g_vehicle_raptor_bomblet_edgedamage;
24 float autocvar_g_vehicle_raptor_bomblet_radius;
25 float autocvar_g_vehicle_raptor_bomblet_force;
26 float autocvar_g_vehicle_raptor_bomblet_explode_delay;
27 float autocvar_g_vehicle_raptor_bombs_refire;
29 float autocvar_g_vehicle_raptor_cannon_turnspeed;
30 float autocvar_g_vehicle_raptor_cannon_turnlimit;
31 float autocvar_g_vehicle_raptor_cannon_pitchlimit_up;
32 float autocvar_g_vehicle_raptor_cannon_pitchlimit_down;
34 float autocvar_g_vehicle_raptor_cannon_locktarget;
35 float autocvar_g_vehicle_raptor_cannon_locking_time;
36 float autocvar_g_vehicle_raptor_cannon_locking_releasetime;
37 float autocvar_g_vehicle_raptor_cannon_locked_time;
38 float autocvar_g_vehicle_raptor_cannon_predicttarget;
40 float autocvar_g_vehicle_raptor_cannon_cost;
41 float autocvar_g_vehicle_raptor_cannon_damage;
42 float autocvar_g_vehicle_raptor_cannon_radius;
43 float autocvar_g_vehicle_raptor_cannon_refire;
44 float autocvar_g_vehicle_raptor_cannon_speed;
45 float autocvar_g_vehicle_raptor_cannon_spread;
46 float autocvar_g_vehicle_raptor_cannon_force;
48 float autocvar_g_vehicle_raptor_energy;
49 float autocvar_g_vehicle_raptor_energy_regen;
50 float autocvar_g_vehicle_raptor_energy_regen_pause;
52 float autocvar_g_vehicle_raptor_health;
53 float autocvar_g_vehicle_raptor_health_regen;
54 float autocvar_g_vehicle_raptor_health_regen_pause;
56 float autocvar_g_vehicle_raptor_shield;
57 float autocvar_g_vehicle_raptor_shield_regen;
58 float autocvar_g_vehicle_raptor_shield_regen_pause;
60 float autocvar_g_vehicle_raptor_bouncefactor;
61 float autocvar_g_vehicle_raptor_bouncestop;
62 vector autocvar_g_vehicle_raptor_bouncepain;
66 float raptor_takeoff();
71 float raptor_altitude(float amax)
73 tracebox(self.origin, self.mins, self.maxs, self.origin - ('0 0 1' * amax), MOVE_WORLDONLY, self);
74 return vlen(self.origin - trace_endpos);
78 void raptor_bomblet_boom()
80 RadiusDamage (self, self.realowner, autocvar_g_vehicle_raptor_bomblet_damage,
81 autocvar_g_vehicle_raptor_bomblet_edgedamage,
82 autocvar_g_vehicle_raptor_bomblet_radius, world,
83 autocvar_g_vehicle_raptor_bomblet_force, DEATH_RAPTOR_BOMB, world);
87 void raptor_bomblet_touch()
89 if(other == self.owner)
93 self.think = raptor_bomblet_boom;
94 self.nextthink = time + random() * autocvar_g_vehicle_raptor_bomblet_explode_delay;
97 void raptor_bomb_burst()
100 if(autocvar_g_vehicle_raptor_bomblet_alt)
102 self.nextthink = time;
103 traceline(self.origin, self.origin + (normalize(self.velocity) * autocvar_g_vehicle_raptor_bomblet_alt), MOVE_NORMAL, self);
104 if((trace_fraction == 1.0) || (vlen(self.origin - self.owner.origin) < autocvar_g_vehicle_raptor_bomblet_radius))
106 UpdateCSQCProjectile(self);
114 Damage_DamageInfo(self.origin, 0, 0, 0, '0 0 0', DEATH_RAPTOR_BOMB_SPLIT, self);
116 for(i = 0; i < autocvar_g_vehicle_raptor_bomblets; ++i)
119 setorigin(bomblet, self.origin);
121 bomblet.movetype = MOVETYPE_TOSS;
122 bomblet.touch = raptor_bomblet_touch;
123 bomblet.think = raptor_bomblet_boom;
124 bomblet.nextthink = time + 5;
125 bomblet.owner = self.owner;
126 bomblet.realowner = self.realowner;
127 bomblet.velocity = normalize(normalize(self.velocity) + (randomvec() * autocvar_g_vehicle_raptor_bomblet_spread)) * vlen(self.velocity);
129 PROJECTILE_MAKETRIGGER(bomblet);
130 CSQCProjectile(bomblet, TRUE, PROJECTILE_RAPTORBOMBLET, TRUE);
136 void raptor_bombdrop()
138 entity bomb_1, bomb_2;
143 setorigin(bomb_1, gettaginfo(self, gettagindex(self, "bombmount_left")));
144 setorigin(bomb_2, gettaginfo(self, gettagindex(self, "bombmount_right")));
146 bomb_1.movetype = bomb_2.movetype = MOVETYPE_BOUNCE;
147 bomb_1.velocity = bomb_2.velocity = self.velocity;
148 bomb_1.touch = bomb_2.touch = raptor_bomb_burst;
149 bomb_1.think = bomb_2.think = raptor_bomb_burst;
150 bomb_1.cnt = bomb_2.cnt = time + 10;
152 if(autocvar_g_vehicle_raptor_bomblet_alt)
153 bomb_1.nextthink = bomb_2.nextthink = time;
155 bomb_1.nextthink = bomb_2.nextthink = time + autocvar_g_vehicle_raptor_bomblet_time;
157 bomb_1.owner = bomb_2.owner = self;
158 bomb_1.realowner = bomb_2.realowner = self.owner;
159 bomb_1.solid = bomb_2.solid = SOLID_BBOX;
160 bomb_1.gravity = bomb_2.gravity = 1;
162 PROJECTILE_MAKETRIGGER(bomb_1);
163 PROJECTILE_MAKETRIGGER(bomb_2);
165 CSQCProjectile(bomb_1, TRUE, PROJECTILE_RAPTORBOMB, TRUE);
166 CSQCProjectile(bomb_2, TRUE, PROJECTILE_RAPTORBOMB, TRUE);
170 void raptor_fire_cannon(entity gun, string tagname)
172 vehicles_projectile("raptor_cannon_muzzleflash", "weapons/lasergun_fire.wav",
173 gettaginfo(gun, gettagindex(gun, tagname)), normalize(v_forward + randomvec() * autocvar_g_vehicle_raptor_cannon_spread) * autocvar_g_vehicle_raptor_cannon_speed,
174 autocvar_g_vehicle_raptor_cannon_damage, autocvar_g_vehicle_raptor_cannon_radius, autocvar_g_vehicle_raptor_cannon_force, 0,
175 DEATH_RAPTOR_CANNON, PROJECTILE_RAPTORCANNON, 0, TRUE, TRUE);
184 self.owner.PlayerPhysplug = raptor_takeoff;
185 self.movetype = MOVETYPE_BOUNCEMISSILE;
186 self.solid = SOLID_SLIDEBOX;
187 self.owner.vehicle_health = (self.vehicle_health / autocvar_g_vehicle_raptor_health) * 100;
188 self.owner.vehicle_shield = (self.vehicle_shield / autocvar_g_vehicle_raptor_shield) * 100;
189 self.velocity_z = 1; // Nudge upwards to takeoff sequense can work.
190 self.tur_head.exteriormodeltoclient = self.owner;
192 self.delay = time + autocvar_g_vehicle_raptor_bombs_refire;
195 if(self.owner.flagcarried)
196 setorigin(self.owner.flagcarried, '-20 0 96');
204 hgt = raptor_altitude(512);
205 self.velocity = (self.velocity * 0.9) + ('0 0 -1800' * (hgt / 256) * sys_frametime);
206 self.angles_x *= 0.95;
207 self.angles_z *= 0.95;
211 self.frame = (hgt / 128) * 25;
213 self.bomb1.gun1.avelocity_y = 90 + ((self.frame / 25) * 2000);
214 self.bomb1.gun2.avelocity_y = -self.bomb1.gun1.avelocity_y;
218 self.movetype = MOVETYPE_TOSS;
219 self.think = raptor_think;
223 self.nextthink = time;
226 void raptor_exit(float eject)
229 self.tur_head.exteriormodeltoclient = world;
231 if(self.deadflag == DEAD_NO)
233 self.think = raptor_land;
234 self.nextthink = time;
240 makevectors(self.angles);
243 spot = self.origin + v_forward * 100 + '0 0 64';
244 spot = vehicles_findgoodexit(spot);
245 setorigin(self.owner , spot);
246 self.owner.velocity = (v_up + v_forward * 0.25) * 750;
247 self.owner.oldvelocity = self.owner.velocity;
251 self.owner.velocity = normalize(self.velocity) * autocvar_sv_maxairspeed;
252 self.owner.oldvelocity = self.owner.velocity;
253 spot = self.origin - v_forward * 200 + '0 0 64';
254 spot = vehicles_findgoodexit(spot);
255 setorigin(self.owner , spot);
257 antilag_clear(self.owner);
261 float raptor_takeoff()
263 entity player, raptor;
266 raptor = self.vehicle;
268 if(self.sound_nexttime < time)
270 self.sound_nexttime = time + 7.955812; //soundlength("vehicles/raptor_fly.wav");
271 sound (self, CH_TRIGGER_SINGLE, "vehicles/raptor_speed.wav", VOL_VEHICLEENGINE, ATTN_NORM);
275 if(raptor.frame < 25)
277 raptor.frame += 0.25;
278 raptor.velocity_z = min(raptor.velocity_z * 1.5, 256);
279 self.bomb1.gun1.avelocity_y = 90 + ((raptor.frame / 25) * 25000);
280 self.bomb1.gun2.avelocity_y = -self.bomb1.gun1.avelocity_y;
281 player.BUTTON_ATCK = player.BUTTON_ATCK2 = player.BUTTON_CROUCH = 0;
283 setorigin(player, raptor.origin + '0 0 32');
286 player.PlayerPhysplug = raptor_frame;
288 if(self.vehicle_flags & VHF_SHIELDREGEN)
289 vehicles_regen(dmg_time, vehicle_shield, autocvar_g_vehicle_raptor_shield, autocvar_g_vehicle_raptor_shield_regen_pause, autocvar_g_vehicle_raptor_shield_regen, frametime);
291 if(self.vehicle_flags & VHF_HEALTHREGEN)
292 vehicles_regen(dmg_time, vehicle_health, autocvar_g_vehicle_raptor_health, autocvar_g_vehicle_raptor_health_regen_pause, autocvar_g_vehicle_raptor_health_regen, frametime);
294 if(self.vehicle_flags & VHF_ENERGYREGEN)
295 vehicles_regen(cnt, vehicle_energy, autocvar_g_vehicle_raptor_energy, autocvar_g_vehicle_raptor_energy_regen_pause, autocvar_g_vehicle_raptor_energy_regen, frametime);
298 raptor.bomb1.alpha = raptor.bomb2.alpha = (time - raptor.lip) / (raptor.delay - raptor.lip);
299 player.vehicle_reload2 = bound(0, raptor.bomb1.alpha * 100, 100);
301 VEHICLE_UPDATE_PLAYER(health, raptor);
302 VEHICLE_UPDATE_PLAYER(energy, raptor);
303 if(self.vehicle_flags & VHF_HASSHIELD)
304 VEHICLE_UPDATE_PLAYER(shield, raptor);
306 player.BUTTON_ATCK = player.BUTTON_ATCK2 = player.BUTTON_CROUCH = 0;
313 entity player, raptor;
317 if(intermission_running)
321 raptor = self.vehicle;
323 vehicles_painframe();
325 ftmp = vlen(self.velocity);
326 if(ftmp > autocvar_g_vehicle_raptor_speed_forward)
329 ftmp = ftmp / autocvar_g_vehicle_raptor_speed_forward;
332 if(self.sound_nexttime < time)
334 self.sound_nexttime = time + 7.955812;
335 //sound (self.tur_head, CH_TRIGGER_SINGLE, "vehicles/raptor_fly.wav", 1 - ftmp, ATTN_NORM );
336 sound (self, CH_TRIGGER_SINGLE, "vehicles/raptor_speed.wav", 1, ATTN_NORM);
340 else if(fabs(ftmp - self.wait) > 0.2)
342 sound (self.tur_head, CH_TRIGGER_SINGLE, "", 1 - ftmp, ATTN_NORM );
343 sound (self, CH_TRIGGER_SINGLE, "", ftmp, ATTN_NORM);
348 if(raptor.deadflag != DEAD_NO)
351 player.BUTTON_ATCK = player.BUTTON_ATCK2 = 0;
354 crosshair_trace(player);
357 vang = raptor.angles;
358 df = vectoangles(normalize(trace_endpos - self.origin + '0 0 32'));
361 if(df_x > 180) df_x -= 360;
362 if(df_x < -180) df_x += 360;
363 if(df_y > 180) df_y -= 360;
364 if(df_y < -180) df_y += 360;
366 ftmp = shortangle_f(player.v_angle_y - vang_y, vang_y);
367 if(ftmp > 180) ftmp -= 360; if(ftmp < -180) ftmp += 360;
368 raptor.avelocity_y = bound(-autocvar_g_vehicle_raptor_turnspeed, ftmp + raptor.avelocity_y * 0.9, autocvar_g_vehicle_raptor_turnspeed);
372 if(player.movement_x > 0 && vang_x < autocvar_g_vehicle_raptor_pitchlimit) ftmp = 5;
373 else if(player.movement_x < 0 && vang_x > -autocvar_g_vehicle_raptor_pitchlimit) ftmp = -20;
375 df_x = bound(-autocvar_g_vehicle_raptor_pitchlimit, df_x , autocvar_g_vehicle_raptor_pitchlimit);
376 ftmp = vang_x - bound(-autocvar_g_vehicle_raptor_pitchlimit, df_x + ftmp, autocvar_g_vehicle_raptor_pitchlimit);
377 raptor.avelocity_x = bound(-autocvar_g_vehicle_raptor_pitchspeed, ftmp + raptor.avelocity_x * 0.9, autocvar_g_vehicle_raptor_pitchspeed);
379 raptor.angles_x = anglemods(raptor.angles_x);
380 raptor.angles_y = anglemods(raptor.angles_y);
381 raptor.angles_z = anglemods(raptor.angles_z);
383 if(autocvar_g_vehicle_raptor_movestyle == 1)
384 makevectors('0 1 0' * raptor.angles_y);
386 makevectors(player.v_angle);
388 df = raptor.velocity * -autocvar_g_vehicle_raptor_friction;
390 if(player.movement_x != 0)
392 if(player.movement_x > 0)
393 df += v_forward * autocvar_g_vehicle_raptor_speed_forward;
394 else if(player.movement_x < 0)
395 df -= v_forward * autocvar_g_vehicle_raptor_speed_forward;
398 if(player.movement_y != 0)
400 if(player.movement_y < 0)
401 df -= v_right * autocvar_g_vehicle_raptor_speed_strafe;
402 else if(player.movement_y > 0)
403 df += v_right * autocvar_g_vehicle_raptor_speed_strafe;
405 raptor.angles_z = bound(-30,raptor.angles_z + (player.movement_y / autocvar_g_vehicle_raptor_speed_strafe),30);
409 raptor.angles_z *= 0.95;
410 if(raptor.angles_z >= -1 && raptor.angles_z <= -1)
414 if(player.BUTTON_CROUCH)
415 df -= v_up * autocvar_g_vehicle_raptor_speed_down;
416 else if (player.BUTTON_JUMP)
417 df += v_up * autocvar_g_vehicle_raptor_speed_up;
419 raptor.velocity += df * frametime;
420 player.velocity = player.movement = raptor.velocity;
421 setorigin(player, raptor.origin + '0 0 32');
424 // Target lock & predict
425 if(autocvar_g_vehicle_raptor_cannon_locktarget)
428 vehicles_locktarget((1 / autocvar_g_vehicle_raptor_cannon_locking_time) * frametime,
429 (1 / autocvar_g_vehicle_raptor_cannon_locking_releasetime) * frametime,
430 autocvar_g_vehicle_raptor_cannon_locked_time);
432 if(self.lock_target != world)
433 if(autocvar_g_vehicle_raptor_cannon_predicttarget)
434 if(self.lock_strength == 1)
436 float i, distance, impact_time;
438 vf = real_origin(raptor.lock_target);
440 for(i = 0; i < 4; ++i)
442 distance = vlen(ad - raptor.origin);
443 impact_time = distance / autocvar_g_vehicle_raptor_cannon_speed;
444 ad = vf + raptor.lock_target.velocity * impact_time;
451 if(raptor.lock_strength == 1)
452 UpdateAuxiliaryXhair(player, real_origin(raptor.lock_target), '1 0 0', 1);
453 else if(self.lock_strength > 0.5)
454 UpdateAuxiliaryXhair(player, real_origin(raptor.lock_target), '0 1 0', 1);
455 else if(self.lock_strength < 0.5)
456 UpdateAuxiliaryXhair(player, real_origin(raptor.lock_target), '0 0 1', 1);
461 ftmp2 = autocvar_g_vehicle_raptor_cannon_turnspeed * frametime;
465 df = gettaginfo(raptor.gun1, gettagindex(raptor.gun1, "fire1"));
468 df = vectoangles(normalize(trace_endpos - df)); // Find the direction & angle
469 df = AnglesTransform_ToAngles(AnglesTransform_LeftDivide(AnglesTransform_FromAngles(raptor.angles), AnglesTransform_FromAngles(df))) - raptor.gun1.angles;
470 df = shortangle_vxy(df, raptor.gun1.angles);
473 df_x = bound(ftmp, df_x, ftmp2);
474 df_y = bound(ftmp, df_y, ftmp2);
476 raptor.gun1.angles_x = bound(-autocvar_g_vehicle_raptor_cannon_pitchlimit_down, df_x + raptor.gun1.angles_x, autocvar_g_vehicle_raptor_cannon_pitchlimit_up);
477 raptor.gun1.angles_y = bound(-autocvar_g_vehicle_raptor_cannon_turnlimit, df_y + raptor.gun1.angles_y, autocvar_g_vehicle_raptor_cannon_turnlimit);
480 df = gettaginfo(raptor.gun2, gettagindex(raptor.gun2, "fire1"));
483 df = vectoangles(normalize(trace_endpos - df)); // Find the direction & angle
484 df = AnglesTransform_ToAngles(AnglesTransform_LeftDivide(AnglesTransform_FromAngles(raptor.angles), AnglesTransform_FromAngles(df))) - raptor.gun2.angles;
485 df = shortangle_vxy(df, raptor.gun2.angles);
488 df_x = bound(ftmp, df_x, ftmp2);
489 df_y = bound(ftmp, df_y, ftmp2);
491 raptor.gun2.angles_x = bound(-autocvar_g_vehicle_raptor_cannon_pitchlimit_down, df_x + raptor.gun2.angles_x, autocvar_g_vehicle_raptor_cannon_pitchlimit_up);
492 raptor.gun2.angles_y = bound(-autocvar_g_vehicle_raptor_cannon_turnlimit, df_y + raptor.gun2.angles_y, autocvar_g_vehicle_raptor_cannon_turnlimit);
496 v_forward = vf * 0.5;
497 traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, raptor);
498 UpdateAuxiliaryXhair(player, trace_endpos, '0 1 0', 0);
501 if(player.BUTTON_ATCK)
502 if(raptor.attack_finished_single <= time)
503 if(raptor.vehicle_energy > autocvar_g_vehicle_raptor_cannon_cost)
505 raptor.misc_bulletcounter += 1;
506 raptor.attack_finished_single = time + autocvar_g_vehicle_raptor_cannon_refire;
507 if(raptor.misc_bulletcounter <= 2)
508 raptor_fire_cannon(self.gun1, "fire1");
509 else if(raptor.misc_bulletcounter == 3)
510 raptor_fire_cannon(self.gun2, "fire1");
513 raptor.attack_finished_single = time + autocvar_g_vehicle_raptor_cannon_refire * 2;
514 raptor_fire_cannon(self.gun2, "fire1");
515 raptor.misc_bulletcounter = 0;
517 raptor.vehicle_energy -= autocvar_g_vehicle_raptor_cannon_cost;
521 if(self.vehicle_flags & VHF_SHIELDREGEN)
522 vehicles_regen(dmg_time, vehicle_shield, autocvar_g_vehicle_raptor_shield, autocvar_g_vehicle_raptor_shield_regen_pause, autocvar_g_vehicle_raptor_shield_regen, frametime);
524 if(self.vehicle_flags & VHF_HEALTHREGEN)
525 vehicles_regen(dmg_time, vehicle_health, autocvar_g_vehicle_raptor_health, autocvar_g_vehicle_raptor_health_regen_pause, autocvar_g_vehicle_raptor_health_regen, frametime);
527 if(self.vehicle_flags & VHF_ENERGYREGEN)
528 vehicles_regen(cnt, vehicle_energy, autocvar_g_vehicle_raptor_energy, autocvar_g_vehicle_raptor_energy_regen_pause, autocvar_g_vehicle_raptor_energy_regen, frametime);
531 if(time > raptor.delay)
532 if(player.BUTTON_ATCK2)
535 raptor.delay = time + autocvar_g_vehicle_raptor_bombs_refire;
539 raptor.bomb1.alpha = raptor.bomb2.alpha = (time - raptor.lip) / (raptor.delay - raptor.lip);
540 player.vehicle_reload2 = bound(0, raptor.bomb1.alpha * 100, 100);
542 VEHICLE_UPDATE_PLAYER(health, raptor);
543 VEHICLE_UPDATE_PLAYER(energy, raptor);
544 if(self.vehicle_flags & VHF_HASSHIELD)
545 VEHICLE_UPDATE_PLAYER(shield, raptor);
547 player.BUTTON_ATCK = player.BUTTON_ATCK2 = player.BUTTON_CROUCH = 0;
555 self.deadflag = DEAD_DEAD;
556 self.vehicle_exit(VHEF_NORMAL);
557 RadiusDamage (self, self, 250, 15, 250, world, 250, DEATH_WAKIBLOWUP, world);
560 self.movetype = MOVETYPE_NONE;
561 self.effects = EF_NODRAW;
562 self.colormod = '0 0 0';
563 self.avelocity = '0 0 0';
564 self.velocity = '0 0 0';
566 setorigin(self, self.pos1);
567 self.touch = SUB_Null;
571 void raptor_diethink()
575 sound (self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);
576 pointparticles(particleeffectnum("explosion_small"), randomvec() * 80 + (self.origin + '0 0 100'), '0 0 0', 1);
578 self.nextthink = time + 0.1;
584 self.event_damage = SUB_Null;
585 self.solid = SOLID_CORPSE;
586 self.takedamage = DAMAGE_NO;
587 self.deadflag = DEAD_DYING;
588 self.movetype = MOVETYPE_BOUNCE;
589 self.think = raptor_diethink;
590 self.nextthink = time;
592 pointparticles(particleeffectnum("explosion_medium"), findbetterlocation (self.origin, 16), '0 0 0', 1);
594 self.velocity_z += 600;
596 self.avelocity = '0 0.5 1' * (random() * 400);
597 self.avelocity -= '0 0.5 1' * (random() * 400);
599 self.colormod = '-0.5 -0.5 -0.5';
600 self.touch = raptor_blowup;
605 if(autocvar_g_vehicle_raptor_bouncepain_x)
606 vehilces_impact(autocvar_g_vehicle_raptor_bouncepain_x, autocvar_g_vehicle_raptor_bouncepain_y, autocvar_g_vehicle_raptor_bouncepain_z);
612 self.vehicle_health = autocvar_g_vehicle_raptor_health;
613 self.vehicle_shield = autocvar_g_vehicle_raptor_shield;
614 self.movetype = MOVETYPE_TOSS;
615 self.solid = SOLID_SLIDEBOX;
616 self.vehicle_energy = 1;
618 self.bomb1.gun1.avelocity_y = 90;
619 self.bomb1.gun2.avelocity_y = -90;
621 setsize(self, RAPTOR_MIN, RAPTOR_MAX );
624 self.bouncefactor = autocvar_g_vehicle_raptor_bouncefactor;
625 self.bouncestop = autocvar_g_vehicle_raptor_bouncestop;
626 self.vehicle_impact = raptor_impact;
629 // If we dont do this ever now and then, the raptors rotors
630 // stop working, presumably due to angle overflow. cute.
631 void raptor_rotor_anglefix()
633 self.gun1.angles_y = anglemods(self.gun1.angles_y);
634 self.gun2.angles_y = anglemods(self.gun2.angles_y);
635 self.nextthink = time + 15;
643 if not (vehicle_initialize(
645 "models/vehicles/raptor.dpm",
647 "models/vehicles/raptor_cockpit.dpm",
648 "", "tag_hud", "tag_camera",
650 RAPTOR_MIN, RAPTOR_MAX,
652 raptor_spawn, autocvar_g_vehicle_raptor_respawntime,
654 raptor_enter, raptor_exit,
655 raptor_die, raptor_think,
662 //FIXME: Camera is in a bad place in HUD model.
663 //setorigin(self.vehicle_viewport, '25 0 5');
667 self.bomb1 = spawn();
668 self.bomb2 = spawn();
672 setmodel(self.bomb1,"models/vehicles/clusterbomb_folded.md3");
673 setmodel(self.bomb2,"models/vehicles/clusterbomb_folded.md3");
674 setmodel(self.gun1, "models/vehicles/raptor_gun.dpm");
675 setmodel(self.gun2, "models/vehicles/raptor_gun.dpm");
676 setmodel(self.tur_head, "models/vehicles/raptor_body.dpm");
678 setattachment(self.bomb1, self,"bombmount_left");
679 setattachment(self.bomb2, self,"bombmount_right");
680 setattachment(self.tur_head, self,"root");
683 // FIXME Guns mounts to angled bones
684 self.bomb1.angles = self.angles;
685 self.angles = '0 0 0';
686 // This messes up gun-aim, so work arround it.
687 //setattachment(self.gun1, self, "gunmount_left");
688 ofs = gettaginfo(self, gettagindex(self, "gunmount_left"));
690 setattachment(self.gun1, self, "");
691 setorigin(self.gun1, ofs);
693 //setattachment(self.gun2, self, "gunmount_right");
694 ofs = gettaginfo(self, gettagindex(self, "gunmount_right"));
696 setattachment(self.gun2, self, "");
697 setorigin(self.gun2, ofs);
699 self.angles = self.bomb1.angles;
700 self.bomb1.angles = '0 0 0';
703 spinner.owner = self;
704 setmodel(spinner,"models/vehicles/spinner.dpm");
705 setattachment(spinner, self, "engine_left");
706 spinner.movetype = MOVETYPE_NOCLIP;
707 spinner.avelocity = '0 90 0';
708 self.bomb1.gun1 = spinner;
711 spinner.owner = self;
712 setmodel(spinner,"models/vehicles/spinner.dpm");
713 setattachment(spinner, self, "engine_right");
714 spinner.movetype = MOVETYPE_NOCLIP;
715 spinner.avelocity = '0 -90 0';
716 self.bomb1.gun2 = spinner;
719 self.bomb1.think = raptor_rotor_anglefix;
720 self.bomb1.nextthink = time;
725 void spawnfunc_vehicle_raptor()
727 vehicles_configcheck("vehicle_raptor.cfg", autocvar_g_vehicle_raptor_health);
729 self.vehicle_flags |= VHF_DMGSHAKE;
730 self.vehicle_flags |= VHF_DMGROLL;
732 if(autocvar_g_vehicle_raptor_shield)
733 self.vehicle_flags |= VHF_HASSHIELD;
735 if(autocvar_g_vehicle_raptor_shield_regen)
736 self.vehicle_flags |= VHF_SHIELDREGEN;
738 if(autocvar_g_vehicle_raptor_health_regen)
739 self.vehicle_flags |= VHF_HEALTHREGEN;
741 if(autocvar_g_vehicle_raptor_energy_regen)
742 self.vehicle_flags |= VHF_ENERGYREGEN;
744 precache_model ("models/vehicles/raptor.dpm");
745 precache_model ("models/vehicles/raptor_gun.dpm");
746 precache_model ("models/vehicles/spinner.dpm");
747 precache_model ("models/vehicles/raptor_cockpit.dpm");
748 //precache_model ("models/vehicles/clusterbomb.md3");
749 precache_model ("models/vehicles/clusterbomb_folded.md3");
750 precache_model ("models/vehicles/raptor_body.dpm");
752 precache_sound ("vehicles/raptor_fly.wav");
753 precache_sound ("vehicles/raptor_speed.wav");
755 self.think = raptor_dinit;
758 self.nextthink = time + 0.5;
760 self.nextthink = time + (autocvar_g_vehicles_delayspawn ? autocvar_g_vehicle_raptor_respawntime + (random() * autocvar_g_vehicles_delayspawn_jitter) : 0.5);