5 /* ammotype */ IT_CELLS,
7 /* flags */ WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH,
8 /* rating */ BOT_PICKUP_RATING_MID,
10 /* shortname */ "hlac",
11 /* fullname */ _("Heavy Laser Assault Cannon")
16 void W_HLAC_Touch (void)
20 self.event_damage = func_null;
22 if(self.projectiledeathtype & HITTYPE_SECONDARY)
23 RadiusDamage (self, self.realowner, 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);
25 RadiusDamage (self, self.realowner, 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);
30 void W_HLAC_Attack (void)
35 W_DecreaseAmmo(ammo_cells, autocvar_g_balance_hlac_primary_ammo, autocvar_g_balance_hlac_reload_ammo);
37 spread = autocvar_g_balance_hlac_primary_spread_min + (autocvar_g_balance_hlac_primary_spread_add * self.misc_bulletcounter);
38 spread = min(spread,autocvar_g_balance_hlac_primary_spread_max);
40 spread = spread * autocvar_g_balance_hlac_primary_spread_crouchmod;
42 W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_A, autocvar_g_balance_hlac_primary_damage);
43 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
44 if (!autocvar_g_norecoil)
46 self.punchangle_x = random () - 0.5;
47 self.punchangle_y = random () - 0.5;
51 missile.owner = missile.realowner = self;
52 missile.classname = "hlacbolt";
53 missile.bot_dodge = TRUE;
55 missile.bot_dodgerating = autocvar_g_balance_hlac_primary_damage;
57 missile.movetype = MOVETYPE_FLY;
58 PROJECTILE_MAKETRIGGER(missile);
60 setorigin (missile, w_shotorg);
61 setsize(missile, '0 0 0', '0 0 0');
63 W_SetupProjectileVelocity(missile, autocvar_g_balance_hlac_primary_speed, spread);
64 //missile.angles = vectoangles (missile.velocity); // csqc
66 missile.touch = W_HLAC_Touch;
67 missile.think = SUB_Remove;
69 missile.nextthink = time + autocvar_g_balance_hlac_primary_lifetime;
71 missile.flags = FL_PROJECTILE;
72 missile.projectiledeathtype = WEP_HLAC;
74 CSQCProjectile(missile, TRUE, PROJECTILE_HLAC, TRUE);
76 other = missile; MUTATOR_CALLHOOK(EditProjectile);
79 void W_HLAC_Attack2f (void)
84 spread = autocvar_g_balance_hlac_secondary_spread;
88 spread = spread * autocvar_g_balance_hlac_secondary_spread_crouchmod;
90 W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_A, autocvar_g_balance_hlac_secondary_damage);
91 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
94 missile.owner = missile.realowner = self;
95 missile.classname = "hlacbolt";
96 missile.bot_dodge = TRUE;
98 missile.bot_dodgerating = autocvar_g_balance_hlac_secondary_damage;
100 missile.movetype = MOVETYPE_FLY;
101 PROJECTILE_MAKETRIGGER(missile);
103 setorigin (missile, w_shotorg);
104 setsize(missile, '0 0 0', '0 0 0');
106 W_SetupProjectileVelocity(missile, autocvar_g_balance_hlac_secondary_speed, spread);
107 //missile.angles = vectoangles (missile.velocity); // csqc
109 missile.touch = W_HLAC_Touch;
110 missile.think = SUB_Remove;
112 missile.nextthink = time + autocvar_g_balance_hlac_secondary_lifetime;
114 missile.flags = FL_PROJECTILE;
115 missile.missile_flags = MIF_SPLASH;
116 missile.projectiledeathtype = WEP_HLAC | HITTYPE_SECONDARY;
118 CSQCProjectile(missile, TRUE, PROJECTILE_HLAC, TRUE);
120 other = missile; MUTATOR_CALLHOOK(EditProjectile);
123 void W_HLAC_Attack2 (void)
127 W_DecreaseAmmo(ammo_cells, autocvar_g_balance_hlac_secondary_ammo, autocvar_g_balance_hlac_reload_ammo);
129 for(i=autocvar_g_balance_hlac_secondary_shots;i>0;--i)
132 if (!autocvar_g_norecoil)
134 self.punchangle_x = random () - 0.5;
135 self.punchangle_y = random () - 0.5;
142 if(self.weapon != self.switchweapon) // abort immediately if switching
148 if (self.BUTTON_ATCK)
150 if (!weapon_action(self.weapon, WR_CHECKAMMO1))
151 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
153 W_SwitchWeapon_Force(self, w_getbestweapon(self));
158 ATTACK_FINISHED(self) = time + autocvar_g_balance_hlac_primary_refire * W_WeaponRateFactor();
160 self.misc_bulletcounter = self.misc_bulletcounter + 1;
161 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hlac_primary_refire, HLAC_fire1_02);
165 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hlac_primary_animtime, w_ready);
169 void spawnfunc_weapon_hlac (void)
171 weapon_defaultspawnfunc(WEP_HLAC);
174 float w_hlac(float req)
178 self.BUTTON_ATCK = bot_aim(autocvar_g_balance_hlac_primary_speed, 0, autocvar_g_balance_hlac_primary_lifetime, FALSE);
179 else if (req == WR_THINK)
181 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
182 weapon_action(self.weapon, WR_RELOAD);
183 else if (self.BUTTON_ATCK)
185 if (weapon_prepareattack(0, autocvar_g_balance_hlac_primary_refire))
187 self.misc_bulletcounter = 0;
189 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hlac_primary_refire, HLAC_fire1_02);
193 else if (self.BUTTON_ATCK2 && autocvar_g_balance_hlac_secondary)
195 if (weapon_prepareattack(1, autocvar_g_balance_hlac_secondary_refire))
198 weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_hlac_secondary_animtime, w_ready);
202 else if (req == WR_PRECACHE)
204 precache_model ("models/weapons/g_hlac.md3");
205 precache_model ("models/weapons/v_hlac.md3");
206 precache_model ("models/weapons/h_hlac.iqm");
207 precache_sound ("weapons/lasergun_fire.wav");
208 //precache_sound ("weapons/reload.wav"); // until weapons have individual reload sounds, precache the reload sound somewhere else
211 else if (req == WR_SETUP)
213 weapon_setup(WEP_HLAC);
214 self.current_ammo = ammo_cells;
216 else if (req == WR_CHECKAMMO1)
218 ammo_amount = self.ammo_cells >= autocvar_g_balance_hlac_primary_ammo;
219 ammo_amount += self.(weapon_load[WEP_HLAC]) >= autocvar_g_balance_hlac_primary_ammo;
222 else if (req == WR_CHECKAMMO2)
224 ammo_amount = self.ammo_cells >= autocvar_g_balance_hlac_secondary_ammo;
225 ammo_amount += self.(weapon_load[WEP_HLAC]) >= autocvar_g_balance_hlac_secondary_ammo;
228 else if (req == WR_RELOAD)
230 W_Reload(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");
232 else if (req == WR_SUICIDEMESSAGE)
234 return WEAPON_HLAC_SUICIDE;
236 else if (req == WR_KILLMESSAGE)
238 return WEAPON_HLAC_MURDER;
244 float w_hlac(float req)
246 if(req == WR_IMPACTEFFECT)
249 org2 = w_org + w_backoff * 6;
250 pointparticles(particleeffectnum("laser_impact"), org2, w_backoff * 1000, 1);
252 sound(self, CH_SHOTS, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM);
254 else if(req == WR_PRECACHE)
256 precache_sound("weapons/laserimpact.wav");