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");
5 .float HLAC_bulletcounter;
6 void W_HLAC_Touch (void)
10 self.event_damage = SUB_Null;
12 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);
17 void W_HLAC_Touch2 (void)
21 self.event_damage = SUB_Null;
23 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);
28 void W_HLAC_Attack (void)
33 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
35 self.ammo_cells = self.ammo_cells - cvar("g_balance_hlac_primary_ammo");
38 spread = cvar("g_balance_hlac_primary_spread_min") + (cvar("g_balance_hlac_primary_spread_add") * self.HLAC_bulletcounter);
39 spread = min(spread,cvar("g_balance_hlac_primary_spread_max"));
41 spread = spread * cvar("g_balance_hlac_primary_spread_crouchmod");
43 W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav", cvar("g_balance_hlac_primary_damage"));
44 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
47 self.punchangle_x = random () - 0.5;
48 self.punchangle_y = random () - 0.5;
53 missile.classname = "hlacbolt";
54 // missile.dmg = issecondary;
55 missile.bot_dodge = TRUE;
57 missile.bot_dodgerating = cvar("g_balance_hlac_primary_damage");
59 missile.movetype = MOVETYPE_FLY;
60 PROJECTILE_MAKETRIGGER(missile);
62 setorigin (missile, w_shotorg);
63 setsize(missile, '0 0 0', '0 0 0');
65 W_SetupProjectileVelocity(missile, cvar("g_balance_hlac_primary_speed"), spread);
66 missile.angles = vectoangles (missile.velocity);
68 missile.touch = W_HLAC_Touch;
69 missile.think = SUB_Remove;
71 missile.nextthink = time + cvar("g_balance_hlac_primary_lifetime");
73 missile.flags = FL_PROJECTILE;
74 missile.projectiledeathtype = WEP_HLAC;
76 CSQCProjectile(missile, TRUE, PROJECTILE_HLAC, TRUE);
79 void W_HLAC_Attack2f (void)
84 spread = cvar("g_balance_hlac_secondary_spread");
88 spread = spread * cvar("g_balance_hlac_secondary_spread_crouchmod");
90 W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav", cvar("g_balance_hlac_secondary_damage"));
91 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
95 missile.classname = "hlacbolt";
96 // missile.dmg = issecondary;
97 missile.bot_dodge = TRUE;
99 missile.bot_dodgerating = cvar("g_balance_hlac_secondary_damage");
101 missile.movetype = MOVETYPE_FLY;
102 PROJECTILE_MAKETRIGGER(missile);
104 setorigin (missile, w_shotorg);
105 setsize(missile, '0 0 0', '0 0 0');
107 W_SetupProjectileVelocity(missile, cvar("g_balance_hlac_secondary_speed"), spread);
108 missile.angles = vectoangles (missile.velocity);
110 missile.touch = W_HLAC_Touch2;
111 missile.think = SUB_Remove;
113 missile.nextthink = time + cvar("g_balance_hlac_secondary_lifetime");
115 missile.flags = FL_PROJECTILE;
116 missile.projectiledeathtype = WEP_HLAC | HITTYPE_SECONDARY;
118 CSQCProjectile(missile, TRUE, PROJECTILE_HLAC, TRUE);
121 void W_HLAC_Attack2 (void)
125 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
127 self.ammo_cells = self.ammo_cells - cvar("g_balance_hlac_secondary_ammo");
130 for(i=cvar("g_balance_hlac_secondary_shots");i>0;--i)
135 self.punchangle_x = random () - 0.5;
136 self.punchangle_y = random () - 0.5;
143 if(self.weapon != self.switchweapon) // abort immediately if switching
149 if (self.BUTTON_ATCK)
151 if (!weapon_action(self.weapon, WR_CHECKAMMO1))
153 W_SwitchWeapon_Force(self, w_getbestweapon(self));
158 ATTACK_FINISHED(self) = time + cvar("g_balance_hlac_primary_refire") * W_WeaponRateFactor();
160 self.HLAC_bulletcounter = self.HLAC_bulletcounter + 1;
161 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_hlac_primary_refire"), HLAC_fire1_02);
165 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_hlac_primary_animtime"), w_ready);
169 void spawnfunc_weapon_hlac (void)
171 weapon_defaultspawnfunc(WEP_HLAC);
174 float w_hlac(float req)
177 self.BUTTON_ATCK = bot_aim(cvar("g_balance_hlac_primary_speed"), 0, cvar("g_balance_hlac_primary_lifetime"), FALSE);
178 else if (req == WR_THINK)
180 if (self.BUTTON_ATCK)
181 if (weapon_prepareattack(0, cvar("g_balance_hlac_primary_refire")))
183 self.HLAC_bulletcounter = 0;
185 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_hlac_primary_refire"), HLAC_fire1_02);
188 if (self.BUTTON_ATCK2 && cvar("g_balance_hlac_secondary"))
189 if (weapon_prepareattack(1, cvar("g_balance_hlac_secondary_refire")))
192 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_hlac_secondary_animtime"), w_ready);
196 else if (req == WR_PRECACHE)
198 precache_model ("models/weapons/g_hlac.md3");
199 precache_model ("models/weapons/v_hlac.md3");
200 precache_model ("models/weapons/h_hlac.iqm");
201 precache_sound ("weapons/lasergun_fire.wav");
204 else if (req == WR_SETUP)
205 weapon_setup(WEP_HLAC);
206 else if (req == WR_CHECKAMMO1)
207 return self.ammo_cells >= cvar("g_balance_hlac_primary_ammo");
208 else if (req == WR_CHECKAMMO2)
209 return self.ammo_cells >= cvar("g_balance_hlac_secondary_ammo");
214 float w_hlac(float req)
216 if(req == WR_IMPACTEFFECT)
219 org2 = w_org + w_backoff * 6;
220 pointparticles(particleeffectnum("laser_impact"), org2, w_backoff * 1000, 1);
222 sound(self, CHAN_PROJECTILE, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM);
224 else if(req == WR_PRECACHE)
226 precache_sound("weapons/laserimpact.wav");
228 else if (req == WR_SUICIDEMESSAGE)
229 w_deathtypestring = "should have used a smaller gun";
230 else if (req == WR_KILLMESSAGE)
231 w_deathtypestring = "was cut down by";