3 /* TUR_##id */ HELLION,
4 /* function */ t_hellion,
5 /* spawnflags */ TUR_FLAG_SPLASH | TUR_FLAG_FASTPROJ | TUR_FLAG_PLAYER | TUR_FLAG_MISSILE,
6 /* mins,maxs */ '-32 -32 0', '32 32 64',
7 /* model */ "base.md3",
8 /* head_model */ "hellion.md3",
9 /* netname */ "hellion",
10 /* fullname */ _("Hellion Missile Turret")
14 float autocvar_g_turrets_unit_hellion_shot_speed_gain;
15 float autocvar_g_turrets_unit_hellion_shot_speed_max;
17 void turret_hellion_missile_think()
23 self.nextthink = time + 0.05;
25 olddir = normalize(self.velocity);
27 if(self.max_health < time)
28 turret_projectile_explode();
30 // Enemy dead? just keep on the current heading then.
31 if ((self.enemy == world) || (self.enemy.deadflag != DEAD_NO))
34 // Make sure we dont return to tracking a respawned player
38 self.angles = vectoangles(self.velocity);
40 if ( (vlen(self.origin - self.owner.origin)) > (self.owner.shot_radius * 5) )
41 turret_projectile_explode();
44 self.velocity = olddir * min(vlen(self.velocity) * (autocvar_g_turrets_unit_hellion_shot_speed_gain), (autocvar_g_turrets_unit_hellion_shot_speed_max));
46 UpdateCSQCProjectile(self);
52 if (vlen(self.origin - self.enemy.origin) < self.owner.shot_radius * 0.2)
53 turret_projectile_explode();
55 // Predict enemy position
56 itime = vlen(self.enemy.origin - self.origin) / vlen(self.velocity);
57 pre_pos = self.enemy.origin + self.enemy.velocity * itime;
59 pre_pos = (pre_pos + self.enemy.origin) * 0.5;
61 // Find out the direction to that place
62 newdir = normalize(pre_pos - self.origin);
65 newdir = normalize(olddir + newdir * 0.35);
68 self.angles = vectoangles(self.velocity);
71 self.velocity = newdir * min(vlen(self.velocity) * (autocvar_g_turrets_unit_hellion_shot_speed_gain), (autocvar_g_turrets_unit_hellion_shot_speed_max));
74 self.think = turret_projectile_explode;
76 UpdateCSQCProjectile(self);
79 void spawnfunc_turret_hellion() { SELFPARAM(); if(!turret_initialize(TUR_HELLION)) remove(self); }
81 float t_hellion(float req)
89 if(self.tur_head.frame != 0)
90 self.tur_shotorg = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_fire"));
92 self.tur_shotorg = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_fire2"));
94 missile = turret_projectile(W_Sound("rocket_fire"), 6, 10, DEATH_TURRET_HELLION, PROJECTILE_ROCKET, FALSE, FALSE);
95 te_explosion (missile.origin);
96 missile.think = turret_hellion_missile_think;
97 missile.nextthink = time;
98 missile.flags = FL_PROJECTILE;
99 missile.max_health = time + 9;
100 missile.tur_aimpos = randomvec() * 128;
101 missile.missile_flags = MIF_SPLASH | MIF_PROXY | MIF_GUIDED_HEAT;
102 self.tur_head.frame += 1;
108 if (self.tur_head.frame != 0)
109 self.tur_head.frame += 1;
111 if (self.tur_head.frame >= 7)
112 self.tur_head.frame = 0;
122 self.aim_flags = TFL_AIM_SIMPLE;
123 self.target_select_flags = TFL_TARGETSELECT_LOS | TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMITS | TFL_TARGETSELECT_TEAMCHECK ;
124 self.firecheck_flags = TFL_FIRECHECK_DEAD | TFL_FIRECHECK_DISTANCES | TFL_FIRECHECK_TEAMCHECK | TFL_FIRECHECK_REFIRE | TFL_FIRECHECK_AFF | TFL_FIRECHECK_AMMO_OWN;
125 self.ammo_flags = TFL_AMMO_ROCKETS | TFL_AMMO_RECHARGE;
140 float t_hellion(float req)
158 #endif // REGISTER_TURRET