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));
17 CLASS(HellionAttack, PortoLaunch)
18 /* flags */ ATTRIB(HellionAttack, spawnflags, int, WEP_TYPE_OTHER);
19 /* impulse */ ATTRIB(HellionAttack, impulse, int, 9);
20 /* refname */ ATTRIB(HellionAttack, netname, string, "turret_hellion");
21 /* wepname */ ATTRIB(HellionAttack, message, string, _("Hellion"));
22 ENDCLASS(HellionAttack)
23 REGISTER_WEAPON(HELLION, NEW(HellionAttack));
29 void turret_initparams(entity);
30 void turret_hellion_missile_think();
31 METHOD(HellionAttack, wr_think, bool(entity thiswep, bool fire1, bool fire2)) {
33 bool isPlayer = IS_PLAYER(self);
35 if (!isPlayer || weapon_prepareattack(false, WEP_CVAR_PRI(electro, refire))) {
37 turret_initparams(self);
38 W_SetupShot_Dir(self, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
39 self.tur_shotdir_updated = w_shotdir;
40 self.tur_shotorg = w_shotorg;
42 self.shot_radius = 500;
43 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
46 if (self.tur_head.frame != 0)
47 self.tur_shotorg = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_fire"));
49 self.tur_shotorg = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_fire2"));
52 entity missile = turret_projectile(SND(ROCKET_FIRE), 6, 10, DEATH_TURRET_HELLION, PROJECTILE_ROCKET, FALSE, FALSE);
53 te_explosion (missile.origin);
54 missile.think = turret_hellion_missile_think;
55 missile.nextthink = time;
56 missile.flags = FL_PROJECTILE;
57 missile.max_health = time + 9;
58 missile.tur_aimpos = randomvec() * 128;
59 missile.missile_flags = MIF_SPLASH | MIF_PROXY | MIF_GUIDED_HEAT;
60 if (!isPlayer) self.tur_head.frame += 1;
65 float autocvar_g_turrets_unit_hellion_shot_speed_gain;
66 float autocvar_g_turrets_unit_hellion_shot_speed_max;
68 void turret_hellion_missile_think()
74 self.nextthink = time + 0.05;
76 olddir = normalize(self.velocity);
78 if(self.max_health < time)
79 turret_projectile_explode();
81 // Enemy dead? just keep on the current heading then.
82 if ((self.enemy == world) || (self.enemy.deadflag != DEAD_NO))
85 // Make sure we dont return to tracking a respawned player
89 self.angles = vectoangles(self.velocity);
91 if ( (vlen(self.origin - self.owner.origin)) > (self.owner.shot_radius * 5) )
92 turret_projectile_explode();
95 self.velocity = olddir * min(vlen(self.velocity) * (autocvar_g_turrets_unit_hellion_shot_speed_gain), (autocvar_g_turrets_unit_hellion_shot_speed_max));
97 UpdateCSQCProjectile(self);
103 if (vlen(self.origin - self.enemy.origin) < self.owner.shot_radius * 0.2)
104 turret_projectile_explode();
106 // Predict enemy position
107 itime = vlen(self.enemy.origin - self.origin) / vlen(self.velocity);
108 pre_pos = self.enemy.origin + self.enemy.velocity * itime;
110 pre_pos = (pre_pos + self.enemy.origin) * 0.5;
112 // Find out the direction to that place
113 newdir = normalize(pre_pos - self.origin);
116 newdir = normalize(olddir + newdir * 0.35);
119 self.angles = vectoangles(self.velocity);
122 self.velocity = newdir * min(vlen(self.velocity) * (autocvar_g_turrets_unit_hellion_shot_speed_gain), (autocvar_g_turrets_unit_hellion_shot_speed_max));
125 self.think = turret_projectile_explode;
127 UpdateCSQCProjectile(self);
130 void spawnfunc_turret_hellion() { SELFPARAM(); if(!turret_initialize(TUR_HELLION.m_id)) remove(self); }
132 METHOD(Hellion, tr_attack, void(Hellion thistur))
134 Weapon wep = WEP_HELLION;
135 wep.wr_think(wep, true, false);
137 METHOD(Hellion, tr_think, bool(Hellion thistur))
139 if (self.tur_head.frame != 0)
140 self.tur_head.frame += 1;
142 if (self.tur_head.frame >= 7)
143 self.tur_head.frame = 0;
147 METHOD(Hellion, tr_death, bool(Hellion thistur))
151 METHOD(Hellion, tr_setup, bool(Hellion thistur))
153 self.aim_flags = TFL_AIM_SIMPLE;
154 self.target_select_flags = TFL_TARGETSELECT_LOS | TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMITS | TFL_TARGETSELECT_TEAMCHECK ;
155 self.firecheck_flags = TFL_FIRECHECK_DEAD | TFL_FIRECHECK_DISTANCES | TFL_FIRECHECK_TEAMCHECK | TFL_FIRECHECK_REFIRE | TFL_FIRECHECK_AFF | TFL_FIRECHECK_AMMO_OWN;
156 self.ammo_flags = TFL_AMMO_ROCKETS | TFL_AMMO_RECHARGE;
160 METHOD(Hellion, tr_precache, bool(Hellion thistur))
167 METHOD(Hellion, tr_setup, bool(Hellion thistur))
171 METHOD(Hellion, tr_precache, bool(Hellion thistur))
177 #endif // REGISTER_TURRET