2 REGISTER_WEAPON(HLAC, w_hlac, IT_CELLS, 6, WEP_FLAG_NORMAL | WEP_TYPE_SPLASH, BOT_PICKUP_RATING_MID, "hlac", "hlac", "Heavy Laser Assault Cannon");
5 .float HLAC_bulletcounter;
6 void W_HLAC_Touch (void)
10 self.event_damage = SUB_Null;
12 RadiusDamage (self, self.owner, autocvar_g_balance_hlac_primary_damage, autocvar_g_balance_hlac_primary_edgedamage, autocvar_g_balance_hlac_primary_radius, world, autocvar_g_balance_hlac_primary_force, self.projectiledeathtype, other);
17 void W_HLAC_Touch2 (void)
21 self.event_damage = SUB_Null;
23 RadiusDamage (self, self.owner, autocvar_g_balance_hlac_secondary_damage, autocvar_g_balance_hlac_secondary_edgedamage, autocvar_g_balance_hlac_secondary_radius, world, autocvar_g_balance_hlac_secondary_force, self.projectiledeathtype, other);
28 void W_HLAC_Attack (void)
33 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
35 self.ammo_cells = self.ammo_cells - autocvar_g_balance_hlac_primary_ammo;
38 spread = autocvar_g_balance_hlac_primary_spread_min + (autocvar_g_balance_hlac_primary_spread_add * self.HLAC_bulletcounter);
39 spread = min(spread,autocvar_g_balance_hlac_primary_spread_max);
41 spread = spread * autocvar_g_balance_hlac_primary_spread_crouchmod;
43 W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav", CHAN_WEAPON, autocvar_g_balance_hlac_primary_damage);
44 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
47 self.punchangle_x = random () - 0.5;
48 self.punchangle_y = random () - 0.5;
53 missile.classname = "hlacbolt";
54 // missile.dmg = issecondary;
55 missile.bot_dodge = TRUE;
57 missile.bot_dodgerating = autocvar_g_balance_hlac_primary_damage;
59 missile.movetype = MOVETYPE_FLY;
60 PROJECTILE_MAKETRIGGER(missile);
62 setorigin (missile, w_shotorg);
63 setsize(missile, '0 0 0', '0 0 0');
65 W_SetupProjectileVelocity(missile, autocvar_g_balance_hlac_primary_speed, spread);
66 missile.angles = vectoangles (missile.velocity);
68 missile.touch = W_HLAC_Touch;
69 missile.think = SUB_Remove;
71 missile.nextthink = time + autocvar_g_balance_hlac_primary_lifetime;
73 missile.flags = FL_PROJECTILE;
74 missile.projectiledeathtype = WEP_HLAC;
76 CSQCProjectile(missile, TRUE, PROJECTILE_HLAC, TRUE);
78 other = missile; MUTATOR_CALLHOOK(EditProjectile);
81 void W_HLAC_Attack2f (void)
86 spread = autocvar_g_balance_hlac_secondary_spread;
90 spread = spread * autocvar_g_balance_hlac_secondary_spread_crouchmod;
92 W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav", CHAN_WEAPON, autocvar_g_balance_hlac_secondary_damage);
93 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
97 missile.classname = "hlacbolt";
98 // missile.dmg = issecondary;
99 missile.bot_dodge = TRUE;
101 missile.bot_dodgerating = autocvar_g_balance_hlac_secondary_damage;
103 missile.movetype = MOVETYPE_FLY;
104 PROJECTILE_MAKETRIGGER(missile);
106 setorigin (missile, w_shotorg);
107 setsize(missile, '0 0 0', '0 0 0');
109 W_SetupProjectileVelocity(missile, autocvar_g_balance_hlac_secondary_speed, spread);
110 missile.angles = vectoangles (missile.velocity);
112 missile.touch = W_HLAC_Touch2;
113 missile.think = SUB_Remove;
115 missile.nextthink = time + autocvar_g_balance_hlac_secondary_lifetime;
117 missile.flags = FL_PROJECTILE;
118 missile.projectiledeathtype = WEP_HLAC | HITTYPE_SECONDARY;
120 CSQCProjectile(missile, TRUE, PROJECTILE_HLAC, TRUE);
122 other = missile; MUTATOR_CALLHOOK(EditProjectile);
125 void W_HLAC_Attack2 (void)
129 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
131 self.ammo_cells = self.ammo_cells - autocvar_g_balance_hlac_secondary_ammo;
134 for(i=autocvar_g_balance_hlac_secondary_shots;i>0;--i)
139 self.punchangle_x = random () - 0.5;
140 self.punchangle_y = random () - 0.5;
147 if(self.weapon != self.switchweapon) // abort immediately if switching
153 if (self.BUTTON_ATCK)
155 if (!weapon_action(self.weapon, WR_CHECKAMMO1))
157 W_SwitchWeapon_Force(self, w_getbestweapon(self));
162 ATTACK_FINISHED(self) = time + autocvar_g_balance_hlac_primary_refire * W_WeaponRateFactor();
164 self.HLAC_bulletcounter = self.HLAC_bulletcounter + 1;
165 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hlac_primary_refire, HLAC_fire1_02);
169 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hlac_primary_animtime, w_ready);
173 void spawnfunc_weapon_hlac (void)
175 weapon_defaultspawnfunc(WEP_HLAC);
178 float w_hlac(float req)
181 self.BUTTON_ATCK = bot_aim(autocvar_g_balance_hlac_primary_speed, 0, autocvar_g_balance_hlac_primary_lifetime, FALSE);
182 else if (req == WR_THINK)
184 if (self.BUTTON_ATCK)
185 if (weapon_prepareattack(0, autocvar_g_balance_hlac_primary_refire))
187 self.HLAC_bulletcounter = 0;
189 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hlac_primary_refire, HLAC_fire1_02);
192 if (self.BUTTON_ATCK2 && autocvar_g_balance_hlac_secondary)
193 if (weapon_prepareattack(1, autocvar_g_balance_hlac_secondary_refire))
196 weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_hlac_secondary_animtime, w_ready);
200 else if (req == WR_PRECACHE)
202 precache_model ("models/weapons/g_hlac.md3");
203 precache_model ("models/weapons/v_hlac.md3");
204 precache_model ("models/weapons/h_hlac.iqm");
205 precache_sound ("weapons/lasergun_fire.wav");
208 else if (req == WR_SETUP)
209 weapon_setup(WEP_HLAC);
210 else if (req == WR_CHECKAMMO1)
211 return self.ammo_cells >= autocvar_g_balance_hlac_primary_ammo;
212 else if (req == WR_CHECKAMMO2)
213 return self.ammo_cells >= autocvar_g_balance_hlac_secondary_ammo;
218 float w_hlac(float req)
220 if(req == WR_IMPACTEFFECT)
223 org2 = w_org + w_backoff * 6;
224 pointparticles(particleeffectnum("laser_impact"), org2, w_backoff * 1000, 1);
226 sound(self, CHAN_PROJECTILE, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM);
228 else if(req == WR_PRECACHE)
230 precache_sound("weapons/laserimpact.wav");
232 else if (req == WR_SUICIDEMESSAGE)
233 w_deathtypestring = "%s should have used a smaller gun";
234 else if (req == WR_KILLMESSAGE)
235 w_deathtypestring = "%s was cut down by %s";