コード例 #1
0
        public void FixedUpdate()
        {
            try
            {
                if (!HighLogic.LoadedSceneIsFlight)
                {
                    return;
                }

                if (!vessel.LandedOrSplashed)
                {
                    return;
                }

                bool hasSkill = LogisticsTools.NearbyCrew(vessel, 500, "LogisticsSkill");

                //Periodic refresh of the warehouses due to vessel change, etc.
                if (Planetarium.GetUniversalTime() > lastWHCheck + CheckFrequency)
                {
                    _warehouseList = null;
                }

                //PlanLog grabs all things attached to this vessel.
                if (_warehouseList == null)
                {
                    _warehouseList = vessel.FindPartModulesImplementing <USI_ModuleResourceWarehouse>();
                }

                if (_warehouseList != null)
                {
                    foreach (var mod in _warehouseList)
                    {
                        if (!mod.soiTransferEnabled)
                        {
                            continue;
                        }

                        var rCount = mod.part.Resources.Count;
                        for (int i = 0; i < rCount; ++i)
                        {
                            var res = mod.part.Resources[i];
                            if (_blackList.Contains(res.resourceName))
                            {
                                continue;
                            }
                            LevelResources(mod.part, res.resourceName, hasSkill);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                print("ERROR IN ModulePlanetaryLogistics -> FixedUpdate: " + ex.StackTrace);
            }
        }
コード例 #2
0
        public void FixedUpdate()
        {
            try
            {
                if (!HighLogic.LoadedSceneIsFlight)
                {
                    return;
                }

                if (!vessel.LandedOrSplashed)
                {
                    return;
                }

                //PlanLog grabs all things attached to this vessel.
                if (_warehouseList == null)
                {
                    _warehouseList = vessel.FindPartModulesImplementing <USI_ModuleResourceWarehouse>();
                }

                if (_warehouseList != null)
                {
                    foreach (var mod in _warehouseList)
                    {
                        bool hasSkill = LogisticsTools.NearbyCrew(vessel, 500, "LogisticsSkill");

                        if (!mod.soiTransferEnabled)
                        {
                            continue;
                        }

                        var rCount = mod.part.Resources.Count;
                        for (int i = 0; i < rCount; ++i)
                        {
                            var res = mod.part.Resources[i];
                            if (_blackList.Contains(res.resourceName))
                            {
                                continue;
                            }
                            LevelResources(mod.part, res.resourceName, hasSkill);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                print("ERROR IN ModulePlanetaryLogistics -> FixedUpdate");
            }
        }