]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
apply same logic to g_pickup_items: -1 is default, 0 = off, 1 = on
authorRudolf Polzer <divverent@alientrap.org>
Thu, 15 Dec 2011 14:57:22 +0000 (15:57 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Thu, 15 Dec 2011 14:57:22 +0000 (15:57 +0100)
defaultXonotic.cfg
qcsrc/server/autocvars.qh
qcsrc/server/g_world.qc
qcsrc/server/t_items.qc

index 7f0844af8dac15ad1b3685f8520437dfdf776e48..0231923cef60c42db7a6b6d1515210c3089c0e47 100644 (file)
@@ -502,7 +502,7 @@ set g_weapon_stay 0 "if set to 1 or 2, weapons stay after they were picked up (1
 set g_weapon_throwable 1 "if set to 1, weapons can be dropped"
 set g_powerups -1 "if set to 0 the strength and shield (invincibility) will not spawn on the map, if 1 they will spawn in all game modes, -1 is game mode default"
 set g_use_ammunition 1 "if set to 0 all weapons have unlimited ammunition"
-set g_pickup_items 1 "if set to 0 all items (health, armor, ammo, weapons...) are removed from the map"
+set g_pickup_items -1 "if set to 0 all items (health, armor, ammo, weapons...) are removed from the map, if 1 they are forced to spawn"
 set g_minstagib 0      "enable minstagib"
 set g_minstagib_extralives 2   "how many extra lives you will get per powerup"
 set g_minstagib_ammo_start 10  "starting ammo"
index ae832d81703b85c1efe8134bf69fcaf512a14a20..255f78aaf602f5dcb26b45d5e6c7a5e64e64d793 100644 (file)
@@ -73,7 +73,6 @@ float autocvar_g_antilag_nudge;
 float autocvar_g_arena_maxspawned;
 float autocvar_g_arena_point_leadlimit;
 float autocvar_g_arena_point_limit;
-float autocvar_g_arena_powerups;
 float autocvar_g_arena_roundbased;
 float autocvar_g_arena_warmup;
 float autocvar_g_assault;
index 3b6ada7024239dc99689c18704b1d81a2dd8333e..5d2a63324eff26bdc0f4ccdd23ec8bf9100b73e8 100644 (file)
@@ -747,8 +747,10 @@ void spawnfunc_worldspawn (void)
                        s = strcat(s, ":no_use_ammunition");
 
                // initialiation stuff, not good in the mutator system
-               if(!autocvar_g_pickup_items)
+               if(autocvar_g_pickup_items == 0)
                        s = strcat(s, ":no_pickup_items");
+               if(autocvar_g_pickup_items > 0)
+                       s = strcat(s, ":pickup_items");
 
                // initialiation stuff, not good in the mutator system
                if(autocvar_g_weaponarena != "0")
index 6cf81edca81e47f034dbc9bec4ea49a89d208fc2..7d2273fe55ac2cf57a2d4fe0915c069cc5ea80e0 100644 (file)
@@ -1,3 +1,36 @@
+float have_pickup_item(void)
+{
+       // minstagib: only allow filtered items
+       if(g_minstagib)
+               if(self.classname != "minstagib")
+                       return FALSE;
+
+       if(self.items == IT_STRENGTH || self.items == IT_INVINCIBLE)
+       {
+               if(autocvar_g_powerups > 0)
+                       return TRUE;
+               if(autocvar_g_powerups == 0)
+                       return FALSE;
+               if(g_arena)
+                       return FALSE;
+       }
+       else
+       {
+               if(autocvar_g_pickup_items > 0)
+                       return TRUE;
+               if(autocvar_g_pickup_items == 0)
+                       return FALSE;
+               if(g_lms)
+                       return FALSE;
+               if(g_ca)
+                       return FALSE;
+               if(g_weaponarena)
+                       if((self.weapons & WEPBIT_ALL) || (self.items & IT_AMMO))
+                               return FALSE;
+       }
+       return TRUE;
+}
+
 #define ITEM_RESPAWN_TICKS 10
 
 #define ITEM_RESPAWNTIME(i)         ((i).respawntime + crandom() * (i).respawntimejitter)
@@ -707,6 +740,13 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime,
                        return;
                }
 
+               if(!have_pickup_item())
+               {
+                       startitem_failed = TRUE;
+                       remove (self);
+                       return;
+               }
+
                self.reset = Item_Reset;
                // it's a level item
                if(self.spawnflags & 1)
@@ -744,35 +784,6 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime,
                }
                */
 
-               if(g_lms || g_ca)
-               {
-                       startitem_failed = TRUE;
-                       remove(self);
-                       return;
-               }
-               else if (g_weaponarena && ((weaponid & WEPBIT_ALL) || (itemid & IT_AMMO)))
-               {
-                       startitem_failed = TRUE;
-                       remove(self);
-                       return;
-               }
-               else if (g_minstagib)
-               {
-                       // don't remove dropped items and powerups
-                       if (self.classname != "minstagib")
-                       {
-                               startitem_failed = TRUE;
-                               remove (self);
-                               return;
-                       }
-               }
-               else if (!autocvar_g_pickup_items && itemid != IT_STRENGTH && itemid != IT_INVINCIBLE)
-               {
-                       startitem_failed = TRUE;
-                       remove (self);
-                       return;
-               }
-
                if(autocvar_spawn_debug >= 2)
                {
                        entity otheritem;
@@ -1240,22 +1251,7 @@ void spawnfunc_item_health1() { spawnfunc_item_health_small(); }
 void spawnfunc_item_health25() { spawnfunc_item_health_medium(); }
 void spawnfunc_item_health100() { spawnfunc_item_health_mega(); }
 
-float have_powerups(void)
-{
-       if(autocvar_g_powerups > 0)
-               return TRUE;
-       else if(autocvar_g_powerups == 0)
-               return FALSE;
-       else if(g_arena)
-               return FALSE;
-       else
-               return TRUE;
-}
-
 void spawnfunc_item_strength (void) {
-       if(!have_powerups())
-               return;
-
        if(g_minstagib) {
                minstagib_items(IT_STRENGTH);
        } else {
@@ -1266,9 +1262,6 @@ void spawnfunc_item_strength (void) {
 }
 
 void spawnfunc_item_invincible (void) {
-       if(!have_powerups())
-               return;
-
        if(g_minstagib) {
                minstagib_items(IT_INVINCIBLE);
        } else {