Пример #1
0
        //TODO Save Is Visible

        public void Initialize(FCSController mono, IFCSStorage storage, FCSPowerManager powerManager, bool canBeVisible = false)
        {
            _mono         = mono;
            _storage      = storage;
            _powerManager = powerManager;
            _canBeVisible = canBeVisible;
        }
Пример #2
0
 public void InitializeBase(FCSController mono, IFCSStorage storage, FCSPowerManager powerManager,
                            PrefabIdentifier prefabIdentifier)
 {
     _mono         = mono;
     _storage      = storage;
     _powerManager = powerManager;
     _prefabId     = prefabIdentifier;
     _isBase       = true;
 }
Пример #3
0
        public void Initialize(Transform trans, string label, string itemNotAllowedMessage, string storageIsFullMessage, IFCSStorage storage, int width = 6, int height = 8, string name = "StorageRoot")
        {
            _itemNotAllowedMessage = itemNotAllowedMessage;
            _storageIsFullMessage  = storageIsFullMessage;
            _storage = storage;

            if (_containerRoot == null)
            {
                var storageRoot = new GameObject(name);
                storageRoot.transform.SetParent(trans, false);
                _containerRoot = storageRoot.AddComponent <ChildObjectIdentifier>();
            }

            if (_dumpContainer == null)
            {
                QuickLogger.Debug("Initializing Container");

                _dumpContainer = new ItemsContainer(width, height, _containerRoot.transform, label, null);

                _dumpContainer.isAllowedToAdd += IsAllowedToAdd;
                _dumpContainer.onAddItem      += DumpContainerOnOnAddItem;
            }
        }
Пример #4
0
        /// <summary>
        /// Removes item from container and sends to another device
        /// </summary>
        /// <param name="techType"></param>
        /// <param name="deviceStorage"></param>
        /// <returns></returns>
        internal bool TransferItem(TechType techType, IFCSStorage deviceStorage)
        {
            try
            {
                //Remove item from container
                var isRemoved = RemoveItemFromContainer(techType);

                if (isRemoved)
                {
                    var canBeStored = deviceStorage.CanBeStored(1, techType);
                    if (canBeStored)
                    {
                        deviceStorage.AddItemToContainer(techType.ToInventoryItem());
                    }
                }
            }
            catch (Exception e)
            {
                QuickLogger.Error <FCSDeepDrillerContainer>(e.Message);
                QuickLogger.Error <FCSDeepDrillerContainer>(e.StackTrace);
            }

            return(true);
        }
Пример #5
0
        private static IEnumerator AddItemToAlterraGen(TechType parkCreatureTechType, IFCSStorage container)
        {
            CoroutineTask <GameObject> task = CraftData.GetPrefabForTechTypeAsync(parkCreatureTechType, false);

            yield return(task);

            GameObject prefab = task.GetResult();

            prefab.SetActive(false);

            while (!container.CanBeStored(1, parkCreatureTechType))
            {
                yield return(new WaitForSecondsRealtime(1));
            }

            GameObject gameObject = GameObject.Instantiate(prefab);

            Pickupable pickupable = gameObject.EnsureComponent <Pickupable>();

#if SUBNAUTICA_EXP
            TaskResult <Pickupable> taskResult = new TaskResult <Pickupable>();
            yield return(pickupable.PickupAsync(taskResult, false));

            pickupable = taskResult.Get();
#else
            pickupable.Pickup(false);
#endif
            container.AddItemToContainer(new InventoryItem(pickupable));

            yield break;
        }
        private static IEnumerator AddItemToAlterraGen(SubRoot subRoot, TechType fishType, IFCSStorage container)
        {
            CoroutineTask <GameObject> task = CraftData.GetPrefabForTechTypeAsync(fishType, false);

            yield return(task);

            GameObject prefab = task.GetResult();

            prefab.SetActive(false);

            int breedCount = 1;

            if (!container.CanBeStored(breedCount, fishType))
            {
                if (QModServices.Main.ModPresent("CyclopsBioReactor"))
                {
                    CBRCompat.TryOverflowIntoCyclopsBioreactors(subRoot, fishType, ref breedCount);
                }

                if (breedCount > 0)
                {
                    Main.TryOverflowIntoBioreactors(subRoot, fishType, ref breedCount);
                }

                yield break;
            }

            if (breedCount == 0)
            {
                yield break;
            }

            GameObject gameObject = GameObject.Instantiate(prefab);
            Pickupable pickupable = gameObject.EnsureComponent <Pickupable>();

#if SUBNAUTICA_EXP
            TaskResult <Pickupable> taskResult = new TaskResult <Pickupable>();
            yield return(pickupable.PickupAsync(taskResult, false));

            pickupable = taskResult.Get();
#else
            pickupable.Pickup(false);
#endif
            container.AddItemToContainer(new InventoryItem(pickupable));

            yield break;
        }
 public void Initialize(FCSController mono, IFCSStorage storage)
 {
     _mono    = mono;
     _storage = storage;
 }