Esempio n. 1
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;
            }
        }
Esempio n. 2
0
        public override void OnFixedUpdate()
        {
            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);
                    print("[ORS] Creating Resource Manager for Vessel " + vessel.GetName() + " (" + resourcename + ")");
                }

                if (resource_manager.PartModule == null || resource_manager.PartModule.vessel != this.vessel || resource_manager.IsUpdatedAtLeastOnce == false)
                {
                    resource_manager.updatePartModule(this);
                    print("[ORS] Updated PartModule of Manager for " + resourcename + "  to " + this.part.partInfo.title);
                }

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

            var priority_manager = getSupplyPriorityManager(this.vessel);

            if (priority_manager.processingPart == null || priority_manager.processingPart.vessel != this.vessel)
            {
                priority_manager.processingPart = this;
            }

            if (priority_manager.processingPart == this)
            {
                priority_manager.UpdateResourceSuppliables(TimeWarp.fixedDeltaTime);
            }
        }