/// <summary> /// Add Item via frontend /// Moves existing Item to this container /// </summary> /// <param name="iItem"></param> /// <returns></returns> public bool AddItem(Item iItem) { MountSlot freeMount = mounts.FindEmptySlot(); if (freeMount != null) { //Move the object to backend Inventory BackendMoveItem(iItem.ID_Instance, ID); //Put it in the first free slot freeMount.Mount(iItem.transform); iItem.ID_Inventory = ID; availableslots--; return(true); } //If there is no slot return(false); }
/// <summary> /// Add object via template ID /// Create a new Item and add it /// </summary> /// <param name="iID"></param> /// <returns></returns> public bool AddItem(uint iID) { MountSlot freeMount = mounts.FindEmptySlot(); if (freeMount != null) { //Create a new item uint instanceID = BackendItemCreate(iID, ID); //Get the object template ID BackendItem temp = BackendGetItem(instanceID); //Create new Frontend Item from the ItemManager Item tItem = itemManager.CreateItem(temp.ID_Template); AddItem(tItem); return(true); } //If there is no slot return(false); }