]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into terencehill/bot_AI_improvements 409/head
authorterencehill <piuntn@gmail.com>
Fri, 17 Feb 2017 18:37:59 +0000 (19:37 +0100)
committerterencehill <piuntn@gmail.com>
Fri, 17 Feb 2017 18:37:59 +0000 (19:37 +0100)
1  2 
qcsrc/common/items/item/armor.qh
qcsrc/common/items/item/health.qh
qcsrc/common/t_items.qc

Simple merge
Simple merge
index f295c1da3eaa092bf1cf4dba4d756b4338369b48,3e3f32a9d35013d9709fd9940785a17d0575d78a..b6f405fec019b5cb8ef6249b3c07a77f02c7fc32
@@@ -1302,58 -1286,8 +1305,56 @@@ void StartItem(entity this, GameItem de
        );
  }
  
 +#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);
  }