2 REGISTER_WEAPON(HLAC, w_hlac, IT_CELLS, 6, WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH, BOT_PICKUP_RATING_MID, "hlac", "hlac", _("Heavy Laser Assault Cannon"))
6 void W_HLAC_Touch (void)
10 self.event_damage = SUB_Null;
12 if(self.projectiledeathtype & HITTYPE_SECONDARY)
13 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);
15 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);
20 void W_HLAC_Attack (void)
25 W_DecreaseAmmo(ammo_cells, autocvar_g_balance_hlac_primary_ammo, autocvar_g_balance_hlac_reload_ammo);
27 spread = autocvar_g_balance_hlac_primary_spread_min + (autocvar_g_balance_hlac_primary_spread_add * self.misc_bulletcounter);
28 spread = min(spread,autocvar_g_balance_hlac_primary_spread_max);
30 spread = spread * autocvar_g_balance_hlac_primary_spread_crouchmod;
32 W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_A, autocvar_g_balance_hlac_primary_damage);
33 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
36 self.punchangle_x = random () - 0.5;
37 self.punchangle_y = random () - 0.5;
41 missile.owner = missile.realowner = self;
42 missile.classname = "hlacbolt";
43 missile.bot_dodge = TRUE;
45 missile.bot_dodgerating = autocvar_g_balance_hlac_primary_damage;
47 missile.movetype = MOVETYPE_FLY;
48 PROJECTILE_MAKETRIGGER(missile);
50 setorigin (missile, w_shotorg);
51 setsize(missile, '0 0 0', '0 0 0');
53 W_SetupProjectileVelocity(missile, autocvar_g_balance_hlac_primary_speed, spread);
54 //missile.angles = vectoangles (missile.velocity); // csqc
56 missile.touch = W_HLAC_Touch;
57 missile.think = SUB_Remove;
59 missile.nextthink = time + autocvar_g_balance_hlac_primary_lifetime;
61 missile.flags = FL_PROJECTILE;
62 missile.projectiledeathtype = WEP_HLAC;
64 CSQCProjectile(missile, TRUE, PROJECTILE_HLAC, TRUE);
66 other = missile; MUTATOR_CALLHOOK(EditProjectile);
69 void W_HLAC_Attack2f (void)
74 spread = autocvar_g_balance_hlac_secondary_spread;
78 spread = spread * autocvar_g_balance_hlac_secondary_spread_crouchmod;
80 W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_A, autocvar_g_balance_hlac_secondary_damage);
81 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
84 missile.owner = missile.realowner = self;
85 missile.classname = "hlacbolt";
86 missile.bot_dodge = TRUE;
88 missile.bot_dodgerating = autocvar_g_balance_hlac_secondary_damage;
90 missile.movetype = MOVETYPE_FLY;
91 PROJECTILE_MAKETRIGGER(missile);
93 setorigin (missile, w_shotorg);
94 setsize(missile, '0 0 0', '0 0 0');
96 W_SetupProjectileVelocity(missile, autocvar_g_balance_hlac_secondary_speed, spread);
97 //missile.angles = vectoangles (missile.velocity); // csqc
99 missile.touch = W_HLAC_Touch;
100 missile.think = SUB_Remove;
102 missile.nextthink = time + autocvar_g_balance_hlac_secondary_lifetime;
104 missile.flags = FL_PROJECTILE;
105 missile.projectiledeathtype = WEP_HLAC | HITTYPE_SECONDARY;
107 CSQCProjectile(missile, TRUE, PROJECTILE_HLAC, TRUE);
109 other = missile; MUTATOR_CALLHOOK(EditProjectile);
112 void W_HLAC_Attack2 (void)
116 W_DecreaseAmmo(ammo_cells, autocvar_g_balance_hlac_secondary_ammo, autocvar_g_balance_hlac_reload_ammo);
118 for(i=autocvar_g_balance_hlac_secondary_shots;i>0;--i)
123 self.punchangle_x = random () - 0.5;
124 self.punchangle_y = random () - 0.5;
131 if(self.weapon != self.switchweapon) // abort immediately if switching
137 if (self.BUTTON_ATCK)
139 if (!weapon_action(self.weapon, WR_CHECKAMMO1))
140 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
142 W_SwitchWeapon_Force(self, w_getbestweapon(self));
147 ATTACK_FINISHED(self) = time + autocvar_g_balance_hlac_primary_refire * W_WeaponRateFactor();
149 self.misc_bulletcounter = self.misc_bulletcounter + 1;
150 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hlac_primary_refire, HLAC_fire1_02);
154 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hlac_primary_animtime, w_ready);
158 void spawnfunc_weapon_hlac (void)
160 weapon_defaultspawnfunc(WEP_HLAC);
163 float w_hlac(float req)
167 self.BUTTON_ATCK = bot_aim(autocvar_g_balance_hlac_primary_speed, 0, autocvar_g_balance_hlac_primary_lifetime, FALSE);
168 else if (req == WR_THINK)
170 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
171 weapon_action(self.weapon, WR_RELOAD);
172 else if (self.BUTTON_ATCK)
174 if (weapon_prepareattack(0, autocvar_g_balance_hlac_primary_refire))
176 self.misc_bulletcounter = 0;
178 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hlac_primary_refire, HLAC_fire1_02);
182 else if (self.BUTTON_ATCK2 && autocvar_g_balance_hlac_secondary)
184 if (weapon_prepareattack(1, autocvar_g_balance_hlac_secondary_refire))
187 weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_hlac_secondary_animtime, w_ready);
191 else if (req == WR_PRECACHE)
193 precache_model ("models/weapons/g_hlac.md3");
194 precache_model ("models/weapons/v_hlac.md3");
195 precache_model ("models/weapons/h_hlac.iqm");
196 precache_sound ("weapons/lasergun_fire.wav");
197 //precache_sound ("weapons/reload.wav"); // until weapons have individual reload sounds, precache the reload sound somewhere else
200 else if (req == WR_SETUP)
202 weapon_setup(WEP_HLAC);
203 self.current_ammo = ammo_cells;
205 else if (req == WR_CHECKAMMO1)
207 ammo_amount = self.ammo_cells >= autocvar_g_balance_hlac_primary_ammo;
208 ammo_amount += self.(weapon_load[WEP_HLAC]) >= autocvar_g_balance_hlac_primary_ammo;
211 else if (req == WR_CHECKAMMO2)
213 ammo_amount = self.ammo_cells >= autocvar_g_balance_hlac_secondary_ammo;
214 ammo_amount += self.(weapon_load[WEP_HLAC]) >= autocvar_g_balance_hlac_secondary_ammo;
217 else if (req == WR_RELOAD)
219 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");
225 float w_hlac(float req)
227 if(req == WR_IMPACTEFFECT)
230 org2 = w_org + w_backoff * 6;
231 pointparticles(particleeffectnum("laser_impact"), org2, w_backoff * 1000, 1);
233 sound(self, CH_SHOTS, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM);
235 else if(req == WR_PRECACHE)
237 precache_sound("weapons/laserimpact.wav");
239 else if (req == WR_SUICIDEMESSAGE)
240 w_deathtypestring = _("%s should have used a smaller gun");
241 else if (req == WR_KILLMESSAGE)
242 w_deathtypestring = _("%s was cut down with a HLAC by %s");