I'm wondering how you can open a custom ItemContainer for players to view and use such as they do in the following plugins:
https://umod.org/plugins/backpacks
I tried peeking at the code in these to see how these wizards did it, but it seems a bit cryptic to me (I'm new to oxide). I tried to put together a simple example based on what I found in the "bank" plugin, this is what I have but it doesn't seem to work:
[ChatCommand("open")]
private void CommandHandler(BasePlayer player, string command, string[] args)
{
ItemContainer itemContainer = new ItemContainer();
itemContainer.entityOwner = player;
itemContainer.isServer = true;
itemContainer.allowedContents = ItemContainer.ContentsType.Generic;
itemContainer.GiveUID();
itemContainer.capacity = 1;
var pos = new Vector3(player.transform.position.x, player.transform.position.y - 1, player.transform.position.z);
string box = "assets/prefabs/deployable/woodenbox/woodbox_deployed.prefab";
var view = GameManager.server.CreateEntity(box, pos) as StorageContainer;
view.GetComponent<GroundWatch>().enabled = false;
view.limitNetworking = true;
view.transform.position = pos;
view.OwnerID = player.userID;
player.EndLooting();
view.enableSaving = false;
view.Spawn();
view.inventory = itemContainer;
view.inventory.entityOwner = view;
player.inventory.loot.entitySource = view;
view.PlayerOpenLoot(player);
}I'm attempting to just open a simple container that resembles the wooden box UI. But calling this command does not seem to do anything. Am I missing something fundamental?