Example #1
0
        private bool moveItem(IMyInventory src, IMyInventory tgt, MyInventoryItem item, MyFixedPoint amt)
        {
            bool        ret   = false;
            IMyRefinery prod1 = src as IMyRefinery;
            IMyRefinery prod2 = tgt as IMyRefinery;

            if (prod1 != null)
            {
                prod1.UseConveyorSystem = true;
            }
            if (prod2 != null)
            {
                prod2.UseConveyorSystem = true;
            }
            if (src.TransferItemTo(tgt, item, amt))
            {
                //show("Moved "+amt+" of "+item.Type.SubtypeId+" from "+src.Owner.Name+" to "+tgt.Owner.Name);
                ret = true;
            }
            else
            {
                //show("Could not move "+item.Type.SubtypeId+" from "+src.Owner.Name+" to "+tgt.Owner.Name);
                ret = false;
            }
            if (prod1 != null)
            {
                prod1.UseConveyorSystem = false;
            }
            if (prod2 != null)
            {
                prod2.UseConveyorSystem = false;
            }
            return(ret);
        }
Example #2
0
        private void addToCache(MyInventoryItem item, IMyCargoContainer box)
        {
            ItemProfile prof = new ItemProfile(item);
            //show("Caching "+prof.ToString()+" in "+box.CustomName);
            List <IMyCargoContainer> li = null;

            sourceCache.TryGetValue(prof, out li);
            if (li == null)
            {
                li = new List <IMyCargoContainer>();
            }
            li.Add(box);
            sourceCache[prof] = li;

            int has = 0;

            allItems.TryGetValue(prof, out has);
            int amt = item.Amount.ToIntSafe();

            has           += amt;
            allItems[prof] = has;
            totalItems    += amt;
        }
Example #3
0
 public bool match(MyInventoryItem item)
 {
     return(strip(item.Type.TypeId) == itemType && strip(item.Type.SubtypeId) == itemSubType);
 }
Example #4
0
 internal ItemProfile(MyInventoryItem item) : this(item.Type.TypeId, item.Type.SubtypeId)
 {
 }
Example #5
0
 internal FoundItem(MyInventoryItem inv, IMyInventory src)
 {
     item   = inv;
     source = src;
 }
Example #6
0
 private bool moveItem(IMyInventory src, IMyInventory tgt, MyInventoryItem item)
 {
     return(moveItem(src, tgt, item, item.Amount));
 }