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 (time < self.minstagib_nextthink)
34 if (self.deadflag || gameover)
35 minstagib_stop_countdown(self);
36 else if (self.ammo_cells > 0 || (self.items & IT_UNLIMITED_WEAPON_AMMO))
37 minstagib_stop_countdown(self);
40 self.minstagib_needammo = TRUE;
43 Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
44 AnnounceTo(self, "terminated");
46 else if (self.health == 10)
48 Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
49 AnnounceTo(self, "1");
51 else if (self.health == 20)
53 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
54 AnnounceTo(self, "2");
56 else if (self.health == 30)
58 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
59 AnnounceTo(self, "3");
61 else if (self.health == 40)
63 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
64 AnnounceTo(self, "4");
66 else if (self.health == 50)
68 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
69 AnnounceTo(self, "5");
71 else if (self.health == 60)
73 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
74 AnnounceTo(self, "6");
76 else if (self.health == 70)
78 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
79 AnnounceTo(self, "7");
81 else if (self.health == 80)
83 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
84 AnnounceTo(self, "8");
86 else if (self.health == 90)
88 Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_MINSTA_FINDAMMO);
89 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
90 AnnounceTo(self, "9");
92 else if (self.health == 100)
94 Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_MINSTA_FINDAMMO_FIRST);
95 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
96 if not(self.flags & FL_GODMODE)
97 AnnounceTo(self, "10");
100 self.minstagib_nextthink = time + 1;
103 MUTATOR_HOOKFUNCTION(minstagib_BotShouldAttack)
105 if(checkentity.items & IT_STRENGTH)
111 MUTATOR_HOOKFUNCTION(minstagib_MakePlayerObserver)
113 minstagib_stop_countdown(self);
117 MUTATOR_HOOKFUNCTION(minstagib_PlayerSpawn)
119 self.effects |= EF_FULLBRIGHT;
123 MUTATOR_HOOKFUNCTION(minstagib_PlayerPreThink)
125 minstagib_ammocheck();
129 MUTATOR_HOOKFUNCTION(minstagib_PlayerPowerups)
131 if not(self.effects & EF_FULLBRIGHT)
132 self.effects |= EF_FULLBRIGHT;
134 if (self.items & IT_STRENGTH)
136 play_countdown(self.strength_finished, "misc/poweroff.wav");
137 if (time > self.strength_finished)
139 self.alpha = default_player_alpha;
140 self.exteriorweaponentity.alpha = default_weapon_alpha;
141 self.items &~= IT_STRENGTH;
142 Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_INVISIBILITY);
147 if (time < self.strength_finished)
149 self.alpha = g_minstagib_invis_alpha;
150 self.exteriorweaponentity.alpha = g_minstagib_invis_alpha;
151 self.items |= IT_STRENGTH;
152 Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_INVISIBILITY, self.netname);
153 Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_INVISIBILITY);
157 if (self.items & IT_INVINCIBLE)
159 play_countdown(self.invincible_finished, "misc/poweroff.wav");
160 if (time > self.invincible_finished)
162 self.items &~= IT_INVINCIBLE;
163 Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_SPEED);
168 if (time < self.invincible_finished)
170 self.items |= IT_INVINCIBLE;
171 Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_SPEED, self.netname);
172 Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_SPEED);
178 MUTATOR_HOOKFUNCTION(minstagib_PlayerPhysics)
180 if(self.items & IT_INVINCIBLE)
181 self.stat_sv_maxspeed = self.stat_sv_maxspeed * autocvar_g_minstagib_speed_highspeed;
186 MUTATOR_HOOKFUNCTION(minstagib_SplitHealthArmor)
189 //damage_take = frag_damage; // frag_damage isn't even set here?!
194 MUTATOR_HOOKFUNCTION(minstagib_ForbidThrowing)
202 MUTATOR_HOOKFUNCTION(minstagib_PlayerDamage)
204 if(autocvar_g_friendlyfire == 0 && !IsDifferentTeam(frag_target, frag_attacker) && IS_PLAYER(frag_target))
207 if(IS_PLAYER(frag_target))
209 if ((frag_deathtype == DEATH_FALL) ||
210 (frag_deathtype == DEATH_DROWN) ||
211 (frag_deathtype == DEATH_SLIME) ||
212 (frag_deathtype == DEATH_LAVA))
217 if (frag_target.armorvalue && (frag_deathtype == WEP_MINSTANEX) && frag_damage)
219 frag_target.armorvalue -= 1;
220 Send_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CENTER_MINSTA_LIVES_REMAINING, frag_target.armorvalue);
222 frag_target.hitsound += 1;
223 frag_attacker.hitsound += 1; // TODO change this to a future specific hitsound for armor hit
225 if (DEATH_ISWEAPON(frag_deathtype, WEP_LASER))
228 frag_mirrordamage = 0;
229 if (frag_target != frag_attacker)
231 if ((frag_target.health >= 1) && IS_PLAYER(frag_target))
232 Send_Notification(NOTIF_ONE, frag_attacker, MSG_CENTER, CENTER_MINSTA_SECONDARY);
233 frag_force = '0 0 0';
234 // keep mirrorfrag_force
235 frag_attacker = frag_target;
240 if(frag_mirrordamage > 0)
242 // just lose extra LIVES, don't kill the player for mirror damage
243 if(frag_attacker.armorvalue > 0)
245 frag_attacker.armorvalue = frag_attacker.armorvalue - 1;
246 Send_Notification(NOTIF_ONE, frag_attacker, MSG_CENTER, CENTER_MINSTA_LIVES_REMAINING, frag_attacker.armorvalue);
247 frag_attacker.hitsound += 1;
249 frag_mirrordamage = 0;
252 if(frag_target.items & IT_STRENGTH)
258 MUTATOR_HOOKFUNCTION(minstagib_SetStartItems)
260 start_ammo_cells = cvar("g_minstagib_ammo_start");
262 g_pinata = 0; // incompatible
263 g_weapon_stay = 0; // incompatible
264 g_bloodloss = 0; // incompatible
266 start_armorvalue = 0;
267 WEPSET_COPY_AW(start_weapons, WEP_MINSTANEX);
268 g_minstagib_invis_alpha = cvar("g_minstagib_invis_alpha");
269 start_items |= IT_UNLIMITED_SUPERWEAPONS;
271 if (g_minstagib_invis_alpha <= 0)
272 g_minstagib_invis_alpha = -1;
277 MUTATOR_HOOKFUNCTION(minstagib_FilterItem)
279 if(self.classname == "item_cells")
280 return TRUE; // no normal cells?
282 if(self.weapon == WEP_MINSTANEX && self.classname == "droppedweapon")
284 self.ammo_cells = autocvar_g_minstagib_ammo_drop;
288 if(self.weapon == WEP_ROCKET_LAUNCHER || self.weapon == WEP_NEX)
291 setorigin(e, self.origin);
295 spawnfunc_item_minst_cells();
300 if(self.flags & FL_POWERUP)
303 if(self.ammo_cells > autocvar_g_minstagib_ammo_drop && self.classname != "item_minst_cells")
304 self.ammo_cells = autocvar_g_minstagib_ammo_drop;
306 if(self.ammo_cells && !self.weapon)
312 MUTATOR_HOOKFUNCTION(minstagib_ItemCountdown)
316 case IT_STRENGTH: item_name = "item-invis"; item_color = '0 0 1'; break;
317 case IT_NAILS: item_name = "item-extralife"; item_color = '1 0 0'; break;
318 case IT_INVINCIBLE: item_name = "item-speed"; item_color = '1 0 1'; break;
323 MUTATOR_HOOKFUNCTION(minstagib_GiveItem)
325 if(giveitem.ammo_cells)
327 // play some cool sounds ;)
328 if (IS_CLIENT(other))
330 if(other.health <= 5)
331 AnnounceTo(other, "lastsecond");
332 else if(other.health < 50)
333 AnnounceTo(other, "narrowly");
336 if(other.health < 100)
339 player_pickedup = TRUE;
342 if(giveitem.max_health)
344 other.armorvalue = bound(other.armorvalue, 999, other.armorvalue + autocvar_g_minstagib_extralives);
345 sprint(other, "^3You picked up some extra lives\n");
346 player_pickedup = TRUE;
352 MUTATOR_HOOKFUNCTION(minstagib_OnEntityPreSpawn)
354 if not(autocvar_g_powerups) { return FALSE; }
355 if not(self.classname == "item_strength" || self.classname == "item_invincible" || self.classname == "item_health_mega")
361 e.think = spawnfunc_item_strength;
362 else if(random() < 0.6)
363 e.think = minstagib_health_mega;
365 e.think = spawnfunc_item_invincible;
367 e.nextthink = time + 0.1;
368 e.spawnflags = self.spawnflags;
369 e.noalign = self.noalign;
370 setorigin(e, self.origin);
375 MUTATOR_HOOKFUNCTION(minstagib_BuildMutatorsString)
377 ret_string = strcat(ret_string, ":MinstaGib");
381 MUTATOR_HOOKFUNCTION(minstagib_BuildMutatorsPrettyString)
383 ret_string = strcat(ret_string, ", MinstaGib");
387 MUTATOR_DEFINITION(mutator_minstagib)
389 MUTATOR_HOOK(BotShouldAttack, minstagib_BotShouldAttack, CBC_ORDER_ANY);
390 MUTATOR_HOOK(PlayerPhysics, minstagib_PlayerPhysics, CBC_ORDER_ANY);
391 MUTATOR_HOOK(PlayerSpawn, minstagib_PlayerSpawn, CBC_ORDER_ANY);
392 MUTATOR_HOOK(PlayerDamage_Calculate, minstagib_PlayerDamage, CBC_ORDER_ANY);
393 MUTATOR_HOOK(MakePlayerObserver, minstagib_MakePlayerObserver, CBC_ORDER_ANY);
394 MUTATOR_HOOK(SetStartItems, minstagib_SetStartItems, CBC_ORDER_ANY);
395 MUTATOR_HOOK(Item_GiveTo, minstagib_GiveItem, CBC_ORDER_ANY);
396 MUTATOR_HOOK(FilterItem, minstagib_FilterItem, CBC_ORDER_ANY);
397 MUTATOR_HOOK(Item_RespawnCountdown, minstagib_ItemCountdown, CBC_ORDER_ANY);
398 MUTATOR_HOOK(PlayerDamage_SplitHealthArmor, minstagib_SplitHealthArmor, CBC_ORDER_ANY);
399 MUTATOR_HOOK(PlayerPowerups, minstagib_PlayerPowerups, CBC_ORDER_ANY);
400 MUTATOR_HOOK(ForbidThrowCurrentWeapon, minstagib_ForbidThrowing, CBC_ORDER_ANY);
401 MUTATOR_HOOK(PlayerPreThink, minstagib_PlayerPreThink, CBC_ORDER_ANY);
402 MUTATOR_HOOK(OnEntityPreSpawn, minstagib_OnEntityPreSpawn, CBC_ORDER_ANY);
403 MUTATOR_HOOK(BuildMutatorsString, minstagib_BuildMutatorsString, CBC_ORDER_ANY);
404 MUTATOR_HOOK(BuildMutatorsPrettyString, minstagib_BuildMutatorsPrettyString, CBC_ORDER_ANY);