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 self.reload_ammo_player = ammo_cells;
9 self.reload_ammo_min = min(autocvar_g_balance_hlac_primary_ammo, autocvar_g_balance_hlac_secondary_ammo);
10 self.reload_ammo_amount = autocvar_g_balance_hlac_reload_ammo;
11 self.reload_time = autocvar_g_balance_hlac_reload_time;
12 self.reload_sound = "weapons/reload.wav";
17 void W_HLAC_Touch (void)
21 self.event_damage = SUB_Null;
23 if(self.projectiledeathtype & HITTYPE_SECONDARY)
24 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);
26 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);
31 void W_HLAC_Attack (void)
36 // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
37 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
39 if(autocvar_g_balance_hlac_reload_ammo)
41 self.clip_load -= autocvar_g_balance_hlac_primary_ammo;
42 self.weapon_load[WEP_HLAC] = self.clip_load;
45 self.ammo_cells -= autocvar_g_balance_hlac_primary_ammo;
48 spread = autocvar_g_balance_hlac_primary_spread_min + (autocvar_g_balance_hlac_primary_spread_add * self.misc_bulletcounter);
49 spread = min(spread,autocvar_g_balance_hlac_primary_spread_max);
51 spread = spread * autocvar_g_balance_hlac_primary_spread_crouchmod;
53 W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav", CHAN_WEAPON, autocvar_g_balance_hlac_primary_damage);
54 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
57 self.punchangle_x = random () - 0.5;
58 self.punchangle_y = random () - 0.5;
63 missile.classname = "hlacbolt";
64 missile.bot_dodge = TRUE;
66 missile.bot_dodgerating = autocvar_g_balance_hlac_primary_damage;
68 missile.movetype = MOVETYPE_FLY;
69 PROJECTILE_MAKETRIGGER(missile);
71 setorigin (missile, w_shotorg);
72 setsize(missile, '0 0 0', '0 0 0');
74 W_SetupProjectileVelocity(missile, autocvar_g_balance_hlac_primary_speed, spread);
75 //missile.angles = vectoangles (missile.velocity); // csqc
77 missile.touch = W_HLAC_Touch;
78 missile.think = SUB_Remove;
80 missile.nextthink = time + autocvar_g_balance_hlac_primary_lifetime;
82 missile.flags = FL_PROJECTILE;
83 missile.projectiledeathtype = WEP_HLAC;
85 CSQCProjectile(missile, TRUE, PROJECTILE_HLAC, TRUE);
87 other = missile; MUTATOR_CALLHOOK(EditProjectile);
90 void W_HLAC_Attack2f (void)
95 spread = autocvar_g_balance_hlac_secondary_spread;
99 spread = spread * autocvar_g_balance_hlac_secondary_spread_crouchmod;
101 W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav", CHAN_WEAPON, autocvar_g_balance_hlac_secondary_damage);
102 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
105 missile.owner = self;
106 missile.classname = "hlacbolt";
107 missile.bot_dodge = TRUE;
109 missile.bot_dodgerating = autocvar_g_balance_hlac_secondary_damage;
111 missile.movetype = MOVETYPE_FLY;
112 PROJECTILE_MAKETRIGGER(missile);
114 setorigin (missile, w_shotorg);
115 setsize(missile, '0 0 0', '0 0 0');
117 W_SetupProjectileVelocity(missile, autocvar_g_balance_hlac_secondary_speed, spread);
118 //missile.angles = vectoangles (missile.velocity); // csqc
120 missile.touch = W_HLAC_Touch;
121 missile.think = SUB_Remove;
123 missile.nextthink = time + autocvar_g_balance_hlac_secondary_lifetime;
125 missile.flags = FL_PROJECTILE;
126 missile.projectiledeathtype = WEP_HLAC | HITTYPE_SECONDARY;
128 CSQCProjectile(missile, TRUE, PROJECTILE_HLAC, TRUE);
130 other = missile; MUTATOR_CALLHOOK(EditProjectile);
133 void W_HLAC_Attack2 (void)
137 // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
138 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
140 if(autocvar_g_balance_hlac_reload_ammo)
142 self.clip_load -= autocvar_g_balance_hlac_secondary_ammo;
143 self.weapon_load[WEP_HLAC] = self.clip_load;
146 self.ammo_cells -= autocvar_g_balance_hlac_secondary_ammo;
149 for(i=autocvar_g_balance_hlac_secondary_shots;i>0;--i)
154 self.punchangle_x = random () - 0.5;
155 self.punchangle_y = random () - 0.5;
162 if(self.weapon != self.switchweapon) // abort immediately if switching
168 if (self.BUTTON_ATCK)
170 if (!weapon_action(self.weapon, WR_CHECKAMMO1))
172 W_SwitchWeapon_Force(self, w_getbestweapon(self));
177 ATTACK_FINISHED(self) = time + autocvar_g_balance_hlac_primary_refire * W_WeaponRateFactor();
179 self.misc_bulletcounter = self.misc_bulletcounter + 1;
180 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hlac_primary_refire, HLAC_fire1_02);
184 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hlac_primary_animtime, w_ready);
188 void spawnfunc_weapon_hlac (void)
190 weapon_defaultspawnfunc(WEP_HLAC);
193 float w_hlac(float req)
197 self.BUTTON_ATCK = bot_aim(autocvar_g_balance_hlac_primary_speed, 0, autocvar_g_balance_hlac_primary_lifetime, FALSE);
198 else if (req == WR_THINK)
200 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
202 else if (self.BUTTON_ATCK)
204 if (weapon_prepareattack(0, autocvar_g_balance_hlac_primary_refire))
206 self.misc_bulletcounter = 0;
208 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hlac_primary_refire, HLAC_fire1_02);
212 else if (self.BUTTON_ATCK2 && autocvar_g_balance_hlac_secondary)
214 if (weapon_prepareattack(1, autocvar_g_balance_hlac_secondary_refire))
217 weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_hlac_secondary_animtime, w_ready);
221 else if (req == WR_PRECACHE)
223 precache_model ("models/weapons/g_hlac.md3");
224 precache_model ("models/weapons/v_hlac.md3");
225 precache_model ("models/weapons/h_hlac.iqm");
226 precache_sound ("weapons/lasergun_fire.wav");
227 precache_sound ("weapons/reload.wav");
230 else if (req == WR_SETUP)
232 weapon_setup(WEP_HLAC);
234 else if (req == WR_CHECKAMMO1)
236 ammo_amount = self.ammo_cells >= autocvar_g_balance_hlac_primary_ammo;
237 ammo_amount += self.weapon_load[WEP_HLAC] >= autocvar_g_balance_hlac_primary_ammo;
240 else if (req == WR_CHECKAMMO2)
242 ammo_amount = self.ammo_cells >= autocvar_g_balance_hlac_secondary_ammo;
243 ammo_amount += self.weapon_load[WEP_HLAC] >= autocvar_g_balance_hlac_secondary_ammo;
246 else if (req == WR_RELOAD)
254 float w_hlac(float req)
256 if(req == WR_IMPACTEFFECT)
259 org2 = w_org + w_backoff * 6;
260 pointparticles(particleeffectnum("laser_impact"), org2, w_backoff * 1000, 1);
262 sound(self, CHAN_PROJECTILE, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM);
264 else if(req == WR_PRECACHE)
266 precache_sound("weapons/laserimpact.wav");
268 else if (req == WR_SUICIDEMESSAGE)
269 w_deathtypestring = _("%s should have used a smaller gun");
270 else if (req == WR_KILLMESSAGE)
271 w_deathtypestring = _("%s was cut down by %s");