public virtual ORSResourceManager createManagerForVessel(PartModule pm)
        {
            ORSResourceManager megamanager = new ORSResourceManager(pm, resource_name);

            managers.Add(pm.vessel, megamanager);
            return(megamanager);
        }
Beispiel #2
0
        public double consumeFNResourcePerSecond(double power_per_second, String resourcename)
        {
            power_per_second = Math.Max(power_per_second, 0);

            ORSResourceManager manager = getManagerForVessel(resourcename, vessel);

            if (manager == null)
            {
                //UnityEngine.Debug.LogWarning("ORS - did not find manager for vessel");
                return(0);
            }

            if (!fnresource_supplied.ContainsKey(resourcename))
            {
                fnresource_supplied.Add(resourcename, 0);
            }

            double power_taken_per_second = Math.Max(Math.Min(power_per_second, fnresource_supplied[resourcename]), 0);

            fnresource_supplied[resourcename] -= power_taken_per_second;

            manager.powerDrawPerSecond(this, power_per_second, power_taken_per_second);

            return(power_taken_per_second);
        }
Beispiel #3
0
        public double consumeFNResource(double power_fixed, String resourcename)
        {
            power_fixed = Math.Max(power_fixed, 0);

            ORSResourceManager manager = getManagerForVessel(resourcename, vessel);

            if (manager == null)
            {
                //UnityEngine.Debug.LogWarning("ORS - consumeFNResource did not find manager for vessel");
                return(0);
            }

            if (!fnresource_supplied.ContainsKey(resourcename))
            {
                fnresource_supplied.Add(resourcename, 0);
            }

            double power_taken_fixed = Math.Max(Math.Min(power_fixed, fnresource_supplied[resourcename] * TimeWarp.fixedDeltaTime), 0);

            fnresource_supplied[resourcename] -= power_taken_fixed / TimeWarp.fixedDeltaTime;

            manager.powerDrawFixed(this, power_fixed, power_taken_fixed);

            return(power_taken_fixed);
        }
Beispiel #4
0
        public double getResourceBarRatio(String resourcename)
        {
            if (!getOvermanagerForResource(resourcename).hasManagerForVessel(vessel))
            {
                return(0);
            }

            ORSResourceManager manager = getOvermanagerForResource(resourcename).getManagerForVessel(vessel);

            return(manager.getResourceBarRatio());
        }
Beispiel #5
0
        public float getCurrentUnfilledResourceDemand(String resourcename)
        {
            if (!getOvermanagerForResource(resourcename).hasManagerForVessel(vessel))
            {
                return(0);
            }

            ORSResourceManager manager = getOvermanagerForResource(resourcename).getManagerForVessel(vessel);

            return(manager.getCurrentUnfilledResourceDemand());
        }
        public float GetPowerSupply(String resourcename)
        {
            if (!getOvermanagerForResource(resourcename).hasManagerForVessel(vessel))
            {
                return(0);
            }

            ORSResourceManager manager = getOvermanagerForResource(resourcename).getManagerForVessel(vessel);

            return(manager.GetPowerSupply());
        }
        public double GetCurrentResourceDemand(String resourcename)
        {
            if (!getOvermanagerForResource(resourcename).hasManagerForVessel(vessel))
            {
                return(0);
            }

            ORSResourceManager manager = getOvermanagerForResource(resourcename).getManagerForVessel(vessel);

            return(manager.GetCurrentRresourceDemand());
        }
Beispiel #8
0
        public float GetRequiredResourceDemand(String resourcename)
        {
            if (!getOvermanagerForResource(resourcename).hasManagerForVessel(vessel))
            {
                return(0);
            }

            ORSResourceManager manager = getOvermanagerForResource(resourcename).getManagerForVessel(vessel);

            return(manager.GetRequiredResourceDemand());
        }
Beispiel #9
0
        public double getTotalResourceCapacity(String resourcename)
        {
            ORSResourceManager manager = getManagerForVessel(resourcename);

            if (manager == null)
            {
                return(0);
            }

            return(manager.getTotalResourceCapacity());
        }
Beispiel #10
0
        public double getResourceAvailability(String resourcename)
        {
            ORSResourceManager manager = getManagerForVessel(resourcename);

            if (manager == null)
            {
                return(0);
            }

            return(manager.getResourceAvailability());
        }
Beispiel #11
0
        public double getResourceBarRatio(String resourcename)
        {
            ORSResourceManager manager = getManagerForVessel(resourcename);

            if (manager == null)
            {
                return(0);
            }

            return(manager.ResourceBarRatio);
        }
Beispiel #12
0
        public double GetCurrentResourceDemand(String resourcename)
        {
            ORSResourceManager manager = getManagerForVessel(resourcename);

            if (manager == null)
            {
                return(0);
            }

            return(manager.CurrentRresourceDemand);
        }
Beispiel #13
0
        public double GetPowerSupply(String resourcename)
        {
            ORSResourceManager manager = getManagerForVessel(resourcename);

            if (manager == null)
            {
                return(0);
            }

            return(manager.PowerSupply);
        }
Beispiel #14
0
        public double GetRequiredResourceDemand(String resourcename)
        {
            ORSResourceManager manager = getManagerForVessel(resourcename);

            if (manager == null)
            {
                return(0);
            }

            return(manager.GetRequiredResourceDemand());
        }
Beispiel #15
0
        public double getDemandStableSupply(String resourcename)
        {
            ORSResourceManager manager = getManagerForVessel(resourcename);

            if (manager == null)
            {
                return(0);
            }

            return(manager.getDemandStableSupply());
        }
Beispiel #16
0
        public double GetOverproduction(String resourcename)
        {
            ORSResourceManager manager = getManagerForVessel(resourcename);

            if (manager == null)
            {
                return(0);
            }

            return(manager.getOverproduction());
        }
Beispiel #17
0
        public double supplyFNResourcePerSecond(double supply, String resourcename)
        {
            ORSResourceManager manager = getManagerForVessel(resourcename);

            if (manager == null)
            {
                return(0);
            }

            return(manager.powerSupplyPerSecond(this, Math.Max(supply, 0)));
        }
Beispiel #18
0
        public double getTotalResourceCapacity(String resourcename)
        {
            if (!getOvermanagerForResource(resourcename).hasManagerForVessel(vessel))
            {
                return(0);
            }

            ORSResourceManager manager = getOvermanagerForResource(resourcename).getManagerForVessel(vessel);

            return(manager.getTotalResourceCapacity());
        }
Beispiel #19
0
        public double getDemandStableSupply(String resourcename)
        {
            if (!getOvermanagerForResource(resourcename).hasManagerForVessel(vessel))
            {
                return(0);
            }

            ORSResourceManager manager = getOvermanagerForResource(resourcename).getManagerForVessel(vessel);

            return(manager.getDemandStableSupply());
        }
Beispiel #20
0
        public double supplyFNResourceFixedWithMax(double supply, double maxsupply, String resourcename)
        {
            ORSResourceManager manager = getManagerForVessel(resourcename);

            if (manager == null)
            {
                return(0);
            }

            return(manager.powerSupplyFixedWithMax(this, Math.Max(supply, 0), Math.Max(maxsupply, 0)));
        }
Beispiel #21
0
        public double supplyFNResourcePerSecond(double supply, String resourcename)
        {
            ORSResourceManager manager = getManagerForVessel(resourcename, vessel);

            if (manager == null)
            {
                //UnityEngine.Debug.LogWarning("ORS - did not find manager for vessel");
                return(0);
            }

            return(manager.powerSupplyPerSecond(this, Math.Max(supply, 0)));
        }
Beispiel #22
0
        public double supplyManagedFNResourcePerSecondWithMinimumRatio(double supply, double ratio_min, String resourcename)
        {
            ORSResourceManager manager = getManagerForVessel(resourcename, vessel);

            if (manager == null)
            {
                UnityEngine.Debug.LogWarning("ORS - did not find manager for vessel");
                return(0);
            }

            return(manager.managedPowerSupplyPerSecondWithMinimumRatio(this, Math.Max(supply, 0), Math.Max(ratio_min, 0)));
        }
Beispiel #23
0
        public double GetPowerSupply(String resourcename)
        {
            ORSResourceManager manager = getManagerForVessel(resourcename, vessel);

            if (manager == null)
            {
                UnityEngine.Debug.LogWarning("ORS - did not find manager for vessel");
                return(0);
            }

            return(manager.PowerSupply);
        }
Beispiel #24
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);
                }
            }
        }
Beispiel #25
0
        public double getTotalResourceCapacity(String resourcename)
        {
            ORSResourceManager manager = getManagerForVessel(resourcename, vessel);

            if (manager == null)
            {
                UnityEngine.Debug.LogWarning("ORS - did not find manager for vessel");
                return(0);
            }

            return(manager.getTotalResourceCapacity());
        }
Beispiel #26
0
        public double getResourceBarRatio(String resourcename)
        {
            ORSResourceManager manager = getManagerForVessel(resourcename, vessel);

            if (manager == null)
            {
                //UnityEngine.Debug.LogWarning("ORS - getResourceBarRatio did not find manager for vessel");
                return(0);
            }

            return(manager.ResourceBarRatio);
        }
Beispiel #27
0
        public double GetCurrentResourceDemand(String resourcename)
        {
            ORSResourceManager manager = getManagerForVessel(resourcename, vessel);

            if (manager == null)
            {
                UnityEngine.Debug.LogWarning("ORS - did not find manager for vessel");
                return(0);
            }

            return(manager.CurrentRresourceDemand);
        }
Beispiel #28
0
        public double supplyManagedFNResource(double supply, String resourcename)
        {
            supply = Math.Max(supply, 0);
            if (!getOvermanagerForResource(resourcename).hasManagerForVessel(vessel))
            {
                return(0);
            }

            ORSResourceManager manager = getOvermanagerForResource(resourcename).getManagerForVessel(vessel);

            return(manager.managedPowerSupply(this, supply));
        }
Beispiel #29
0
        public double GetOverproduction(String resourcename)
        {
            ORSResourceManager manager = getManagerForVessel(resourcename, vessel);

            if (manager == null)
            {
                UnityEngine.Debug.LogWarning("ORS - did not find manager for vessel");
                return(0);
            }

            return(manager.getOverproduction());
        }
Beispiel #30
0
        public double supplyFNResourceFixedMax(double supply, double maxsupply, String resourcename)
        {
            supply    = Math.Max(supply, 0);
            maxsupply = Math.Max(maxsupply, 0);
            if (!getOvermanagerForResource(resourcename).hasManagerForVessel(vessel))
            {
                return(0);
            }

            ORSResourceManager manager = getOvermanagerForResource(resourcename).getManagerForVessel(vessel);

            return(manager.powerSupplyFixedMax(this, supply, maxsupply));
        }
 public void deleteManager(ORSResourceManager manager) {
     managers.Remove(manager.getVessel());
 }
 public virtual ORSResourceManager createManagerForVessel(PartModule pm) {
     ORSResourceManager megamanager = new ORSResourceManager(pm, resource_name);
     managers.Add(pm.vessel, megamanager);
     return megamanager;
 }