2 REGISTER_WEAPON(HLAC, w_hlac, IT_CELLS, 6, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH, BOT_PICKUP_RATING_MID, "hlac", "hlac", _("Heavy Laser Assault Cannon"))
8 W_Reload(ammo_cells, min(autocvar_g_balance_hlac_primary_ammo, autocvar_g_balance_hlac_secondary_ammo), autocvar_g_balance_hlac_reload_ammo, autocvar_g_balance_hlac_reload_time, "weapons/reload.wav");
11 void W_HLAC_Touch (void)
15 self.event_damage = SUB_Null;
17 if(self.projectiledeathtype & HITTYPE_SECONDARY)
18 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);
20 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);
25 void W_HLAC_Attack (void)
30 // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
31 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
33 if(autocvar_g_balance_hlac_reload_ammo)
35 self.clip_load -= autocvar_g_balance_hlac_primary_ammo;
36 self.weapon_load[WEP_HLAC] = self.clip_load;
39 self.ammo_cells -= autocvar_g_balance_hlac_primary_ammo;
42 spread = autocvar_g_balance_hlac_primary_spread_min + (autocvar_g_balance_hlac_primary_spread_add * self.misc_bulletcounter);
43 spread = min(spread,autocvar_g_balance_hlac_primary_spread_max);
45 spread = spread * autocvar_g_balance_hlac_primary_spread_crouchmod;
47 W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav", CHAN_WEAPON, autocvar_g_balance_hlac_primary_damage);
48 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
51 self.punchangle_x = random () - 0.5;
52 self.punchangle_y = random () - 0.5;
57 missile.classname = "hlacbolt";
58 missile.bot_dodge = TRUE;
60 missile.bot_dodgerating = autocvar_g_balance_hlac_primary_damage;
62 missile.movetype = MOVETYPE_FLY;
63 PROJECTILE_MAKETRIGGER(missile);
65 setorigin (missile, w_shotorg);
66 setsize(missile, '0 0 0', '0 0 0');
68 W_SetupProjectileVelocity(missile, autocvar_g_balance_hlac_primary_speed, spread);
69 //missile.angles = vectoangles (missile.velocity); // csqc
71 missile.touch = W_HLAC_Touch;
72 missile.think = SUB_Remove;
74 missile.nextthink = time + autocvar_g_balance_hlac_primary_lifetime;
76 missile.flags = FL_PROJECTILE;
77 missile.projectiledeathtype = WEP_HLAC;
79 CSQCProjectile(missile, TRUE, PROJECTILE_HLAC, TRUE);
81 other = missile; MUTATOR_CALLHOOK(EditProjectile);
84 void W_HLAC_Attack2f (void)
89 spread = autocvar_g_balance_hlac_secondary_spread;
93 spread = spread * autocvar_g_balance_hlac_secondary_spread_crouchmod;
95 W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav", CHAN_WEAPON, autocvar_g_balance_hlac_secondary_damage);
96 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
100 missile.classname = "hlacbolt";
101 missile.bot_dodge = TRUE;
103 missile.bot_dodgerating = autocvar_g_balance_hlac_secondary_damage;
105 missile.movetype = MOVETYPE_FLY;
106 PROJECTILE_MAKETRIGGER(missile);
108 setorigin (missile, w_shotorg);
109 setsize(missile, '0 0 0', '0 0 0');
111 W_SetupProjectileVelocity(missile, autocvar_g_balance_hlac_secondary_speed, spread);
112 //missile.angles = vectoangles (missile.velocity); // csqc
114 missile.touch = W_HLAC_Touch;
115 missile.think = SUB_Remove;
117 missile.nextthink = time + autocvar_g_balance_hlac_secondary_lifetime;
119 missile.flags = FL_PROJECTILE;
120 missile.projectiledeathtype = WEP_HLAC | HITTYPE_SECONDARY;
122 CSQCProjectile(missile, TRUE, PROJECTILE_HLAC, TRUE);
124 other = missile; MUTATOR_CALLHOOK(EditProjectile);
127 void W_HLAC_Attack2 (void)
131 // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
132 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
134 if(autocvar_g_balance_hlac_reload_ammo)
136 self.clip_load -= autocvar_g_balance_hlac_secondary_ammo;
137 self.weapon_load[WEP_HLAC] = self.clip_load;
140 self.ammo_cells -= autocvar_g_balance_hlac_secondary_ammo;
143 for(i=autocvar_g_balance_hlac_secondary_shots;i>0;--i)
148 self.punchangle_x = random () - 0.5;
149 self.punchangle_y = random () - 0.5;
156 if(self.weapon != self.switchweapon) // abort immediately if switching
162 if (self.BUTTON_ATCK)
164 if (!weapon_action(self.weapon, WR_CHECKAMMO1))
166 W_SwitchWeapon_Force(self, w_getbestweapon(self));
171 ATTACK_FINISHED(self) = time + autocvar_g_balance_hlac_primary_refire * W_WeaponRateFactor();
173 self.misc_bulletcounter = self.misc_bulletcounter + 1;
174 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hlac_primary_refire, HLAC_fire1_02);
178 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hlac_primary_animtime, w_ready);
182 void spawnfunc_weapon_hlac (void)
184 weapon_defaultspawnfunc(WEP_HLAC);
187 float w_hlac(float req)
191 self.BUTTON_ATCK = bot_aim(autocvar_g_balance_hlac_primary_speed, 0, autocvar_g_balance_hlac_primary_lifetime, FALSE);
192 else if (req == WR_THINK)
194 if(autocvar_g_balance_hlac_reload_ammo && self.clip_load < min(autocvar_g_balance_hlac_primary_ammo, autocvar_g_balance_hlac_secondary_ammo)) // forced reload
196 else if (self.BUTTON_ATCK)
198 if (weapon_prepareattack(0, autocvar_g_balance_hlac_primary_refire))
200 self.misc_bulletcounter = 0;
202 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hlac_primary_refire, HLAC_fire1_02);
206 else if (self.BUTTON_ATCK2 && autocvar_g_balance_hlac_secondary)
208 if (weapon_prepareattack(1, autocvar_g_balance_hlac_secondary_refire))
211 weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_hlac_secondary_animtime, w_ready);
215 else if (req == WR_PRECACHE)
217 precache_model ("models/weapons/g_hlac.md3");
218 precache_model ("models/weapons/v_hlac.md3");
219 precache_model ("models/weapons/h_hlac.iqm");
220 precache_sound ("weapons/lasergun_fire.wav");
221 precache_sound ("weapons/reload.wav");
224 else if (req == WR_SETUP)
226 weapon_setup(WEP_HLAC);
228 else if (req == WR_CHECKAMMO1)
230 ammo_amount = self.ammo_cells >= autocvar_g_balance_hlac_primary_ammo;
231 ammo_amount += self.weapon_load[WEP_HLAC] >= autocvar_g_balance_hlac_primary_ammo;
234 else if (req == WR_CHECKAMMO2)
236 ammo_amount = self.ammo_cells >= autocvar_g_balance_hlac_secondary_ammo;
237 ammo_amount += self.weapon_load[WEP_HLAC] >= autocvar_g_balance_hlac_secondary_ammo;
240 else if (req == WR_RELOAD)
248 float w_hlac(float req)
250 if(req == WR_IMPACTEFFECT)
253 org2 = w_org + w_backoff * 6;
254 pointparticles(particleeffectnum("laser_impact"), org2, w_backoff * 1000, 1);
256 sound(self, CHAN_PROJECTILE, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM);
258 else if(req == WR_PRECACHE)
260 precache_sound("weapons/laserimpact.wav");
262 else if (req == WR_SUICIDEMESSAGE)
263 w_deathtypestring = _("%s should have used a smaller gun");
264 else if (req == WR_KILLMESSAGE)
265 w_deathtypestring = _("%s was cut down by %s");