1 .float HLAC_bulletcounter;
2 void W_HLAC_Touch (void)
6 self.event_damage = SUB_Null;
8 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);
13 void W_HLAC_Touch2 (void)
17 self.event_damage = SUB_Null;
19 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);
24 void W_HLAC_Attack (void)
29 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
31 self.ammo_cells = self.ammo_cells - cvar("g_balance_hlac_primary_ammo");
34 spread = cvar("g_balance_hlac_primary_spread_min") + (cvar("g_balance_hlac_primary_spread_add") * self.HLAC_bulletcounter);
35 spread = min(spread,cvar("g_balance_hlac_primary_spread_max"));
37 spread = spread * cvar("g_balance_hlac_primary_spread_crouchmod");
39 W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav", cvar("g_balance_hlac_primary_damage"));
40 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
43 self.punchangle_x = random () - 0.5;
44 self.punchangle_y = random () - 0.5;
49 missile.classname = "hlacbolt";
50 // missile.dmg = issecondary;
51 missile.bot_dodge = TRUE;
53 missile.bot_dodgerating = cvar("g_balance_hlac_primary_damage");
55 missile.movetype = MOVETYPE_FLY;
56 PROJECTILE_MAKETRIGGER(missile);
58 setorigin (missile, w_shotorg);
59 setsize(missile, '0 0 0', '0 0 0');
61 missile.velocity = (w_shotdir + randomvec() * spread) * cvar("g_balance_hlac_primary_speed");
63 W_SetupProjectileVelocity(missile);
64 missile.angles = vectoangles (missile.velocity);
66 missile.touch = W_HLAC_Touch;
67 missile.think = SUB_Remove;
69 missile.nextthink = time + cvar("g_balance_hlac_primary_lifetime");
71 missile.flags = FL_PROJECTILE;
72 missile.projectiledeathtype = WEP_HLAC;
74 CSQCProjectile(missile, TRUE, PROJECTILE_HLAC, TRUE);
77 void W_HLAC_Attack2f (void)
82 spread = cvar("g_balance_hlac_secondary_spread");
86 spread = spread * cvar("g_balance_hlac_secondary_spread_crouchmod");
88 W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav", cvar("g_balance_hlac_secondary_damage"));
89 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
93 missile.classname = "hlacbolt";
94 // missile.dmg = issecondary;
95 missile.bot_dodge = TRUE;
97 missile.bot_dodgerating = cvar("g_balance_hlac_secondary_damage");
99 missile.movetype = MOVETYPE_FLY;
100 PROJECTILE_MAKETRIGGER(missile);
102 setorigin (missile, w_shotorg);
103 setsize(missile, '0 0 0', '0 0 0');
105 missile.velocity = (w_shotdir + randomvec() * spread) * cvar("g_balance_hlac_secondary_speed");
107 W_SetupProjectileVelocity(missile);
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;
144 if(self.weapon != self.switchweapon) // abort immediately if switching
150 if (self.BUTTON_ATCK)
152 if (!weapon_action(self.weapon, WR_CHECKAMMO1))
154 W_SwitchWeapon_Force(self, w_getbestweapon(self));
159 ATTACK_FINISHED(self) = time + cvar("g_balance_hlac_primary_refire") * W_WeaponRateFactor();
161 self.HLAC_bulletcounter = self.HLAC_bulletcounter + 1;
162 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_hlac_primary_refire"), HLAC_fire1_02);
166 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_hlac_primary_animtime"), w_ready);
170 void spawnfunc_weapon_hlac (void)
172 weapon_defaultspawnfunc(WEP_HLAC);
175 float w_hlac(float req)
178 self.BUTTON_ATCK = bot_aim(cvar("g_balance_hlac_primary_speed"), 0, cvar("g_balance_hlac_primary_lifetime"), FALSE);
179 else if (req == WR_THINK)
181 if (self.BUTTON_ATCK)
182 if (weapon_prepareattack(0, cvar("g_balance_hlac_primary_refire")))
184 self.HLAC_bulletcounter = 0;
186 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_hlac_primary_refire"), HLAC_fire1_02);
189 if (self.BUTTON_ATCK2)
190 if (weapon_prepareattack(1, cvar("g_balance_hlac_secondary_refire")))
193 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_hlac_secondary_animtime"), w_ready);
197 else if (req == WR_PRECACHE)
199 precache_model ("models/weapons/g_hlac.md3");
200 precache_model ("models/weapons/v_hlac.md3");
201 precache_model ("models/weapons/h_hlac.dpm");
202 precache_sound ("weapons/lasergun_fire.wav");
205 else if (req == WR_SETUP)
206 weapon_setup(WEP_HLAC);
207 else if (req == WR_CHECKAMMO1)
208 return self.ammo_cells >= cvar("g_balance_hlac_primary_ammo");
209 else if (req == WR_CHECKAMMO2)
210 return self.ammo_cells >= cvar("g_balance_hlac_secondary_ammo");
211 else if (req == WR_SUICIDEMESSAGE)
212 w_deathtypestring = "should have used a smaller gun";
213 else if (req == WR_KILLMESSAGE)
214 w_deathtypestring = "was cut down by";