have the weapon entities know the ammo field of the weapon
authorRudolf Polzer <divVerent@xonotic.org>
Fri, 11 Feb 2011 14:54:23 +0000 (15:54 +0100)
committerRudolf Polzer <divVerent@xonotic.org>
Fri, 11 Feb 2011 14:54:23 +0000 (15:54 +0100)
qcsrc/common/items.qc
qcsrc/common/items.qh

index 5387c05..3ddf809 100644 (file)
@@ -19,6 +19,18 @@ void register_weapon(float id, float(float) func, float ammotype, float i, float
        e.model2 = strzone(strcat("wpn-", e.mdl));
        e.impulse = i;
        e.bot_pickupbasevalue = pickupbasevalue;
+       if(ammotype & IT_SHELLS)
+               e.ammo_field = ammo_shells;
+       else if(ammotype & IT_NAILS)
+               e.ammo_field = ammo_nails;
+       else if(ammotype & IT_ROCKETS)
+               e.ammo_field = ammo_rockets;
+       else if(ammotype & IT_CELLS)
+               e.ammo_field = ammo_cells;
+       else if(ammotype & IT_FUEL)
+               e.ammo_field = ammo_fuel;
+       else
+               e.ammo_field = ammo_batteries;
 }
 float w_null(float dummy)
 {
index 64d7abd..ebee8aa 100644 (file)
@@ -60,6 +60,14 @@ string W_FixWeaponOrder(string order, float complete);
 string W_NameWeaponOrder(string order);
 string W_NumberWeaponOrder(string order);
 
+// ammo types
+.float ammo_shells;
+.float ammo_nails;
+.float ammo_rockets;
+.float ammo_cells;
+.float ammo_fuel;
+.float ammo_batteries; // dummy
+
 // entity properties of weaponinfo:
 .float weapon; // WEP_...
 .float weapons; // WEPBIT_...
@@ -73,8 +81,7 @@ string W_NumberWeaponOrder(string order);
 .float impulse; // weapon impulse
 .float bot_pickupbasevalue; // bot weapon priority
 .string model2; // wpn- sprite name
-
-
+..float ammo_field; // main ammo field
 
 // dynamic weapon adding
 float w_null(float dummy);