示例#1
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);
        }
示例#2
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);
        }