2 REGISTER_WEAPON(HAGAR, w_hagar, IT_ROCKETS, 8, WEP_FLAG_NORMAL | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH, BOT_PICKUP_RATING_MID, "hagar", "hagar", _("Hagar"))
5 // NO bounce protection, as bounces are limited!
7 void W_Hagar_SetAmmoCounter()
9 // set clip_load to the weapon we have switched to, if the gun uses reloading
10 if(!autocvar_g_balance_hagar_reload_ammo)
11 self.clip_load = 0; // also keeps crosshair ammo from displaying
14 self.clip_load = self.weapon_load[WEP_HAGAR];
15 self.clip_size = autocvar_g_balance_hagar_reload_ammo; // for the crosshair ammo display
21 self.reload_ammo_player = ammo_rockets;
22 self.reload_ammo_min = min(autocvar_g_balance_hagar_primary_ammo, autocvar_g_balance_hagar_secondary_ammo);
23 self.reload_ammo_amount = autocvar_g_balance_hagar_reload_ammo;
24 self.reload_time = autocvar_g_balance_hagar_reload_time;
25 self.reload_sound = "weapons/reload.wav";
30 void W_Hagar_Explode (void)
32 self.event_damage = SUB_Null;
33 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);
38 void W_Hagar_Explode2 (void)
40 self.event_damage = SUB_Null;
41 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);
46 void W_Hagar_Touch (void)
52 void W_Hagar_Touch2 (void)
56 if(self.cnt > 0 || other.takedamage == DAMAGE_AIM) {
60 pointparticles(particleeffectnum("hagar_bounce"), self.origin, self.velocity, 1);
61 self.angles = vectoangles (self.velocity);
63 self.projectiledeathtype |= HITTYPE_BOUNCE;
67 void W_Hagar_Attack (void)
71 // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
72 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
74 if(autocvar_g_balance_hagar_reload_ammo)
76 self.clip_load -= autocvar_g_balance_hagar_primary_ammo;
77 self.weapon_load[WEP_HAGAR] = self.clip_load;
80 self.ammo_rockets -= autocvar_g_balance_hagar_primary_ammo;
83 W_SetupShot (self, FALSE, 2, "weapons/hagar_fire.wav", CHAN_WEAPON, autocvar_g_balance_hagar_primary_damage);
85 pointparticles(particleeffectnum("hagar_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
88 missile.owner = missile.realowner = self;
89 missile.classname = "missile";
90 missile.bot_dodge = TRUE;
91 missile.bot_dodgerating = autocvar_g_balance_hagar_primary_damage;
92 missile.touch = W_Hagar_Touch;
93 missile.use = W_Hagar_Explode;
94 missile.think = adaptor_think2use_hittype_splash;
95 missile.nextthink = time + autocvar_g_balance_hagar_primary_lifetime;
96 PROJECTILE_MAKETRIGGER(missile);
97 missile.projectiledeathtype = WEP_HAGAR;
98 setorigin (missile, w_shotorg);
99 setsize(missile, '0 0 0', '0 0 0');
101 missile.movetype = MOVETYPE_FLY;
102 W_SETUPPROJECTILEVELOCITY(missile, g_balance_hagar_primary);
104 missile.angles = vectoangles (missile.velocity);
105 missile.flags = FL_PROJECTILE;
107 CSQCProjectile(missile, TRUE, PROJECTILE_HAGAR, TRUE);
109 other = missile; MUTATOR_CALLHOOK(EditProjectile);
112 void W_Hagar_Attack2 (void)
114 local entity missile;
116 // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
117 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
119 if(autocvar_g_balance_hagar_reload_ammo)
121 self.clip_load -= autocvar_g_balance_hagar_secondary_ammo;
122 self.weapon_load[WEP_HAGAR] = self.clip_load;
125 self.ammo_rockets -= autocvar_g_balance_hagar_secondary_ammo;
128 W_SetupShot (self, FALSE, 2, "weapons/hagar_fire.wav", CHAN_WEAPON, autocvar_g_balance_hagar_secondary_damage);
130 pointparticles(particleeffectnum("hagar_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
133 missile.owner = missile.realowner = self;
134 missile.classname = "missile";
135 missile.bot_dodge = TRUE;
136 missile.bot_dodgerating = autocvar_g_balance_hagar_secondary_damage;
137 missile.touch = W_Hagar_Touch2;
139 missile.use = W_Hagar_Explode2;
140 missile.think = adaptor_think2use_hittype_splash;
141 missile.nextthink = time + autocvar_g_balance_hagar_secondary_lifetime_min + random() * autocvar_g_balance_hagar_secondary_lifetime_rand;
142 PROJECTILE_MAKETRIGGER(missile);
143 missile.projectiledeathtype = WEP_HAGAR | HITTYPE_SECONDARY;
144 setorigin (missile, w_shotorg);
145 setsize(missile, '0 0 0', '0 0 0');
147 missile.movetype = MOVETYPE_BOUNCEMISSILE;
148 W_SETUPPROJECTILEVELOCITY(missile, g_balance_hagar_secondary);
150 missile.angles = vectoangles (missile.velocity);
151 missile.flags = FL_PROJECTILE;
153 CSQCProjectile(missile, TRUE, PROJECTILE_HAGAR_BOUNCING, TRUE);
155 other = missile; MUTATOR_CALLHOOK(EditProjectile);
158 void spawnfunc_weapon_hagar (void)
160 weapon_defaultspawnfunc(WEP_HAGAR);
163 float w_hagar(float req)
168 self.BUTTON_ATCK = bot_aim(autocvar_g_balance_hagar_primary_speed, 0, autocvar_g_balance_hagar_primary_lifetime, FALSE);
171 // not using secondary_speed since these are only 15% and should cause some ricochets without re-aiming
172 self.BUTTON_ATCK2 = bot_aim(autocvar_g_balance_hagar_primary_speed, 0, autocvar_g_balance_hagar_primary_lifetime, FALSE);
174 else if (req == WR_THINK)
176 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
178 else if (self.BUTTON_ATCK)
180 if (weapon_prepareattack(0, autocvar_g_balance_hagar_primary_refire))
183 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hagar_primary_refire, w_ready);
186 else if (self.BUTTON_ATCK2 && autocvar_g_balance_hagar_secondary)
188 if (weapon_prepareattack(1, autocvar_g_balance_hagar_secondary_refire))
191 weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_hagar_secondary_refire, w_ready);
195 else if (req == WR_PRECACHE)
197 precache_model ("models/weapons/g_hagar.md3");
198 precache_model ("models/weapons/v_hagar.md3");
199 precache_model ("models/weapons/h_hagar.iqm");
200 precache_sound ("weapons/hagar_fire.wav");
201 precache_sound ("weapons/reload.wav");
203 else if (req == WR_SETUP)
205 weapon_setup(WEP_HAGAR);
206 W_Hagar_SetAmmoCounter();
208 else if (req == WR_CHECKAMMO1)
210 ammo_amount = self.ammo_rockets >= autocvar_g_balance_hagar_primary_ammo;
211 ammo_amount += self.weapon_load[WEP_HAGAR] >= autocvar_g_balance_hagar_primary_ammo;
214 else if (req == WR_CHECKAMMO2)
216 ammo_amount = self.ammo_rockets >= autocvar_g_balance_hagar_secondary_ammo;
217 ammo_amount += self.weapon_load[WEP_HAGAR] >= autocvar_g_balance_hagar_secondary_ammo;
220 else if (req == WR_RESETPLAYER)
222 // all weapons must be fully loaded when we spawn
223 self.weapon_load[WEP_HAGAR] = autocvar_g_balance_hagar_reload_ammo;
225 else if (req == WR_RELOAD)
233 float w_hagar(float req)
235 if(req == WR_IMPACTEFFECT)
238 org2 = w_org + w_backoff * 6;
239 pointparticles(particleeffectnum("hagar_explode"), org2, '0 0 0', 1);
243 sound(self, CHAN_PROJECTILE, "weapons/hagexp1.wav", VOL_BASE, ATTN_NORM);
244 else if (w_random<0.7)
245 sound(self, CHAN_PROJECTILE, "weapons/hagexp2.wav", VOL_BASE, ATTN_NORM);
247 sound(self, CHAN_PROJECTILE, "weapons/hagexp3.wav", VOL_BASE, ATTN_NORM);
250 else if(req == WR_PRECACHE)
252 precache_sound("weapons/hagexp1.wav");
253 precache_sound("weapons/hagexp2.wav");
254 precache_sound("weapons/hagexp3.wav");
256 else if (req == WR_SUICIDEMESSAGE)
257 w_deathtypestring = _("%s played with tiny rockets");
258 else if (req == WR_KILLMESSAGE)
260 if(w_deathtype & HITTYPE_BOUNCE) // must be secondary; unchecked: SPLASH
261 w_deathtypestring = _("%s hoped %s's missiles wouldn't bounce");
262 else // unchecked: SPLASH, SECONDARY
263 w_deathtypestring = _("%s was pummeled by %s");