Esempio n. 1
0
    // An item that we'll try taking, and a flag whether we should actually take it or not (we could just be checking if we have space)
    public bool AttemptGiveItem(ItemBase item, int amount = 1, bool actuallyTakeItem = true)
    {
        VicisMod.log(getPrefix(), "Attempting to receive " + amount + " item " + item.GetDisplayString() + " with id = " + item.mnItemID + " and type = " + item.mType);
        // Can we even take this item(s)?
        if (getNumItems() + amount > maxItems)
        {
            return(false);
        }
        for (int i = 0; i < items.Count; ++i)
        {
            if (ItemBaseUtil.compareCubeStack(items[i] as ItemCubeStack, item as ItemCubeStack))
            {
                ItemCubeStack a         = items[i] as ItemCubeStack;
                int           amntTaken = Math.Min(amount, a.mnAmount);
                if (a != null && a.mnAmount < maxBinSize)
                {
                    if (actuallyTakeItem)
                    {
                        a.mnAmount += amount;
                    }
                    MarkDirtyDelayed();
                    return(true);
                }
            }
            else if (ItemBaseUtil.compareStack(items[i] as ItemStack, item as ItemStack))
            {
                ItemStack a = items[i] as ItemStack;
                if (a != null && a.mnAmount < maxBinSize)
                {
                    if (actuallyTakeItem)
                    {
                        a.mnAmount += amount;
                    }
                    MarkDirtyDelayed();
                    return(true);
                }
            }
        }

        if (items.Count < maxBins)
        {
            if (actuallyTakeItem)
            {
                items.Add(item);
            }
            MarkDirtyDelayed();
            return(true);
        }

        VicisMod.log(getPrefix(), "Did not accept item " + item.GetDisplayString());
        return(false);
    }
 public bool AttemptGiveItem(ItemBase item)
 {
     foreach (MassCrateModule mcm in modules.Keys)
     {
         VicisMod.log(LOGGER_PREFIX, "Attempting to give " + item.GetDisplayString() + " to a module");
         if (mcm.AttemptGiveItem(item))
         {
             return(true);
         }
         VicisMod.log(LOGGER_PREFIX, "Failed, will attempt again");
     }
     VicisMod.log(LOGGER_PREFIX, "Could not give item " + item.GetDisplayString());
     return(false);
 }
Esempio n. 3
0
        // An item that we'll try taking, and a flag whether we should actually take it or not (we could just be checking if we have space)
        public bool AttemptGiveItem(ItemBase item, int amount, bool actuallyTakeItem = true)
        {
            VicisMod.log(getPrefix(), "Attempting to receive " + amount + " item " + item.GetDisplayString() + " with id = " + item.mnItemID + " and type = " + item.mType);
            // Can we even take this item(s)?
            if (getNumItems() + amount > maxItems)
            {
                return(false);
            }
            if (claimed != null && !claimed.compareBaseDeep(item))
            {
                return(false);
            }
            if (!actuallyTakeItem && getNumItems() == 0 && maxItems > 0 && maxBins > 0 && maxBinSize > 0)
            {
                return(true);
            }
            for (int i = 0; item.isStack() && i < items.Count; ++i)
            {
                if (items[i].isStackAndSame(item))
                {
                    if ((items[i].getAmount() + amount) <= maxBinSize)
                    {
                        if (actuallyTakeItem)
                        {
                            items[i].incrementStack(amount);
                            MarkDirtyDelayed();
                        }
                        return(true);
                    }
                }
            }
            if (item.isStack() && items.Count >= maxBins)
            {
                VicisMod.log(getPrefix(), "Couldn't find stack for " + item.GetDisplayString() + ", returning false");
                return(false);
            }

            if (items.Count < maxBins)
            {
                if (actuallyTakeItem)
                {
                    items.Add(item);
                    MarkDirtyDelayed();
                }
                return(true);
            }

            VicisMod.log(getPrefix(), "Did not accept item " + item.GetDisplayString());
            return(false);
        }
Esempio n. 4
0
        private void UpdateMeshText()
        {
            if (mDistanceToPlayer >= 12.0 || !AmInSameRoom())
            {
                return;
            }

            if (!GameObjectsInitialized())
            {
                return;
            }

            string meshText = "INPUT:\n";

            if (_incomingItem != null)
            {
                meshText += "" + _incomingItem.GetDisplayString();
            }
            else
            {
                meshText += "NONE";
            }

            TextMesh textMesh = mWrapper.mGameObjectList[0].gameObject.transform.Search("Storage Text")
                                .GetComponent <TextMesh>();

            if (textMesh != null)
            {
                Renderer renderer = textMesh.GetComponent <Renderer>();
                textMesh.text    = meshText;
                renderer.enabled = true;
            }
        }
    public ItemBase AttemptTakeItem(ItemBase item)
    {
        foreach (MassCrateModule mcm in modules.Keys)
        {
            VicisMod.log(LOGGER_PREFIX, "Attempting to take " + item.GetDisplayString() + " to a module");
            ItemBase ret = mcm.AttemptTakeItem(item);
            if (ret != null)
            {
                return(ret);
            }

            VicisMod.log(LOGGER_PREFIX, "Failed, will attempt again");
        }
        VicisMod.log(LOGGER_PREFIX, "Could not give take " + item.GetDisplayString());
        return(null);
    }
Esempio n. 6
0
        public static ItemBase newInstance(ItemBase a)
        {
            VicisMod.log(LOGGER_PREFIX, "Creating new instance of " + a.GetDisplayString());
            switch (a.mType)
            {
            case ItemType.ItemCubeStack:
                ItemCubeStack ics = a as ItemCubeStack;
                return(new ItemCubeStack(ics.mCubeType, ics.mCubeValue, ics.mnAmount));

            case ItemType.ItemStack:
                ItemStack its = a as ItemStack;
                return(new ItemStack(its.mnItemID, its.mnAmount));

            case ItemType.ItemCharge:
                ItemCharge ic = a as ItemCharge;
                return(new ItemCharge(ic.mnItemID, (int)ic.mChargeLevel));

            case ItemType.ItemDurability:
                ItemDurability id = a as ItemDurability;
                return(new ItemDurability(id.mnItemID, id.mnCurrentDurability, id.mnMaxDurability));

            case ItemType.ItemLocation:
                ItemLocation il = a as ItemLocation;
                return(new ItemLocation(il.mnItemID, il.mLocX, il.mLocY, il.mLocZ, il.mLookVector));

            case ItemType.ItemSingle:
                return(new ItemSingle(a.mnItemID));
            }
            return(null);
        }
Esempio n. 7
0
        protected virtual bool AttemptTakeItem()
        {
            if (getCarriedItemCount() > 0)
            {
                return(false);
            }

            VicisMod.log(getPrefix(), "Attempting to get item " + chosen.GetDisplayString());
            ItemBase item = headTo.AttemptTakeItem(chosen, batch);

            if (item != null)
            {
                carriedItems.Add(item);
                mbCarriedCubeNeedsConfiguring = true;
                return(true);
            }
            return(false);
        }
Esempio n. 8
0
 public static void incrementStack(this ItemBase a, int amount)
 {
     if (a.mType == ItemType.ItemCubeStack)
     {
         (a as ItemCubeStack).mnAmount += amount;
     }
     else if (a.mType == ItemType.ItemStack)
     {
         (a as ItemStack).mnAmount += amount;
     }
     VicisMod.log(LOGGER_PREFIX, "Tried incrementing a non stacked item! " + a.GetDisplayString());
 }
Esempio n. 9
0
        // An item that we're going to give, or check that we can give
        public ItemBase AttemptTakeItem(ItemBase item, int amount = 1, bool actuallyGiveItem = true)
        {
            VicisMod.log(getPrefix(), "Attempting to give " + amount + " item " + item.GetDisplayString() + " with id = " + item.mnItemID + " and type = " + item.mType);
            if (getNumItems() == 0)
            {
                return(null);
            }
            bool itemIsStack = item.isStack();

            for (int i = 0; i < items.Count; ++i)
            {
                if (itemIsStack && items[i].isStackAndSame(item))
                {
                    VicisMod.log(getPrefix(), "Found a CubeStack " + items[i].GetDisplayString() + ", which is storing " + items[i].getAmount() + " blocks");
                    int      amntTaken = Math.Min(amount, items[i].getAmount());
                    ItemBase ret       = ItemBaseUtil.newInstance(items[i]);
                    ret.setAmount(amntTaken);
                    if (actuallyGiveItem)
                    {
                        VicisMod.log(getPrefix(), "Taking Away");
                        items[i].decrementStack(amntTaken);
                        if (items[i].getAmount() == 0)
                        {
                            VicisMod.log(getPrefix(), "There are " + items[i].getAmount() + " items for " + items[i].GetDisplayString() + ", removing it from items");
                            items.RemoveAt(i);
                        }
                        MarkDirtyDelayed();
                    }
                    return(ret);
                }
                else if (!item.isStack() && items[i].compareBase(item))
                {
                    ItemBase ret = items[i];
                    VicisMod.log(getPrefix(), "Found a " + ret.GetDisplayString() + ", with id = " + ret.mnItemID + " and type = " + ret.mType);
                    if (actuallyGiveItem)
                    {
                        VicisMod.log(getPrefix(), "Removing from items");
                        items.RemoveAt(i);
                        MarkDirtyDelayed();
                    }
                    return(ret);
                }
            }

            return(null);
        }
Esempio n. 10
0
    public override void Read(BinaryReader reader, int entityVersion)
    {
        VicisMod.VicisModVersion version = (VicisMod.VicisModVersion)entityVersion;
        items.Clear();
        switch (version)
        {
        case VicisMod.VicisModVersion.Version1:
        case VicisMod.VicisModVersion.Version2:
        case VicisMod.VicisModVersion.Version3:
            break;

        default:
            int count = reader.ReadInt32();
            for (int i = 0; i < count; ++i)
            {
                ItemBase item = ItemFile.DeserialiseItem(reader);
                VicisMod.log(getPrefix(), "Reading from file " + item.GetDisplayString());
                items.Add(item);
            }
            break;
        }
    }
Esempio n. 11
0
        public override string GetPopupText()
        {
            if (Input.GetButton("Interact"))
            {
                if (Input.GetKey(KeyCode.LeftShift))
                {
                    claimed = null;
                }
                else
                {
                    claimed = MassGiver.getCurrentHotBarItem();
                }
            }

            string ret = "I'm connected to " + manager.modules.Count + " modules" +
                         "\nNetwork storing " + manager.getNumItems() + " / " + manager.getMaxItems() + " items";

            if (maxItems > 0)
            {
                ret += "\nThis crate storing " + getNumItems() + " / " + maxItems + " items";
            }

            if (claimed == null)
            {
                ret += "\nNo items claimed";
            }
            else
            {
                ret += "\nClaimed " + claimed.GetDisplayString();
            }

            for (int i = 0; i < items.Count; ++i)
            {
                ret += "\n" + items[i].GetDisplayString();
            }

            return(ret);
        }
    public override string GetPopupText()
    {
        int segmentCount = WorldScript.instance.mSegmentUpdater.updateList.Count;
        //Header
        string retText = "Auto Lens Swapper";

        retText += "   Power: " + Mathf.Round(mrCurrentPower).ToString() + " / " + Mathf.Round(mrMaxPower).ToString();
        retText += "\neStatus: " + mStatus.ToString();
        retText += "   eIssue: " + mIssue.ToString();
        if (mTargetLens != null)
        {
            retText += "\nNew lens: " + mTargetLens.GetDisplayString();
            retText += "   Stored: " + (mnStorageMax - getStorageAvailable()).ToString() + " / " + mnStorageMax.ToString();
        }
        else
        {
            retText += "\nNew lens: null - Press T to insert & set!";
        }
        retText += "\n------";
        //Body
        switch (mStatus)
        {
        case eStatuses.Stopped:

            if (mIssue != eIssues.Ready)
            {
                retText += GetIssueText(mIssue);
            }
            else
            {
                /*
                 * if (mbOnlySwap) retText += "\nMode: swap only (Shift + T)";
                 * else retText += "\nMode: swap & insert (Shift + T)";
                 * if (mbTrashOld) retText += "\nOld lenses: destroy (Shift + Q)";
                 * else retText += "\nOld lenses: output to adjacent machine (Shift + Q)";
                 */
                retText += "\n\nPress E to start running!";
                retText += "\nPress Q to remove lenses and reset machine at any time.";
                // ^^^ replace with dynamic text for "E"

                /*
                 * if (Input.GetButtonDown("Store") && Input.GetKeyDown(KeyCode.LeftShift))// && UIManager.AllowInteracting)
                 *  mbOnlySwap = !mbOnlySwap;
                 * else if (Input.GetButtonDown("Extract") && Input.GetKeyDown(KeyCode.LeftShift))// && UIManager.AllowInteracting)
                 *  mbTrashOld = !mbTrashOld;
                 */
                if (Input.GetButtonDown("Interact") && !Input.GetKeyDown(KeyCode.LeftShift))    // && UIManager.AllowInteracting)
                {
                    mStatus = eStatuses.Running;
                }
            }
            break;

        case eStatuses.Running:
            //power, stored lenses, percent_progress, ID, and max
            if (mIssue != eIssues.Ready)
            {
                retText += GetIssueText(mIssue);
            }
            else
            {
                retText += "\nSegment: " + mnSegmentID.ToString() + " / " + segmentCount.ToString() + " (" + (Mathf.Round((float)mnSegmentID / (float)segmentCount * 100f)).ToString() + "%)";
                retText += "\nLPTs checked: " + mnTrackLPTs.ToString();
                retText += "\nLens swaps: " + mnTrackSwaps.ToString();
            }
            retText += "\nPress Q to remove lenses and reset machine.";
            break;

        case eStatuses.Done:
            //finished running over ID segments, swapping index? lenses
            if (mbHaltedEarly)
            {
                retText += "\nHalted early!";
            }
            else
            {
                retText += "\nComplete!";
            }
            retText += "   Segments checked: " + mnSegmentID.ToString();
            retText += "   LPTs checked: " + mnTrackLPTs.ToString();
            retText += "   Lens swaps: " + mnTrackSwaps.ToString();
            retText += "\nPress Q to start over!";
            // ^^^ replace with dynamic text for "Q"
            break;


        default:
            break;
        }

        if (Input.GetButtonDown("Extract") && !Input.GetKey(KeyCode.LeftShift) && UIManager.AllowInteracting)
        {
            PlayerExtractRequest();
        }
        if (Input.GetButtonDown("Store") && !Input.GetKey(KeyCode.LeftShift) && UIManager.AllowInteracting)
        {
            PlayerStoreRequest();
        }

        return(retText);
    }
Esempio n. 13
0
    // An item that we're going to give, or check that we can give
    public ItemBase AttemptTakeItem(ItemBase item, int amount = 1, bool actuallyGiveItem = true)
    {
        VicisMod.log(getPrefix(), "Attempting to give " + amount + " item " + item.GetDisplayString() + " with id = " + item.mnItemID + " and type = " + item.mType);
        if (getNumItems() == 0)
        {
            return(null);
        }
        for (int i = 0; i < items.Count; ++i)
        {
            if (ItemBaseUtil.compareCubeStack(items[i] as ItemCubeStack, item as ItemCubeStack))
            {
                ItemCubeStack a = items[i] as ItemCubeStack;
                VicisMod.log(getPrefix(), "Found a CubeStack " + a.GetDisplayString() + ", which is storing " + a.mnAmount + " blocks");
                if (a != null)
                {
                    int           amntTaken = Math.Min(amount, a.mnAmount);
                    ItemCubeStack ret       = new ItemCubeStack(a.mCubeType, a.mCubeValue, amntTaken);
                    if (actuallyGiveItem)
                    {
                        VicisMod.log(getPrefix(), "Taking away");
                        a.mnAmount -= amntTaken;
                        if (a.mnAmount <= 0)
                        {
                            VicisMod.log(getPrefix(), "There are " + a.mnAmount + " items for " + a.GetDisplayString() + ", removing it from items");
                            items.RemoveAt(i);
                        }
                    }
                    MarkDirtyDelayed();
                    return(ret);
                }
                // a was null, this is bad. Clean up, hide the evidence
                VicisMod.log(getPrefix(), "Removing a null that masquaraded as an ItemCubeStack!");
                items.RemoveAt(i);
                return(null);
            }
            else if (ItemBaseUtil.compareStack(items[i] as ItemStack, item as ItemStack))
            {
                ItemStack a = items[i] as ItemStack;
                VicisMod.log(getPrefix(), "Found a Stack " + a.GetDisplayString() + ", which is storing " + a.mnAmount + " blocks");
                if (a != null)
                {
                    int       amntTaken = Math.Min(amount, a.mnAmount);
                    ItemStack ret       = new ItemStack(a.mnItemID, amntTaken);
                    if (actuallyGiveItem)
                    {
                        VicisMod.log(getPrefix(), "Taking away");
                        a.mnAmount -= amntTaken;
                        if (a.mnAmount <= 0)
                        {
                            VicisMod.log(getPrefix(), "There are " + a.mnAmount + " items for " + a.GetDisplayString() + ", removing it from items");
                            items.RemoveAt(i);
                        }
                    }
                    MarkDirtyDelayed();
                    return(ret);
                }
                // a was null, this is bad. Clean up, hide the evidence
                VicisMod.log(getPrefix(), "Removing a null that masquaraded as an ItemStack!");
                items.RemoveAt(i);
                return(null);
            }
        }

        if (ItemBaseUtil.isStack(item))
        {
            VicisMod.log(getPrefix(), "Could not find a stack or cube stack for " + item.GetDisplayString() + ", returning null");
            return(null);
        }

        // What we're looking for is not a stack, start looking at the individual items.
        for (int i = 0; i < items.Count; ++i)
        {
            if (ItemBaseUtil.compareBase(items[i], item))
            {
                ItemBase ret = items[i];
                VicisMod.log(getPrefix(), "Found a " + ret.GetDisplayString() + ", with id = " + ret.mnItemID + " and type = " + ret.mType);
                if (actuallyGiveItem)
                {
                    VicisMod.log(getPrefix(), "Removing from items");
                    items.RemoveAt(i);
                }
                MarkDirtyDelayed();
                return(ret);
            }
        }
        return(null);
    }
Esempio n. 14
0
        public override void LowFrequencyUpdate()
        {
            if (mcm == null)
            {
                LookForAttachedModules();
            }

            if (getStoredItemsCount() < maxItems)
            {
                VicisMod.log(getPrefix(), "Attempting to get item from surroundings");
                ItemBase item = this.TakeFromSurrounding();
                if (item != null)
                {
                    VicisMod.log(getPrefix(), "Got a " + item.GetDisplayString());
                    addItem(item);
                }
            }

            if (!linkedToGo)
            {
                droneLogic(LowFrequencyThread.mrPreviousUpdateTimeStep);
            }

            if (items.Count == 0 && carriedItems.Count == 0)
            {
                return;
            }

            if (mcm != null && items.Count > 0 && headTo == null)
            {
                if (items[0] == null)
                {
                    items.RemoveAt(0);
                    return;
                }
                VicisMod.log(getPrefix(), "LFU trying to find place to drop off " + items[0].GetDisplayString());
                headTo = mcm.manager.provideCrateDropoff(items[0], this, getDropOffSize());
                if (headTo != null)
                {
                    lastInteracted = headTo;
                }
            }

            if (headTo != null && carriedItems.Count == 0)
            {
                float dist = (drone.getPos() - mUnityDroneRestPos).magnitude;
                VicisMod.log(getPrefix(), "LFU Attempting to give item to drone, drone is at " + drone.getPos() + ", dist = " + dist);
                if (dist <= 0.05f)
                {
                    if (AttemptGiveItem())
                    {
                        MarkDirtyDelayed();
                        return;
                    }
                }
            }

            if (headTo != null && carriedItems.Count > 0)
            {
                if (carriedItems[0] == null)
                {
                    carriedItems.RemoveAt(0);
                    return;
                }
                float dist = (drone.getPos() - targetCoords).magnitude;
                VicisMod.log(getPrefix(), "LFU drone is at " + drone.getPos() + ", dist = " + dist);
                if (dist <= 0.05f)
                {
                    VicisMod.log(getPrefix(), "LFU Finalising drop off");
                    if (!FinishGiveItem())
                    {
                        // Dammit, the crate was filled before the drone got there. Recollect, try again.
                        items.Insert(0, carriedItems[0]);
                        carriedItems.RemoveAt(0);
                        if (carriedItems.Count == 0)
                        {
                            VicisMod.log(getPrefix(), "I'm still carrying something. What?");
                        }
                    }
                    else
                    {
                        MarkDirtyDelayed();
                    }
                }
            }

            if (headTo != null && carriedItems.Count == 0)
            {
                VicisMod.log(getPrefix(), "LFU resetting headTo and targetCoords");
                headTo       = null;
                targetCoords = Vector3.zero;
            }
        }
    private bool checkReady()
    {
        if (mUpdates % 20 == 0 && mDebug)
        {
            string txt = "[Auto Lens Swapper][DEBUG] checkReady called.";
            txt += "\nmIssue: " + mIssue.ToString();
            Debug.LogWarning(txt);
        }

        if (mrCurrentPower < mrPowerPerSwap)
        {
            mIssue = eIssues.Power;
            if (mUpdates % 20 == 0 && mDebug)
            {
                Debug.LogWarning("[Auto Lens Swapper][DEBUG] checkReady Issue: Power:" + mrCurrentPower + " - " + mrMaxPower);
            }
            return(false);
        }
        else if (mTargetLens == null)
        {
            mIssue = eIssues.SetLens;
            if (mUpdates % 20 == 0 && mDebug)
            {
                Debug.LogWarning("[Auto Lens Swapper][DEBUG] checkReady Issue: setlens, null");
            }
            return(false);
        }
        else if (!isValidLensID(mTargetLens.mnItemID))
        {
            mIssue = eIssues.SetLens;
            if (mUpdates % 20 == 0 && mDebug)
            {
                Debug.LogWarning("[Auto Lens Swapper][DEBUG] checkReady Issue: setlens invalid" + isValidLensID(mTargetLens.mnItemID));
            }
            return(false);
        }
        else if (mStoredLenses == null)
        {
            mIssue = eIssues.Input;
            if (mUpdates % 20 == 0 && mDebug)
            {
                Debug.LogWarning("[Auto Lens Swapper][DEBUG] checkReady Issue: stored lenses null" + mStoredLenses.GetDisplayString());
            }
            return(false);
        }
        else if (mStoredLenses.GetAmount() <= 0)
        {
            if (mUpdates % 20 == 0 && mDebug)
            {
                Debug.LogWarning("[Auto Lens Swapper][DEBUG] checkReady Issue: stored lenses 0");
            }
            if (!TakeLensSurrounding())
            {
                mIssue = eIssues.Input;
                if (mUpdates % 20 == 0 && mDebug)
                {
                    Debug.LogWarning("[Auto Lens Swapper][DEBUG] checkReady Issue: Couldn't pull any lenses!");
                }
                return(false);
            }
        }
        else if (mIssue == eIssues.Output)
        {
            if (mUpdates % 20 == 0 && mDebug)
            {
                Debug.LogWarning("[Auto Lens Swapper][DEBUG] checkReady Issue: Couldn't drop-off lenses!");
            }
            if (mLastLPT == null)
            {
                Debug.LogWarning("[Auto Lens Swapper][info] eIssue was output, but then mLastLPT was null! Assuming lpt was deleted and moving on.");
            }
            else if (!runSwapLens(mLastLPT))
            {
                return(false);
            }
            mIssue = eIssues.Ready;
            RequestImmediateNetworkUpdate();
        }
        else if (mIssue != eIssues.Ready)
        {
            mIssue = eIssues.Ready;
            RequestImmediateNetworkUpdate();
        }
        else
        {
            mIssue = eIssues.Ready;
        }
        return(true);
    }
    public static bool StoreItems(Player player, ExtraStorageHoppers_OT hopper, ItemBase itemToStore)
    {
        if ((player == WorldScript.mLocalPlayer) && !WorldScript.mLocalPlayer.mInventory.RemoveItemByExample(itemToStore, true))
        {
            Debug.Log(string.Concat(new object[] { "Player ", player.mUserName, " doesnt have ", itemToStore.GetDisplayString() }));
            return(false);
        }
        if (!hopper.AddItem(itemToStore))
        {
            Debug.LogWarning("Bad thing that used to be unhandled! Thread interaccess probably caused this to screw up!");
            if (player == WorldScript.mLocalPlayer)
            {
                WorldScript.mLocalPlayer.mInventory.AddItem(itemToStore);
                return(false);
            }
            player.mInventory.AddItem(itemToStore);
            return(false);
        }
        if (player.mbIsLocalPlayer)
        {
            Color    green = Color.green;
            ItemBase lItem = itemToStore;
            if (lItem.mType == ItemType.ItemCubeStack)
            {
                ItemCubeStack stack = lItem as ItemCubeStack;
                if (CubeHelper.IsGarbage(stack.mCubeType))
                {
                    green = Color.red;
                }
                if (CubeHelper.IsSmeltableOre(stack.mCubeType))
                {
                    green = Color.green;
                }
            }
            if (lItem.mType == ItemType.ItemStack)
            {
                green = Color.cyan;
            }
            if (lItem.mType == ItemType.ItemSingle)
            {
                green = Color.white;
            }
            if (lItem.mType == ItemType.ItemCharge)
            {
                green = Color.magenta;
            }
            if (lItem.mType == ItemType.ItemDurability)
            {
                green = Color.yellow;
            }
            if (lItem.mType == ItemType.ItemLocation)
            {
                green = Color.gray;
            }
            FloatingCombatTextManager.instance.QueueText(hopper.mnX, hopper.mnY + 1L, hopper.mnZ, 1f, "Stored " + lItem.GetDisplayString(), green, 1.5f);
            char[] whitespace = new char[] { ' ', '\t' };
        }

        player.mInventory.VerifySuitUpgrades();
        if (!WorldScript.mbIsServer)
        {
            NetworkManager.instance.SendInterfaceCommand("ExtraStorageHopperWindow_OT", "StoreItems", null, itemToStore, hopper, 0f);
        }
        return(true);
    }
Esempio n. 17
0
 public static void setAmount(ItemBase a, int amount)
 {
     if (a.mType == ItemType.ItemCubeStack)
     {
         (a as ItemCubeStack).mnAmount = amount;
     }
     else if (a.mType == ItemType.ItemStack)
     {
         (a as ItemStack).mnAmount = amount;
     }
     VicisMod.log(LOGGER_PREFIX, "Tried setting an amount on a non stacked item! " + a.GetDisplayString());
 }