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 self.reload_ammo_player = ammo_rockets;
10 self.reload_ammo_min = min(autocvar_g_balance_hagar_primary_ammo, autocvar_g_balance_hagar_secondary_ammo);
11 self.reload_ammo_amount = autocvar_g_balance_hagar_reload_ammo;
12 self.reload_time = autocvar_g_balance_hagar_reload_time;
13 self.reload_sound = "weapons/reload.wav";
18 void W_Hagar_Explode (void)
20 self.event_damage = SUB_Null;
21 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);
26 void W_Hagar_Explode2 (void)
28 self.event_damage = SUB_Null;
29 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);
34 void W_Hagar_Touch (void)
40 void W_Hagar_Touch2 (void)
44 if(self.cnt > 0 || other.takedamage == DAMAGE_AIM) {
48 pointparticles(particleeffectnum("hagar_bounce"), self.origin, self.velocity, 1);
49 self.angles = vectoangles (self.velocity);
51 self.projectiledeathtype |= HITTYPE_BOUNCE;
55 void W_Hagar_Attack (void)
59 // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
60 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
62 if(autocvar_g_balance_hagar_reload_ammo)
64 self.clip_load -= autocvar_g_balance_hagar_primary_ammo;
65 self.weapon_load[WEP_HAGAR] = self.clip_load;
68 self.ammo_rockets -= autocvar_g_balance_hagar_primary_ammo;
71 W_SetupShot (self, FALSE, 2, "weapons/hagar_fire.wav", CHAN_WEAPON, autocvar_g_balance_hagar_primary_damage);
73 pointparticles(particleeffectnum("hagar_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
76 missile.owner = missile.realowner = self;
77 missile.classname = "missile";
78 missile.bot_dodge = TRUE;
79 missile.bot_dodgerating = autocvar_g_balance_hagar_primary_damage;
80 missile.touch = W_Hagar_Touch;
81 missile.use = W_Hagar_Explode;
82 missile.think = adaptor_think2use_hittype_splash;
83 missile.nextthink = time + autocvar_g_balance_hagar_primary_lifetime;
84 PROJECTILE_MAKETRIGGER(missile);
85 missile.projectiledeathtype = WEP_HAGAR;
86 setorigin (missile, w_shotorg);
87 setsize(missile, '0 0 0', '0 0 0');
89 missile.movetype = MOVETYPE_FLY;
90 W_SETUPPROJECTILEVELOCITY(missile, g_balance_hagar_primary);
92 missile.angles = vectoangles (missile.velocity);
93 missile.flags = FL_PROJECTILE;
95 CSQCProjectile(missile, TRUE, PROJECTILE_HAGAR, TRUE);
97 other = missile; MUTATOR_CALLHOOK(EditProjectile);
100 void W_Hagar_Attack2 (void)
102 local entity missile;
104 // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
105 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
107 if(autocvar_g_balance_hagar_reload_ammo)
109 self.clip_load -= autocvar_g_balance_hagar_secondary_ammo;
110 self.weapon_load[WEP_HAGAR] = self.clip_load;
113 self.ammo_rockets -= autocvar_g_balance_hagar_secondary_ammo;
116 W_SetupShot (self, FALSE, 2, "weapons/hagar_fire.wav", CHAN_WEAPON, autocvar_g_balance_hagar_secondary_damage);
118 pointparticles(particleeffectnum("hagar_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
121 missile.owner = missile.realowner = self;
122 missile.classname = "missile";
123 missile.bot_dodge = TRUE;
124 missile.bot_dodgerating = autocvar_g_balance_hagar_secondary_damage;
125 missile.touch = W_Hagar_Touch2;
127 missile.use = W_Hagar_Explode2;
128 missile.think = adaptor_think2use_hittype_splash;
129 missile.nextthink = time + autocvar_g_balance_hagar_secondary_lifetime_min + random() * autocvar_g_balance_hagar_secondary_lifetime_rand;
130 PROJECTILE_MAKETRIGGER(missile);
131 missile.projectiledeathtype = WEP_HAGAR | HITTYPE_SECONDARY;
132 setorigin (missile, w_shotorg);
133 setsize(missile, '0 0 0', '0 0 0');
135 missile.movetype = MOVETYPE_BOUNCEMISSILE;
136 W_SETUPPROJECTILEVELOCITY(missile, g_balance_hagar_secondary);
138 missile.angles = vectoangles (missile.velocity);
139 missile.flags = FL_PROJECTILE;
141 CSQCProjectile(missile, TRUE, PROJECTILE_HAGAR_BOUNCING, TRUE);
143 other = missile; MUTATOR_CALLHOOK(EditProjectile);
146 void spawnfunc_weapon_hagar (void)
148 weapon_defaultspawnfunc(WEP_HAGAR);
151 float w_hagar(float req)
156 self.BUTTON_ATCK = bot_aim(autocvar_g_balance_hagar_primary_speed, 0, autocvar_g_balance_hagar_primary_lifetime, FALSE);
159 // not using secondary_speed since these are only 15% and should cause some ricochets without re-aiming
160 self.BUTTON_ATCK2 = bot_aim(autocvar_g_balance_hagar_primary_speed, 0, autocvar_g_balance_hagar_primary_lifetime, FALSE);
162 else if (req == WR_THINK)
164 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
166 else if (self.BUTTON_ATCK)
168 if (weapon_prepareattack(0, autocvar_g_balance_hagar_primary_refire))
171 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hagar_primary_refire, w_ready);
174 else if (self.BUTTON_ATCK2 && autocvar_g_balance_hagar_secondary)
176 if (weapon_prepareattack(1, autocvar_g_balance_hagar_secondary_refire))
179 weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_hagar_secondary_refire, w_ready);
183 else if (req == WR_PRECACHE)
185 precache_model ("models/weapons/g_hagar.md3");
186 precache_model ("models/weapons/v_hagar.md3");
187 precache_model ("models/weapons/h_hagar.iqm");
188 precache_sound ("weapons/hagar_fire.wav");
189 precache_sound ("weapons/reload.wav");
191 else if (req == WR_SETUP)
193 weapon_setup(WEP_HAGAR);
195 else if (req == WR_CHECKAMMO1)
197 ammo_amount = self.ammo_rockets >= autocvar_g_balance_hagar_primary_ammo;
198 ammo_amount += self.weapon_load[WEP_HAGAR] >= autocvar_g_balance_hagar_primary_ammo;
201 else if (req == WR_CHECKAMMO2)
203 ammo_amount = self.ammo_rockets >= autocvar_g_balance_hagar_secondary_ammo;
204 ammo_amount += self.weapon_load[WEP_HAGAR] >= autocvar_g_balance_hagar_secondary_ammo;
207 else if (req == WR_RELOAD)
215 float w_hagar(float req)
217 if(req == WR_IMPACTEFFECT)
220 org2 = w_org + w_backoff * 6;
221 pointparticles(particleeffectnum("hagar_explode"), org2, '0 0 0', 1);
225 sound(self, CHAN_PROJECTILE, "weapons/hagexp1.wav", VOL_BASE, ATTN_NORM);
226 else if (w_random<0.7)
227 sound(self, CHAN_PROJECTILE, "weapons/hagexp2.wav", VOL_BASE, ATTN_NORM);
229 sound(self, CHAN_PROJECTILE, "weapons/hagexp3.wav", VOL_BASE, ATTN_NORM);
232 else if(req == WR_PRECACHE)
234 precache_sound("weapons/hagexp1.wav");
235 precache_sound("weapons/hagexp2.wav");
236 precache_sound("weapons/hagexp3.wav");
238 else if (req == WR_SUICIDEMESSAGE)
239 w_deathtypestring = _("%s played with tiny rockets");
240 else if (req == WR_KILLMESSAGE)
242 if(w_deathtype & HITTYPE_BOUNCE) // must be secondary; unchecked: SPLASH
243 w_deathtypestring = _("%s hoped %s's missiles wouldn't bounce");
244 else // unchecked: SPLASH, SECONDARY
245 w_deathtypestring = _("%s was pummeled by %s");