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");
6 void W_HLAC_Touch (void)
10 self.event_damage = SUB_Null;
12 if(self.projectiledeathtype & HITTYPE_SECONDARY)
13 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);
15 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);
20 void W_HLAC_Attack (void)
25 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
27 self.ammo_cells = self.ammo_cells - autocvar_g_balance_hlac_primary_ammo;
30 spread = autocvar_g_balance_hlac_primary_spread_min + (autocvar_g_balance_hlac_primary_spread_add * self.misc_bulletcounter);
31 spread = min(spread,autocvar_g_balance_hlac_primary_spread_max);
33 spread = spread * autocvar_g_balance_hlac_primary_spread_crouchmod;
35 W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav", CHAN_WEAPON, autocvar_g_balance_hlac_primary_damage);
36 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
39 self.punchangle_x = random () - 0.5;
40 self.punchangle_y = random () - 0.5;
45 missile.classname = "hlacbolt";
46 missile.bot_dodge = TRUE;
48 missile.bot_dodgerating = autocvar_g_balance_hlac_primary_damage;
50 missile.movetype = MOVETYPE_FLY;
51 PROJECTILE_MAKETRIGGER(missile);
53 setorigin (missile, w_shotorg);
54 setsize(missile, '0 0 0', '0 0 0');
56 W_SetupProjectileVelocity(missile, autocvar_g_balance_hlac_primary_speed, spread);
57 //missile.angles = vectoangles (missile.velocity); // csqc
59 missile.touch = W_HLAC_Touch;
60 missile.think = SUB_Remove;
62 missile.nextthink = time + autocvar_g_balance_hlac_primary_lifetime;
64 missile.flags = FL_PROJECTILE;
65 missile.projectiledeathtype = WEP_HLAC;
67 CSQCProjectile(missile, TRUE, PROJECTILE_HLAC, TRUE);
69 other = missile; MUTATOR_CALLHOOK(EditProjectile);
72 void W_HLAC_Attack2f (void)
77 spread = autocvar_g_balance_hlac_secondary_spread;
81 spread = spread * autocvar_g_balance_hlac_secondary_spread_crouchmod;
83 W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav", CHAN_WEAPON, autocvar_g_balance_hlac_secondary_damage);
84 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
88 missile.classname = "hlacbolt";
89 missile.bot_dodge = TRUE;
91 missile.bot_dodgerating = autocvar_g_balance_hlac_secondary_damage;
93 missile.movetype = MOVETYPE_FLY;
94 PROJECTILE_MAKETRIGGER(missile);
96 setorigin (missile, w_shotorg);
97 setsize(missile, '0 0 0', '0 0 0');
99 W_SetupProjectileVelocity(missile, autocvar_g_balance_hlac_secondary_speed, spread);
100 //missile.angles = vectoangles (missile.velocity); // csqc
102 missile.touch = W_HLAC_Touch;
103 missile.think = SUB_Remove;
105 missile.nextthink = time + autocvar_g_balance_hlac_secondary_lifetime;
107 missile.flags = FL_PROJECTILE;
108 missile.projectiledeathtype = WEP_HLAC | HITTYPE_SECONDARY;
110 CSQCProjectile(missile, TRUE, PROJECTILE_HLAC, TRUE);
112 other = missile; MUTATOR_CALLHOOK(EditProjectile);
115 void W_HLAC_Attack2 (void)
119 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
121 self.ammo_cells = self.ammo_cells - autocvar_g_balance_hlac_secondary_ammo;
124 for(i=autocvar_g_balance_hlac_secondary_shots;i>0;--i)
129 self.punchangle_x = random () - 0.5;
130 self.punchangle_y = random () - 0.5;
137 if(self.weapon != self.switchweapon) // abort immediately if switching
143 if (self.BUTTON_ATCK)
145 if (!weapon_action(self.weapon, WR_CHECKAMMO1))
147 W_SwitchWeapon_Force(self, w_getbestweapon(self));
152 ATTACK_FINISHED(self) = time + autocvar_g_balance_hlac_primary_refire * W_WeaponRateFactor();
154 self.misc_bulletcounter = self.misc_bulletcounter + 1;
155 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hlac_primary_refire, HLAC_fire1_02);
159 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hlac_primary_animtime, w_ready);
163 void spawnfunc_weapon_hlac (void)
165 weapon_defaultspawnfunc(WEP_HLAC);
168 float w_hlac(float req)
171 self.BUTTON_ATCK = bot_aim(autocvar_g_balance_hlac_primary_speed, 0, autocvar_g_balance_hlac_primary_lifetime, FALSE);
172 else if (req == WR_THINK)
174 if (self.BUTTON_ATCK)
175 if (weapon_prepareattack(0, autocvar_g_balance_hlac_primary_refire))
177 self.misc_bulletcounter = 0;
179 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hlac_primary_refire, HLAC_fire1_02);
182 if (self.BUTTON_ATCK2 && autocvar_g_balance_hlac_secondary)
183 if (weapon_prepareattack(1, autocvar_g_balance_hlac_secondary_refire))
186 weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_hlac_secondary_animtime, w_ready);
190 else if (req == WR_PRECACHE)
192 precache_model ("models/weapons/g_hlac.md3");
193 precache_model ("models/weapons/v_hlac.md3");
194 precache_model ("models/weapons/h_hlac.iqm");
195 precache_sound ("weapons/lasergun_fire.wav");
198 else if (req == WR_SETUP)
199 weapon_setup(WEP_HLAC);
200 else if (req == WR_CHECKAMMO1)
201 return self.ammo_cells >= autocvar_g_balance_hlac_primary_ammo;
202 else if (req == WR_CHECKAMMO2)
203 return self.ammo_cells >= autocvar_g_balance_hlac_secondary_ammo;
208 float w_hlac(float req)
210 if(req == WR_IMPACTEFFECT)
213 org2 = w_org + w_backoff * 6;
214 pointparticles(particleeffectnum("laser_impact"), org2, w_backoff * 1000, 1);
216 sound(self, CHAN_PROJECTILE, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM);
218 else if(req == WR_PRECACHE)
220 precache_sound("weapons/laserimpact.wav");
222 else if (req == WR_SUICIDEMESSAGE)
223 w_deathtypestring = "%s should have used a smaller gun";
224 else if (req == WR_KILLMESSAGE)
225 w_deathtypestring = "%s was cut down by %s";