#include "items.qc"
+#ifdef SVQC
+float autocvar_g_instagib_invis_alpha;
+#endif
+
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
-#include "../../../../server/cl_client.qh"
-#include "../../../buffs/all.qh"
+int autocvar_g_instagib_ammo_drop;
+int autocvar_g_instagib_extralives;
+float autocvar_g_instagib_speed_highspeed;
-#include "../../../items/all.qc"
+#include <server/cl_client.qh>
+
+#include <common/items/all.qc>
REGISTER_MUTATOR(mutator_instagib, cvar("g_instagib") && !g_nexball);
spawnfunc(item_minst_cells)
{
- if (!g_instagib) { remove(self); return; }
- if (!self.ammo_cells) self.ammo_cells = autocvar_g_instagib_ammo_drop;
- StartItemA(ITEM_VaporizerCells);
+ if (!g_instagib) { remove(this); return; }
+ if (!this.ammo_cells) this.ammo_cells = autocvar_g_instagib_ammo_drop;
+ StartItem(this, ITEM_VaporizerCells);
}
-void instagib_invisibility()
-{SELFPARAM();
- self.strength_finished = autocvar_g_balance_powerup_strength_time;
- StartItemA(ITEM_Invisibility);
+void instagib_invisibility(entity this)
+{
+ this.strength_finished = autocvar_g_balance_powerup_strength_time;
+ StartItem(this, ITEM_Invisibility);
}
-void instagib_extralife()
-{SELFPARAM();
- self.max_health = 1;
- StartItemA(ITEM_ExtraLife);
+void instagib_extralife(entity this)
+{
+ StartItem(this, ITEM_ExtraLife);
}
-void instagib_speed()
-{SELFPARAM();
- self.invincible_finished = autocvar_g_balance_powerup_invincible_time;
- StartItemA(ITEM_Speed);
+void instagib_speed(entity this)
+{
+ this.invincible_finished = autocvar_g_balance_powerup_invincible_time;
+ StartItem(this, ITEM_Speed);
}
.float instagib_nextthink;
{
if (!e.instagib_needammo)
return;
- Kill_Notification(NOTIF_ONE_ONLY, e, MSG_CENTER_CPID, CPID_INSTAGIB_FINDAMMO);
+ Kill_Notification(NOTIF_ONE_ONLY, e, MSG_CENTER, CPID_INSTAGIB_FINDAMMO);
e.instagib_needammo = false;
}
-void instagib_ammocheck()
-{SELFPARAM();
- if(time < self.instagib_nextthink)
+void instagib_ammocheck(entity this)
+{
+ if(time < this.instagib_nextthink)
return;
- if(!IS_PLAYER(self))
+ if(!IS_PLAYER(this))
return; // not a player
- if(self.deadflag || gameover)
- instagib_stop_countdown(self);
- else if (self.ammo_cells > 0 || (self.items & IT_UNLIMITED_WEAPON_AMMO) || (self.flags & FL_GODMODE))
- instagib_stop_countdown(self);
+ if(IS_DEAD(this) || gameover)
+ instagib_stop_countdown(this);
+ else if (this.ammo_cells > 0 || (this.items & IT_UNLIMITED_WEAPON_AMMO) || (this.flags & FL_GODMODE))
+ instagib_stop_countdown(this);
else if(autocvar_g_rm && autocvar_g_rm_laser)
{
- if(!self.instagib_needammo)
+ if(!this.instagib_needammo)
{
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_INSTAGIB_DOWNGRADE);
- self.instagib_needammo = true;
+ Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_INSTAGIB_DOWNGRADE);
+ this.instagib_needammo = true;
}
}
else
{
- self.instagib_needammo = true;
- if (self.health <= 5)
+ this.instagib_needammo = true;
+ if (this.health <= 5)
{
- Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
- Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_INSTAGIB_TERMINATED);
+ Damage(this, this, this, 5, DEATH_NOAMMO.m_id, this.origin, '0 0 0');
+ Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_INSTAGIB_TERMINATED);
}
- else if (self.health <= 10)
+ else if (this.health <= 10)
{
- Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
- Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_1);
+ Damage(this, this, this, 5, DEATH_NOAMMO.m_id, this.origin, '0 0 0');
+ Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_1);
}
- else if (self.health <= 20)
+ else if (this.health <= 20)
{
- Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
- Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_2);
+ Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0');
+ Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_2);
}
- else if (self.health <= 30)
+ else if (this.health <= 30)
{
- Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
- Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_3);
+ Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0');
+ Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_3);
}
- else if (self.health <= 40)
+ else if (this.health <= 40)
{
- Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
- Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_4);
+ Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0');
+ Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_4);
}
- else if (self.health <= 50)
+ else if (this.health <= 50)
{
- Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
- Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_5);
+ Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0');
+ Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_5);
}
- else if (self.health <= 60)
+ else if (this.health <= 60)
{
- Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
- Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_6);
+ Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0');
+ Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_6);
}
- else if (self.health <= 70)
+ else if (this.health <= 70)
{
- Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
- Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_7);
+ Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0');
+ Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_7);
}
- else if (self.health <= 80)
+ else if (this.health <= 80)
{
- Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
- Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_8);
+ Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0');
+ Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_8);
}
- else if (self.health <= 90)
+ else if (this.health <= 90)
{
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_INSTAGIB_FINDAMMO);
- Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
- Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_9);
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_INSTAGIB_FINDAMMO);
+ Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0');
+ Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_9);
}
else
{
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_MULTI, MULTI_INSTAGIB_FINDAMMO);
- Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_MULTI, MULTI_INSTAGIB_FINDAMMO);
+ Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0');
}
}
- self.instagib_nextthink = time + 1;
+ this.instagib_nextthink = time + 1;
}
MUTATOR_HOOKFUNCTION(mutator_instagib, MatchEnd)
{
- entity head;
- FOR_EACH_PLAYER(head)
- instagib_stop_countdown(head);
-
+ FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(instagib_stop_countdown(it)));
return false;
}
MUTATOR_HOOKFUNCTION(mutator_instagib, MonsterDropItem)
{
- other.monster_loot = spawnfunc_item_minst_cells;
+ entity item = M_ARGV(1, entity);
+
+ item.monster_loot = spawnfunc_item_minst_cells;
return false;
}
MUTATOR_HOOKFUNCTION(mutator_instagib, MonsterSpawn)
-{SELFPARAM();
+{
+ entity mon = M_ARGV(0, entity);
+
// always refill ammo
- if(self.monsterid == MON_MAGE.monsterid)
- self.skin = 1;
+ if(mon.monsterid == MON_MAGE.monsterid)
+ mon.skin = 1;
return false;
}
MUTATOR_HOOKFUNCTION(mutator_instagib, BotShouldAttack)
{
- if (checkentity.items & ITEM_Invisibility.m_itemid)
+ entity targ = M_ARGV(1, entity);
+
+ if (targ.items & ITEM_Invisibility.m_itemid)
return true;
return false;
}
MUTATOR_HOOKFUNCTION(mutator_instagib, MakePlayerObserver)
-{SELFPARAM();
- instagib_stop_countdown(self);
- return false;
+{
+ entity player = M_ARGV(0, entity);
+
+ instagib_stop_countdown(player);
}
MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerSpawn)
-{SELFPARAM();
- self.effects |= EF_FULLBRIGHT;
- return false;
+{
+ entity player = M_ARGV(0, entity);
+
+ player.effects |= EF_FULLBRIGHT;
}
MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerPreThink)
{
- instagib_ammocheck();
- return false;
+ entity player = M_ARGV(0, entity);
+
+ instagib_ammocheck(player);
}
MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerRegen)
}
MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerPowerups)
-{SELFPARAM();
- if (!(self.effects & EF_FULLBRIGHT))
- self.effects |= EF_FULLBRIGHT;
+{
+ entity player = M_ARGV(0, entity);
+
+ if (!(player.effects & EF_FULLBRIGHT))
+ player.effects |= EF_FULLBRIGHT;
- if (self.items & ITEM_Invisibility.m_itemid)
+ if (player.items & ITEM_Invisibility.m_itemid)
{
- play_countdown(self.strength_finished, SND(POWEROFF));
- if (time > self.strength_finished)
+ play_countdown(player, player.strength_finished, SND_POWEROFF);
+ if (time > player.strength_finished)
{
- self.alpha = default_player_alpha;
- self.exteriorweaponentity.alpha = default_weapon_alpha;
- self.items &= ~ITEM_Invisibility.m_itemid;
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_INVISIBILITY);
+ player.alpha = default_player_alpha;
+ player.exteriorweaponentity.alpha = default_weapon_alpha;
+ player.items &= ~ITEM_Invisibility.m_itemid;
+ Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_POWERDOWN_INVISIBILITY);
}
}
else
{
- if (time < self.strength_finished)
+ if (time < player.strength_finished)
{
- self.alpha = autocvar_g_instagib_invis_alpha;
- self.exteriorweaponentity.alpha = autocvar_g_instagib_invis_alpha;
- 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);
+ player.alpha = autocvar_g_instagib_invis_alpha;
+ player.exteriorweaponentity.alpha = autocvar_g_instagib_invis_alpha;
+ player.items |= ITEM_Invisibility.m_itemid;
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_INVISIBILITY, player.netname);
+ Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_POWERUP_INVISIBILITY);
}
}
- if (self.items & ITEM_Speed.m_itemid)
+ if (player.items & ITEM_Speed.m_itemid)
{
- play_countdown(self.invincible_finished, SND(POWEROFF));
- if (time > self.invincible_finished)
+ play_countdown(player, player.invincible_finished, SND_POWEROFF);
+ if (time > player.invincible_finished)
{
- self.items &= ~ITEM_Speed.m_itemid;
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_SPEED);
+ player.items &= ~ITEM_Speed.m_itemid;
+ Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_POWERDOWN_SPEED);
}
}
else
{
- if (time < self.invincible_finished)
+ if (time < player.invincible_finished)
{
- 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);
+ player.items |= ITEM_Speed.m_itemid;
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_SPEED, player.netname);
+ Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_POWERUP_SPEED);
}
}
- return false;
}
.float stat_sv_maxspeed;
MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerPhysics)
-{SELFPARAM();
- if(self.items & ITEM_Speed.m_itemid)
- self.stat_sv_maxspeed = self.stat_sv_maxspeed * autocvar_g_instagib_speed_highspeed;
+{
+ entity player = M_ARGV(0, entity);
- return false;
+ if(player.items & ITEM_Speed.m_itemid)
+ player.stat_sv_maxspeed = player.stat_sv_maxspeed * autocvar_g_instagib_speed_highspeed;
}
MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerDamage_SplitHealthArmor)
{
- damage_save = 0;
- damage_take = frag_damage;
-
- return false;
+ M_ARGV(4, float) = M_ARGV(7, float); // take = damage
+ M_ARGV(5, float) = 0; // save
}
MUTATOR_HOOKFUNCTION(mutator_instagib, ForbidThrowCurrentWeapon)
MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerDamage_Calculate)
{
+ entity frag_attacker = M_ARGV(1, entity);
+ entity frag_target = M_ARGV(2, entity);
+ float frag_deathtype = M_ARGV(3, float);
+ float frag_damage = M_ARGV(4, float);
+ float frag_mirrordamage = M_ARGV(5, float);
+ vector frag_force = M_ARGV(6, vector);
+
if(autocvar_g_friendlyfire == 0 && SAME_TEAM(frag_target, frag_attacker) && IS_PLAYER(frag_target) && IS_PLAYER(frag_attacker))
frag_damage = 0;
if(IS_PLAYER(frag_target))
{
- if(frag_deathtype == DEATH_FALL)
+ if(frag_deathtype == DEATH_FALL.m_id)
frag_damage = 0; // never count fall damage
if(!autocvar_g_instagib_damagedbycontents)
- switch(frag_deathtype)
+ switch(DEATH_ENT(frag_deathtype))
{
case DEATH_DROWN:
case DEATH_SLIME:
}
if(IS_PLAYER(frag_attacker))
- if(DEATH_ISWEAPON(frag_deathtype, WEP_VAPORIZER.m_id))
+ if(DEATH_ISWEAPON(frag_deathtype, WEP_VAPORIZER))
{
+ if(!autocvar_g_instagib_friendlypush && SAME_TEAM(frag_target, frag_attacker))
+ frag_force = '0 0 0';
+
if(frag_target.armorvalue)
{
frag_target.armorvalue -= 1;
frag_damage = 0;
frag_target.damage_dealt += 1;
- frag_attacker.damage_dealt += 1; // TODO: change this to a specific hitsound for armor hit
+ frag_attacker.damage_dealt += 1;
Send_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CENTER_INSTAGIB_LIVES_REMAINING, frag_target.armorvalue);
}
}
- if(IS_PLAYER(frag_attacker) && DEATH_ISWEAPON(frag_deathtype, WEP_BLASTER.m_id))
+ if(IS_PLAYER(frag_attacker) && DEATH_ISWEAPON(frag_deathtype, WEP_BLASTER))
{
if(frag_deathtype & HITTYPE_SECONDARY)
{
- if(!autocvar_g_instagib_blaster_keepdamage)
- frag_damage = frag_mirrordamage = 0;
+ if(!autocvar_g_instagib_blaster_keepdamage || frag_attacker == frag_target)
+ {
+ frag_damage = 0;
+ if(!autocvar_g_instagib_mirrordamage)
+ frag_mirrordamage = 0; // never do mirror damage on enemies
+ }
if(frag_target != frag_attacker)
{
}
}
+ if(!autocvar_g_instagib_mirrordamage) // only apply the taking lives hack if we don't want to support real damage mirroring
if(IS_PLAYER(frag_attacker))
if(frag_mirrordamage > 0)
{
frag_mirrordamage = 0;
}
- if((frag_target.buffs & BUFF_INVISIBLE.m_itemid) || (frag_target.items & ITEM_Invisibility.m_itemid))
+ if(frag_target.alpha && frag_target.alpha < 1)
+ if(IS_PLAYER(frag_target))
yoda = 1;
+ M_ARGV(4, float) = frag_damage;
+ M_ARGV(5, float) = frag_mirrordamage;
+ M_ARGV(6, vector) = frag_force;
+
return false;
}
}
MUTATOR_HOOKFUNCTION(mutator_instagib, FilterItem)
-{SELFPARAM();
- if(self.classname == "item_cells")
+{
+ entity item = M_ARGV(0, entity);
+
+ if(item.classname == "item_cells")
return true; // no normal cells?
- if(self.weapon == WEP_VAPORIZER.m_id && self.classname == "droppedweapon")
+ if(item.weapon == WEP_VAPORIZER.m_id && item.classname == "droppedweapon")
{
- self.ammo_cells = autocvar_g_instagib_ammo_drop;
+ item.ammo_cells = autocvar_g_instagib_ammo_drop;
return false;
}
- if(self.weapon == WEP_DEVASTATOR.m_id || self.weapon == WEP_VORTEX.m_id)
+ if(item.weapon == WEP_DEVASTATOR.m_id || item.weapon == WEP_VORTEX.m_id)
{
entity e = spawn();
- setorigin(e, self.origin);
- e.noalign = self.noalign;
- e.cnt = self.cnt;
- e.team = self.team;
- WITH(entity, self, e, spawnfunc_item_minst_cells(e));
+ setorigin(e, item.origin);
+ e.noalign = item.noalign;
+ e.cnt = item.cnt;
+ e.team = item.team;
+ e.spawnfunc_checked = true;
+ WITHSELF(e, spawnfunc_item_minst_cells(e));
return true;
}
- if(self.flags & FL_POWERUP)
+ if(item.flags & FL_POWERUP)
return false;
- if(self.ammo_cells > autocvar_g_instagib_ammo_drop && self.classname != "item_minst_cells")
- self.ammo_cells = autocvar_g_instagib_ammo_drop;
+ if(item.ammo_cells > autocvar_g_instagib_ammo_drop && item.classname != "item_minst_cells")
+ item.ammo_cells = autocvar_g_instagib_ammo_drop;
- if(self.ammo_cells && !self.weapon)
+ if(item.ammo_cells && !item.weapon)
return false;
return true;
}
MUTATOR_HOOKFUNCTION(mutator_instagib, CustomizeWaypoint)
-{SELFPARAM();
- entity e = WaypointSprite_getviewentity(other);
+{
+ entity wp = M_ARGV(0, entity);
+ entity player = M_ARGV(1, entity);
+
+ entity e = WaypointSprite_getviewentity(player);
// 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 & ITEM_Invisibility.m_itemid) && (e == other))
- if(DIFF_TEAM(self.owner, e))
+ if((wp.owner.flags & FL_CLIENT) && (wp.owner.items & ITEM_Invisibility.m_itemid) && (e == player))
+ if(DIFF_TEAM(wp.owner, e))
return true;
return false;
MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerDies)
{
- if(DEATH_ISWEAPON(frag_deathtype, WEP_VAPORIZER.m_id))
- frag_damage = 1000; // always gib if it was a vaporizer death
+ float frag_deathtype = M_ARGV(3, float);
+
+ if(DEATH_ISWEAPON(frag_deathtype, WEP_VAPORIZER))
+ M_ARGV(4, float) = 1000; // always gib if it was a vaporizer death
- return FALSE;
+ return false;
}
MUTATOR_HOOKFUNCTION(mutator_instagib, ItemTouch)
-{SELFPARAM();
- if(self.ammo_cells)
+{
+ entity item = M_ARGV(0, entity);
+ entity toucher = M_ARGV(1, entity);
+
+ if(item.ammo_cells)
{
// play some cool sounds ;)
- if (IS_CLIENT(other))
+ if (IS_CLIENT(toucher))
{
- if(other.health <= 5)
- Send_Notification(NOTIF_ONE, other, MSG_ANNCE, ANNCE_INSTAGIB_LASTSECOND);
- else if(other.health < 50)
- Send_Notification(NOTIF_ONE, other, MSG_ANNCE, ANNCE_INSTAGIB_NARROWLY);
+ if(toucher.health <= 5)
+ Send_Notification(NOTIF_ONE, toucher, MSG_ANNCE, ANNCE_INSTAGIB_LASTSECOND);
+ else if(toucher.health < 50)
+ Send_Notification(NOTIF_ONE, toucher, MSG_ANNCE, ANNCE_INSTAGIB_NARROWLY);
}
- if(other.health < 100)
- other.health = 100;
+ if(toucher.health < 100)
+ toucher.health = 100;
return MUT_ITEMTOUCH_CONTINUE;
}
- if(self.max_health)
+ if(item.itemdef == ITEM_ExtraLife)
{
- other.armorvalue = bound(other.armorvalue, 999, other.armorvalue + autocvar_g_instagib_extralives);
- Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_EXTRALIVES);
+ toucher.armorvalue = bound(toucher.armorvalue, 999, toucher.armorvalue + autocvar_g_instagib_extralives);
+ Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_EXTRALIVES);
return MUT_ITEMTOUCH_PICKUP;
}
}
MUTATOR_HOOKFUNCTION(mutator_instagib, OnEntityPreSpawn)
-{SELFPARAM();
+{
if (!autocvar_g_powerups) { return false; }
+ entity ent = M_ARGV(0, entity);
// Can't use .itemdef here
- if (!(self.classname == "item_strength" || self.classname == "item_invincible" || self.classname == "item_health_mega"))
+ if (!(ent.classname == "item_strength" || ent.classname == "item_invincible" || ent.classname == "item_health_mega"))
return false;
entity e = spawn();
float r = random();
if (r < 0.3)
- e.think = instagib_invisibility;
+ setthink(e, instagib_invisibility);
else if (r < 0.6)
- e.think = instagib_extralife;
+ setthink(e, instagib_extralife);
else
- e.think = instagib_speed;
+ setthink(e, instagib_speed);
e.nextthink = time + 0.1;
- e.spawnflags = self.spawnflags;
- e.noalign = self.noalign;
- setorigin(e, self.origin);
+ e.spawnflags = ent.spawnflags;
+ e.noalign = ent.noalign;
+ setorigin(e, ent.origin);
return true;
}
MUTATOR_HOOKFUNCTION(mutator_instagib, BuildMutatorsString)
{
- ret_string = strcat(ret_string, ":instagib");
- return false;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ":instagib");
}
MUTATOR_HOOKFUNCTION(mutator_instagib, BuildMutatorsPrettyString)
{
- ret_string = strcat(ret_string, ", instagib");
- return false;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ", instagib");
}
MUTATOR_HOOKFUNCTION(mutator_instagib, SetModname)
{
- modname = "instagib";
+ M_ARGV(0, string) = "InstaGib";
return true;
}