]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Attempt to remove more g_minstagib checks from the code
authorMario <mario.mario@y7mail.com>
Fri, 19 Apr 2013 05:16:04 +0000 (15:16 +1000)
committerMario <mario.mario@y7mail.com>
Fri, 19 Apr 2013 05:16:04 +0000 (15:16 +1000)
qcsrc/server/autocvars.qh
qcsrc/server/defs.qh
qcsrc/server/miscfunctions.qc
qcsrc/server/mutators/mutator_minstagib.qc
qcsrc/server/mutators/mutator_vampire.qc

index 1febc23d26801842d3f916d02357612009789d63..ed1c560ee0615a66d93a48808c6d93db7ecddbd5 100644 (file)
@@ -891,6 +891,7 @@ float autocvar_g_midair_shieldtime;
 float autocvar_g_minstagib_ammo_drop;
 float autocvar_g_minstagib_extralives;
 float autocvar_g_minstagib_speed_highspeed;
+float autocvar_g_minstagib_invis_alpha;
 #define autocvar_g_mirrordamage cvar("g_mirrordamage")
 #define autocvar_g_mirrordamage_virtual cvar("g_mirrordamage_virtual")
 
index 668433ce0058ad55f603b9062a23bf4e3e478d5a..b56648de3ca4a02b785dd832edb7253eb67babb5 100644 (file)
@@ -16,7 +16,7 @@ noref float require_spawnfunc_prefix; // if this float exists, only functions wi
 
 // Globals
 
-float g_cloaked, g_footsteps, g_jump_grunt, g_grappling_hook, g_midair, g_minstagib, g_pinata, g_norecoil, g_minstagib_invis_alpha, g_bloodloss;
+float g_cloaked, g_footsteps, g_jump_grunt, g_grappling_hook, g_midair, g_minstagib, g_pinata, g_norecoil, g_bloodloss;
 float g_warmup_limit;
 float g_warmup_allguns;
 float g_warmup_allow_timeout;
index 4a5282e45f29718f9c95265e715d3b8c31813c81..bea0bf7e02c00a3af2aad3ee78ec4f6adb0f4cae 100644 (file)
@@ -824,7 +824,6 @@ void readplayerstartcvars()
 
        if (g_weaponarena)
        {
-               g_minstagib = 0; // incompatible
                g_pinata = 0; // incompatible
                g_weapon_stay = 0; // incompatible
                WEPSET_COPY_AA(start_weapons, g_weaponarena_weapons);
@@ -986,8 +985,6 @@ float sv_taunt;
 string GetGametype(); // g_world.qc
 void readlevelcvars(void)
 {
-       g_minstagib = cvar("g_minstagib");
-
        // load ALL the mutators
        if(cvar("g_dodging"))
                MUTATOR_ADD(mutator_dodging);
@@ -996,23 +993,20 @@ void readlevelcvars(void)
        if(cvar("g_physical_items"))
                MUTATOR_ADD(mutator_physical_items);
        if(cvar("g_minstagib"))
-               MUTATOR_ADD(mutator_minstagib); 
-
-       if(!g_minstagib)
-       {
-               if(cvar("g_invincible_projectiles"))
-                       MUTATOR_ADD(mutator_invincibleprojectiles);
-               if(cvar("g_new_toys"))
-                       MUTATOR_ADD(mutator_new_toys);
-               if(cvar("g_nix"))
-                       MUTATOR_ADD(mutator_nix);
-               if(cvar("g_rocket_flying"))
-                       MUTATOR_ADD(mutator_rocketflying);
-               if(cvar("g_vampire"))
-                       MUTATOR_ADD(mutator_vampire);           
-               if(cvar("g_superspectate"))
-                       MUTATOR_ADD(mutator_superspec);
-       }
+               MUTATOR_ADD(mutator_minstagib);
+       if(cvar("g_invincible_projectiles"))
+               MUTATOR_ADD(mutator_invincibleprojectiles);
+       if(cvar("g_new_toys"))
+               MUTATOR_ADD(mutator_new_toys);
+       if(!cvar("g_minstagib")) // TODO: nix support?
+       if(cvar("g_nix"))
+               MUTATOR_ADD(mutator_nix);
+       if(cvar("g_rocket_flying"))
+               MUTATOR_ADD(mutator_rocketflying);
+       if(cvar("g_vampire"))
+               MUTATOR_ADD(mutator_vampire);           
+       if(cvar("g_superspectate"))
+               MUTATOR_ADD(mutator_superspec);
 
        // is this a mutator? is this a mode?
        if(cvar("g_sandbox"))
@@ -1036,6 +1030,8 @@ void readlevelcvars(void)
     g_bugrigs_speed_ref = cvar("g_bugrigs_speed_ref");
     g_bugrigs_speed_pow = cvar("g_bugrigs_speed_pow");
     g_bugrigs_steer = cvar("g_bugrigs_steer");
+       
+       g_minstagib = cvar("g_minstagib");
 
     g_touchexplode = cvar("g_touchexplode");
     g_touchexplode_radius = cvar("g_touchexplode_radius");
@@ -1065,7 +1061,7 @@ void readlevelcvars(void)
        g_warmup_allguns = cvar("g_warmup_allguns");
        g_warmup_allow_timeout = cvar("g_warmup_allow_timeout");
 
-       if ((g_race && g_race_qualifying == 2) || g_arena || g_assault || cvar("g_campaign"))
+       if ((g_race && g_race_qualifying == 2) || g_arena || g_minstagib || g_assault || cvar("g_campaign"))
                inWarmupStage = 0; // these modes cannot work together, sorry
 
        g_pickup_respawntime_weapon = cvar("g_pickup_respawntime_weapon");
index f8c833144c831657bee30197925fecf86efdbc96..e1e4ebf5c6f178a81576b7916eac6439ce11816f 100644 (file)
@@ -146,8 +146,8 @@ MUTATOR_HOOKFUNCTION(minstagib_PlayerPowerups)
        {
                if (time < self.strength_finished)
                {
-                       self.alpha = g_minstagib_invis_alpha;
-                       self.exteriorweaponentity.alpha = g_minstagib_invis_alpha;
+                       self.alpha = autocvar_g_minstagib_invis_alpha;
+                       self.exteriorweaponentity.alpha = autocvar_g_minstagib_invis_alpha;
                        self.items |= IT_STRENGTH;
                        Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_INVISIBILITY, self.netname);
                        Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_INVISIBILITY);
@@ -259,17 +259,10 @@ MUTATOR_HOOKFUNCTION(minstagib_SetStartItems)
 {
        start_ammo_cells = cvar("g_minstagib_ammo_start");
        
-       g_pinata = 0; // incompatible
-       g_weapon_stay = 0; // incompatible
-       g_bloodloss = 0; // incompatible
        start_health = 100;
        start_armorvalue = 0;
        WEPSET_COPY_AW(start_weapons, WEP_MINSTANEX);
-       g_minstagib_invis_alpha = cvar("g_minstagib_invis_alpha");
        start_items |= IT_UNLIMITED_SUPERWEAPONS;
-
-       if (g_minstagib_invis_alpha <= 0)
-               g_minstagib_invis_alpha = -1;
                
        return FALSE;
 }
index 40a925b3ce835fbc24c9b64f424d9022690dd0bc..baeadac1cd5a4eb1fe70da513e98425f1d2d137e 100644 (file)
@@ -2,6 +2,8 @@ MUTATOR_HOOKFUNCTION(vampire_PlayerDamage)
 {
        if(time < self.spawnshieldtime)
                return 0;
+       if(frag_attacker == frag_target)
+               return 0;
        if(g_minstagib)
        {
                // minstagib: each hit means +1 ammo