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!
6 void W_Hagar_Explode (void)
8 self.event_damage = SUB_Null;
9 RadiusDamage (self, self.realowner, cvar("g_balance_hagar_primary_damage"), cvar("g_balance_hagar_primary_edgedamage"), cvar("g_balance_hagar_primary_radius"), world, cvar("g_balance_hagar_primary_force"), self.projectiledeathtype, other);
14 void W_Hagar_Explode2 (void)
16 self.event_damage = SUB_Null;
17 RadiusDamage (self, self.realowner, cvar("g_balance_hagar_secondary_damage"), cvar("g_balance_hagar_secondary_edgedamage"), cvar("g_balance_hagar_secondary_radius"), world, cvar("g_balance_hagar_secondary_force"), self.projectiledeathtype, other);
22 void W_Hagar_Touch (void)
28 void W_Hagar_Touch2 (void)
32 if(self.cnt > 0 || other.takedamage == DAMAGE_AIM) {
36 pointparticles(particleeffectnum("hagar_bounce"), self.origin, self.velocity, 1);
37 self.angles = vectoangles (self.velocity);
39 self.projectiledeathtype |= HITTYPE_BOUNCE;
43 void W_Hagar_Attack (void)
47 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
48 self.ammo_rockets = self.ammo_rockets - cvar("g_balance_hagar_primary_ammo");
49 W_SetupShot (self, FALSE, 2, "weapons/hagar_fire.wav", cvar("g_balance_hagar_primary_damage"));
51 pointparticles(particleeffectnum("hagar_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
54 missile.owner = missile.realowner = self;
55 missile.classname = "missile";
56 missile.bot_dodge = TRUE;
57 missile.bot_dodgerating = cvar("g_balance_hagar_primary_damage");
58 missile.touch = W_Hagar_Touch;
59 missile.use = W_Hagar_Explode;
60 missile.think = adaptor_think2use_hittype_splash;
61 missile.nextthink = time + cvar("g_balance_hagar_primary_lifetime");
62 PROJECTILE_MAKETRIGGER(missile);
63 missile.projectiledeathtype = WEP_HAGAR;
64 setorigin (missile, w_shotorg);
65 setsize(missile, '0 0 0', '0 0 0');
67 missile.movetype = MOVETYPE_FLY;
68 W_SETUPPROJECTILEVELOCITY(missile, g_balance_hagar_primary);
70 missile.angles = vectoangles (missile.velocity);
71 missile.flags = FL_PROJECTILE;
73 CSQCProjectile(missile, TRUE, PROJECTILE_HAGAR, TRUE);
76 void W_Hagar_Attack2 (void)
80 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
81 self.ammo_rockets = self.ammo_rockets - cvar("g_balance_hagar_secondary_ammo");
82 W_SetupShot (self, FALSE, 2, "weapons/hagar_fire.wav", cvar("g_balance_hagar_secondary_damage"));
83 //W_SetupShot (self, FALSE, 2, "weapons/hagar_fire.wav"); // TODO: move model a little to the right
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 = cvar("g_balance_hagar_secondary_damage");
92 missile.touch = W_Hagar_Touch2;
94 missile.use = W_Hagar_Explode2;
95 missile.think = adaptor_think2use_hittype_splash;
96 missile.nextthink = time + cvar("g_balance_hagar_secondary_lifetime_min") + random() * cvar("g_balance_hagar_secondary_lifetime_rand");
97 PROJECTILE_MAKETRIGGER(missile);
98 missile.projectiledeathtype = WEP_HAGAR | HITTYPE_SECONDARY;
99 setorigin (missile, w_shotorg);
100 setsize(missile, '0 0 0', '0 0 0');
102 missile.movetype = MOVETYPE_BOUNCEMISSILE;
103 W_SETUPPROJECTILEVELOCITY(missile, g_balance_hagar_secondary);
105 missile.angles = vectoangles (missile.velocity);
106 missile.flags = FL_PROJECTILE;
108 CSQCProjectile(missile, TRUE, PROJECTILE_HAGAR_BOUNCING, TRUE);
111 void spawnfunc_weapon_hagar (void)
113 weapon_defaultspawnfunc(WEP_HAGAR);
116 float w_hagar(float req)
120 self.BUTTON_ATCK = bot_aim(cvar("g_balance_hagar_primary_speed"), 0, cvar("g_balance_hagar_primary_lifetime"), FALSE);
123 // not using secondary_speed since these are only 15% and should cause some ricochets without re-aiming
124 self.BUTTON_ATCK2 = bot_aim(cvar("g_balance_hagar_primary_speed"), 0, cvar("g_balance_hagar_primary_lifetime"), FALSE);
126 else if (req == WR_THINK)
128 if (self.BUTTON_ATCK)
129 if (weapon_prepareattack(0, cvar("g_balance_hagar_primary_refire")))
132 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_hagar_primary_refire"), w_ready);
134 if (self.BUTTON_ATCK2 && cvar("g_balance_hagar_secondary"))
135 if (weapon_prepareattack(1, cvar("g_balance_hagar_secondary_refire")))
138 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_hagar_secondary_refire"), w_ready);
141 else if (req == WR_PRECACHE)
143 precache_model ("models/weapons/g_hagar.md3");
144 precache_model ("models/weapons/v_hagar.md3");
145 precache_model ("models/weapons/h_hagar.iqm");
146 precache_sound ("weapons/hagar_fire.wav");
148 else if (req == WR_SETUP)
149 weapon_setup(WEP_HAGAR);
150 else if (req == WR_CHECKAMMO1)
151 return self.ammo_rockets >= cvar("g_balance_hagar_primary_ammo");
152 else if (req == WR_CHECKAMMO2)
153 return self.ammo_rockets >= cvar("g_balance_hagar_secondary_ammo");
158 float w_hagar(float req)
160 if(req == WR_IMPACTEFFECT)
163 org2 = w_org + w_backoff * 6;
164 pointparticles(particleeffectnum("hagar_explode"), org2, '0 0 0', 1);
168 sound(self, CHAN_PROJECTILE, "weapons/hagexp1.wav", VOL_BASE, ATTN_NORM);
169 else if (w_random<0.7)
170 sound(self, CHAN_PROJECTILE, "weapons/hagexp2.wav", VOL_BASE, ATTN_NORM);
172 sound(self, CHAN_PROJECTILE, "weapons/hagexp3.wav", VOL_BASE, ATTN_NORM);
175 else if(req == WR_PRECACHE)
177 precache_sound("weapons/hagexp1.wav");
178 precache_sound("weapons/hagexp2.wav");
179 precache_sound("weapons/hagexp3.wav");
181 else if (req == WR_SUICIDEMESSAGE)
182 w_deathtypestring = "played with tiny rockets";
183 else if (req == WR_KILLMESSAGE)
185 if(w_deathtype & HITTYPE_BOUNCE) // must be secondary; unchecked: SPLASH
186 w_deathtypestring = "hoped #'s missiles wouldn't bounce";
187 else // unchecked: SPLASH, SECONDARY
188 w_deathtypestring = "was pummeled by";