]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/mutators/mutator_nix.qc
Remove more stupidity
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / mutator_nix.qc
index dad19e4a3748f468c93db674b6b2e9c7e7e43a2c..166063df5699b5a05ea888a0faea34526e455ee0 100644 (file)
@@ -1,5 +1,5 @@
 float g_nix_with_laser;
-
+// WEAPONTODO
 float nix_weapon;
 float nix_weapon_ammo;
 float nix_nextchange;
@@ -60,7 +60,7 @@ void NIX_GiveCurrentWeapon()
                        nix_nextchange = time; // start the first round now!
                else
                        nix_nextchange = time + autocvar_g_balance_nix_roundtime;
-               //weapon_action(nix_weapon, WR_PRECACHE); // forget it, too slow
+               //WEP_ACTION(nix_weapon, WR_INIT); // forget it, too slow
        }
 
        if(nix_nextchange != self.nix_lastchange_id) // this shall only be called once per round!
@@ -96,29 +96,29 @@ void NIX_GiveCurrentWeapon()
                if(dt >= 1 && dt <= 5)
                        self.nix_lastinfotime = -42;
                else
-                       Send_CSQC_Centerprint_Generic(self, CPID_NIX_WPNCHANGE, strcat("^2Active weapon: ^3", W_Name(nix_weapon)), 0, 0);
+                       Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_NIX_NEWWEAPON, nix_weapon);
 
-               weapon_action(nix_weapon, WR_RESETPLAYER);
+               WEP_ACTION(nix_weapon, WR_RESETPLAYER);
 
                // all weapons must be fully loaded when we spawn
                entity e;
                e = get_weaponinfo(nix_weapon);
                if(e.spawnflags & WEP_FLAG_RELOADABLE) // prevent accessing undefined cvars
-                       self.(weapon_load[nix_weapon]) = cvar(strcat("g_balance_", e.netname, "_reload_ammo"));
+                       self.(weapon_load[nix_weapon]) = e.reloading_ammo;
 
                // nex too
-               if(autocvar_g_balance_nex_charge)
+               if(WEP_CVAR(nex, charge))
                {
-                       if(autocvar_g_balance_nex_secondary_chargepool)
+                       if(WEP_CVAR_SEC(nex, chargepool))
                                self.nex_chargepool_ammo = 1;
-                       self.nex_charge = autocvar_g_balance_nex_charge_start;
+                       self.nex_charge = WEP_CVAR(nex, charge_start);
                }
        }
        if(self.nix_lastinfotime != dt)
        {
                self.nix_lastinfotime = dt; // initial value 0 should count as "not seen"
                if(dt >= 1 && dt <= 5)
-                       Send_CSQC_Centerprint_Generic(self, CPID_NIX_WPNCHANGE, strcat("^3%d^2 seconds until weapon change...\n\nNext weapon: ^3", W_Name(nix_nextweapon)), 1, dt);
+                       Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_NIX_COUNTDOWN, nix_nextweapon, dt);
        }
 
        if(!(self.items & IT_UNLIMITED_WEAPON_AMMO) && time > self.nix_nextincr)
@@ -152,7 +152,7 @@ void NIX_precache()
        float i;
        for (i = WEP_FIRST; i <= WEP_LAST; ++i)
                if (NIX_CanChooseWeapon(i))
-                       weapon_action(i, WR_PRECACHE);
+                       WEP_ACTION(i, WR_INIT);
 }
 
 MUTATOR_HOOKFUNCTION(nix_ForbidThrowCurrentWeapon)
@@ -205,7 +205,7 @@ MUTATOR_HOOKFUNCTION(nix_PlayerPreThink)
 {
        if(!intermission_running)
        if(self.deadflag == DEAD_NO)
-       if(self.classname == "player")
+       if(IS_PLAYER(self))
                NIX_GiveCurrentWeapon();
        return 0;
 }
@@ -247,6 +247,11 @@ MUTATOR_DEFINITION(mutator_nix)
                NIX_precache();
        }
 
+       MUTATOR_ONROLLBACK_OR_REMOVE
+       {
+               // nothing to roll back
+       }
+
        MUTATOR_ONREMOVE
        {
                // as the PlayerSpawn hook will no longer run, NIX is turned off by this!