Lower range of magnet item pickups, and greatly reduce range of picking up other...
authorMario <mario@smbclan.net>
Fri, 15 Jan 2016 15:05:08 +0000 (01:05 +1000)
committerMario <mario@smbclan.net>
Fri, 15 Jan 2016 15:05:08 +0000 (01:05 +1000)
mutators.cfg
qcsrc/common/mutators/mutator/buffs/buffs.qc

index 931e4df..4675b00 100644 (file)
@@ -351,9 +351,10 @@ set g_buffs_inferno_burntime_target_time 5 "seconds of burn given g_buffs_infern
 set g_buffs_swapper 0 "swapper buff: press dropweapon to switch places with a nearby enemy"
 set g_buffs_swapper_time 60 "swapper buff carry time"
 set g_buffs_swapper_range 1500 "maximum range of swapping with enemy"
-set g_buffs_magnet 0 "magnet buff: greatly increased item pickup range"
+set g_buffs_magnet 1 "magnet buff: greatly increased item pickup range"
 set g_buffs_magnet_time 60 "magnet buff carry time"
-set g_buffs_magnet_range_item 450 "item pickup range"
+set g_buffs_magnet_range_item 350 "range around player that items are automatically picked up (excludes other buffs)"
+set g_buffs_magnet_range_buff 200 "range around player that only buffs are picked up (drops magnet buff)"
 
 
 // ==============
index ae78665..0b3f4ee 100644 (file)
@@ -45,6 +45,7 @@ float autocvar_g_buffs_inferno_burntime_target_time;
 float autocvar_g_buffs_inferno_damagemultiplier;
 float autocvar_g_buffs_swapper_range;
 float autocvar_g_buffs_magnet_range_item;
+float autocvar_g_buffs_magnet_range_buff = 200;
 
 // ammo
 .float buff_ammo_prev_infitems;
@@ -887,17 +888,24 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink)
 
        if(self.buffs & BUFF_MAGNET.m_itemid)
        {
-               vector pickup_size = '1 1 1' * autocvar_g_buffs_magnet_range_item;
-               for(other = world; (other = findflags(other, flags, FL_ITEM)); )
-               if(boxesoverlap(self.absmin - pickup_size, self.absmax + pickup_size, other.absmin, other.absmax))
+               vector pickup_size;
+               FOREACH_ENTITY_FLAGS(flags, FL_ITEM,
                {
-                       setself(other);
-                       other = this;
-                       if(self.touch)
-                               self.touch();
-                       other = self;
-                       setself(this);
-               }
+                       if(it.buffs)
+                               pickup_size = '1 1 1' * autocvar_g_buffs_magnet_range_buff;
+                       else
+                               pickup_size = '1 1 1' * autocvar_g_buffs_magnet_range_item;
+
+                       if(boxesoverlap(self.absmin - pickup_size, self.absmax + pickup_size, it.absmin, it.absmax))
+                       {
+                               setself(other);
+                               other = this;
+                               if(self.touch)
+                                       self.touch();
+                               other = self;
+                               setself(this);
+                       }
+               });
        }
 
        if(self.buffs & BUFF_AMMO.m_itemid)