#include "ammo.qh"
+#include "../../../server/t_items.qh"
-#define REGISTER_AMMO(id) REGISTER_ITEM(id, Ammo, LAMBDA(this.ammoName = #id))
-REGISTER_AMMO(nails)
-REGISTER_AMMO(rockets)
-REGISTER_AMMO(cells)
-REGISTER_AMMO(plasma)
-REGISTER_AMMO(fuel)
+#define REGISTER_AMMO(id, model, sound, name, itemid, basevalue) \
+REGISTER_ITEM(id, Ammo, LAMBDA({ \
+ this.ammoModel = model; \
+ this.ammoSound = sound; \
+ this.ammoName = name; \
+ this.ammoId = itemid; \
+ this.ammoQuantity = basevalue; \
+}))
+
+REGISTER_AMMO(Bullets,
+ "models/items/a_bullets.mdl",
+ "misc/itempickup.wav",
+ "bullets",
+ IT_NAILS,
+ 2000
+)
+REGISTER_AMMO(Cells,
+ "models/items/a_cells.md3",
+ "misc/itempickup.wav",
+ "cells",
+ IT_ROCKETS,
+ 2000
+)
+REGISTER_AMMO(Plasma,
+ "models/items/a_cells.md3",
+ "misc/itempickup.wav",
+ "plasma",
+ IT_ROCKETS,
+ 2000
+)
+REGISTER_AMMO(Rockets,
+ "models/items/a_rockets.md3",
+ "misc/itempickup.wav",
+ "rockets",
+ IT_ROCKETS,
+ 3000
+)
+REGISTER_AMMO(Shells,
+ "models/items/a_shells.md3",
+ "misc/itempickup.wav",
+ "shells",
+ IT_SHELLS,
+ 500
+)
bool Ammo_respondTo(entity this, int request)
{
#include "../item.qh"
CLASS(Ammo, GameItem)
METHOD(Ammo, respondTo, bool(entity, int))
+ ATTRIB(Ammo, ammoModel, string, string_null)
+ ATTRIB(Ammo, ammoSound, string, string_null)
ATTRIB(Ammo, ammoName, string, string_null)
+ ATTRIB(Ammo, ammoId, int, 0)
+ ATTRIB(Ammo, ammoQuantity, int, 0)
ENDCLASS(Ammo)
#endif
#include "t_items.qh"
+#include "../common/items/all.qc"
+
#if defined(SVQC)
#include "_all.qh"
return;
}
}
+
+void StartItemA (entity a)
+{
+ StartItem(a.ammoModel, a.ammoSound, g_pickup_respawntime_ammo, g_pickup_respawntimejitter_ammo, a.ammoName, a.ammoId, 0, 0, commodity_pickupevalfunc, a.ammoQuantity);
+}
+
void spawnfunc_item_rockets (void) {
if(!self.ammo_rockets)
self.ammo_rockets = g_pickup_rockets;
if(!self.pickup_anyway)
self.pickup_anyway = g_pickup_ammo_anyway;
- StartItem ("models/items/a_rockets.md3", "misc/itempickup.wav", g_pickup_respawntime_ammo, g_pickup_respawntimejitter_ammo, "rockets", IT_ROCKETS, 0, 0, commodity_pickupevalfunc, 3000);
+ StartItemA (ITEM_Rockets);
}
void spawnfunc_item_bullets (void) {
self.ammo_nails = g_pickup_nails;
if(!self.pickup_anyway)
self.pickup_anyway = g_pickup_ammo_anyway;
- StartItem ("models/items/a_bullets.mdl", "misc/itempickup.wav", g_pickup_respawntime_ammo, g_pickup_respawntimejitter_ammo, "bullets", IT_NAILS, 0, 0, commodity_pickupevalfunc, 2000);
+ StartItemA (ITEM_Bullets);
}
void spawnfunc_item_cells (void) {
self.ammo_cells = g_pickup_cells;
if(!self.pickup_anyway)
self.pickup_anyway = g_pickup_ammo_anyway;
- StartItem ("models/items/a_cells.md3", "misc/itempickup.wav", g_pickup_respawntime_ammo, g_pickup_respawntimejitter_ammo, "cells", IT_CELLS, 0, 0, commodity_pickupevalfunc, 2000);
+ StartItemA (ITEM_Cells);
}
void spawnfunc_item_plasma()
self.ammo_plasma = g_pickup_plasma;
if(!self.pickup_anyway)
self.pickup_anyway = g_pickup_ammo_anyway;
- StartItem ("models/items/a_cells.md3", "misc/itempickup.wav", g_pickup_respawntime_ammo, g_pickup_respawntimejitter_ammo, "plasma", IT_PLASMA, 0, 0, commodity_pickupevalfunc, 2000);
+ StartItemA (ITEM_Plasma);
}
void spawnfunc_item_shells (void) {
self.ammo_shells = g_pickup_shells;
if(!self.pickup_anyway)
self.pickup_anyway = g_pickup_ammo_anyway;
- StartItem ("models/items/a_shells.md3", "misc/itempickup.wav", g_pickup_respawntime_ammo, g_pickup_respawntimejitter_ammo, "shells", IT_SHELLS, 0, 0, commodity_pickupevalfunc, 500);
+ StartItemA (ITEM_Shells);
}
void spawnfunc_item_armor_small (void) {