Example #1
0
        public MassCrateModule provideCratePickup(ItemBase item, MassGiver giver, int amount)
        {
            float           dist = 99999999999;
            MassCrateModule ret  = null;

            foreach (MassCrateModule mcm in modules)
            {
                if (mcm.AttemptTakeItem(item, amount, false) != null)
                {
                    float tdist = calcDist(mcm, giver);
                    if (tdist < dist)
                    {
                        ret  = mcm;
                        dist = tdist;
                    }
                }
            }
            return(ret);
        }
Example #2
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);
        }
Example #3
0
        public MassCrateModule provideCratePickup(ItemBase item, MassGiver giver, int amount)
        {
            float           dist = float.MaxValue;
            MassCrateModule ret  = null;

            for (int i = 0; i < modules.Count; ++i)  // MassCrateModule mcm in modules) {
            {
                if (modules[i].shouldSkip())
                {
                    continue;
                }
                MassCrateModule mcm = modules[i];
                if (mcm.AttemptTakeItem(item, amount, false) != null)
                {
                    float tdist = calcDist(mcm, giver);
                    if (tdist < dist)
                    {
                        ret  = mcm;
                        dist = tdist;
                    }
                }
            }
            return(ret);
        }