1 void spawnfunc_item_minst_cells (void)
3 if not(g_minstagib) { remove(self); return; }
4 if not(self.ammo_cells)
5 self.ammo_cells = autocvar_g_minstagib_ammo_drop;
7 StartItem ("models/items/a_cells.md3",
8 "misc/itempickup.wav", 45, 0,
9 "MinstaNex Ammo", IT_CELLS, 0, 0, generic_pickupevalfunc, 100);
12 void minstagib_health_mega()
15 StartItem ("models/items/g_h100.md3",
16 "misc/megahealth.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup,
17 "Extralife", IT_NAILS, 0, FL_POWERUP, generic_pickupevalfunc, BOT_PICKUP_RATING_HIGH);
20 .float minstagib_nextthink;
21 .float minstagib_needammo;
22 void minstagib_stop_countdown(entity e)
24 if (!e.minstagib_needammo)
26 Kill_Notification(NOTIF_ONE_ONLY, e, MSG_CENTER_CPID, CPID_MINSTA_FINDAMMO);
27 e.minstagib_needammo = FALSE;
29 void minstagib_ammocheck(void)
31 if not(IS_PLAYER(self))
32 return; // not a player
33 if (time < self.minstagib_nextthink)
36 if (self.deadflag || gameover)
37 minstagib_stop_countdown(self);
38 else if (self.ammo_cells > 0 || (self.items & IT_UNLIMITED_WEAPON_AMMO))
39 minstagib_stop_countdown(self);
42 self.minstagib_needammo = TRUE;
45 Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
46 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_MINSTAGIB_TERMINATED);
48 else if (self.health == 10)
50 Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
51 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_1);
53 else if (self.health == 20)
55 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
56 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_2);
58 else if (self.health == 30)
60 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
61 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_3);
63 else if (self.health == 40)
65 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
66 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_4);
68 else if (self.health == 50)
70 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
71 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_5);
73 else if (self.health == 60)
75 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
76 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_6);
78 else if (self.health == 70)
80 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
81 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_7);
83 else if (self.health == 80)
85 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
86 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_8);
88 else if (self.health == 90)
90 Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_MINSTA_FINDAMMO);
91 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
92 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_9);
94 else if (self.health == 100)
96 Send_Notification(NOTIF_ONE_ONLY, self, MSG_MULTI, MULTI_MINSTA_FINDAMMO);
97 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
100 self.minstagib_nextthink = time + 1;
103 MUTATOR_HOOKFUNCTION(minstagib_MatchEnd)
106 FOR_EACH_PLAYER(head)
107 minstagib_stop_countdown(head);
112 MUTATOR_HOOKFUNCTION(minstagib_BotShouldAttack)
114 if(checkentity.items & IT_STRENGTH)
120 MUTATOR_HOOKFUNCTION(minstagib_MakePlayerObserver)
122 minstagib_stop_countdown(self);
126 MUTATOR_HOOKFUNCTION(minstagib_PlayerSpawn)
128 self.effects |= EF_FULLBRIGHT;
132 MUTATOR_HOOKFUNCTION(minstagib_PlayerPreThink)
134 minstagib_ammocheck();
138 MUTATOR_HOOKFUNCTION(minstagib_PlayerPowerups)
140 if not(self.effects & EF_FULLBRIGHT)
141 self.effects |= EF_FULLBRIGHT;
143 if (self.items & IT_STRENGTH)
145 play_countdown(self.strength_finished, "misc/poweroff.wav");
146 if (time > self.strength_finished)
148 self.alpha = default_player_alpha;
149 self.exteriorweaponentity.alpha = default_weapon_alpha;
150 self.items &~= IT_STRENGTH;
151 Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_INVISIBILITY);
156 if (time < self.strength_finished)
158 self.alpha = autocvar_g_minstagib_invis_alpha;
159 self.exteriorweaponentity.alpha = autocvar_g_minstagib_invis_alpha;
160 self.items |= IT_STRENGTH;
161 Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_INVISIBILITY, self.netname);
162 Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_INVISIBILITY);
166 if (self.items & IT_INVINCIBLE)
168 play_countdown(self.invincible_finished, "misc/poweroff.wav");
169 if (time > self.invincible_finished)
171 self.items &~= IT_INVINCIBLE;
172 Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_SPEED);
177 if (time < self.invincible_finished)
179 self.items |= IT_INVINCIBLE;
180 Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_SPEED, self.netname);
181 Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_SPEED);
187 MUTATOR_HOOKFUNCTION(minstagib_PlayerPhysics)
189 if(self.items & IT_INVINCIBLE)
190 self.stat_sv_maxspeed = self.stat_sv_maxspeed * autocvar_g_minstagib_speed_highspeed;
195 MUTATOR_HOOKFUNCTION(minstagib_SplitHealthArmor)
198 //damage_take = frag_damage; // frag_damage isn't even set here?!
203 MUTATOR_HOOKFUNCTION(minstagib_ForbidThrowing)
211 MUTATOR_HOOKFUNCTION(minstagib_PlayerDamage)
213 if(autocvar_g_friendlyfire == 0 && !IsDifferentTeam(frag_target, frag_attacker) && IS_PLAYER(frag_target))
216 if(IS_PLAYER(frag_target))
218 if ((frag_deathtype == DEATH_FALL) ||
219 (frag_deathtype == DEATH_DROWN) ||
220 (frag_deathtype == DEATH_SLIME) ||
221 (frag_deathtype == DEATH_LAVA))
226 if (frag_target.armorvalue && (frag_deathtype == WEP_MINSTANEX) && frag_damage)
228 frag_target.armorvalue -= 1;
229 Send_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CENTER_MINSTA_LIVES_REMAINING, frag_target.armorvalue);
231 frag_target.hitsound += 1;
232 frag_attacker.hitsound += 1; // TODO change this to a future specific hitsound for armor hit
234 if (DEATH_ISWEAPON(frag_deathtype, WEP_LASER))
237 frag_mirrordamage = 0;
238 if (frag_target != frag_attacker)
240 if ((frag_target.health >= 1) && IS_PLAYER(frag_target))
241 Send_Notification(NOTIF_ONE, frag_attacker, MSG_CENTER, CENTER_MINSTA_SECONDARY);
242 frag_force = '0 0 0';
243 // keep mirrorfrag_force
244 frag_attacker = frag_target;
249 if(frag_mirrordamage > 0)
251 // just lose extra LIVES, don't kill the player for mirror damage
252 if(frag_attacker.armorvalue > 0)
254 frag_attacker.armorvalue = frag_attacker.armorvalue - 1;
255 Send_Notification(NOTIF_ONE, frag_attacker, MSG_CENTER, CENTER_MINSTA_LIVES_REMAINING, frag_attacker.armorvalue);
256 frag_attacker.hitsound += 1;
258 frag_mirrordamage = 0;
261 if(frag_target.items & IT_STRENGTH)
267 MUTATOR_HOOKFUNCTION(minstagib_SetStartItems)
269 start_ammo_cells = cvar("g_minstagib_ammo_start");
272 start_armorvalue = 0;
273 WEPSET_COPY_AW(start_weapons, WEP_MINSTANEX);
274 start_items |= IT_UNLIMITED_SUPERWEAPONS;
279 MUTATOR_HOOKFUNCTION(minstagib_FilterItem)
281 if(self.classname == "item_cells")
282 return TRUE; // no normal cells?
284 if(self.weapon == WEP_MINSTANEX && self.classname == "droppedweapon")
286 self.ammo_cells = autocvar_g_minstagib_ammo_drop;
290 if(self.weapon == WEP_ROCKET_LAUNCHER || self.weapon == WEP_NEX)
293 setorigin(e, self.origin);
297 spawnfunc_item_minst_cells();
302 if(self.flags & FL_POWERUP)
305 if(self.ammo_cells > autocvar_g_minstagib_ammo_drop && self.classname != "item_minst_cells")
306 self.ammo_cells = autocvar_g_minstagib_ammo_drop;
308 if(self.ammo_cells && !self.weapon)
314 MUTATOR_HOOKFUNCTION(minstagib_CustomizeWaypoint)
316 entity e = WaypointSprite_getviewentity(other);
318 // if you have the invisibility powerup, sprites ALWAYS are restricted to your team
319 // but only apply this to real players, not to spectators
320 if((self.owner.flags & FL_CLIENT) && (self.owner.items & IT_STRENGTH) && (e == other))
321 if(IsDifferentTeam(self.owner, e))
327 MUTATOR_HOOKFUNCTION(minstagib_ItemCountdown)
331 case IT_STRENGTH: item_name = "item-invis"; item_color = '0 0 1'; break;
332 case IT_NAILS: item_name = "item-extralife"; item_color = '1 0 0'; break;
333 case IT_INVINCIBLE: item_name = "item-speed"; item_color = '1 0 1'; break;
338 MUTATOR_HOOKFUNCTION(minstagib_ItemTouch)
342 // play some cool sounds ;)
343 if (IS_CLIENT(other))
345 if(other.health <= 5)
346 Send_Notification(NOTIF_ONE, other, MSG_ANNCE, ANNCE_MINSTAGIB_LASTSECOND);
347 else if(other.health < 50)
348 Send_Notification(NOTIF_ONE, other, MSG_ANNCE, ANNCE_MINSTAGIB_NARROWLY);
351 if(other.health < 100)
357 other.armorvalue = bound(other.armorvalue, 999, other.armorvalue + autocvar_g_minstagib_extralives);
358 sprint(other, "^3You picked up some extra lives\n");
364 MUTATOR_HOOKFUNCTION(minstagib_OnEntityPreSpawn)
366 if not(autocvar_g_powerups) { return FALSE; }
367 if not(self.classname == "item_strength" || self.classname == "item_invincible" || self.classname == "item_health_mega")
373 e.think = spawnfunc_item_strength;
374 else if(random() < 0.6)
375 e.think = minstagib_health_mega;
377 e.think = spawnfunc_item_invincible;
379 e.nextthink = time + 0.1;
380 e.spawnflags = self.spawnflags;
381 e.noalign = self.noalign;
382 setorigin(e, self.origin);
387 MUTATOR_HOOKFUNCTION(minstagib_BuildMutatorsString)
389 ret_string = strcat(ret_string, ":MinstaGib");
393 MUTATOR_HOOKFUNCTION(minstagib_BuildMutatorsPrettyString)
395 ret_string = strcat(ret_string, ", MinstaGib");
399 MUTATOR_DEFINITION(mutator_minstagib)
401 MUTATOR_HOOK(MatchEnd, minstagib_MatchEnd, CBC_ORDER_ANY);
402 MUTATOR_HOOK(BotShouldAttack, minstagib_BotShouldAttack, CBC_ORDER_ANY);
403 MUTATOR_HOOK(PlayerPhysics, minstagib_PlayerPhysics, CBC_ORDER_ANY);
404 MUTATOR_HOOK(PlayerSpawn, minstagib_PlayerSpawn, CBC_ORDER_ANY);
405 MUTATOR_HOOK(PlayerDamage_Calculate, minstagib_PlayerDamage, CBC_ORDER_ANY);
406 MUTATOR_HOOK(MakePlayerObserver, minstagib_MakePlayerObserver, CBC_ORDER_ANY);
407 MUTATOR_HOOK(SetStartItems, minstagib_SetStartItems, CBC_ORDER_ANY);
408 MUTATOR_HOOK(ItemTouch, minstagib_ItemTouch, CBC_ORDER_ANY);
409 MUTATOR_HOOK(FilterItem, minstagib_FilterItem, CBC_ORDER_ANY);
410 MUTATOR_HOOK(CustomizeWaypoint, minstagib_CustomizeWaypoint, CBC_ORDER_ANY);
411 MUTATOR_HOOK(Item_RespawnCountdown, minstagib_ItemCountdown, CBC_ORDER_ANY);
412 MUTATOR_HOOK(PlayerDamage_SplitHealthArmor, minstagib_SplitHealthArmor, CBC_ORDER_ANY);
413 MUTATOR_HOOK(PlayerPowerups, minstagib_PlayerPowerups, CBC_ORDER_ANY);
414 MUTATOR_HOOK(ForbidThrowCurrentWeapon, minstagib_ForbidThrowing, CBC_ORDER_ANY);
415 MUTATOR_HOOK(PlayerPreThink, minstagib_PlayerPreThink, CBC_ORDER_ANY);
416 MUTATOR_HOOK(OnEntityPreSpawn, minstagib_OnEntityPreSpawn, CBC_ORDER_ANY);
417 MUTATOR_HOOK(BuildMutatorsString, minstagib_BuildMutatorsString, CBC_ORDER_ANY);
418 MUTATOR_HOOK(BuildMutatorsPrettyString, minstagib_BuildMutatorsPrettyString, CBC_ORDER_ANY);