1 void spawnfunc_item_minst_cells (void)
3 if (!g_minstagib) { remove(self); return; }
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()
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_MonsterLoot)
114 other.monster_loot = spawnfunc_item_minst_cells;
119 MUTATOR_HOOKFUNCTION(minstagib_MonsterSpawn)
121 // always refill ammo
122 if(self.monsterid == MON_MAGE)
128 MUTATOR_HOOKFUNCTION(minstagib_BotShouldAttack)
130 if(checkentity.items & IT_STRENGTH)
136 MUTATOR_HOOKFUNCTION(minstagib_MakePlayerObserver)
138 minstagib_stop_countdown(self);
142 MUTATOR_HOOKFUNCTION(minstagib_PlayerSpawn)
144 self.effects |= EF_FULLBRIGHT;
148 MUTATOR_HOOKFUNCTION(minstagib_PlayerPreThink)
150 minstagib_ammocheck();
154 MUTATOR_HOOKFUNCTION(minstagib_PlayerRegen)
156 // no regeneration in minstagib
160 MUTATOR_HOOKFUNCTION(minstagib_PlayerPowerups)
162 if (!(self.effects & EF_FULLBRIGHT))
163 self.effects |= EF_FULLBRIGHT;
165 if (self.items & IT_STRENGTH)
167 play_countdown(self.strength_finished, "misc/poweroff.wav");
168 if (time > self.strength_finished)
170 self.alpha = default_player_alpha;
171 self.exteriorweaponentity.alpha = default_weapon_alpha;
172 self.items &= ~IT_STRENGTH;
173 Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_INVISIBILITY);
178 if (time < self.strength_finished)
180 self.alpha = autocvar_g_minstagib_invis_alpha;
181 self.exteriorweaponentity.alpha = autocvar_g_minstagib_invis_alpha;
182 self.items |= IT_STRENGTH;
183 Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_INVISIBILITY, self.netname);
184 Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_INVISIBILITY);
188 if (self.items & IT_INVINCIBLE)
190 play_countdown(self.invincible_finished, "misc/poweroff.wav");
191 if (time > self.invincible_finished)
193 self.items &= ~IT_INVINCIBLE;
194 Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_SPEED);
199 if (time < self.invincible_finished)
201 self.items |= IT_INVINCIBLE;
202 Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_SPEED, self.netname);
203 Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_SPEED);
209 MUTATOR_HOOKFUNCTION(minstagib_PlayerPhysics)
211 if(self.items & IT_INVINCIBLE)
212 self.stat_sv_maxspeed = self.stat_sv_maxspeed * autocvar_g_minstagib_speed_highspeed;
217 MUTATOR_HOOKFUNCTION(minstagib_SplitHealthArmor)
220 damage_take = frag_damage;
225 MUTATOR_HOOKFUNCTION(minstagib_ForbidThrowing)
227 // weapon dropping on death handled by FilterItem
233 MUTATOR_HOOKFUNCTION(minstagib_PlayerDamage)
235 if(autocvar_g_friendlyfire == 0 && SAME_TEAM(frag_target, frag_attacker) && IS_PLAYER(frag_target) && IS_PLAYER(frag_attacker))
238 if(IS_PLAYER(frag_target))
240 if ((frag_deathtype == DEATH_FALL) ||
241 (frag_deathtype == DEATH_DROWN) ||
242 (frag_deathtype == DEATH_SLIME) ||
243 (frag_deathtype == DEATH_LAVA))
248 if(IS_PLAYER(frag_attacker))
249 if(DEATH_ISWEAPON(frag_deathtype, WEP_MINSTANEX))
250 if(frag_target.armorvalue)
252 frag_target.armorvalue -= 1;
253 Send_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CENTER_MINSTA_LIVES_REMAINING, frag_target.armorvalue);
255 frag_target.hitsound += 1;
256 frag_attacker.hitsound += 1; // TODO change this to a future specific hitsound for armor hit
259 if(IS_PLAYER(frag_attacker))
260 if (DEATH_ISWEAPON(frag_deathtype, WEP_LASER))
263 frag_mirrordamage = 0;
264 if (frag_target != frag_attacker)
266 if (frag_target.health >= 1)
267 Send_Notification(NOTIF_ONE, frag_attacker, MSG_CENTER, CENTER_MINSTA_SECONDARY);
268 frag_force = '0 0 0';
269 // keep mirrorfrag_force
270 //frag_attacker = frag_target;
275 if(IS_PLAYER(frag_attacker))
276 if(frag_mirrordamage > 0)
278 // just lose extra LIVES, don't kill the player for mirror damage
279 if(frag_attacker.armorvalue > 0)
281 frag_attacker.armorvalue -= 1;
282 Send_Notification(NOTIF_ONE, frag_attacker, MSG_CENTER, CENTER_MINSTA_LIVES_REMAINING, frag_attacker.armorvalue);
283 frag_attacker.hitsound += 1;
285 frag_mirrordamage = 0;
288 if(frag_target.items & IT_STRENGTH)
294 MUTATOR_HOOKFUNCTION(minstagib_SetStartItems)
296 start_ammo_cells = cvar("g_minstagib_ammo_start");
299 start_armorvalue = 0;
300 start_weapons = WEPSET_MINSTANEX;
301 warmup_start_weapons = WEPSET_MINSTANEX;
302 start_items |= IT_UNLIMITED_SUPERWEAPONS;
307 MUTATOR_HOOKFUNCTION(minstagib_FilterItem)
309 if(self.classname == "item_cells")
310 return TRUE; // no normal cells?
312 if(self.weapon == WEP_MINSTANEX && self.classname == "droppedweapon")
314 self.ammo_cells = autocvar_g_minstagib_ammo_drop;
318 if(self.weapon == WEP_ROCKET_LAUNCHER || self.weapon == WEP_NEX)
321 setorigin(e, self.origin);
325 spawnfunc_item_minst_cells();
330 if(self.flags & FL_POWERUP)
333 if(self.ammo_cells > autocvar_g_minstagib_ammo_drop && self.classname != "item_minst_cells")
334 self.ammo_cells = autocvar_g_minstagib_ammo_drop;
336 if(self.ammo_cells && !self.weapon)
342 MUTATOR_HOOKFUNCTION(minstagib_CustomizeWaypoint)
344 entity e = WaypointSprite_getviewentity(other);
346 // if you have the invisibility powerup, sprites ALWAYS are restricted to your team
347 // but only apply this to real players, not to spectators
348 if((self.owner.flags & FL_CLIENT) && (self.owner.items & IT_STRENGTH) && (e == other))
349 if(DIFF_TEAM(self.owner, e))
355 MUTATOR_HOOKFUNCTION(minstagib_ItemCountdown)
359 case IT_STRENGTH: item_name = "item-invis"; item_color = '0 0 1'; break;
360 case IT_NAILS: item_name = "item-extralife"; item_color = '1 0 0'; break;
361 case IT_INVINCIBLE: item_name = "item-speed"; item_color = '1 0 1'; break;
366 MUTATOR_HOOKFUNCTION(minstagib_ItemTouch)
370 // play some cool sounds ;)
371 if (IS_CLIENT(other))
373 if(other.health <= 5)
374 Send_Notification(NOTIF_ONE, other, MSG_ANNCE, ANNCE_MINSTAGIB_LASTSECOND);
375 else if(other.health < 50)
376 Send_Notification(NOTIF_ONE, other, MSG_ANNCE, ANNCE_MINSTAGIB_NARROWLY);
379 if(other.health < 100)
382 return MUT_ITEMTOUCH_CONTINUE;
387 other.armorvalue = bound(other.armorvalue, 999, other.armorvalue + autocvar_g_minstagib_extralives);
388 Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_EXTRALIVES);
389 return MUT_ITEMTOUCH_PICKUP;
392 return MUT_ITEMTOUCH_CONTINUE;
395 MUTATOR_HOOKFUNCTION(minstagib_OnEntityPreSpawn)
397 if (!autocvar_g_powerups) { return FALSE; }
398 if (!(self.classname == "item_strength" || self.classname == "item_invincible" || self.classname == "item_health_mega"))
404 e.think = spawnfunc_item_strength;
405 else if(random() < 0.6)
406 e.think = minstagib_health_mega;
408 e.think = spawnfunc_item_invincible;
410 e.nextthink = time + 0.1;
411 e.spawnflags = self.spawnflags;
412 e.noalign = self.noalign;
413 setorigin(e, self.origin);
418 MUTATOR_HOOKFUNCTION(minstagib_BuildMutatorsString)
420 ret_string = strcat(ret_string, ":MinstaGib");
424 MUTATOR_HOOKFUNCTION(minstagib_BuildMutatorsPrettyString)
426 ret_string = strcat(ret_string, ", MinstaGib");
430 MUTATOR_HOOKFUNCTION(minstagib_SetModname)
432 modname = "MinstaGib";
436 MUTATOR_DEFINITION(mutator_minstagib)
438 MUTATOR_HOOK(MatchEnd, minstagib_MatchEnd, CBC_ORDER_ANY);
439 MUTATOR_HOOK(MonsterDropItem, minstagib_MonsterLoot, CBC_ORDER_ANY);
440 MUTATOR_HOOK(MonsterSpawn, minstagib_MonsterSpawn, CBC_ORDER_ANY);
441 MUTATOR_HOOK(BotShouldAttack, minstagib_BotShouldAttack, CBC_ORDER_ANY);
442 MUTATOR_HOOK(PlayerPhysics, minstagib_PlayerPhysics, CBC_ORDER_ANY);
443 MUTATOR_HOOK(PlayerSpawn, minstagib_PlayerSpawn, CBC_ORDER_ANY);
444 MUTATOR_HOOK(PlayerDamage_Calculate, minstagib_PlayerDamage, CBC_ORDER_ANY);
445 MUTATOR_HOOK(MakePlayerObserver, minstagib_MakePlayerObserver, CBC_ORDER_ANY);
446 MUTATOR_HOOK(SetStartItems, minstagib_SetStartItems, CBC_ORDER_ANY);
447 MUTATOR_HOOK(ItemTouch, minstagib_ItemTouch, CBC_ORDER_ANY);
448 MUTATOR_HOOK(FilterItem, minstagib_FilterItem, CBC_ORDER_ANY);
449 MUTATOR_HOOK(CustomizeWaypoint, minstagib_CustomizeWaypoint, CBC_ORDER_ANY);
450 MUTATOR_HOOK(Item_RespawnCountdown, minstagib_ItemCountdown, CBC_ORDER_ANY);
451 MUTATOR_HOOK(PlayerDamage_SplitHealthArmor, minstagib_SplitHealthArmor, CBC_ORDER_ANY);
452 MUTATOR_HOOK(PlayerPowerups, minstagib_PlayerPowerups, CBC_ORDER_ANY);
453 MUTATOR_HOOK(ForbidThrowCurrentWeapon, minstagib_ForbidThrowing, CBC_ORDER_ANY);
454 MUTATOR_HOOK(PlayerPreThink, minstagib_PlayerPreThink, CBC_ORDER_ANY);
455 MUTATOR_HOOK(PlayerRegen, minstagib_PlayerRegen, CBC_ORDER_ANY);
456 MUTATOR_HOOK(OnEntityPreSpawn, minstagib_OnEntityPreSpawn, CBC_ORDER_ANY);
457 MUTATOR_HOOK(BuildMutatorsString, minstagib_BuildMutatorsString, CBC_ORDER_ANY);
458 MUTATOR_HOOK(BuildMutatorsPrettyString, minstagib_BuildMutatorsPrettyString, CBC_ORDER_ANY);
459 MUTATOR_HOOK(SetModname, minstagib_SetModname, CBC_ORDER_ANY);