1 void spawnfunc_item_minst_cells (void)
10 .float minstagib_nextthink;
11 .float minstagib_needammo;
12 void minstagib_stop_countdown(entity e)
14 if (!e.minstagib_needammo)
16 Send_CSQC_Centerprint_Generic_Expire(e, CPID_MINSTA_FINDAMMO);
17 e.minstagib_needammo = FALSE;
19 void minstagib_ammocheck(void)
21 if (time < self.minstagib_nextthink)
24 if (self.deadflag || gameover)
25 minstagib_stop_countdown(self);
26 else if (self.ammo_cells > 0 || (self.items & IT_UNLIMITED_WEAPON_AMMO))
28 minstagib_stop_countdown(self);
34 self.minstagib_needammo = TRUE;
37 Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
38 AnnounceTo(self, "terminated");
40 else if (self.health == 10)
42 Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
43 AnnounceTo(self, "1");
45 else if (self.health == 20)
47 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
48 AnnounceTo(self, "2");
50 else if (self.health == 30)
52 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
53 AnnounceTo(self, "3");
55 else if (self.health == 40)
57 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
58 AnnounceTo(self, "4");
60 else if (self.health == 50)
62 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
63 AnnounceTo(self, "5");
65 else if (self.health == 60)
67 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
68 AnnounceTo(self, "6");
70 else if (self.health == 70)
72 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
73 AnnounceTo(self, "7");
75 else if (self.health == 80)
77 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
78 AnnounceTo(self, "8");
80 else if (self.health == 90)
82 Send_CSQC_Centerprint_Generic(self, CPID_MINSTA_FINDAMMO, "^1%d^7 seconds left to find some ammo", 1, 9);
83 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
84 AnnounceTo(self, "9");
86 else if (self.health == 100)
88 Send_CSQC_Centerprint_Generic(self, CPID_MINSTA_FINDAMMO, "get some ammo or\nyou'll be dead in ^3%d^7 seconds...", 1, 10);
89 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
90 if not(self.flags & FL_GODMODE)
91 AnnounceTo(self, "10");
94 self.minstagib_nextthink = time + 1;
97 MUTATOR_HOOKFUNCTION(minstagib_BotShouldAttack)
99 if(checkentity.items & IT_STRENGTH)
105 MUTATOR_HOOKFUNCTION(minstagib_MakePlayerObserver)
107 minstagib_stop_countdown(self);
111 MUTATOR_HOOKFUNCTION(minstagib_PlayerSpawn)
113 self.effects |= EF_FULLBRIGHT;
117 MUTATOR_HOOKFUNCTION(minstagib_PlayerPreThink)
119 minstagib_ammocheck();
123 MUTATOR_HOOKFUNCTION(minstagib_PlayerPowerups)
125 if not(self.effects & EF_FULLBRIGHT)
126 self.effects |= EF_FULLBRIGHT;
128 if (self.items & IT_STRENGTH)
130 play_countdown(self.strength_finished, "misc/poweroff.wav");
131 if (time > self.strength_finished)
133 self.alpha = default_player_alpha;
134 self.exteriorweaponentity.alpha = default_weapon_alpha;
135 self.items &~= IT_STRENGTH;
136 sprint(self, "^3Invisibility has worn off\n");
141 if (time < self.strength_finished)
143 self.alpha = g_minstagib_invis_alpha;
144 self.exteriorweaponentity.alpha = g_minstagib_invis_alpha;
145 self.items |= IT_STRENGTH;
146 sprint(self, "^3You are invisible\n");
150 if (self.items & IT_INVINCIBLE)
152 play_countdown(self.invincible_finished, "misc/poweroff.wav");
153 if (time > self.invincible_finished)
155 self.items &~= IT_INVINCIBLE;
156 sprint(self, "^3Speed has worn off\n");
161 if (time < self.invincible_finished)
163 self.items |= IT_INVINCIBLE;
164 sprint(self, "^3You are on speed\n");
170 MUTATOR_HOOKFUNCTION(minstagib_PlayerPhysics)
172 if(self.items & IT_INVINCIBLE)
173 self.stat_sv_maxspeed = self.stat_sv_maxspeed * autocvar_g_minstagib_speed_highspeed;
178 MUTATOR_HOOKFUNCTION(minstagib_SplitHealthArmor)
181 damage_take = frag_damage;
186 MUTATOR_HOOKFUNCTION(minstagib_ForbidThrowing)
194 MUTATOR_HOOKFUNCTION(minstagib_PlayStrengthSound)
196 // You shall not play!
200 MUTATOR_HOOKFUNCTION(minstagib_PlayerDamage)
202 if(autocvar_g_friendlyfire == 0)
205 if(frag_target.classname == "player")
207 if ((frag_deathtype == DEATH_FALL) ||
208 (frag_deathtype == DEATH_DROWN) ||
209 (frag_deathtype == DEATH_SLIME) ||
210 (frag_deathtype == DEATH_LAVA))
215 if (frag_target.armorvalue && (frag_deathtype == WEP_MINSTANEX) && frag_damage)
217 frag_target.armorvalue -= 1;
218 centerprint(frag_target, strcat("^3Remaining extra lives: ",ftos(frag_target.armorvalue)));
220 frag_target.hitsound += 1;
221 frag_attacker.hitsound += 1; // TODO change this to a future specific hitsound for armor hit
223 if (DEATH_ISWEAPON(frag_deathtype, WEP_LASER))
226 frag_mirrordamage = 0;
227 if (frag_target != frag_attacker)
229 if ((frag_target.health >= 1) && (frag_target.classname == "player"))
230 centerprint(frag_attacker, "Secondary fire inflicts no damage!");
231 frag_force = '0 0 0';
232 // keep mirrorfrag_force
233 frag_attacker = frag_target;
238 if(frag_mirrordamage > 0)
240 // just lose extra LIVES, don't kill the player for mirror damage
241 if(frag_attacker.armorvalue > 0)
243 frag_attacker.armorvalue = frag_attacker.armorvalue - 1;
244 centerprint(frag_attacker, strcat("^3Remaining extra lives: ", ftos(frag_attacker.armorvalue)));
245 frag_attacker.hitsound += 1;
247 frag_mirrordamage = 0;
250 if(frag_target.items & IT_STRENGTH)
256 MUTATOR_HOOKFUNCTION(minstagib_SetStartItems)
258 start_ammo_cells = cvar("g_minstagib_ammo_start");
260 g_pinata = 0; // incompatible
261 g_weapon_stay = 0; // incompatible
262 g_bloodloss = 0; // incompatible
264 start_armorvalue = 0;
265 WEPSET_COPY_AW(start_weapons, WEP_MINSTANEX);
266 g_minstagib_invis_alpha = cvar("g_minstagib_invis_alpha");
267 start_items |= IT_UNLIMITED_SUPERWEAPONS;
269 if (g_minstagib_invis_alpha <= 0)
270 g_minstagib_invis_alpha = -1;
275 MUTATOR_HOOKFUNCTION(minstagib_FilterItem)
277 if(self.weapon == -2)
280 if(self.classname == "item_minst_cells" || self.weapon == WEP_ROCKET_LAUNCHER || self.weapon == WEP_NEX)
282 self.ammo_cells = autocvar_g_minstagib_ammo_drop;
283 StartItem ("models/items/a_cells.md3",
284 "misc/itempickup.wav", 45, 0,
285 "MinstaNex Ammo", IT_CELLS, -2, 0, generic_pickupevalfunc, 100);
289 if(self.flags & FL_POWERUP)
292 float rnd = random() * 3;
294 self.items = IT_STRENGTH;
296 self.items = IT_NAILS;
298 self.items = IT_INVINCIBLE;
300 if (self.items == IT_STRENGTH)
302 if(!self.strength_finished)
303 self.strength_finished = autocvar_g_balance_powerup_strength_time;
304 StartItem ("models/items/g_strength.md3",
305 "misc/powerup.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup,
306 "Invisibility", IT_STRENGTH, -2, FL_POWERUP, generic_pickupevalfunc, BOT_PICKUP_RATING_MID);
308 // replace with extra lives
309 else if (self.items == IT_NAILS)
312 StartItem ("models/items/g_h100.md3",
313 "misc/megahealth.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup,
314 "Extralife", IT_NAILS, -2, FL_POWERUP, generic_pickupevalfunc, BOT_PICKUP_RATING_HIGH);
316 // replace with speed
317 else if (self.items == IT_INVINCIBLE)
319 if(!self.invincible_finished)
320 self.invincible_finished = autocvar_g_balance_powerup_invincible_time;
321 StartItem ("models/items/g_invincible.md3",
322 "misc/powerup_shield.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup,
323 "Speed", IT_INVINCIBLE, -2, FL_POWERUP, generic_pickupevalfunc, BOT_PICKUP_RATING_MID);
331 MUTATOR_HOOKFUNCTION(minstagib_ItemCountdown)
335 case IT_STRENGTH: item_name = "item-invis"; item_color = '0 0 1'; break;
336 case IT_NAILS: item_name = "item-extralife"; item_color = '1 0 0'; break;
337 case IT_INVINCIBLE: item_name = "item-speed"; item_color = '1 0 1'; break;
342 MUTATOR_HOOKFUNCTION(minstagib_GiveItem)
345 float prevcells = giveplayer.ammo_cells;
347 player_pickedup |= Item_GiveAmmoTo(giveitem, giveplayer, ammo_fuel, g_pickup_fuel_max, ITEM_MODE_FUEL);
348 player_pickedup |= Item_GiveAmmoTo(giveitem, giveplayer, ammo_cells, 999, ITEM_MODE_NONE);
350 if(giveplayer.ammo_cells > prevcells)
352 player_wswitch = TRUE;
353 // play some cool sounds ;)
354 if (clienttype(giveplayer) == CLIENTTYPE_REAL)
356 if(giveplayer.health <= 5)
357 AnnounceTo(giveplayer, "lastsecond");
358 else if(giveplayer.health < 50)
359 AnnounceTo(giveplayer, "narrowly");
362 if (WEPSET_CONTAINS_EW(giveitem, WEP_MINSTANEX))
363 W_GiveWeapon (giveplayer, WEP_MINSTANEX, giveitem.netname);
364 giveplayer.health = 100;
367 if((it = (giveitem.items - (giveitem.items & giveplayer.items)) & IT_PICKUPMASK))
369 player_pickedup = TRUE;
370 giveplayer.items |= it;
371 sprint (giveplayer, strcat("You got the ^2", giveitem.netname, "\n"));
375 if (giveitem.max_health)
377 player_pickedup = TRUE;
378 // sound not available
379 // AnnounceTo(giveplayer, "_lives");
380 giveplayer.armorvalue = bound(giveplayer.armorvalue, 999, giveplayer.armorvalue + autocvar_g_minstagib_extralives);
381 sprint(giveplayer, "^3You picked up some extra lives\n");
385 if (giveitem.strength_finished)
387 player_pickedup = TRUE;
388 // sound not available
389 // AnnounceTo(giveplayer, "invisible");
390 giveplayer.strength_finished = max(giveplayer.strength_finished, time) + autocvar_g_balance_powerup_strength_time;
394 if (giveitem.invincible_finished)
396 player_pickedup = TRUE;
397 // sound not available
398 // AnnounceTo(giveplayer, "speed");
399 giveplayer.invincible_finished = max(giveplayer.invincible_finished, time) + autocvar_g_balance_powerup_invincible_time;
405 MUTATOR_HOOKFUNCTION(minstagib_BuildMutatorsString)
407 ret_string = strcat(ret_string, ":MinstaGib");
411 MUTATOR_HOOKFUNCTION(minstagib_BuildMutatorsPrettyString)
413 ret_string = strcat(ret_string, ", MinstaGib");
417 MUTATOR_DEFINITION(mutator_minstagib)
419 MUTATOR_HOOK(BotShouldAttack, minstagib_BotShouldAttack, CBC_ORDER_ANY);
420 MUTATOR_HOOK(PlayerPhysics, minstagib_PlayerPhysics, CBC_ORDER_ANY);
421 MUTATOR_HOOK(PlayerSpawn, minstagib_PlayerSpawn, CBC_ORDER_ANY);
422 MUTATOR_HOOK(PlayerDamage_Calculate, minstagib_PlayerDamage, CBC_ORDER_ANY);
423 MUTATOR_HOOK(PlayStrengthSound, minstagib_PlayStrengthSound, CBC_ORDER_ANY);
424 MUTATOR_HOOK(MakePlayerObserver, minstagib_MakePlayerObserver, CBC_ORDER_ANY);
425 MUTATOR_HOOK(SetStartItems, minstagib_SetStartItems, CBC_ORDER_ANY);
426 MUTATOR_HOOK(FilterItem, minstagib_FilterItem, CBC_ORDER_ANY);
427 MUTATOR_HOOK(Item_RespawnCountdown, minstagib_ItemCountdown, CBC_ORDER_ANY);
428 MUTATOR_HOOK(PlayerDamage_SplitHealthArmor, minstagib_SplitHealthArmor, CBC_ORDER_ANY);
429 MUTATOR_HOOK(PlayerPowerups, minstagib_PlayerPowerups, CBC_ORDER_ANY);
430 MUTATOR_HOOK(ForbidThrowCurrentWeapon, minstagib_ForbidThrowing, CBC_ORDER_ANY);
431 MUTATOR_HOOK(PlayerPreThink, minstagib_PlayerPreThink, CBC_ORDER_ANY);
432 MUTATOR_HOOK(BuildMutatorsString, minstagib_BuildMutatorsString, CBC_ORDER_ANY);
433 MUTATOR_HOOK(BuildMutatorsPrettyString, minstagib_BuildMutatorsPrettyString, CBC_ORDER_ANY);