Trying this:
The sell order is added, but the item will not move. No error. Ideas?
edit: It works after inserting an item manually into its itemcontainer, seems the inventory is not created.
edit2: works now:
...
private const string VendPrefab = "assets/prefabs/deployable/vendingmachine/vendingmachine.deployed.prefab";
...
_vendingMachine = GameManager.server.CreateEntity(VendPrefab, _spawnPoint, monument.transform.rotation) as VendingMachine;
...
private void CmdSell(BasePlayer player, string command, string[] args)
{
var item = player.GetActiveItem();
var blueprint = item.IsBlueprint() ? (byte)1 : (byte)0;
_vendingMachine.AddSellOrder(item.info.itemid, item.amount, -932201673, 10, blueprint);
item.MoveToContainer(_vendingMachine.inventory);
}
The sell order is added, but the item will not move. No error. Ideas?
edit: It works after inserting an item manually into its itemcontainer, seems the inventory is not created.
edit2: works now:
after .Spawn();
_vendingMachine.inventory = new ItemContainer();
_vendingMachine.inventory.ServerInitialize(null, 10);
if ((int) _vendingMachine.inventory.uid == 0)
{
PrintToChat("It was 0");
_vendingMachine.inventory.GiveUID();
}