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

            managers.Add(pm.vessel, megamanager);
            return(megamanager);
        }
        public double getSpareResourceCapacity(String resourcename)
        {
            if (!getOvermanagerForResource(resourcename).hasManagerForVessel(vessel))
            {
                return(0);
            }

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

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

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

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

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

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

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

            return(manager.getStableResourceSupply());
        }
        public double supplyFNResource(double supply, String resourcename)
        {
            supply = Math.Max(supply, 0);
            if (!getOvermanagerForResource(resourcename).hasManagerForVessel(vessel))
            {
                return(0);
            }

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

            return(manager.powerSupply(this, supply));
        }
        public double supplyManagedFNResourceWithMinimum(double supply, double rat_min, String resourcename)
        {
            supply  = Math.Max(supply, 0);
            rat_min = Math.Max(rat_min, 0);
            if (!getOvermanagerForResource(resourcename).hasManagerForVessel(vessel))
            {
                return(0);
            }

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

            return(manager.managedPowerSupplyWithMinimum(this, supply, rat_min));
        }
        public float consumeFNResource(double power, String resourcename)
        {
            power = Math.Max(power, 0);
            if (!getOvermanagerForResource(resourcename).hasManagerForVessel(vessel))
            {
                return(0);
            }
            if (!fnresource_supplied.ContainsKey(resourcename))
            {
                fnresource_supplied.Add(resourcename, 0);
            }
            double power_taken = Math.Max(Math.Min(power, fnresource_supplied[resourcename] * TimeWarp.fixedDeltaTime), 0);

            fnresource_supplied[resourcename] -= power_taken;
            ORSX_ResourceManager mega_manager = getOvermanagerForResource(resourcename).getManagerForVessel(vessel);

            mega_manager.powerDraw(this, power);
            return((float)power_taken);
        }
 public void deleteManager(ORSX_ResourceManager manager)
 {
     managers.Remove(manager.getVessel());
 }
Example #10
0
 public void deleteManager(ORSX_ResourceManager manager)
 {
     managers.Remove(manager.getVessel());
 }
Example #11
0
 public virtual ORSX_ResourceManager createManagerForVessel(PartModule pm)
 {
     var megamanager = new ORSX_ResourceManager(pm, resource_name);
     managers.Add(pm.vessel, megamanager);
     return megamanager;
 }