]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mutators/mutator/instagib/instagib.qc
Fix some mistakes
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / instagib / instagib.qc
index ec96d462601d92aa2b189307a2fa0d532b2b4a5a..0f1b199a446d542e3511925dd1e5d78cb1cdc1e3 100644 (file)
@@ -153,17 +153,21 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, MonsterDropItem)
 }
 
 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;
@@ -184,9 +188,10 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerSpawn)
 }
 
 MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerPreThink)
-{SELFPARAM();
-       instagib_ammocheck(self);
-       return false;
+{
+       entity player = M_ARGV(0, entity);
+
+       instagib_ammocheck(player);
 }
 
 MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerRegen)
@@ -196,62 +201,63 @@ 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)
@@ -430,37 +436,39 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, CustomizeWaypoint)
 MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerDies)
 {
        float frag_deathtype = M_ARGV(3, float);
-       float frag_damage = M_ARGV(4, float);
 
        if(DEATH_ISWEAPON(frag_deathtype, WEP_VAPORIZER))
-               frag_damage = 1000; // always gib if it was a vaporizer death
+               M_ARGV(4, float) = 1000; // always gib if it was a vaporizer death
 
        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.itemdef == ITEM_ExtraLife)
+       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;
        }
 
@@ -495,19 +503,17 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, OnEntityPreSpawn)
 
 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;
 }