]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/compat/quake3.qc
Rename GetAmmoConsumptionPrimary to GetAmmoConsumptionQ3 and move to quake3.qc
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / compat / quake3.qc
index 85219b1c8de98e67065cd9e42b63978d314cc30f..4c50ea51f66822002ca47d48f9509b2f20df34c3 100644 (file)
@@ -3,10 +3,10 @@
 #include <server/client.qh>
 #include <common/weapons/_all.qh>
 #include <common/stats.qh>
-#include <server/miscfunctions.qh>
 #include <server/items/items.qh>
 #include <server/items/spawning.qh>
 #include <server/resources.qh>
+#include <server/world.qh>
 #include <common/gamemodes/_mod.qh>
 #include <common/gamemodes/gamemode/ctf/sv_ctf.qh>
 #include <common/mapobjects/triggers.qh>
@@ -78,6 +78,7 @@ SPAWNFUNC_Q3(weapon_railgun, ammo_slugs, WEP_VORTEX)
 
 // BFG -> Crylink || Fireball
 SPAWNFUNC_Q3_COND(weapon_bfg, ammo_bfg, cvar_string("g_mod_balance") == "XDF", WEP_CRYLINK, WEP_FIREBALL)
+       // FIXME: WEP_FIREBALL has no ammo_type field so ammo_bfg is deleted by SPAWNFUNC_BODY
 
 // grappling hook -> hook
 SPAWNFUNC_WEAPON(weapon_grapplinghook, WEP_HOOK)
@@ -332,3 +333,19 @@ bool DoesQ3ARemoveThisEntity(entity this)
 
        return false;
 }
+
+int GetAmmoConsumptionQ3(string netname)
+// Returns ammo consumed per shot by the primary/default fire mode
+// Returns 0 if the netname has no ammo cvar
+{
+       switch (netname)
+       {
+               case "arc":        return autocvar_g_balance_arc_beam_ammo;
+               case "devastator": return autocvar_g_balance_devastator_ammo;
+               case "machinegun": return autocvar_g_balance_machinegun_sustained_ammo;
+               case "minelayer":  return autocvar_g_balance_minelayer_ammo;
+               case "seeker":     return autocvar_g_balance_seeker_tag_ammo;
+               default:           return cvar(strcat("g_balance_", netname, "_primary_ammo"));
+       }
+}
+