4 CLASS(HellionAttack, PortoLaunch)
5 /* flags */ ATTRIB(HellionAttack, spawnflags, int, WEP_TYPE_OTHER);
6 /* impulse */ ATTRIB(HellionAttack, impulse, int, 9);
7 /* refname */ ATTRIB(HellionAttack, netname, string, "turret_hellion");
8 /* wepname */ ATTRIB(HellionAttack, message, string, _("Hellion"));
9 ENDCLASS(HellionAttack)
10 REGISTER_WEAPON(HELLION, NEW(HellionAttack));
12 CLASS(Hellion, Turret)
13 /* spawnflags */ ATTRIB(Hellion, spawnflags, int, TUR_FLAG_SPLASH | TUR_FLAG_FASTPROJ | TUR_FLAG_PLAYER | TUR_FLAG_MISSILE);
14 /* mins */ ATTRIB(Hellion, mins, vector, '-32 -32 0');
15 /* maxs */ ATTRIB(Hellion, maxs, vector, '32 32 64');
16 /* modelname */ ATTRIB(Hellion, mdl, string, "base.md3");
17 /* model */ ATTRIB(Hellion, model, string, strzone(strcat("models/turrets/", this.mdl)));
18 /* head_model */ ATTRIB(Hellion, head_model, string, strzone(strcat("models/turrets/", "hellion.md3")));
19 /* netname */ ATTRIB(Hellion, netname, string, "hellion");
20 /* fullname */ ATTRIB(Hellion, turret_name, string, _("Hellion Missile Turret"));
21 ATTRIB(Hellion, m_weapon, Weapon, WEP_HELLION);
23 REGISTER_TURRET(HELLION, NEW(Hellion));
29 void turret_hellion_missile_think();
30 METHOD(HellionAttack, wr_think, bool(entity thiswep, bool fire1, bool fire2)) {
32 bool isPlayer = IS_PLAYER(self);
34 if (!isPlayer || weapon_prepareattack(false, WEP_CVAR_PRI(electro, refire))) {
36 turret_initparams(self);
37 W_SetupShot_Dir(self, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
38 self.tur_shotdir_updated = w_shotdir;
39 self.tur_shotorg = w_shotorg;
41 self.shot_radius = 500;
42 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
45 if (self.tur_head.frame != 0)
46 self.tur_shotorg = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_fire"));
48 self.tur_shotorg = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_fire2"));
51 entity missile = turret_projectile(SND(ROCKET_FIRE), 6, 10, DEATH_TURRET_HELLION, PROJECTILE_ROCKET, FALSE, FALSE);
52 te_explosion (missile.origin);
53 missile.think = turret_hellion_missile_think;
54 missile.nextthink = time;
55 missile.flags = FL_PROJECTILE;
56 missile.max_health = time + 9;
57 missile.tur_aimpos = randomvec() * 128;
58 missile.missile_flags = MIF_SPLASH | MIF_PROXY | MIF_GUIDED_HEAT;
59 if (!isPlayer) self.tur_head.frame += 1;
64 float autocvar_g_turrets_unit_hellion_shot_speed_gain;
65 float autocvar_g_turrets_unit_hellion_shot_speed_max;
67 void turret_hellion_missile_think()
73 self.nextthink = time + 0.05;
75 olddir = normalize(self.velocity);
77 if(self.max_health < time)
78 turret_projectile_explode();
80 // Enemy dead? just keep on the current heading then.
81 if ((self.enemy == world) || (self.enemy.deadflag != DEAD_NO))
84 // Make sure we dont return to tracking a respawned player
88 self.angles = vectoangles(self.velocity);
90 if ( (vlen(self.origin - self.owner.origin)) > (self.owner.shot_radius * 5) )
91 turret_projectile_explode();
94 self.velocity = olddir * min(vlen(self.velocity) * (autocvar_g_turrets_unit_hellion_shot_speed_gain), (autocvar_g_turrets_unit_hellion_shot_speed_max));
96 UpdateCSQCProjectile(self);
102 if (vlen(self.origin - self.enemy.origin) < self.owner.shot_radius * 0.2)
103 turret_projectile_explode();
105 // Predict enemy position
106 itime = vlen(self.enemy.origin - self.origin) / vlen(self.velocity);
107 pre_pos = self.enemy.origin + self.enemy.velocity * itime;
109 pre_pos = (pre_pos + self.enemy.origin) * 0.5;
111 // Find out the direction to that place
112 newdir = normalize(pre_pos - self.origin);
115 newdir = normalize(olddir + newdir * 0.35);
118 self.angles = vectoangles(self.velocity);
121 self.velocity = newdir * min(vlen(self.velocity) * (autocvar_g_turrets_unit_hellion_shot_speed_gain), (autocvar_g_turrets_unit_hellion_shot_speed_max));
124 self.think = turret_projectile_explode;
126 UpdateCSQCProjectile(self);
129 void spawnfunc_turret_hellion() { SELFPARAM(); if(!turret_initialize(TUR_HELLION)) remove(self); }
131 METHOD(Hellion, tr_think, void(Hellion thistur))
133 if (self.tur_head.frame != 0)
134 self.tur_head.frame += 1;
136 if (self.tur_head.frame >= 7)
137 self.tur_head.frame = 0;
139 METHOD(Hellion, tr_setup, void(Hellion this, entity it))
141 it.aim_flags = TFL_AIM_SIMPLE;
142 it.target_select_flags = TFL_TARGETSELECT_LOS | TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMITS | TFL_TARGETSELECT_TEAMCHECK ;
143 it.firecheck_flags = TFL_FIRECHECK_DEAD | TFL_FIRECHECK_DISTANCES | TFL_FIRECHECK_TEAMCHECK | TFL_FIRECHECK_REFIRE | TFL_FIRECHECK_AFF | TFL_FIRECHECK_AMMO_OWN;
144 it.ammo_flags = TFL_AMMO_ROCKETS | TFL_AMMO_RECHARGE;