]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/all.qc
Merge branch 'master' into bones_was_here/q3compat
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / all.qc
index 7c089ba70c096514f3af93df29aecd695b88ecde..606090db315cedf59e314fd29f411ddb1ea8b087 100644 (file)
@@ -234,6 +234,39 @@ string GetAmmoName(int ammotype)
        }
 }
 
+entity GetAmmoItem(int ammotype)
+{
+       switch (ammotype)
+       {
+               case RES_SHELLS:  return ITEM_Shells;
+               case RES_BULLETS: return ITEM_Bullets;
+               case RES_ROCKETS: return ITEM_Rockets;
+               case RES_CELLS:   return ITEM_Cells;
+               case RES_PLASMA:  return ITEM_Plasma;
+               case RES_FUEL:    return ITEM_JetpackFuel;
+       }
+       LOG_WARNF("Invalid ammo type %d ", ammotype);
+       return NULL;
+       // WEAPONTODO: use this generic func to reduce duplication ?
+       // GetAmmoPicture  GetAmmoName  notif_arg_item_wepammo  ammo_pickupevalfunc ?
+}
+
+#ifdef SVQC
+int GetAmmoConsumptionPrimary(string netname)
+// Returns ammo consumed per shot by the primary/default fire mode
+{
+       switch (netname)
+       {
+               case "arc":        return cvar("g_balance_arc_beam_ammo");
+               case "devastator": return cvar("g_balance_devastator_ammo");
+               case "machinegun": return cvar("g_balance_machinegun_sustained_ammo");
+               case "minelayer":  return cvar("g_balance_minelayer_ammo");
+               case "seeker":     return cvar("g_balance_seeker_tag_ammo");
+               default:           return cvar(strcat("g_balance_", netname, "_primary_ammo"));
+       }
+}
+#endif
+
 #ifdef CSQC
 int GetAmmoTypeFromNum(int i)
 {