-#include "../_all.qh"
#include "mutator.qh"
#include "../cl_client.qh"
-#include "../../common/buffs.qh"
+#include "../../common/buffs/all.qh"
#include "../../common/items/all.qc"
-void spawnfunc_item_minst_cells (void)
+spawnfunc(item_minst_cells)
{
if (!g_instagib) { remove(self); return; }
- if (!self.ammo_cells)
- self.ammo_cells = autocvar_g_instagib_ammo_drop;
+ if (!self.ammo_cells) self.ammo_cells = autocvar_g_instagib_ammo_drop;
+ StartItemA(ITEM_VaporizerCells);
+}
- StartItemA (ITEM_VaporizerCells);
+void instagib_invisibility()
+{SELFPARAM();
+ self.strength_finished = autocvar_g_balance_powerup_strength_time;
+ StartItemA(ITEM_Invisibility);
}
-void instagib_health_mega()
-{
+void instagib_extralife()
+{SELFPARAM();
self.max_health = 1;
- StartItemA (ITEM_ExtraLife);
+ StartItemA(ITEM_ExtraLife);
+}
+
+void instagib_speed()
+{SELFPARAM();
+ self.invincible_finished = autocvar_g_balance_powerup_invincible_time;
+ StartItemA(ITEM_Speed);
}
.float instagib_nextthink;
e.instagib_needammo = false;
}
void instagib_ammocheck()
-{
+{SELFPARAM();
if(time < self.instagib_nextthink)
return;
if(!IS_PLAYER(self))
instagib_stop_countdown(self);
else if (self.ammo_cells > 0 || (self.items & IT_UNLIMITED_WEAPON_AMMO) || (self.flags & FL_GODMODE))
instagib_stop_countdown(self);
+ else if(autocvar_g_rm && autocvar_g_rm_laser)
+ {
+ if(!self.instagib_needammo)
+ {
+ Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_INSTAGIB_DOWNGRADE);
+ self.instagib_needammo = true;
+ }
+ }
else
{
self.instagib_needammo = true;
}
MUTATOR_HOOKFUNCTION(instagib_MonsterSpawn)
-{
+{SELFPARAM();
// always refill ammo
- if(self.monsterid == MON_MAGE)
+ if(self.monsterid == MON_MAGE.monsterid)
self.skin = 1;
return false;
MUTATOR_HOOKFUNCTION(instagib_BotShouldAttack)
{
- if(checkentity.items & IT_STRENGTH)
+ if (checkentity.items & ITEM_Invisibility.m_itemid)
return true;
return false;
}
MUTATOR_HOOKFUNCTION(instagib_MakePlayerObserver)
-{
+{SELFPARAM();
instagib_stop_countdown(self);
return false;
}
MUTATOR_HOOKFUNCTION(instagib_PlayerSpawn)
-{
+{SELFPARAM();
self.effects |= EF_FULLBRIGHT;
return false;
}
}
MUTATOR_HOOKFUNCTION(instagib_PlayerPowerups)
-{
+{SELFPARAM();
if (!(self.effects & EF_FULLBRIGHT))
self.effects |= EF_FULLBRIGHT;
- if (self.items & IT_STRENGTH)
+ if (self.items & ITEM_Invisibility.m_itemid)
{
- play_countdown(self.strength_finished, "misc/poweroff.wav");
+ play_countdown(self.strength_finished, SND(POWEROFF));
if (time > self.strength_finished)
{
self.alpha = default_player_alpha;
self.exteriorweaponentity.alpha = default_weapon_alpha;
- self.items &= ~IT_STRENGTH;
+ self.items &= ~ITEM_Invisibility.m_itemid;
Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_INVISIBILITY);
}
}
{
self.alpha = autocvar_g_instagib_invis_alpha;
self.exteriorweaponentity.alpha = autocvar_g_instagib_invis_alpha;
- self.items |= IT_STRENGTH;
+ self.items |= ITEM_Invisibility.m_itemid;
Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_INVISIBILITY, self.netname);
Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_INVISIBILITY);
}
}
- if (self.items & IT_INVINCIBLE)
+ if (self.items & ITEM_Speed.m_itemid)
{
- play_countdown(self.invincible_finished, "misc/poweroff.wav");
+ play_countdown(self.invincible_finished, SND(POWEROFF));
if (time > self.invincible_finished)
{
- self.items &= ~IT_INVINCIBLE;
+ self.items &= ~ITEM_Speed.m_itemid;
Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_SPEED);
}
}
{
if (time < self.invincible_finished)
{
- self.items |= IT_INVINCIBLE;
+ self.items |= ITEM_Speed.m_itemid;
Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_SPEED, self.netname);
Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_SPEED);
}
return false;
}
+.float stat_sv_maxspeed;
+
MUTATOR_HOOKFUNCTION(instagib_PlayerPhysics)
-{
- if(self.items & IT_INVINCIBLE)
+{SELFPARAM();
+ if(self.items & ITEM_Speed.m_itemid)
self.stat_sv_maxspeed = self.stat_sv_maxspeed * autocvar_g_instagib_speed_highspeed;
return false;
if(IS_PLAYER(frag_target))
{
- if ((frag_deathtype == DEATH_FALL) ||
- (frag_deathtype == DEATH_DROWN) ||
- (frag_deathtype == DEATH_SLIME) ||
- (frag_deathtype == DEATH_LAVA))
+ if(frag_deathtype == DEATH_FALL)
+ frag_damage = 0; // never count fall damage
+
+ if(!autocvar_g_instagib_damagedbycontents)
+ switch(frag_deathtype)
{
- frag_damage = 0;
+ case DEATH_DROWN:
+ case DEATH_SLIME:
+ case DEATH_LAVA:
+ frag_damage = 0;
+ break;
}
if(IS_PLAYER(frag_attacker))
- if(DEATH_ISWEAPON(frag_deathtype, WEP_VAPORIZER))
+ if(DEATH_ISWEAPON(frag_deathtype, WEP_VAPORIZER.m_id))
{
if(frag_target.armorvalue)
{
}
}
- if(IS_PLAYER(frag_attacker) && DEATH_ISWEAPON(frag_deathtype, WEP_BLASTER))
+ if(IS_PLAYER(frag_attacker) && DEATH_ISWEAPON(frag_deathtype, WEP_BLASTER.m_id))
{
if(frag_deathtype & HITTYPE_SECONDARY)
{
- frag_damage = frag_mirrordamage = 0;
+ if(!autocvar_g_instagib_blaster_keepdamage)
+ frag_damage = frag_mirrordamage = 0;
if(frag_target != frag_attacker)
{
- if(frag_target.health > 0) { Send_Notification(NOTIF_ONE, frag_attacker, MSG_CENTER, CENTER_SECONDARY_NODAMAGE); }
- frag_force = '0 0 0';
+ if(frag_damage <= 0 && frag_target.health > 0) { Send_Notification(NOTIF_ONE, frag_attacker, MSG_CENTER, CENTER_SECONDARY_NODAMAGE); }
+ if(!autocvar_g_instagib_blaster_keepforce)
+ frag_force = '0 0 0';
}
}
}
{
frag_attacker.armorvalue -= 1;
Send_Notification(NOTIF_ONE, frag_attacker, MSG_CENTER, CENTER_INSTAGIB_LIVES_REMAINING, frag_attacker.armorvalue);
- frag_attacker.damage_dealt += 1;
+ frag_attacker.damage_dealt += frag_mirrordamage;
}
frag_mirrordamage = 0;
}
- if((frag_target.buffs & BUFF_INVISIBLE) || (frag_target.items & IT_STRENGTH))
+ if((frag_target.buffs & BUFF_INVISIBLE.m_itemid) || (frag_target.items & ITEM_Invisibility.m_itemid))
yoda = 1;
return false;
start_ammo_rockets = warmup_start_ammo_rockets = 0;
start_ammo_fuel = warmup_start_ammo_fuel = 0;
- start_weapons = warmup_start_weapons = WEPSET_VAPORIZER;
+ start_weapons = warmup_start_weapons = WEPSET(VAPORIZER);
start_items |= IT_UNLIMITED_SUPERWEAPONS;
return false;
}
MUTATOR_HOOKFUNCTION(instagib_FilterItem)
-{
+{SELFPARAM();
if(self.classname == "item_cells")
return true; // no normal cells?
- if(self.weapon == WEP_VAPORIZER && self.classname == "droppedweapon")
+ if(self.weapon == WEP_VAPORIZER.m_id && self.classname == "droppedweapon")
{
self.ammo_cells = autocvar_g_instagib_ammo_drop;
return false;
}
- if(self.weapon == WEP_DEVASTATOR || self.weapon == WEP_VORTEX)
+ if(self.weapon == WEP_DEVASTATOR.m_id || self.weapon == WEP_VORTEX.m_id)
{
entity e = spawn();
setorigin(e, self.origin);
- entity oldself;
- oldself = self;
- self = e;
- spawnfunc_item_minst_cells();
- self = oldself;
+ e.noalign = self.noalign;
+ e.cnt = self.cnt;
+ e.team = self.team;
+ WITH(entity, self, e, spawnfunc_item_minst_cells(e));
return true;
}
}
MUTATOR_HOOKFUNCTION(instagib_CustomizeWaypoint)
-{
+{SELFPARAM();
entity e = WaypointSprite_getviewentity(other);
// if you have the invisibility powerup, sprites ALWAYS are restricted to your team
// but only apply this to real players, not to spectators
- if((self.owner.flags & FL_CLIENT) && (self.owner.items & IT_STRENGTH) && (e == other))
+ if((self.owner.flags & FL_CLIENT) && (self.owner.items & ITEM_Invisibility.m_itemid) && (e == other))
if(DIFF_TEAM(self.owner, e))
return true;
return false;
}
-MUTATOR_HOOKFUNCTION(instagib_ItemCountdown)
+MUTATOR_HOOKFUNCTION(instagib_PlayerDies)
{
- switch(self.items)
- {
- case IT_STRENGTH: item_name = "item-invis"; item_color = '0 0 1'; break;
- case IT_NAILS: item_name = "item-extralife"; item_color = '1 0 0'; break;
- case IT_INVINCIBLE: item_name = "item-speed"; item_color = '1 0 1'; break;
- }
- return false;
+ if(DEATH_ISWEAPON(frag_deathtype, WEP_VAPORIZER.m_id))
+ frag_damage = 1000; // always gib if it was a vaporizer death
+
+ return FALSE;
}
MUTATOR_HOOKFUNCTION(instagib_ItemTouch)
-{
+{SELFPARAM();
if(self.ammo_cells)
{
// play some cool sounds ;)
}
MUTATOR_HOOKFUNCTION(instagib_OnEntityPreSpawn)
-{
+{SELFPARAM();
if (!autocvar_g_powerups) { return false; }
+ // Can't use .itemdef here
if (!(self.classname == "item_strength" || self.classname == "item_invincible" || self.classname == "item_health_mega"))
return false;
entity e = spawn();
- if(random() < 0.3)
- e.think = spawnfunc_item_strength;
- else if(random() < 0.6)
- e.think = instagib_health_mega;
+ float r = random();
+ if (r < 0.3)
+ e.think = instagib_invisibility;
+ else if (r < 0.6)
+ e.think = instagib_extralife;
else
- e.think = spawnfunc_item_invincible;
+ e.think = instagib_speed;
e.nextthink = time + 0.1;
e.spawnflags = self.spawnflags;
MUTATOR_HOOK(ItemTouch, instagib_ItemTouch, CBC_ORDER_ANY);
MUTATOR_HOOK(FilterItem, instagib_FilterItem, CBC_ORDER_ANY);
MUTATOR_HOOK(CustomizeWaypoint, instagib_CustomizeWaypoint, CBC_ORDER_ANY);
- MUTATOR_HOOK(Item_RespawnCountdown, instagib_ItemCountdown, CBC_ORDER_ANY);
+ MUTATOR_HOOK(PlayerDies, instagib_PlayerDies, CBC_ORDER_ANY);
MUTATOR_HOOK(PlayerDamage_SplitHealthArmor, instagib_SplitHealthArmor, CBC_ORDER_ANY);
MUTATOR_HOOK(PlayerPowerups, instagib_PlayerPowerups, CBC_ORDER_ANY);
MUTATOR_HOOK(ForbidThrowCurrentWeapon, instagib_ForbidThrowing, CBC_ORDER_ANY);