2 REGISTER_WEAPON(HAGAR, w_hagar, IT_ROCKETS, 8, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH, BOT_PICKUP_RATING_MID, "hagar", "hagar", _("Hagar"))
5 // NO bounce protection, as bounces are limited!
9 W_Reload(ammo_rockets, min(autocvar_g_balance_hagar_primary_ammo, autocvar_g_balance_hagar_secondary_ammo), autocvar_g_balance_hagar_reload_ammo, autocvar_g_balance_hagar_reload_time, "weapons/reload.wav");
12 void W_Hagar_Explode (void)
14 self.event_damage = SUB_Null;
15 RadiusDamage (self, self.realowner, autocvar_g_balance_hagar_primary_damage, autocvar_g_balance_hagar_primary_edgedamage, autocvar_g_balance_hagar_primary_radius, world, autocvar_g_balance_hagar_primary_force, self.projectiledeathtype, other);
20 void W_Hagar_Explode2 (void)
22 self.event_damage = SUB_Null;
23 RadiusDamage (self, self.realowner, autocvar_g_balance_hagar_secondary_damage, autocvar_g_balance_hagar_secondary_edgedamage, autocvar_g_balance_hagar_secondary_radius, world, autocvar_g_balance_hagar_secondary_force, self.projectiledeathtype, other);
28 void W_Hagar_Touch (void)
34 void W_Hagar_Touch2 (void)
38 if(self.cnt > 0 || other.takedamage == DAMAGE_AIM) {
42 pointparticles(particleeffectnum("hagar_bounce"), self.origin, self.velocity, 1);
43 self.angles = vectoangles (self.velocity);
45 self.projectiledeathtype |= HITTYPE_BOUNCE;
49 void W_Hagar_Attack (void)
53 // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
54 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
56 if(autocvar_g_balance_hagar_reload_ammo)
58 self.clip_load -= autocvar_g_balance_hagar_primary_ammo;
59 self.weapon_load[WEP_HAGAR] = self.clip_load;
62 self.ammo_rockets -= autocvar_g_balance_hagar_primary_ammo;
65 W_SetupShot (self, FALSE, 2, "weapons/hagar_fire.wav", CHAN_WEAPON, autocvar_g_balance_hagar_primary_damage);
67 pointparticles(particleeffectnum("hagar_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
70 missile.owner = missile.realowner = self;
71 missile.classname = "missile";
72 missile.bot_dodge = TRUE;
73 missile.bot_dodgerating = autocvar_g_balance_hagar_primary_damage;
74 missile.touch = W_Hagar_Touch;
75 missile.use = W_Hagar_Explode;
76 missile.think = adaptor_think2use_hittype_splash;
77 missile.nextthink = time + autocvar_g_balance_hagar_primary_lifetime;
78 PROJECTILE_MAKETRIGGER(missile);
79 missile.projectiledeathtype = WEP_HAGAR;
80 setorigin (missile, w_shotorg);
81 setsize(missile, '0 0 0', '0 0 0');
83 missile.movetype = MOVETYPE_FLY;
84 W_SETUPPROJECTILEVELOCITY(missile, g_balance_hagar_primary);
86 missile.angles = vectoangles (missile.velocity);
87 missile.flags = FL_PROJECTILE;
89 CSQCProjectile(missile, TRUE, PROJECTILE_HAGAR, TRUE);
91 other = missile; MUTATOR_CALLHOOK(EditProjectile);
94 void W_Hagar_Attack2 (void)
98 // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
99 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
101 if(autocvar_g_balance_hagar_reload_ammo)
103 self.clip_load -= autocvar_g_balance_hagar_secondary_ammo;
104 self.weapon_load[WEP_HAGAR] = self.clip_load;
107 self.ammo_rockets -= autocvar_g_balance_hagar_secondary_ammo;
110 W_SetupShot (self, FALSE, 2, "weapons/hagar_fire.wav", CHAN_WEAPON, autocvar_g_balance_hagar_secondary_damage);
112 pointparticles(particleeffectnum("hagar_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
115 missile.owner = missile.realowner = self;
116 missile.classname = "missile";
117 missile.bot_dodge = TRUE;
118 missile.bot_dodgerating = autocvar_g_balance_hagar_secondary_damage;
119 missile.touch = W_Hagar_Touch2;
121 missile.use = W_Hagar_Explode2;
122 missile.think = adaptor_think2use_hittype_splash;
123 missile.nextthink = time + autocvar_g_balance_hagar_secondary_lifetime_min + random() * autocvar_g_balance_hagar_secondary_lifetime_rand;
124 PROJECTILE_MAKETRIGGER(missile);
125 missile.projectiledeathtype = WEP_HAGAR | HITTYPE_SECONDARY;
126 setorigin (missile, w_shotorg);
127 setsize(missile, '0 0 0', '0 0 0');
129 missile.movetype = MOVETYPE_BOUNCEMISSILE;
130 W_SETUPPROJECTILEVELOCITY(missile, g_balance_hagar_secondary);
132 missile.angles = vectoangles (missile.velocity);
133 missile.flags = FL_PROJECTILE;
135 CSQCProjectile(missile, TRUE, PROJECTILE_HAGAR_BOUNCING, TRUE);
137 other = missile; MUTATOR_CALLHOOK(EditProjectile);
140 void spawnfunc_weapon_hagar (void)
142 weapon_defaultspawnfunc(WEP_HAGAR);
145 float w_hagar(float req)
150 self.BUTTON_ATCK = bot_aim(autocvar_g_balance_hagar_primary_speed, 0, autocvar_g_balance_hagar_primary_lifetime, FALSE);
153 // not using secondary_speed since these are only 15% and should cause some ricochets without re-aiming
154 self.BUTTON_ATCK2 = bot_aim(autocvar_g_balance_hagar_primary_speed, 0, autocvar_g_balance_hagar_primary_lifetime, FALSE);
156 else if (req == WR_THINK)
158 if(autocvar_g_balance_hagar_reload_ammo && self.clip_load < min(autocvar_g_balance_hagar_primary_ammo, autocvar_g_balance_hagar_secondary_ammo)) // forced reload
160 else if (self.BUTTON_ATCK)
162 if (weapon_prepareattack(0, autocvar_g_balance_hagar_primary_refire))
165 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hagar_primary_refire, w_ready);
168 else if (self.BUTTON_ATCK2 && autocvar_g_balance_hagar_secondary)
170 if (weapon_prepareattack(1, autocvar_g_balance_hagar_secondary_refire))
173 weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_hagar_secondary_refire, w_ready);
177 else if (req == WR_PRECACHE)
179 precache_model ("models/weapons/g_hagar.md3");
180 precache_model ("models/weapons/v_hagar.md3");
181 precache_model ("models/weapons/h_hagar.iqm");
182 precache_sound ("weapons/hagar_fire.wav");
183 precache_sound ("weapons/reload.wav");
185 else if (req == WR_SETUP)
187 weapon_setup(WEP_HAGAR);
189 else if (req == WR_CHECKAMMO1)
191 ammo_amount = self.ammo_rockets >= autocvar_g_balance_hagar_primary_ammo;
192 ammo_amount += self.weapon_load[WEP_HAGAR] >= autocvar_g_balance_hagar_primary_ammo;
195 else if (req == WR_CHECKAMMO2)
197 ammo_amount = self.ammo_rockets >= autocvar_g_balance_hagar_secondary_ammo;
198 ammo_amount += self.weapon_load[WEP_HAGAR] >= autocvar_g_balance_hagar_secondary_ammo;
201 else if (req == WR_RELOAD)
209 float w_hagar(float req)
211 if(req == WR_IMPACTEFFECT)
214 org2 = w_org + w_backoff * 6;
215 pointparticles(particleeffectnum("hagar_explode"), org2, '0 0 0', 1);
219 sound(self, CHAN_PROJECTILE, "weapons/hagexp1.wav", VOL_BASE, ATTN_NORM);
220 else if (w_random<0.7)
221 sound(self, CHAN_PROJECTILE, "weapons/hagexp2.wav", VOL_BASE, ATTN_NORM);
223 sound(self, CHAN_PROJECTILE, "weapons/hagexp3.wav", VOL_BASE, ATTN_NORM);
226 else if(req == WR_PRECACHE)
228 precache_sound("weapons/hagexp1.wav");
229 precache_sound("weapons/hagexp2.wav");
230 precache_sound("weapons/hagexp3.wav");
232 else if (req == WR_SUICIDEMESSAGE)
233 w_deathtypestring = _("%s played with tiny rockets");
234 else if (req == WR_KILLMESSAGE)
236 if(w_deathtype & HITTYPE_BOUNCE) // must be secondary; unchecked: SPLASH
237 w_deathtypestring = _("%s hoped %s's missiles wouldn't bounce");
238 else // unchecked: SPLASH, SECONDARY
239 w_deathtypestring = _("%s was pummeled by %s");