);
}
+#define IS_SMALL(def) ((def.instanceOfHealth && def == ITEM_HealthSmall) || (def.instanceOfArmor && def == ITEM_ArmorSmall))
+int group_count = 1;
+
+void setItemGroup(entity this)
+{
+ if(!IS_SMALL(this.itemdef))
+ return;
+
+ FOREACH_ENTITY_RADIUS(this.origin, 120, (it != this) && IS_SMALL(it.itemdef),
+ {
+ if(!this.item_group)
+ {
+ if(!it.item_group)
+ {
+ it.item_group = group_count;
+ group_count++;
+ }
+ this.item_group = it.item_group;
+ }
+ else // spawning item is already part of a item_group X
+ {
+ if(!it.item_group)
+ it.item_group = this.item_group;
+ else if(it.item_group != this.item_group) // found an item near the spawning item that is part of a different item_group Y
+ {
+ int grY = it.item_group;
+ // move all items of item_group Y to item_group X
+ FOREACH_ENTITY(IS_SMALL(it.itemdef),
+ {
+ if(it.item_group == grY)
+ it.item_group = this.item_group;
+ });
+ }
+ }
+ });
+}
+
+void setItemGroupCount()
+{
+ for (int k = 1; k <= group_count; k++)
+ {
+ int count = 0;
+ FOREACH_ENTITY(IS_SMALL(it.itemdef) && it.item_group == k, { count++; });
+ if (count)
+ FOREACH_ENTITY(IS_SMALL(it.itemdef) && it.item_group == k, { it.item_group_count = count; });
+ }
+}
+
spawnfunc(item_rockets)
{
- if(!this.ammo_rockets)
- this.ammo_rockets = g_pickup_rockets;
StartItem(this, ITEM_Rockets);
}