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_SetAmmoCounter()
8 // set clip_load to the weapon we have switched to, if the gun uses reloading
9 if(!autocvar_g_balance_hlac_reload_ammo)
10 self.clip_load = 0; // also keeps crosshair ammo from displaying
13 self.clip_load = self.weapon_load[WEP_HLAC];
14 self.clip_size = autocvar_g_balance_hlac_reload_ammo; // for the crosshair ammo display
20 self.reload_ammo_player = ammo_cells;
21 self.reload_ammo_min = min(autocvar_g_balance_hlac_primary_ammo, autocvar_g_balance_hlac_secondary_ammo);
22 self.reload_ammo_amount = autocvar_g_balance_hlac_reload_ammo;
23 self.reload_time = autocvar_g_balance_hlac_reload_time;
24 self.reload_sound = "weapons/reload.wav";
29 void W_HLAC_Touch (void)
33 self.event_damage = SUB_Null;
35 if(self.projectiledeathtype & HITTYPE_SECONDARY)
36 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);
38 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);
43 void W_HLAC_Attack (void)
48 // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
49 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
51 if(autocvar_g_balance_hlac_reload_ammo)
53 self.clip_load -= autocvar_g_balance_hlac_primary_ammo;
54 self.weapon_load[WEP_HLAC] = self.clip_load;
57 self.ammo_cells -= autocvar_g_balance_hlac_primary_ammo;
60 spread = autocvar_g_balance_hlac_primary_spread_min + (autocvar_g_balance_hlac_primary_spread_add * self.misc_bulletcounter);
61 spread = min(spread,autocvar_g_balance_hlac_primary_spread_max);
63 spread = spread * autocvar_g_balance_hlac_primary_spread_crouchmod;
65 W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav", CHAN_WEAPON, autocvar_g_balance_hlac_primary_damage);
66 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
69 self.punchangle_x = random () - 0.5;
70 self.punchangle_y = random () - 0.5;
75 missile.classname = "hlacbolt";
76 missile.bot_dodge = TRUE;
78 missile.bot_dodgerating = autocvar_g_balance_hlac_primary_damage;
80 missile.movetype = MOVETYPE_FLY;
81 PROJECTILE_MAKETRIGGER(missile);
83 setorigin (missile, w_shotorg);
84 setsize(missile, '0 0 0', '0 0 0');
86 W_SetupProjectileVelocity(missile, autocvar_g_balance_hlac_primary_speed, spread);
87 //missile.angles = vectoangles (missile.velocity); // csqc
89 missile.touch = W_HLAC_Touch;
90 missile.think = SUB_Remove;
92 missile.nextthink = time + autocvar_g_balance_hlac_primary_lifetime;
94 missile.flags = FL_PROJECTILE;
95 missile.projectiledeathtype = WEP_HLAC;
97 CSQCProjectile(missile, TRUE, PROJECTILE_HLAC, TRUE);
99 other = missile; MUTATOR_CALLHOOK(EditProjectile);
102 void W_HLAC_Attack2f (void)
104 local entity missile;
107 spread = autocvar_g_balance_hlac_secondary_spread;
111 spread = spread * autocvar_g_balance_hlac_secondary_spread_crouchmod;
113 W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav", CHAN_WEAPON, autocvar_g_balance_hlac_secondary_damage);
114 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
117 missile.owner = self;
118 missile.classname = "hlacbolt";
119 missile.bot_dodge = TRUE;
121 missile.bot_dodgerating = autocvar_g_balance_hlac_secondary_damage;
123 missile.movetype = MOVETYPE_FLY;
124 PROJECTILE_MAKETRIGGER(missile);
126 setorigin (missile, w_shotorg);
127 setsize(missile, '0 0 0', '0 0 0');
129 W_SetupProjectileVelocity(missile, autocvar_g_balance_hlac_secondary_speed, spread);
130 //missile.angles = vectoangles (missile.velocity); // csqc
132 missile.touch = W_HLAC_Touch;
133 missile.think = SUB_Remove;
135 missile.nextthink = time + autocvar_g_balance_hlac_secondary_lifetime;
137 missile.flags = FL_PROJECTILE;
138 missile.projectiledeathtype = WEP_HLAC | HITTYPE_SECONDARY;
140 CSQCProjectile(missile, TRUE, PROJECTILE_HLAC, TRUE);
142 other = missile; MUTATOR_CALLHOOK(EditProjectile);
145 void W_HLAC_Attack2 (void)
149 // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
150 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
152 if(autocvar_g_balance_hlac_reload_ammo)
154 self.clip_load -= autocvar_g_balance_hlac_secondary_ammo;
155 self.weapon_load[WEP_HLAC] = self.clip_load;
158 self.ammo_cells -= autocvar_g_balance_hlac_secondary_ammo;
161 for(i=autocvar_g_balance_hlac_secondary_shots;i>0;--i)
166 self.punchangle_x = random () - 0.5;
167 self.punchangle_y = random () - 0.5;
174 if(self.weapon != self.switchweapon) // abort immediately if switching
180 if (self.BUTTON_ATCK)
182 if (!weapon_action(self.weapon, WR_CHECKAMMO1))
184 W_SwitchWeapon_Force(self, w_getbestweapon(self));
189 ATTACK_FINISHED(self) = time + autocvar_g_balance_hlac_primary_refire * W_WeaponRateFactor();
191 self.misc_bulletcounter = self.misc_bulletcounter + 1;
192 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hlac_primary_refire, HLAC_fire1_02);
196 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hlac_primary_animtime, w_ready);
200 void spawnfunc_weapon_hlac (void)
202 weapon_defaultspawnfunc(WEP_HLAC);
205 float w_hlac(float req)
209 self.BUTTON_ATCK = bot_aim(autocvar_g_balance_hlac_primary_speed, 0, autocvar_g_balance_hlac_primary_lifetime, FALSE);
210 else if (req == WR_THINK)
212 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
214 else if (self.BUTTON_ATCK)
216 if (weapon_prepareattack(0, autocvar_g_balance_hlac_primary_refire))
218 self.misc_bulletcounter = 0;
220 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hlac_primary_refire, HLAC_fire1_02);
224 else if (self.BUTTON_ATCK2 && autocvar_g_balance_hlac_secondary)
226 if (weapon_prepareattack(1, autocvar_g_balance_hlac_secondary_refire))
229 weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_hlac_secondary_animtime, w_ready);
233 else if (req == WR_PRECACHE)
235 precache_model ("models/weapons/g_hlac.md3");
236 precache_model ("models/weapons/v_hlac.md3");
237 precache_model ("models/weapons/h_hlac.iqm");
238 precache_sound ("weapons/lasergun_fire.wav");
239 precache_sound ("weapons/reload.wav");
242 else if (req == WR_SETUP)
244 weapon_setup(WEP_HLAC);
245 W_HLAC_SetAmmoCounter();
247 else if (req == WR_CHECKAMMO1)
249 ammo_amount = self.ammo_cells >= autocvar_g_balance_hlac_primary_ammo;
250 ammo_amount += self.weapon_load[WEP_HLAC] >= autocvar_g_balance_hlac_primary_ammo;
253 else if (req == WR_CHECKAMMO2)
255 ammo_amount = self.ammo_cells >= autocvar_g_balance_hlac_secondary_ammo;
256 ammo_amount += self.weapon_load[WEP_HLAC] >= autocvar_g_balance_hlac_secondary_ammo;
259 else if (req == WR_RELOAD)
267 float w_hlac(float req)
269 if(req == WR_IMPACTEFFECT)
272 org2 = w_org + w_backoff * 6;
273 pointparticles(particleeffectnum("laser_impact"), org2, w_backoff * 1000, 1);
275 sound(self, CHAN_PROJECTILE, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM);
277 else if(req == WR_PRECACHE)
279 precache_sound("weapons/laserimpact.wav");
281 else if (req == WR_SUICIDEMESSAGE)
282 w_deathtypestring = _("%s should have used a smaller gun");
283 else if (req == WR_KILLMESSAGE)
284 w_deathtypestring = _("%s was cut down by %s");