5 /* spawnflags */ ATTRIB(Hellion, spawnflags, int, TUR_FLAG_SPLASH | TUR_FLAG_FASTPROJ | TUR_FLAG_PLAYER | TUR_FLAG_MISSILE);
6 /* mins */ ATTRIB(Hellion, mins, vector, '-32 -32 0');
7 /* maxs */ ATTRIB(Hellion, maxs, vector, '32 32 64');
8 /* modelname */ ATTRIB(Hellion, mdl, string, "base.md3");
9 /* model */ ATTRIB(Hellion, model, string, strzone(strcat("models/turrets/", this.mdl)));
10 /* head_model */ ATTRIB(Hellion, head_model, string, strzone(strcat("models/turrets/", "hellion.md3")));
11 /* netname */ ATTRIB(Hellion, netname, string, "hellion");
12 /* fullname */ ATTRIB(Hellion, turret_name, string, _("Hellion Missile Turret"));
15 REGISTER_TURRET(HELLION, NEW(Hellion));
21 float autocvar_g_turrets_unit_hellion_shot_speed_gain;
22 float autocvar_g_turrets_unit_hellion_shot_speed_max;
24 void turret_hellion_missile_think()
30 self.nextthink = time + 0.05;
32 olddir = normalize(self.velocity);
34 if(self.max_health < time)
35 turret_projectile_explode();
37 // Enemy dead? just keep on the current heading then.
38 if ((self.enemy == world) || (self.enemy.deadflag != DEAD_NO))
41 // Make sure we dont return to tracking a respawned player
45 self.angles = vectoangles(self.velocity);
47 if ( (vlen(self.origin - self.owner.origin)) > (self.owner.shot_radius * 5) )
48 turret_projectile_explode();
51 self.velocity = olddir * min(vlen(self.velocity) * (autocvar_g_turrets_unit_hellion_shot_speed_gain), (autocvar_g_turrets_unit_hellion_shot_speed_max));
53 UpdateCSQCProjectile(self);
59 if (vlen(self.origin - self.enemy.origin) < self.owner.shot_radius * 0.2)
60 turret_projectile_explode();
62 // Predict enemy position
63 itime = vlen(self.enemy.origin - self.origin) / vlen(self.velocity);
64 pre_pos = self.enemy.origin + self.enemy.velocity * itime;
66 pre_pos = (pre_pos + self.enemy.origin) * 0.5;
68 // Find out the direction to that place
69 newdir = normalize(pre_pos - self.origin);
72 newdir = normalize(olddir + newdir * 0.35);
75 self.angles = vectoangles(self.velocity);
78 self.velocity = newdir * min(vlen(self.velocity) * (autocvar_g_turrets_unit_hellion_shot_speed_gain), (autocvar_g_turrets_unit_hellion_shot_speed_max));
81 self.think = turret_projectile_explode;
83 UpdateCSQCProjectile(self);
86 void spawnfunc_turret_hellion() { SELFPARAM(); if(!turret_initialize(TUR_HELLION.m_id)) remove(self); }
88 METHOD(Hellion, tr_attack, void(Hellion thistur))
92 if(self.tur_head.frame != 0)
93 self.tur_shotorg = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_fire"));
95 self.tur_shotorg = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_fire2"));
97 missile = turret_projectile(SND(ROCKET_FIRE), 6, 10, DEATH_TURRET_HELLION, PROJECTILE_ROCKET, FALSE, FALSE);
98 te_explosion (missile.origin);
99 missile.think = turret_hellion_missile_think;
100 missile.nextthink = time;
101 missile.flags = FL_PROJECTILE;
102 missile.max_health = time + 9;
103 missile.tur_aimpos = randomvec() * 128;
104 missile.missile_flags = MIF_SPLASH | MIF_PROXY | MIF_GUIDED_HEAT;
105 self.tur_head.frame += 1;
107 METHOD(Hellion, tr_think, bool(Hellion thistur))
109 if (self.tur_head.frame != 0)
110 self.tur_head.frame += 1;
112 if (self.tur_head.frame >= 7)
113 self.tur_head.frame = 0;
117 METHOD(Hellion, tr_death, bool(Hellion thistur))
121 METHOD(Hellion, tr_setup, bool(Hellion thistur))
123 self.aim_flags = TFL_AIM_SIMPLE;
124 self.target_select_flags = TFL_TARGETSELECT_LOS | TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMITS | TFL_TARGETSELECT_TEAMCHECK ;
125 self.firecheck_flags = TFL_FIRECHECK_DEAD | TFL_FIRECHECK_DISTANCES | TFL_FIRECHECK_TEAMCHECK | TFL_FIRECHECK_REFIRE | TFL_FIRECHECK_AFF | TFL_FIRECHECK_AMMO_OWN;
126 self.ammo_flags = TFL_AMMO_ROCKETS | TFL_AMMO_RECHARGE;
130 METHOD(Hellion, tr_precache, bool(Hellion thistur))
137 METHOD(Hellion, tr_setup, bool(Hellion thistur))
141 METHOD(Hellion, tr_precache, bool(Hellion thistur))
147 #endif // REGISTER_TURRET