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!
7 void W_Hagar_Explode (void)
9 self.event_damage = SUB_Null;
10 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);
15 void W_Hagar_Explode2 (void)
17 self.event_damage = SUB_Null;
18 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);
23 void W_Hagar_Touch (void)
29 void W_Hagar_Touch2 (void)
33 if(self.cnt > 0 || other.takedamage == DAMAGE_AIM) {
37 pointparticles(particleeffectnum("hagar_bounce"), self.origin, self.velocity, 1);
38 self.angles = vectoangles (self.velocity);
40 self.projectiledeathtype |= HITTYPE_BOUNCE;
44 void W_Hagar_Attack (void)
48 // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
49 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
51 if(autocvar_g_balance_hagar_reload_ammo)
53 self.clip_load -= autocvar_g_balance_hagar_primary_ammo;
54 self.weapon_load[WEP_HAGAR] = self.clip_load;
57 self.ammo_rockets -= autocvar_g_balance_hagar_primary_ammo;
60 W_SetupShot (self, FALSE, 2, "weapons/hagar_fire.wav", CHAN_WEAPON, autocvar_g_balance_hagar_primary_damage);
62 pointparticles(particleeffectnum("hagar_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
65 missile.owner = missile.realowner = self;
66 missile.classname = "missile";
67 missile.bot_dodge = TRUE;
68 missile.bot_dodgerating = autocvar_g_balance_hagar_primary_damage;
69 missile.touch = W_Hagar_Touch;
70 missile.use = W_Hagar_Explode;
71 missile.think = adaptor_think2use_hittype_splash;
72 missile.nextthink = time + autocvar_g_balance_hagar_primary_lifetime;
73 PROJECTILE_MAKETRIGGER(missile);
74 missile.projectiledeathtype = WEP_HAGAR;
75 setorigin (missile, w_shotorg);
76 setsize(missile, '0 0 0', '0 0 0');
78 missile.movetype = MOVETYPE_FLY;
79 W_SETUPPROJECTILEVELOCITY(missile, g_balance_hagar_primary);
81 missile.angles = vectoangles (missile.velocity);
82 missile.flags = FL_PROJECTILE;
84 CSQCProjectile(missile, TRUE, PROJECTILE_HAGAR, TRUE);
86 other = missile; MUTATOR_CALLHOOK(EditProjectile);
89 void W_Hagar_Attack2 (void)
93 // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
94 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
96 if(autocvar_g_balance_hagar_reload_ammo)
98 self.clip_load -= autocvar_g_balance_hagar_secondary_ammo;
99 self.weapon_load[WEP_HAGAR] = self.clip_load;
102 self.ammo_rockets -= autocvar_g_balance_hagar_secondary_ammo;
105 W_SetupShot (self, FALSE, 2, "weapons/hagar_fire.wav", CHAN_WEAPON, autocvar_g_balance_hagar_secondary_damage);
107 pointparticles(particleeffectnum("hagar_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
110 missile.owner = missile.realowner = self;
111 missile.classname = "missile";
112 missile.bot_dodge = TRUE;
113 missile.bot_dodgerating = autocvar_g_balance_hagar_secondary_damage;
114 missile.touch = W_Hagar_Touch2;
116 missile.use = W_Hagar_Explode2;
117 missile.think = adaptor_think2use_hittype_splash;
118 missile.nextthink = time + autocvar_g_balance_hagar_secondary_lifetime_min + random() * autocvar_g_balance_hagar_secondary_lifetime_rand;
119 PROJECTILE_MAKETRIGGER(missile);
120 missile.projectiledeathtype = WEP_HAGAR | HITTYPE_SECONDARY;
121 setorigin (missile, w_shotorg);
122 setsize(missile, '0 0 0', '0 0 0');
124 missile.movetype = MOVETYPE_BOUNCEMISSILE;
125 W_SETUPPROJECTILEVELOCITY(missile, g_balance_hagar_secondary);
127 missile.angles = vectoangles (missile.velocity);
128 missile.flags = FL_PROJECTILE;
130 CSQCProjectile(missile, TRUE, PROJECTILE_HAGAR_BOUNCING, TRUE);
132 other = missile; MUTATOR_CALLHOOK(EditProjectile);
135 void spawnfunc_weapon_hagar (void)
137 weapon_defaultspawnfunc(WEP_HAGAR);
140 float w_hagar(float req)
145 self.BUTTON_ATCK = bot_aim(autocvar_g_balance_hagar_primary_speed, 0, autocvar_g_balance_hagar_primary_lifetime, FALSE);
148 // not using secondary_speed since these are only 15% and should cause some ricochets without re-aiming
149 self.BUTTON_ATCK2 = bot_aim(autocvar_g_balance_hagar_primary_speed, 0, autocvar_g_balance_hagar_primary_lifetime, FALSE);
151 else if (req == WR_THINK)
153 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
154 weapon_action(self.weapon, WR_RELOAD);
155 else if (self.BUTTON_ATCK)
157 if (weapon_prepareattack(0, autocvar_g_balance_hagar_primary_refire))
160 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hagar_primary_refire, w_ready);
163 else if (self.BUTTON_ATCK2 && autocvar_g_balance_hagar_secondary)
165 if (weapon_prepareattack(1, autocvar_g_balance_hagar_secondary_refire))
168 weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_hagar_secondary_refire, w_ready);
172 else if (req == WR_PRECACHE)
174 precache_model ("models/weapons/g_hagar.md3");
175 precache_model ("models/weapons/v_hagar.md3");
176 precache_model ("models/weapons/h_hagar.iqm");
177 precache_sound ("weapons/hagar_fire.wav");
178 precache_sound ("weapons/reload.wav");
180 else if (req == WR_SETUP)
182 weapon_setup(WEP_HAGAR);
184 else if (req == WR_CHECKAMMO1)
186 ammo_amount = self.ammo_rockets >= autocvar_g_balance_hagar_primary_ammo;
187 ammo_amount += self.weapon_load[WEP_HAGAR] >= autocvar_g_balance_hagar_primary_ammo;
190 else if (req == WR_CHECKAMMO2)
192 ammo_amount = self.ammo_rockets >= autocvar_g_balance_hagar_secondary_ammo;
193 ammo_amount += self.weapon_load[WEP_HAGAR] >= autocvar_g_balance_hagar_secondary_ammo;
196 else if (req == WR_RELOAD)
198 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");
204 float w_hagar(float req)
206 if(req == WR_IMPACTEFFECT)
209 org2 = w_org + w_backoff * 6;
210 pointparticles(particleeffectnum("hagar_explode"), org2, '0 0 0', 1);
214 sound(self, CHAN_PROJECTILE, "weapons/hagexp1.wav", VOL_BASE, ATTN_NORM);
215 else if (w_random<0.7)
216 sound(self, CHAN_PROJECTILE, "weapons/hagexp2.wav", VOL_BASE, ATTN_NORM);
218 sound(self, CHAN_PROJECTILE, "weapons/hagexp3.wav", VOL_BASE, ATTN_NORM);
221 else if(req == WR_PRECACHE)
223 precache_sound("weapons/hagexp1.wav");
224 precache_sound("weapons/hagexp2.wav");
225 precache_sound("weapons/hagexp3.wav");
227 else if (req == WR_SUICIDEMESSAGE)
228 w_deathtypestring = _("%s played with tiny rockets");
229 else if (req == WR_KILLMESSAGE)
231 if(w_deathtype & HITTYPE_BOUNCE) // must be secondary; unchecked: SPLASH
232 w_deathtypestring = _("%s hoped %s's missiles wouldn't bounce");
233 else // unchecked: SPLASH, SECONDARY
234 w_deathtypestring = _("%s was pummeled by %s");