1 hitting barrels?

Trying to setup auto pickup for barrels but it keeps 1 hitting barrels when enabled even with a rock.

Almost like it's picking up the barrel itself. What's going on?


{
  "Settings": {
    "Clear Data On Map Wipe": false,
    "Use Teams": false,
    "Use Clans": true,
    "Use Friends": true,
    "Auto pickup is enabled by default": true,
    "Prevent pickup other player's backpack": true,
    "Prevent pickup other player's corpse": true,
    "Prevent pickup other player's plant entity": true,
    "Prevent pickup other player's loot container": true,
    "Prevent pickup of plant entities in the planter box": true
  },
  "Chat Settings": {
    "Chat Command": "ap",
    "Chat Prefix": "<color=#00FFFF>[AutoPickup]</color>: ",
    "Chat SteamID Icon": 0
  },
  "Auto Pickup Settings": {
    "PlantEntity": {
      "Enabled": false,
      "Check Radius": 0.5
    },
    "CollectibleEntity": {
      "Enabled": false,
      "Check Radius": 1.5
    },
    "MurdererCorpse": {
      "Enabled": false,
      "Check Radius": 0.5
    },
    "ScientistCorpse": {
      "Enabled": false,
      "Check Radius": 0.5
    },
    "PlayerCorpse": {
      "Enabled": false,
      "Check Radius": 0.5
    },
    "ItemDropBackpack": {
      "Enabled": false,
      "Check Radius": 0.5
    },
    "ItemDrop": {
      "Enabled": false,
      "Check Radius": 1.5
    },
    "WorldItem": {
      "Enabled": false,
      "Check Radius": 1.5
    },
    "LootContainer": {
      "Enabled": true,
      "Check Radius": 1.5
    },
    "CollectableGifts": {
      "Enabled": false,
      "Check Radius": 0.5
    }
  },
  "World Item Pickup Settings": {
    "Auto Pickup Delay": 0.3,
    "Check that player's inventory is full": true,
    "Only pickup items that exist in player's inventory": false,
    "Item Block List (Item shortname)": [],
    "Allow Pickup Item Category": {
      "Attire": true,
      "Misc": true,
      "Items": true,
      "Ammunition": true,
      "Construction": true,
      "Component": true,
      "Traps": true,
      "Electrical": true,
      "Fun": true,
      "Food": true,
      "Resources": true,
      "Tool": true,
      "Weapon": true,
      "Medical": true
    }
  },
  "Collectable Gifts Pickup Settings": {
    "Requires player to hold a basket": false
  },
  "Loot Container Pickup Settings": {
    "loot-barrel-1": true,
    "loot-barrel-2": true,
    "trash-pile-1": false,
    "crate_basic": false,
    "crate_elite": false,
    "crate_mine": false,
    "crate_normal": false,
    "crate_normal_2": false,
    "crate_normal_2_food": false,
    "crate_normal_2_medical": false,
    "crate_tools": false,
    "crate_underwater_advanced": false,
    "crate_underwater_basic": false,
    "dm ammo": false,
    "dm c4": false,
    "dm construction resources": false,
    "dm construction tools": false,
    "dm food": false,
    "dm medical": false,
    "dm res": false,
    "dm tier1 lootbox": false,
    "dm tier2 lootbox": false,
    "dm tier3 lootbox": false,
    "foodbox": false,
    "loot_barrel_1": true,
    "loot_barrel_2": true,
    "loot_component_test": false,
    "loot_trash": false,
    "minecart": false,
    "oil_barrel": true,
    "crate_ammunition": false,
    "crate_food_1": false,
    "crate_food_2": false,
    "crate_fuel": false,
    "crate_medical": false,
    "tech_parts_1": false,
    "tech_parts_2": false,
    "vehicle_parts": false,
    "roadsign1": false,
    "roadsign2": false,
    "roadsign3": false,
    "roadsign4": false,
    "roadsign5": false,
    "roadsign6": false,
    "roadsign7": false,
    "roadsign8": false,
    "roadsign9": false,
    "codelockedhackablecrate": false,
    "codelockedhackablecrate_oilrig": false,
    "supply_drop": false,
    "giftbox_loot": false,
    "presentdrop": false,
    "stocking_large_deployed": false,
    "stocking_small_deployed": false,
    "bradley_crate": false,
    "heli_crate": false,
    "diesel_barrel_world": false,
    "visualshelvestest": false
  },
  "Collectible Entity Pickup Settings": {
    "berry-black-collectable": false,
    "berry-blue-collectable": false,
    "berry-green-collectable": false,
    "berry-red-collectable": false,
    "berry-white-collectable": false,
    "berry-yellow-collectable": false,
    "corn-collectable": false,
    "hemp-collectable": false,
    "mushroom-cluster-5": false,
    "mushroom-cluster-6": false,
    "potato-collectable": false,
    "pumpkin-collectable": false,
    "halloween-bone-collectable": false,
    "halloween-metal-collectable": false,
    "halloween-stone-collectable": false,
    "halloween-sulfur-collectible": false,
    "halloween-wood-collectable": false,
    "metal-collectable": false,
    "stone-collectable": false,
    "sulfur-collectable": false,
    "wood-collectable": false,
    "diesel_collectable": false
  },
  "Plant Entity Pickup Settings": {
    "black_berry.entity": false,
    "blue_berry.entity": false,
    "green_berry.entity": false,
    "red_berry.entity": false,
    "white_berry.entity": false,
    "yellow_berry.entity": false,
    "corn.entity": false,
    "hemp.entity": false,
    "potato.entity": false,
    "pumpkin.entity": false
  },
  "Version": {
    "Major": 1,
    "Minor": 2,
    "Patch": 15
  }
}​

Hitting it with anything will auto pick it up

itj6e5jH9Eh5mRT.jpg Arainrr

Hitting it with anything will auto pick it up

Yeah but it brakes with 1 hit?

Yes, this is the automatic pickup of the barrel

Still have same problem, should only pickup the items dropped from the barrel not the barrel itself. I think thats why its "1 shotting" with any tool/weapon.

You should disable all barrel s and enable WorldItem

ruIwson9GtxeqdU.jpg Arainrr

You should disable all barrel s and enable WorldItem

This is my config. 

{
  "Settings": {
    "Clear Data On Map Wipe": false,
    "Use Teams": true,
    "Use Clans": false,
    "Use Friends": false,
    "Auto pickup is enabled by default": true,
    "Prevent pickup other player's backpack": true,
    "Prevent pickup other player's corpse": true,
    "Prevent pickup other player's plant entity": true,
    "Prevent pickup other player's loot container": false,
    "Prevent pickup of plant entities in the planter box": true
  },
  "Chat Settings": {
    "Chat Command": "ap",
    "Chat Prefix": "<color=#00FFFF>[AutoPickup]</color>: ",
    "Chat SteamID Icon": 0
  },
  "Auto Pickup Settings": {
    "PlantEntity": {
      "Enabled": false,
      "Check Radius": 0.5
    },
    "CollectibleEntity": {
      "Enabled": false,
      "Check Radius": 0.5
    },
    "MurdererCorpse": {
      "Enabled": false,
      "Check Radius": 0.5
    },
    "ScientistCorpse": {
      "Enabled": false,
      "Check Radius": 0.5
    },
    "PlayerCorpse": {
      "Enabled": false,
      "Check Radius": 0.5
    },
    "ItemDropBackpack": {
      "Enabled": false,
      "Check Radius": 0.5
    },
    "ItemDrop": {
      "Enabled": false,
      "Check Radius": 1.5
    },
    "WorldItem": {
      "Enabled": true,
      "Check Radius": 1.7
    },
    "LootContainer": {
      "Enabled": false,
      "Check Radius": 1.7
    },
    "CollectableGifts": {
      "Enabled": false,
      "Check Radius": 0.5
    }
  },
  "World Item Pickup Settings": {
    "Auto Pickup Delay": 0.3,
    "Check that player's inventory is full": true,
    "Only pickup items that exist in player's inventory": false,
    "Item Block List (Item shortname)": [],
    "Allow Pickup Item Category": {
      "Attire": false,
      "Misc": false,
      "Items": false,
      "Component": true,
      "Ammunition": false,
      "Construction": false,
      "Traps": false,
      "Electrical": false,
      "Fun": false,
      "Food": false,
      "Resources": true,
      "Tool": false,
      "Weapon": false,
      "Medical": false
    }
  },
  "Collectable Gifts Pickup Settings": {
    "Requires player to hold a basket": true
  },
  "Loot Container Pickup Settings": {
    "loot-barrel-1": false,
    "loot-barrel-2": false,
    "trash-pile-1": false,
    "hiddenhackablecrate": false,
    "invisible_crate_basic": false,
    "invisible_crate_elite": false,
    "invisible_crate_normal": false,
    "invisible_crate_normal_2": false,
    "invisible_crate_normal_2_food": false,
    "invisible_crate_normal_2_medical": false,
    "invisible_crate_tools": false,
    "invisible_foodbox": false,
    "invisible_vehicle_parts": false,
    "crate_basic": false,
    "crate_elite": false,
    "crate_mine": false,
    "crate_normal": false,
    "crate_normal_2": false,
    "crate_normal_2_food": false,
    "crate_normal_2_medical": false,
    "crate_tools": false,
    "crate_underwater_advanced": false,
    "crate_underwater_basic": false,
    "dm ammo": false,
    "dm c4": false,
    "dm construction resources": false,
    "dm construction tools": false,
    "dm food": false,
    "dm medical": false,
    "dm res": false,
    "dm tier1 lootbox": false,
    "dm tier2 lootbox": false,
    "dm tier3 lootbox": false,
    "foodbox": false,
    "loot_barrel_1": false,
    "loot_barrel_2": false,
    "loot_component_test": false,
    "loot_trash": false,
    "minecart": false,
    "oil_barrel": false,
    "crate_ammunition": false,
    "crate_food_1": false,
    "crate_food_2": false,
    "crate_fuel": false,
    "crate_medical": false,
    "tech_parts_1": false,
    "tech_parts_2": false,
    "vehicle_parts": false,
    "roadsign1": true,
    "roadsign2": true,
    "roadsign3": true,
    "roadsign4": true,
    "roadsign5": true,
    "roadsign6": true,
    "roadsign8": true,
    "roadsign7": true,
    "roadsign9": true,
    "codelockedhackablecrate": false,
    "codelockedhackablecrate_oilrig": false,
    "supply_drop": false,
    "giftbox_loot": false,
    "presentdrop": false,
    "stocking_large_deployed": false,
    "stocking_small_deployed": false,
    "logstash": false,
    "missionlootbox_basic": false,
    "missionstash": false,
    "tacklebox": false,
    "bradley_crate": false,
    "heli_crate": false,
    "diesel_barrel_world": false,
    "visualshelvestest": false
  },
  "Collectible Entity Pickup Settings": {
    "berry-black-collectable": false,
    "berry-blue-collectable": false,
    "berry-green-collectable": false,
    "berry-red-collectable": false,
    "berry-white-collectable": false,
    "berry-yellow-collectable": false,
    "corn-collectable": false,
    "hemp-collectable": false,
    "mushroom-cluster-5": false,
    "mushroom-cluster-6": false,
    "potato-collectable": false,
    "pumpkin-collectable": false,
    "halloween-bone-collectable": false,
    "halloween-metal-collectable": false,
    "halloween-stone-collectable": false,
    "halloween-sulfur-collectible": false,
    "halloween-wood-collectable": false,
    "metal-collectable": false,
    "stone-collectable": false,
    "sulfur-collectable": false,
    "wood-collectable": false,
    "diesel_collectable": false
  },
  "Plant Entity Pickup Settings": {
    "black_berry.entity": false,
    "blue_berry.entity": false,
    "green_berry.entity": false,
    "red_berry.entity": false,
    "white_berry.entity": false,
    "yellow_berry.entity": false,
    "corn.entity": false,
    "hemp.entity": false,
    "potato.entity": false,
    "pumpkin.entity": false
  },
  "Version": {
    "Major": 1,
    "Minor": 2,
    "Patch": 15
  }
}



I tried changing the settings as you suggested, it auto picks up all components players drop not just from barrels after smashing them.



I could be wrong and dont have it setup right, but It shouldn't be picking up the barrels themself and should only pickup the items dropped from the barrel after smahing it.

Does not support it and works for all world items, not just the dropped from barrels

ruIwson9GtxeqdU.jpg Arainrr

Does not support it and works for all world items, not just the dropped from barrels

Would this be a feature you could please add? "Loot container dropped items"

Hello,

Since it's a long-time problem, here is a simple solution that doesn't alter the plugin.

Change

Unsubscribe(nameof(OnPlayerAttack));​

To
Unsubscribe(nameof(OnEntityDeath));​


Change
Subscribe(nameof(OnPlayerAttack));​

To

Subscribe(nameof(OnEntityDeath));


Change

        private void OnPlayerAttack(BasePlayer attacker, HitInfo info)
        {
            if (attacker == null || !attacker.userID.IsSteamId()) return;
            var barrel = info?.HitEntity as LootContainer;
            if (barrel == null || barrel.net == null) return;
            if (!IsBarrel(barrel.ShortPrefabName)) return;
            var radius = configData.autoPickupS[PickupType.LootContainer].radius;
            if (radius > 0f && Vector3.Distance(attacker.transform.position, barrel.transform.position) > radius)
            {
                return;
            }
            if (permission.UserHasPermission(attacker.UserIDString, PERMISSION_USE))
            {
                if (TryPickupLootContainer(barrel, attacker, info))
                {
                }
            }
        }

To

        private void OnEntityDeath(BaseCombatEntity victimEntity, HitInfo info)
        {
            if (info != null)
            {
                BasePlayer attacker = info.InitiatorPlayer;
                if (attacker == null || !attacker.userID.IsSteamId()) return;
                var barrel = info.HitEntity as LootContainer;
                if (barrel == null || barrel.net == null) return;
                if (!IsBarrel(barrel.ShortPrefabName)) return;
                var radius = configData.autoPickupS[PickupType.LootContainer].radius;
                if (radius > 0f && Vector3.Distance(attacker.transform.position, barrel.transform.position) > radius)
                {
                    return;
                }
                if (permission.UserHasPermission(attacker.UserIDString, PERMISSION_USE))
                {
                    if (TryPickupLootContainer(barrel, attacker, info))
                    {
                    }
                }
            }
        }

This should do the trick :)

Have fun

This is not really a long-term problem, it was originally designed to be so. 🤣

ruIwson9GtxeqdU.jpg Arainrr

This is not really a long-term problem, it was originally designed to be so. 🤣

I dont understand why you would code it to be like that, doesn't make sense 1 hitting barrels when you have the settings enabled to auto loot barrels. Works much better with sami's adjustments.