コード例 #1
0
        bool Sandbox.ModAPI.Interfaces.IMyInventory.IsConnectedTo(Sandbox.ModAPI.Interfaces.IMyInventory dst)
        {
            MyInventory dstInventory = dst as MyInventory;

            if (dstInventory != null)
            {
                return(IsConnected(dstInventory));
            }
            return(false);
        }
コード例 #2
0
        private bool TransferItemsFrom(Sandbox.ModAPI.Interfaces.IMyInventory sourceInventory, int sourceItemIndex, int?targetItemIndex, bool?stackIfPossible, VRage.MyFixedPoint?amount, bool useConveyors)
        {
            MyInventory srcInventory = sourceInventory as MyInventory;

            if (srcInventory != null && (useConveyors == false || IsConnected(srcInventory) == true))
            {
                TransferItemFrom(srcInventory, sourceItemIndex, targetItemIndex, stackIfPossible, amount);
                return(true);
            }
            return(false);
        }
コード例 #3
0
        private bool TransferItemsTo(Sandbox.ModAPI.Interfaces.IMyInventory dst, int sourceItemIndex, int?targetItemIndex, VRage.MyFixedPoint?amount, bool useConveyor)
        {
            MyInventory dstInventory = dst as MyInventory;

            if (dstInventory != null)
            {
                if (sourceItemIndex < 0 || sourceItemIndex >= this.m_items.Count || (useConveyor == true && IsConnected(dstInventory) == false))
                {
                    return(false);
                }
                Transfer(this as MyInventory, dstInventory, this.GetItems()[sourceItemIndex].ItemId, targetItemIndex.HasValue ? targetItemIndex.Value : -1, amount);
                return(true);
            }
            return(false);
        }
コード例 #4
0
 bool Sandbox.ModAPI.Interfaces.IMyInventory.TransferItemTo(Sandbox.ModAPI.Interfaces.IMyInventory dst, int sourceItemIndex, int?targetItemIndex, bool?stackIfPossible, VRage.MyFixedPoint?amount)
 {
     return(TransferItemsTo(dst, sourceItemIndex, targetItemIndex, amount, true));
 }
コード例 #5
0
 bool Sandbox.ModAPI.IMyInventory.TransferItemFrom(Sandbox.ModAPI.Interfaces.IMyInventory sourceInventory, int sourceItemIndex, int?targetItemIndex = null, bool?stackIfPossible = null, VRage.MyFixedPoint?amount = null, bool checkConnection = false)
 {
     return(TransferItemsFrom(sourceInventory, sourceItemIndex, targetItemIndex, stackIfPossible, amount, checkConnection));
 }