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

            managers.Add(pm.vessel, megamanager);
            return(megamanager);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 4
0
        public double getResourceBarRatio(String resourcename)
        {
            if (!getOvermanagerForResource(resourcename).hasManagerForVessel(vessel))
            {
                return(0);
            }

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

            return(manager.getResourceBarRatio());
        }
Exemplo n.º 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());
        }
Exemplo n.º 8
0
        public float GetRequiredResourceDemand(String resourcename)
        {
            if (!getOvermanagerForResource(resourcename).hasManagerForVessel(vessel))
            {
                return(0);
            }

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

            return(manager.GetRequiredResourceDemand());
        }
Exemplo n.º 9
0
        public double getTotalResourceCapacity(String resourcename)
        {
            ORSResourceManager manager = getManagerForVessel(resourcename);

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

            return(manager.getTotalResourceCapacity());
        }
Exemplo n.º 10
0
        public double getResourceAvailability(String resourcename)
        {
            ORSResourceManager manager = getManagerForVessel(resourcename);

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

            return(manager.getResourceAvailability());
        }
Exemplo n.º 11
0
        public double getResourceBarRatio(String resourcename)
        {
            ORSResourceManager manager = getManagerForVessel(resourcename);

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

            return(manager.ResourceBarRatio);
        }
Exemplo n.º 12
0
        public double GetCurrentResourceDemand(String resourcename)
        {
            ORSResourceManager manager = getManagerForVessel(resourcename);

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

            return(manager.CurrentRresourceDemand);
        }
Exemplo n.º 13
0
        public double GetPowerSupply(String resourcename)
        {
            ORSResourceManager manager = getManagerForVessel(resourcename);

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

            return(manager.PowerSupply);
        }
Exemplo n.º 14
0
        public double GetRequiredResourceDemand(String resourcename)
        {
            ORSResourceManager manager = getManagerForVessel(resourcename);

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

            return(manager.GetRequiredResourceDemand());
        }
Exemplo n.º 15
0
        public double getDemandStableSupply(String resourcename)
        {
            ORSResourceManager manager = getManagerForVessel(resourcename);

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

            return(manager.getDemandStableSupply());
        }
Exemplo n.º 16
0
        public double GetOverproduction(String resourcename)
        {
            ORSResourceManager manager = getManagerForVessel(resourcename);

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

            return(manager.getOverproduction());
        }
Exemplo n.º 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)));
        }
Exemplo n.º 18
0
        public double getTotalResourceCapacity(String resourcename)
        {
            if (!getOvermanagerForResource(resourcename).hasManagerForVessel(vessel))
            {
                return(0);
            }

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

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

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

            return(manager.getDemandStableSupply());
        }
Exemplo n.º 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)));
        }
Exemplo n.º 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)));
        }
Exemplo n.º 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)));
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
                }
            }
        }
Exemplo n.º 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());
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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));
        }
Exemplo n.º 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());
        }
Exemplo n.º 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;
 }