1 void spawnfunc_turret_mlrs();
2 void turret_mlrs_dinit();
3 void turret_mlrs_attack();
4 void turret_mlrs_rocket_explode();
5 void turret_mlrs_rocket_touch();
7 void turret_mlrs_postthink()
10 self.tur_head.frame = bound(0, 6 - floor(0.1 + self.ammo / self.shot_dmg), 6);
11 if(self.tur_head.frame < 0)
13 dprint("ammo:",ftos(self.ammo),"\n");
14 dprint("shot_dmg:",ftos(self.shot_dmg),"\n");
19 void turret_mlrs_attack()
23 turret_tag_fire_update();
25 sound (self, CHAN_WEAPON, "weapons/rocket_fire.wav", VOL_BASE, ATTN_NORM);
28 setsize (missile, '-3 -3 -3', '3 3 3'); // give it some size so it can be shot
29 setorigin(missile, self.tur_shotorg);
30 missile.classname = "mlrs_missile";
32 missile.bot_dodge = TRUE;
33 missile.bot_dodgerating = self.shot_dmg;
34 missile.takedamage = DAMAGE_NO;
35 missile.damageforcescale = 4;
36 missile.think = turret_mlrs_rocket_explode;
37 missile.nextthink = time + max(self.tur_impacttime,(self.shot_radius * 2) / self.shot_speed);
38 missile.solid = SOLID_BBOX;
39 missile.movetype = MOVETYPE_FLYMISSILE;
40 missile.velocity = normalize(self.tur_shotdir_updated + randomvec() * self.shot_spread) * self.shot_speed;
41 missile.angles = vectoangles(missile.velocity);
42 missile.touch = turret_mlrs_rocket_touch;
43 missile.flags = FL_PROJECTILE;
44 missile.solid = SOLID_BBOX;
45 missile.enemy = self.enemy;
47 CSQCProjectile(missile, TRUE, PROJECTILE_ROCKET, FALSE); // no cull, fly sound
49 te_explosion (missile.origin);
52 void turret_mlrs_rocket_touch()
54 if( (other == self.owner) || (other == self.owner.tur_head) )
59 turret_mlrs_rocket_explode();
62 void turret_mlrs_rocket_explode()
66 if(self.event_damage != SUB_Null)
68 self.event_damage = SUB_Null;
69 self.think = turret_mlrs_rocket_explode;
70 self.nextthink = time;
75 sound (self, CHAN_PROJECTILE, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);
76 org2 = findbetterlocation (self.origin, 16);
77 pointparticles(particleeffectnum("rocket_explode"), org2, '0 0 0', 1);
78 //w_deathtypestring = "dident escape the rocket barrage";
82 d = RadiusDamage (self, self.owner, self.owner.shot_dmg, 0, self.owner.shot_radius, world, self.owner.shot_force, DEATH_TURRET, world);
83 self.owner.tur_dbg_dmg_t_h = self.owner.tur_dbg_dmg_t_h + d; //self.owner.shot_dmg;
84 self.owner.tur_dbg_dmg_t_f = self.owner.tur_dbg_dmg_t_f + self.owner.shot_dmg;
86 RadiusDamage (self, self.owner, self.owner.shot_dmg, self.owner.shot_dmg * 0.5, self.owner.shot_radius, world, self.owner.shot_force, DEATH_TURRET, world);
89 // Target dead, Tell turret.
90 if ((self.enemy.deadflag != DEAD_NO) && (self.enemy == self.owner.enemy))
91 self.owner.enemy = world;
96 void turret_mlrs_dinit()
98 if (self.netname == "") self.netname = "MLRS turret";
100 self.turrcaps_flags = TFL_TURRCAPS_RADIUSDMG | TFL_TURRCAPS_MEDPROJ | TFL_TURRCAPS_PLAYERKILL;
101 self.ammo_flags = TFL_AMMO_ROCKETS | TFL_AMMO_RECHARGE;
102 self.aim_flags = TFL_AIM_LEAD | TFL_AIM_SHOTTIMECOMPENSATE;// | TFL_AIM_GROUND2;
104 if (turret_stdproc_init("mlrs_std",0,"models/turrets/base.md3","models/turrets/mlrs.md3") == 0)
110 self.damage_flags |= TFL_DMG_HEADSHAKE;
111 self.shoot_flags |= TFL_SHOOT_VOLLYALWAYS;
112 self.volly_counter = self.shot_volly;
114 if (!turret_tag_fire_update())
115 dprint("Warning: Turret ",self.classname, " faild to initialize md3 tags\n");
118 self.turret_firefunc = turret_mlrs_attack;
119 self.turret_postthink = turret_mlrs_postthink;
123 /*QUAKED turret_mlrs (0 .5 .8) ?
126 void spawnfunc_turret_mlrs()
128 precache_model ("models/turrets/mlrs.md3");
129 precache_model ("models/turrets/base.md3");
131 self.think = turret_mlrs_dinit;
132 self.nextthink = time + 0.5;