コード例 #1
0
        public void RemoveItselfAsManager()
        {
            foreach (String resourcename in resources_to_supply)
            {
                ORSResourceManager resource_manager = getOvermanagerForResource(resourcename).getManagerForVessel(vessel);

                if (resource_manager != null && resource_manager.PartModule == this)
                {
                    resource_manager.UpdatePartModule(null);
                }
            }
        }
コード例 #2
0
        public override void OnFixedUpdate()
        {
            timeWarpFixedDeltaTime = TimeWarpFixedDeltaTime;

            try
            {
                updateCounter++;

                if (resources_to_supply == null)
                {
                    return;
                }

                foreach (String resourcename in resources_to_supply)
                {
                    ORSResourceManager resource_manager = getOvermanagerForResource(resourcename).getManagerForVessel(vessel);

                    if (resource_manager == null)
                    {
                        resource_manager = createResourceManagerForResource(resourcename);
                        Debug.Log("[KSPI] Creating Resource Manager for Vessel " + vessel.GetName() + " (" + resourcename + ")");
                    }

                    if (resource_manager.PartModule == null || resource_manager.PartModule.vessel != this.vessel || resource_manager.Counter < updateCounter)
                    {
                        resource_manager.UpdatePartModule(this);
                    }

                    if (resource_manager.PartModule == this)
                    {
                        resource_manager.update(updateCounter);
                    }
                }

                var priority_manager = getSupplyPriorityManager(this.vessel);
                if (priority_manager.ProcessingPart == null || priority_manager.ProcessingPart.vessel != this.vessel || priority_manager.Counter < updateCounter)
                {
                    priority_manager.UpdatePartModule(this);
                }

                if (priority_manager.ProcessingPart == this)
                {
                    priority_manager.UpdateResourceSuppliables(updateCounter, timeWarpFixedDeltaTime);
                }
            }
            catch (Exception e)
            {
                Debug.LogError("[KSPI] - Exception in ORSResourceSuppliableModule.OnFixedUpdate " + e.Message);
                throw;
            }
        }