Command to destroy containers but leave contents (Rust)
Hi guys,

The entkill command destroys containers (like barrels and crates and so on) but _also_ destroys their contents.  I was wondering if there was a way of having a variation of that command created, so that you could destroy a container using the command, but _release_ its contents to the ground for pick-up, rather than destroying them outright ?

Thanks so much ! =]]

!?!?! ShadowRaven !?!?!
Only with a plugin that people should create first.
Thanks misticos - perhaps somebody will come up with one *fingers crossed* =]

!?!?! ShadowRaven !?!?!
ShadowRaven
Thanks misticos - perhaps somebody will come up with one *fingers crossed* =]

!?!?! ShadowRaven !?!?!

Yesterday you said "canister" that I rejected. If you mean barrels or crates then it's possible. I will create it for you, let's chat on our channel for more detail

Sure thing Ultra =]

!?!?! ShadowRaven !?!?!
object OnServerCommand(ConsoleSystem.Arg arg)
        {
            if (arg.Args != null && arg.Args.Length == 2 && arg.Args[0] == "kill")
            {
                uint itemId = 0;

                if (uint.TryParse(arg.Args[1], out itemId))
                {
                    BaseNetworkable baseNetworkable = BaseNetworkable.serverEntities.Find(itemId);
                    if (baseNetworkable != null)
                    {
                        var container = baseNetworkable as LootContainer;
                        if (container != null)
                        {
                            Vector3 dropPosition = container.GetDropPosition();
                            Vector3 dropVelocity = container.GetDropVelocity();
                            float move = 0;
                            foreach (Item item in container.inventory.itemList)
                            {
                                move = move + 0.1F;
                                dropPosition = new Vector3(dropPosition.x + move, dropPosition.y + 1, dropPosition.z + move);

                                Item itemToDrop = null;
                                if (item.info.shortname == "blueprintbase")
                                {
                                    itemToDrop = ItemManager.Create(ItemManager.FindItemDefinition("blueprintbase"), 1);
                                    itemToDrop.blueprintTarget = item.blueprintTarget;
                                }
                                else
                                {
                                    itemToDrop = ItemManager.CreateByItemID(item.info.itemid, item.amount);
                                }

                                itemToDrop.Drop(dropPosition, dropVelocity, Quaternion.identity);
                            }
                        }
                    }
                }
            }

            return null;
        }



Enjoy!

Thanks so much !I'm going to go try it now =D

!?!?! ShadowRaven !?!?!