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");
4 .float HLAC_bulletcounter;
5 void W_HLAC_Touch (void)
9 self.event_damage = SUB_Null;
11 RadiusDamage (self, self.owner, cvar("g_balance_hlac_primary_damage"), cvar("g_balance_hlac_primary_edgedamage"), cvar("g_balance_hlac_primary_radius"), world, cvar("g_balance_hlac_primary_force"), self.projectiledeathtype, other);
16 void W_HLAC_Touch2 (void)
20 self.event_damage = SUB_Null;
22 RadiusDamage (self, self.owner, cvar("g_balance_hlac_secondary_damage"), cvar("g_balance_hlac_secondary_edgedamage"), cvar("g_balance_hlac_secondary_radius"), world, cvar("g_balance_hlac_secondary_force"), self.projectiledeathtype, other);
27 void W_HLAC_Attack (void)
32 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
34 self.ammo_cells = self.ammo_cells - cvar("g_balance_hlac_primary_ammo");
37 spread = cvar("g_balance_hlac_primary_spread_min") + (cvar("g_balance_hlac_primary_spread_add") * self.HLAC_bulletcounter);
38 spread = min(spread,cvar("g_balance_hlac_primary_spread_max"));
40 spread = spread * cvar("g_balance_hlac_primary_spread_crouchmod");
42 W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav", cvar("g_balance_hlac_primary_damage"));
43 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
46 self.punchangle_x = random () - 0.5;
47 self.punchangle_y = random () - 0.5;
52 missile.classname = "hlacbolt";
53 // missile.dmg = issecondary;
54 missile.bot_dodge = TRUE;
56 missile.bot_dodgerating = cvar("g_balance_hlac_primary_damage");
58 missile.movetype = MOVETYPE_FLY;
59 PROJECTILE_MAKETRIGGER(missile);
61 setorigin (missile, w_shotorg);
62 setsize(missile, '0 0 0', '0 0 0');
64 W_SetupProjectileVelocity(missile, cvar("g_balance_hlac_primary_speed"), spread);
65 missile.angles = vectoangles (missile.velocity);
67 missile.touch = W_HLAC_Touch;
68 missile.think = SUB_Remove;
70 missile.nextthink = time + cvar("g_balance_hlac_primary_lifetime");
72 missile.flags = FL_PROJECTILE;
73 missile.projectiledeathtype = WEP_HLAC;
75 CSQCProjectile(missile, TRUE, PROJECTILE_HLAC, TRUE);
78 void W_HLAC_Attack2f (void)
83 spread = cvar("g_balance_hlac_secondary_spread");
87 spread = spread * cvar("g_balance_hlac_secondary_spread_crouchmod");
89 W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav", cvar("g_balance_hlac_secondary_damage"));
90 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
94 missile.classname = "hlacbolt";
95 // missile.dmg = issecondary;
96 missile.bot_dodge = TRUE;
98 missile.bot_dodgerating = cvar("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, cvar("g_balance_hlac_secondary_speed"), spread);
107 missile.angles = vectoangles (missile.velocity);
109 missile.touch = W_HLAC_Touch2;
110 missile.think = SUB_Remove;
112 missile.nextthink = time + cvar("g_balance_hlac_secondary_lifetime");
114 missile.flags = FL_PROJECTILE;
115 missile.projectiledeathtype = WEP_HLAC | HITTYPE_SECONDARY;
117 CSQCProjectile(missile, TRUE, PROJECTILE_HLAC, TRUE);
120 void W_HLAC_Attack2 (void)
124 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
126 self.ammo_cells = self.ammo_cells - cvar("g_balance_hlac_secondary_ammo");
129 for(i=cvar("g_balance_hlac_secondary_shots");i>0;--i)
134 self.punchangle_x = random () - 0.5;
135 self.punchangle_y = random () - 0.5;
139 // experimental lightning gun
140 void W_HLAC_Attack3 (void)
142 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
143 self.ammo_cells = self.ammo_cells - cvar("g_balance_hlac_primary_ammo");
144 W_SetupShot (self, TRUE, 0, "weapons/crylink_fire2.wav", cvar("g_balance_hlac_primary_damage"));
146 traceline_antilag(self, w_shotorg, w_shotorg + w_shotdir * cvar("g_balance_hlac_primary_radius"), FALSE, self, ANTILAG_LATENCY(self));
148 te_lightning1(self, w_shotorg, trace_endpos);
150 if (trace_fraction < 1)
151 Damage(trace_ent, self, self, cvar("g_balance_hlac_primary_damage"), WEP_HLAC | HITTYPE_SECONDARY, trace_endpos, cvar("g_balance_hlac_primary_force") * w_shotdir);
157 if(self.weapon != self.switchweapon) // abort immediately if switching
163 if (self.BUTTON_ATCK)
165 if (!weapon_action(self.weapon, WR_CHECKAMMO1))
167 W_SwitchWeapon_Force(self, w_getbestweapon(self));
172 ATTACK_FINISHED(self) = time + cvar("g_balance_hlac_primary_refire") * W_WeaponRateFactor();
174 self.HLAC_bulletcounter = self.HLAC_bulletcounter + 1;
175 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_hlac_primary_refire"), HLAC_fire1_02);
179 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_hlac_primary_animtime"), w_ready);
183 void spawnfunc_weapon_hlac (void)
185 weapon_defaultspawnfunc(WEP_HLAC);
188 float w_hlac(float req)
191 self.BUTTON_ATCK = bot_aim(cvar("g_balance_hlac_primary_speed"), 0, cvar("g_balance_hlac_primary_lifetime"), FALSE);
192 else if (req == WR_THINK)
194 if (self.BUTTON_ATCK)
195 if (weapon_prepareattack(0, cvar("g_balance_hlac_primary_refire")))
197 self.HLAC_bulletcounter = 0;
198 if(cvar("g_balance_hlac_primary_lightning"))
202 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_hlac_primary_refire"), HLAC_fire1_02);
205 if (self.BUTTON_ATCK2 && cvar("g_balance_hlac_secondary"))
206 if (weapon_prepareattack(1, cvar("g_balance_hlac_secondary_refire")))
209 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_hlac_secondary_animtime"), w_ready);
213 else if (req == WR_PRECACHE)
215 precache_model ("models/weapons/g_hlac.md3");
216 precache_model ("models/weapons/v_hlac.md3");
217 precache_model ("models/weapons/h_hlac.dpm");
218 precache_sound ("weapons/lasergun_fire.wav");
221 else if (req == WR_SETUP)
222 weapon_setup(WEP_HLAC);
223 else if (req == WR_CHECKAMMO1)
224 return self.ammo_cells >= cvar("g_balance_hlac_primary_ammo");
225 else if (req == WR_CHECKAMMO2)
226 return self.ammo_cells >= cvar("g_balance_hlac_secondary_ammo");
227 else if (req == WR_SUICIDEMESSAGE)
228 w_deathtypestring = "should have used a smaller gun";
229 else if (req == WR_KILLMESSAGE)
230 w_deathtypestring = "was cut down by";