]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mutators/mutator/nix/nix.qc
Merge branch 'master' into Mario/entrap_nade
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / nix / nix.qc
index 238e7fbacdcd8648fb85b6b2ba4d9e0e840af1f2..f52d75a9e93c769c195d066279cf85c31593701f 100644 (file)
@@ -36,7 +36,6 @@ bool NIX_CanChooseWeapon(int wpn);
 
 REGISTER_MUTATOR(nix, cvar("g_nix") && !cvar("g_instagib") && !cvar("g_overkill"))
 {
-    SELFPARAM();
        MUTATOR_ONADD
        {
                g_nix_with_blaster = autocvar_g_nix_with_blaster;
@@ -64,7 +63,7 @@ REGISTER_MUTATOR(nix, cvar("g_nix") && !cvar("g_instagib") && !cvar("g_overkill"
                        it.ammo_fuel = start_ammo_fuel;
                        it.weapons = start_weapons;
                        if(!client_hasweapon(it, PS(it).m_weapon, true, false))
-                               PS(it).m_switchweapon = w_getbestweapon(self);
+                               PS(it).m_switchweapon = w_getbestweapon(it);
                });
        }
 
@@ -96,7 +95,7 @@ void NIX_ChooseNextWeapon()
        RandomSelection_Init();
        FOREACH(Weapons, it != WEP_Null, LAMBDA(
                if(NIX_CanChooseWeapon(it.m_id))
-                       RandomSelection_Add(world, it.m_id, string_null, 1, (it.m_id != nix_weapon));
+                       RandomSelection_Add(NULL, it.m_id, string_null, 1, (it.m_id != nix_weapon));
        ));
        nix_nextweapon = RandomSelection_chosen_float;
 }
@@ -125,7 +124,7 @@ void NIX_GiveCurrentWeapon(entity this)
        // get weapon info
        entity e = Weapons_from(nix_weapon);
 
-       if(nix_nextchange != self.nix_lastchange_id) // this shall only be called once per round!
+       if(nix_nextchange != this.nix_lastchange_id) // this shall only be called once per round!
        {
                this.ammo_shells = this.ammo_nails = this.ammo_rockets = this.ammo_cells = this.ammo_plasma = this.ammo_fuel = 0;
 
@@ -160,7 +159,7 @@ void NIX_GiveCurrentWeapon(entity this)
                else
                        Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_NIX_NEWWEAPON, nix_weapon);
 
-               WITHSELF(this, e.wr_resetplayer(e, this));
+               e.wr_resetplayer(e, this);
 
                // all weapons must be fully loaded when we spawn
                if(e.spawnflags & WEP_FLAG_RELOADABLE) // prevent accessing undefined cvars
@@ -261,16 +260,16 @@ MUTATOR_HOOKFUNCTION(nix, OnEntityPreSpawn)
 
        if(ent.classname == "target_items") // items triggers cannot work in nix (as they change weapons/ammo)
                return true;
-       return false;
 }
 
 MUTATOR_HOOKFUNCTION(nix, PlayerPreThink)
-{SELFPARAM();
+{
+       entity player = M_ARGV(0, entity);
+
        if(!intermission_running)
-       if(!IS_DEAD(self))
-       if(IS_PLAYER(self))
-               NIX_GiveCurrentWeapon(this);
-       return false;
+       if(!IS_DEAD(player))
+       if(IS_PLAYER(player))
+               NIX_GiveCurrentWeapon(player);
 }
 
 MUTATOR_HOOKFUNCTION(nix, PlayerSpawn)
@@ -280,12 +279,10 @@ MUTATOR_HOOKFUNCTION(nix, PlayerSpawn)
        player.nix_lastchange_id = -1;
        NIX_GiveCurrentWeapon(player); // overrides the weapons you got when spawning
        player.items |= IT_UNLIMITED_SUPERWEAPONS;
-       return false;
 }
 
 MUTATOR_HOOKFUNCTION(nix, SetModname, CBC_ORDER_LAST)
 {
        M_ARGV(0, string) = "NIX";
-       return false;
 }
 #endif