Jump to content

[KSP 1.12.4] On Demand Fuel Cells (ODFC) - 1.2.99.1-prerelease - `<BlackOut>` edition [26 Dec 2022]


zer0Kerbal

Recommended Posts

On 10/8/2019 at 2:12 PM, eightiesboi said:

FYI, I went back and liked the things I couldn't like before. :) Oh, and I added the NRE issue that I posted to the Near Future Electrical forum to Github. 

thank you @reseune .
fixed internally.

 

patch you requested:
:blink:&)

Spoiler

 

// Percolator.cfg v1.2
// On Demand Fuel Cells Refueled
// created: 31 Aug 19
// updated: 09 Oct 19

RESOURCE_DEFINITION
{
    name = JebsCoffee
    displayName = Jeb's Coffee
    density = 0.0010000000
    volume = 1
    hsp = 41830
    unitCost = 0.0008
    color = 0.67, 0.17, 0.17
    flowMode = ALL_VESSEL
    transfer = PUMP
    isTweakable = true
    isVisible = true
    ksparpicon = TriggerTech/KSPAlternateResourcePanel/Icons/ExoticMatter
}

RESOURCE_DEFINITION
{
    name = JebsScones
    displayName = Jeb's Scones
    density = 4.0
    volume = 1
    hsp = 41830
    color = 1.0, 1.0, 1.0
    unitCost = 0.238874700854701
    flowMode = ALL_VESSEL
    transfer = PUMP
    isTweakable = True
    isVisible = true
    ksparpicon = TriggerTech/KSPAlternateResourcePanel/Icons/ExoticMatter
}

@PART[mk1pod]:NEEDS[ODFC]:AFTER[ODFC]
{
    // @name ^= :^:ODFC:
    @cost += 50
    @title ^= :$: <color=#6495ED> ODFC</color>:
    @description ^= :$:<#6495ED><i>ODFC Percolator installed. Beware of hot scones and don't for the love of all that is kerbal - <b>DON'T DRINK THE COFFEE</b></i></color>:
    @mass += 0.001
    @tags ^= :$:  odfc demand jeb coffee scones:

    !MODULE[ModuleResourceConverter] {}
    MODULE:NEEDS[CommunityResourcePack,Snacks]
    {
        name = ODFC
        MODE
        {
            MaxEC = -18
            FUELS
            {
                MonoPropellant = 0.018
                LiquidFuel = 0.02025
                Oxidizer = 0.055
                Snacks = 1.0
                Food = 1.0
            }
            BYPRODUCTS
            {
                JebsScones = 1.0
            }
        }
        MODE
        {
            MaxEC = 18
            FUELS
            {
                LiquidFuel = 0.02025
                Oxidizer = 0.055
            }
        }
        MODE:NEEDS[CommunityResourcePack]
        {
            MaxEC = -428
            FUELS
            {
                Hydrogen = 3.75353458622189
                Oxygen = 2.83903913718094
                LiquidFuel = 0.0017
                Karbonite = 0.0001
                EnrichedUranium = 0.000017
                Antimatter = 0.00000000000000001
                ChargedParticles = 0.00000000000000001
                Salt = 0.045
                CoffeeBeans = 0.0042
            }
            BYPRODUCTS
            {
                JebsCoffee = 0.00303630919748661
            }
        }
        MODE
        {
            MaxEC = 18
            FUELS
            {
                LiquidFuel = 0.00153
                IntakeAir = 0.3672
            }
        }
        MODE:NEEDS[CommunityResourcePack]
        {
            MaxEC = 3.2
            FUELS
            {
                Hydrazine = .00782
                Oxygen = .00591
            }
            BYPRODUCTS
            {
                Water = .00000633
            }
        }
    }

    %RESOURCE[JebsScones]
    {
        &amount = 5
        %amount += 5
        &maxAmount = 5
        %maxAmount += 5
        flowState = False // get your own!
    }

    %RESOURCE[JebsCoffee]
    {
        &amount = 5
        %amount += 5
        &maxAmount = 5
        %maxAmount += 5
        flowState = False // get your own cup!
    }
}

// CC BY-NC-SA-4.0
// zer0Kerbal

 

 

Edited by zer0Kerbal
Link to comment
Share on other sites

7 hours ago, zer0Kerbal said:

thank you @reseune .
fixed internally.

 

patch you requested:
:blink:&)

  Reveal hidden contents

 

// Percolator.cfg v1.2
// On Demand Fuel Cells Refueled
// created: 31 Aug 19
// updated: 09 Oct 19

RESOURCE_DEFINITION
{
    name = JebsCoffee
    displayName = Jeb's Coffee
    density = 0.0010000000
    volume = 1
    hsp = 41830
    unitCost = 0.0008
    color = 0.67, 0.17, 0.17
    flowMode = ALL_VESSEL
    transfer = PUMP
    isTweakable = true
    isVisible = true
    ksparpicon = TriggerTech/KSPAlternateResourcePanel/Icons/ExoticMatter
}

RESOURCE_DEFINITION
{
    name = JebsScones
    displayName = Jeb's Scones
    density = 4.0
    volume = 1
    hsp = 41830
    color = 1.0, 1.0, 1.0
    unitCost = 0.238874700854701
    flowMode = ALL_VESSEL
    transfer = PUMP
    isTweakable = True
    isVisible = true
    ksparpicon = TriggerTech/KSPAlternateResourcePanel/Icons/ExoticMatter
}

@PART[mk1pod]:NEEDS[ODFC,KGEx/JatwaaDemolitionsCo]:AFTER[ODFC]
{
    // @name ^= :^:ODFC:
    @cost += 50
    @title ^= :$: <color=#6495ED> ODFC</color>:
    @description ^= :$:<#6495ED><i>ODFC Percolator installed. Beware of hot scones and don't for the love of all that is kerbal - <b>DON'T DRINK THE COFFEE</b></i></color>:
    @mass += 0.001
    @tags ^= :$:  odfc demand jeb coffee scones:

    !MODULE[ModuleResourceConverter] {}
    MODULE:NEEDS[CommunityResourcePack]
    {
        name = ODFC
        MODE
        {
            MaxEC = -18
            FUELS
            {
                MonoPropellant = 0.018
                LiquidFuel = 0.02025
                Oxidizer = 0.055
                Snacks = 1.0
                Food = 1.0
            }
            BYPRODUCTS
            {
                JebsScones = 1.0
            }
        }
        MODE
        {
            MaxEC = 18
            FUELS
            {
                LiquidFuel = 0.02025
                Oxidizer = 0.055
            }
        }
        MODE:NEEDS[CommunityResourcePack]
        {
            MaxEC = -428
            FUELS
            {
                Hydrogen = 3.75353458622189
                Oxygen = 2.83903913718094
                LiquidFuel = 0.0017
                Karbonite = 0.0001
                EnrichedUranium = 0.000017
                Antimatter = 0.00000000000000001
                ChargedParticles = 0.00000000000000001
                Salt = 0.045
                CoffeeBeans = 0.0042
            }
            BYPRODUCTS
            {
                JebsCoffee = 0.00303630919748661
            }
        }
        MODE
        {
            MaxEC = 18
            FUELS
            {
                LiquidFuel = 0.00153
                IntakeAir = 0.3672
            }
        }
        MODE:NEEDS[CommunityResourcePack]
        {
            MaxEC = 3.2
            FUELS
            {
                Hydrazine = .00782
                Oxygen = .00591
            }
            BYPRODUCTS
            {
                Water = .00000633
            }
        }
    }

    %RESOURCE[JebsScones]
    {
        &amount = 5
        %amount += 5
        &maxAmount = 5
        %maxAmount += 5
        flowState = False // get your own!
    }

    %RESOURCE[JebsCoffee]
    {
        &amount = 5
        %amount += 5
        &maxAmount = 5
        %maxAmount += 5
        flowState = False // get your own cup!
    }
}

// CC BY-NC-SA-4.0
// zer0Kerbal

 

 

You are freaking awesome! :lol:&)

Link to comment
Share on other sites

  • 1 month later...

So is this mod only for PODS? Can it be used to keep my mining station batteries up to power and switch back and forth to solar reliance? I have used some other mods but they keep running the Fuel cells non-stop once they have been activated and never deactivate once solar power kicks in. Does this mod do that?

If so. I am ecstatic! lol

Thank you.

Edited by B15hop
Link to comment
Share on other sites

On 11/17/2019 at 11:27 PM, B15hop said:

So is this mod only for PODS? Can it be used to keep my mining station batteries up to power and switch back and forth to solar reliance? I have used some other mods but they keep running the Fuel cells non-stop once they have been activated and never deactivate once solar power kicks in. Does this mod do that?

If so. I am ecstatic! lol

Thank you.

This mod can be used (installed) into any part - just have to either modify the part.cfg or use a module manager patch to add it.

It should work the way you want - and in fact that is how it is designed. However, does not work in the background - something I am working on hopefully in the new year (after tweakscale and B9).

This mod allows you to set two things:

  1. at what point do you want the fuel cell to turn on/off? (% of vessel's total EC)
  2. how much EC do you want it to produce (from 100% of its capicity down to 5%)

Hope that answers your question @B15hop.

 

ps - tagging me will get faster responses. :)

pss - I have been really busy in real life, and hopefully things will settle down in a couple of weeks. We are '' this close to getting ODFC to work with TweakScale.

 

psss - this mod has patches to add it into stock (and other) fuel cell parts.

Edited by zer0Kerbal
Link to comment
Share on other sites

19 hours ago, zer0Kerbal said:

This mod can be used (installed) into any part - just have to either modify the part.cfg or use a module manager patch to add it.

It should work the way you want - and in fact that is how it is designed. However, does not work in the background - something I am working on hopefully in the new year (after tweakscale and B9).

This mod allows you to set two things:

  1. at what point do you want the fuel cell to turn on/off? (% of vessel's total EC)
  2. how much EC do you want it to produce (from 100% of its capicity down to 5%)

Hope that answers your question @B15hop.

 

ps - tagging me will get faster responses. :)

pss - I have been really busy in real life, and hopefully things will settle down in a couple of weeks. We are '' this close to getting ODFC to work with TweakScale.

 

psss - this mod has patches to add it into stock (and other) fuel cell parts.

Well that is just awesome. Thank you very much for the clarifications. :D

Link to comment
Share on other sites

On Demand Fuel Cells Refueled (ODFCr)

ODFC version 1.2.0.0 For KSP 1.8.1 CKAN Indexed CC 4.0 BY-NC-SA

v.1.2.0.0 - To Go Boldly (KSP 1.8.1 + .NET Framework 4.8)

  • update to .NET Framework 4.8
  • update to Kerbal Space Program (KSP) 1.8.1
  • update .csproj: Reference Include="$(DevDir)\KSP_x64_Data\Managed\UnityEngine*.dll" /
  • now can enter numbers instead of using slider by using the # on PAW
  • recompile for KSP 1.8.1

Known Issue Tracker

  • [BUG 1.1.2.1a] AmpYear doesn't seem to recognize ODFC
  • [BUG 1.1.2.0a] TweakScale will not scale module ODFC
  • [BUG 0.0.1.9a] B9 module swapping - needs onLoad etc update to make work
  • [BUG 0.0.1.9b] next fuel mode should not be visible when only one mode
  • [BUG 0.0.1.6a] Does not seeming work with BackgroundProcessing or Background Resources mods (being looked at) (so ODFC doesn't work when doesn't have focus). Should not have both BackgroundProcessing and BackgroundResources installed.
  • [BUG 1.1.2.0b] Kerbalism doesn't recognize ODFC, ODFC still functions correctly

Kerbal Space Program 1.8.1
.NET Framework 4.8

Edited by zer0Kerbal
Link to comment
Share on other sites

  • 1 month later...

ODFC update:

work continues - and almost ready to release next version.

No timeline.

Already working on the next features and here are two of the requests (besides localization):

Spoiler
  • HotStandby mode/status. OFF until lower threshold reached, then maxON until upper threshold, then OFF
    • could be setup in PAW/part.cfg
    • could also be set in settings
    • uses existing slider or use new?
  • Delay in startup
    • SpoolUpDelay =
    • would need to be setup in part.cfg in MODE{}
    • universal delay in settings/difficulties
    • in theory should be straightforward to implement; just an if (options) countdown...
    • a little beyond what I know how to do due to timing code

@Lisias

 

Edited by zer0Kerbal
Link to comment
Share on other sites

  • 1 month later...

Great idea!  Sorry if I missed this in the OP, but does this mod throw up a warning when a non focused spacecraft switches to fuel cell backup?  I noticed you mentioned not using multiple background processing mods.  My luck is that my kerbal would switch to fuel cell backup, but by the time I noticed the fuel cell backup would have needed a fuel cell backup-backup.

Link to comment
Share on other sites

8 hours ago, Probus said:

Great idea!  Sorry if I missed this in the OP, but does this mod throw up a warning when a non focused spacecraft switches to fuel cell backup?  I noticed you mentioned not using multiple background processing mods.  My luck is that my kerbal would switch to fuel cell backup, but by the time I noticed the fuel cell backup would have needed a fuel cell backup-backup.

it doesn't - but what are you looking for? screen message? in game mail? would only work for loading ODFC modules (those in physics range (~2.4km))

and I understand. *chuckle* that is one of the nice things about this - it shuts itself off when it reaches a certain user-settable threshold. But if the occupants decide to leave the stove on....

 

I suggest making your way to the GitHub repo and making a feature request. This one should be *knocking on wood* relatively easy and straightforward.

UPDATE:
Next version is still in the works. Just trying to get one more big bug squished/swatted.

Link to comment
Share on other sites

  • 1 month later...
20 hours ago, gamerscircle said:

Do I need a patch for using this plugin with Restock?  I did read through the forums and I saw that there was patches in CKAN, but they send me right back here and wasn't sure where this information might have been displayed.

thanks,
GamersCircle

This mod has nothing to do with ReStock/ReStock+.

This mod consists of two parts - the actual add-on (the .dll) and the Module Manager patches to implement the .dll.

The patches convert part that have stock fuel cells to use ODFC instead. Not all, but many. The patches either modify existing parts, or copy the parts and modify the copies (or both).

Hope that helps.

PS - @gamerscircle should ping the person you are asking - that is why I didn't see this right away.

Link to comment
Share on other sites

Hey there @zer0Kerbal - you are correct, I should have pinged you.  I did read that this was just a plugin, but since I am new to using restock and had to get some community extensions for another mod, so I figured I should ask just to make sure.

I appreciate this idea of the mod, just putting a new save together to stream and I am looking for options. :)  Again thank you

Link to comment
Share on other sites

4 hours ago, gamerscircle said:

Hey there @zer0Kerbal - you are correct, I should have pinged you.  I did read that this was just a plugin, but since I am new to using restock and had to get some community extensions for another mod, so I figured I should ask just to make sure.

I appreciate this idea of the mod, just putting a new save together to stream and I am looking for options. :)  Again thank you

:D asking is fine. I appreciate questions, answers, feedback, even an occasional tango or  ha-cha-cha!

I secretly keep a (somewhat) updated list of great mods on my SpaceDock profile - plus the only mods I follow are the ones I have (or will be) adopted(ing).

happy streaming!

mods by

@zer0Kerbal

 

 

Link to comment
Share on other sites

  • 1 year later...
3 hours ago, Ender65535 said:

Hi @zer0Kerbal

We have talked in the automatic fuel cell thread. You mentioned that you may be able to make the fuel choice (for EC) more flexible and smart ?

you had mentioned a specific fuel - what are the fuels, byproducts, and the ratio of  consumption/production? which mod is it for and for which parts?

I can help you write a patch for it.

Link to comment
Share on other sites

21 hours ago, zer0Kerbal said:

you had mentioned a specific fuel - what are the fuels, byproducts, and the ratio of  consumption/production? which mod is it for and for which parts?

I can help you write a patch for it.

It uses liquid hydrogen and oxidizer to generate EC and water. It's actually part of the cryo tank mod of near future series. Not documented, but source code is here

https://github.com/post-kerbin-mining-corporation/CryoTanks/blob/871f7e9c454fd6a007a645bdd082f86e4efc5aec/GameData/CryoTanks/Patches/CryoTanksFuelCells.cfg

 

Not a modder, but wouldn't it be more elegant to just try importing every ModuleResourceConverter that generates EC at game start? That sounds better than hard code everything and write a separate patch for each mod.

Edited by Ender65535
Link to comment
Share on other sites

6 hours ago, Ender65535 said:

It uses liquid hydrogen and oxidizer to generate EC and water. It's actually part of the cryo tank mod of near future series. Not documented, but source code is here

https://github.com/post-kerbin-mining-corporation/CryoTanks/blob/871f7e9c454fd6a007a645bdd082f86e4efc5aec/GameData/CryoTanks/Patches/CryoTanksFuelCells.cfg

Here is the updated StockFuelCells.cfg patch (modify)

Spoiler

// StockFuelCells.cfg v1.2.2.0
// On Demand Fuel Cells (ODFC)
// created: 13 Aug 19
// updated: 10 Jun 2021

@PART[FuelCell,FuelCellArray]:NEEDS[ODFC]:FOR[ODFC]
{
	@cost += 50
	@title ^= :$: <color=#6495ED> ODFC</color>:
	@description ^= :(.)$:$0\n<#6495ED><i>ODFC installed.</i></color>:
	@mass += 0.001
	@tags ^= :$: odfc demand:

	!MODULE[ModuleResourceConverter] {}
	MODULE,0
	{
		name = ODFC
		//scaleFactor = 1
		// threshold = 0.33
		// rateLimit = 0.75
		// fuelCellIsEnabled = false
		// fuelMode = 2
		MODE
		{
			name = MP
			MaxEC = 1.0
			FUELS
			{
				MonoPropellant = 0.001
			}
		}
		MODE
		{
			name = LFO
			MaxEC = 1.0
			FUELS
			{
				LiquidFuel = 0.001125
				Oxidizer = 0.0030555555555556
			}
		}
		MODE
		{
			name = LFIA
			MaxEC = 1.0
			FUELS
			{
				LiquidFuel = 0.000085
				IntakeAir = 0.0204
			}
		}
		MODE:NEEDS[CommunityResourcePack]
		{
			name = H2OW
			MaxEC = 1.0
			FUELS
			{
				Hydrogen = 0.20852969923455
				Oxygen = 0.1577243965100526
			}
			BYPRODUCTS
			{
				Water = 0.0001686838444
			}
		}
		MODE:NEEDS[CryoTanks]
		{
			name = LH2O
			MaxEC = 1.0
			FUELS
			{
				LqdHydrogen = 0.02063
				Oxidizer = 0.00138
			}
			BYPRODUCTS
			{
				Water = 0.00773
			}
		}
		MODE:NEEDS[CommunityResourcePack]
		{
			name = Hydrazine
			MaxEC = 1.0
			FUELS
			{
				Hydrazine = 0.01564
				Oxygen = 0.01182
			}
			BYPRODUCTS
			{
				Water = 0.00001266
			}
		}
	}
}

@PART[FuelCell]:NEEDS[ODFC]:AFTER[ODFC]
{
	@MODULE[ODFC]
	{
		@MODE[MP]
		{
			@MaxEC *= 5
			@FUELS
			{
				@MonoPropellant *= 5
			}
		}
		@MODE[LFO]
		{
			@MaxEC *= 5
			@FUELS
			{
				@LiquidFuel *= 5
				@Oxidizer *= 5
			}
		}
		@MODE[LFIA]
		{
			@MaxEC *= 5
			@FUELS
			{
				@LiquidFuel *= 5
				@IntakeAir *= 5
			}
		}
		@MODE[H2OW]:NEEDS[CommunityResourcePack]
		{
			@MaxEC *= 5
			@FUELS
			{
				@Hydrogen *= 5
				@Oxygen *= 5
			}
			@BYPRODUCTS
			{
				@Water *= 5
			}
		}
		@MODE[LH2O]:NEEDS[CryoTanks]
		{
			@MaxEC *= 1.5
			@FUELS
			{
				@LqdHydrogen *= 1.5
				@Oxidizer *= 1.5
			}
			@BYPRODUCTS
			{
				@Water *= 1.5
			}
		}
		@MODE[Hydrazine]:NEEDS[CommunityResourcePack]
		{
			@MaxEC *= 5
			@FUELS
			{
				@Hydrazine *= 5
				@Oxygen *= 5
			}
			@BYPRODUCTS
			{
				@Water *= 5
			}
		}
	}
}

@PART[FuelCellArray]:NEEDS[ODFC]:AFTER[ODFC]
{
	@MODULE[ODFC]
	{
		@MODE[MP]
		{
			@MaxEC *= 32
			@FUELS
			{
				@MonoPropellant *= 32
			}
		}
		@MODE[LFO]
		{
			@MaxEC *= 32
			@FUELS
			{
				@LiquidFuel *= 32
				@Oxidizer *= 32
			}
		}
		@MODE[LFIA]
		{
			@MaxEC *= 32
			@FUELS
			{
				@LiquidFuel *= 32
				@IntakeAir *= 32
			}
		}
		@MODE[H2OW]:NEEDS[CommunityResourcePack]
		{
			@MaxEC *= 32
			@FUELS
			{
				@Hydrogen *= 32
				@Oxygen *= 32
			}
			@BYPRODUCTS
			{
				@Water *= 32
			}
		}
		@MODE[LH2O]:NEEDS[CommunityResourcePack]
		{
			@MaxEC *= 18
			@FUELS
			{
				@LqdHydrogen *= 18
				@Oxidizer *= 18
			}
			@BYPRODUCTS
			{
				@Water *= 18
			}
		}
		@MODE[Hydrazine]:NEEDS[CommunityResourcePack]
		{
			@MaxEC *= 32
			@FUELS
			{
				@Hydrazine *= 32
				@Oxygen *= 32
			}
			@BYPRODUCTS
			{
				@Water *= 32
			}
		}
	}
}
// GPLv2
// zer0Kerbal

 

 

6 hours ago, Ender65535 said:

Not a modder, but wouldn't it be more elegant to just try importing every ModuleResourceConverter that generates EC at game start? That sounds better than hard code everything and write a separate patch for each mod.

It would be - and I have thought about changing to that method for the next release.  The reason for it has always been choices. Some players just want certain ones converted over - like Kerbalism players (or so I've heard).

 

Link to comment
Share on other sites

On 6/10/2021 at 2:53 AM, zer0Kerbal said:

Here is the updated StockFuelCells.cfg patch (modify)

  Reveal hidden contents


// StockFuelCells.cfg v1.2.2.0
// On Demand Fuel Cells (ODFC)
// created: 13 Aug 19
// updated: 10 Jun 2021

@PART[FuelCell,FuelCellArray]:NEEDS[ODFC]:FOR[ODFC]
{
	@cost += 50
	@title ^= :$: <color=#6495ED> ODFC</color>:
	@description ^= :(.)$:$0\n<#6495ED><i>ODFC installed.</i></color>:
	@mass += 0.001
	@tags ^= :$: odfc demand:

	!MODULE[ModuleResourceConverter] {}
	MODULE,0
	{
		name = ODFC
		//scaleFactor = 1
		// threshold = 0.33
		// rateLimit = 0.75
		// fuelCellIsEnabled = false
		// fuelMode = 2
		MODE
		{
			name = MP
			MaxEC = 1.0
			FUELS
			{
				MonoPropellant = 0.001
			}
		}
		MODE
		{
			name = LFO
			MaxEC = 1.0
			FUELS
			{
				LiquidFuel = 0.001125
				Oxidizer = 0.0030555555555556
			}
		}
		MODE
		{
			name = LFIA
			MaxEC = 1.0
			FUELS
			{
				LiquidFuel = 0.000085
				IntakeAir = 0.0204
			}
		}
		MODE:NEEDS[CommunityResourcePack]
		{
			name = H2OW
			MaxEC = 1.0
			FUELS
			{
				Hydrogen = 0.20852969923455
				Oxygen = 0.1577243965100526
			}
			BYPRODUCTS
			{
				Water = 0.0001686838444
			}
		}
		MODE:NEEDS[CryoTanks]
		{
			name = LH2O
			MaxEC = 1.0
			FUELS
			{
				LqdHydrogen = 0.02063
				Oxidizer = 0.00138
			}
			BYPRODUCTS
			{
				Water = 0.00773
			}
		}
		MODE:NEEDS[CommunityResourcePack]
		{
			name = Hydrazine
			MaxEC = 1.0
			FUELS
			{
				Hydrazine = 0.01564
				Oxygen = 0.01182
			}
			BYPRODUCTS
			{
				Water = 0.00001266
			}
		}
	}
}

@PART[FuelCell]:NEEDS[ODFC]:AFTER[ODFC]
{
	@MODULE[ODFC]
	{
		@MODE[MP]
		{
			@MaxEC *= 5
			@FUELS
			{
				@MonoPropellant *= 5
			}
		}
		@MODE[LFO]
		{
			@MaxEC *= 5
			@FUELS
			{
				@LiquidFuel *= 5
				@Oxidizer *= 5
			}
		}
		@MODE[LFIA]
		{
			@MaxEC *= 5
			@FUELS
			{
				@LiquidFuel *= 5
				@IntakeAir *= 5
			}
		}
		@MODE[H2OW]:NEEDS[CommunityResourcePack]
		{
			@MaxEC *= 5
			@FUELS
			{
				@Hydrogen *= 5
				@Oxygen *= 5
			}
			@BYPRODUCTS
			{
				@Water *= 5
			}
		}
		@MODE[LH2O]:NEEDS[CryoTanks]
		{
			@MaxEC *= 1.5
			@FUELS
			{
				@LqdHydrogen *= 1.5
				@Oxidizer *= 1.5
			}
			@BYPRODUCTS
			{
				@Water *= 1.5
			}
		}
		@MODE[Hydrazine]:NEEDS[CommunityResourcePack]
		{
			@MaxEC *= 5
			@FUELS
			{
				@Hydrazine *= 5
				@Oxygen *= 5
			}
			@BYPRODUCTS
			{
				@Water *= 5
			}
		}
	}
}

@PART[FuelCellArray]:NEEDS[ODFC]:AFTER[ODFC]
{
	@MODULE[ODFC]
	{
		@MODE[MP]
		{
			@MaxEC *= 32
			@FUELS
			{
				@MonoPropellant *= 32
			}
		}
		@MODE[LFO]
		{
			@MaxEC *= 32
			@FUELS
			{
				@LiquidFuel *= 32
				@Oxidizer *= 32
			}
		}
		@MODE[LFIA]
		{
			@MaxEC *= 32
			@FUELS
			{
				@LiquidFuel *= 32
				@IntakeAir *= 32
			}
		}
		@MODE[H2OW]:NEEDS[CommunityResourcePack]
		{
			@MaxEC *= 32
			@FUELS
			{
				@Hydrogen *= 32
				@Oxygen *= 32
			}
			@BYPRODUCTS
			{
				@Water *= 32
			}
		}
		@MODE[LH2O]:NEEDS[CommunityResourcePack]
		{
			@MaxEC *= 18
			@FUELS
			{
				@LqdHydrogen *= 18
				@Oxidizer *= 18
			}
			@BYPRODUCTS
			{
				@Water *= 18
			}
		}
		@MODE[Hydrazine]:NEEDS[CommunityResourcePack]
		{
			@MaxEC *= 32
			@FUELS
			{
				@Hydrazine *= 32
				@Oxygen *= 32
			}
			@BYPRODUCTS
			{
				@Water *= 32
			}
		}
	}
}
// GPLv2
// zer0Kerbal

 

 

It would be - and I have thought about changing to that method for the next release.  The reason for it has always been choices. Some players just want certain ones converted over - like Kerbalism players (or so I've heard).

 

The conversion ratio is still a bit off, otherwise it works perfectly, thanks!

 

Do you have plan to merge this into next release?

 

 

I could not think of why anyone would want it hardcoded rather than auto-update? Or maybe you could make separate parts that one is auto-import and another is hardcoded? Just curious.

 

Thanks again for this excellent mod

Link to comment
Share on other sites

2 hours ago, Ender65535 said:

The conversion ratio is still a bit off, otherwise it works perfectly, thanks!

@Ender65535welcome!

what numbers would fix it? I copied them exactly from the patch supplied (just converted from 1.5 to 1 then multiplied to match existing EC supplied)

2 hours ago, Ender65535 said:

Do you have plan to merge this into next release?

Yes - in fact I am planning on just including the patches; with the modify versions on by default, and the copy included and off by default.

Am in the process of updating all the patches to use this new format. Adds some patches, but much easier to adapt to different parts without having to use a spreadsheet to convert consumption::production ratios. :D

 

Link to comment
Share on other sites

On 6/12/2021 at 5:22 PM, zer0Kerbal said:

@Ender65535welcome!

what numbers would fix it? I copied them exactly from the patch supplied (just converted from 1.5 to 1 then multiplied to match existing EC supplied)

Yes - in fact I am planning on just including the patches; with the modify versions on by default, and the copy included and off by default.

Am in the process of updating all the patches to use this new format. Adds some patches, but much easier to adapt to different parts without having to use a spreadsheet to convert consumption::production ratios. :D

 

Here is what looks like in game.

vVUtEdl.png

F5F6why.png

Mo25w5O.png

Link to comment
Share on other sites

4 hours ago, Ender65535 said:

Here is what looks like in game.

something is confusing me - 

the EC production (and therefor the autoscaling of inputs/outputs) for the Stock Fuel Cell is 5 ec/sec and the Stock Fuel Cell Array is 32 ec/sec but I am seeing 1.5 and 18

 

I had to look at the patch I provided - here is the most recent version:

Spoiler



// StockFuelCells.cfg v1.2.2.1
// On Demand Fuel Cells (ODFC)
// created: 13 Aug 19
// updated: 16 Jun 2021

@PART[FuelCell,FuelCellArray]:NEEDS[ODFC]:FOR[ODFC]
{
	@cost += 50
	@title ^= :$: <color=#6495ED> ODFC</color>:
	@description ^= :(.)$:$0\n<#6495ED><i>ODFC installed.</i></color>:
	@mass += 0.001
	@tags ^= :$: odfc demand:

	!MODULE[ModuleResourceConverter] {}
	MODULE,0
	{
		name = ODFC
		ODFCMaxEC = 1.0
		// scaleFactor = 1
		// threshold = 0.33
		// rateLimit = 0.75
		// fuelCellIsEnabled = false
		// fuelMode = 2
		MODE
		{
			name = MP
			MaxEC = 1.0
			FUELS
			{
				MonoPropellant = 0.001
			}
		}
		MODE
		{
			name = LFO
			MaxEC = 1.0
			FUELS
			{
				LiquidFuel = 0.001125
				Oxidizer = 0.0030555555555556
			}
		}
		MODE
		{
			name = LFIA
			MaxEC = 1.0
			FUELS
			{
				LiquidFuel = 0.000085
				IntakeAir = 0.0204
			}
		}
		MODE:NEEDS[CommunityResourcePack]
		{
			name = H2OW
			MaxEC = 1.0
			FUELS
			{
				Hydrogen = 0.20852969923455
				Oxygen = 0.1577243965100526
			}
			BYPRODUCTS
			{
				Water = 0.0001686838444
			}
		}
		MODE:NEEDS[CryoTanks]
		{
			name = LH2O
			MaxEC = 1.0
			FUELS
			{
				LqdHydrogen = 0.020625 //0.02063
				Oxidizer = 0.001375 // 0.00138
			}
			BYPRODUCTS
			{
				Water = 0.00773
			}
		}
		MODE:NEEDS[CommunityResourcePack]
		{
			name = Hydrazine
			MaxEC = 1.0
			FUELS
			{
				Hydrazine = 0.01564
				Oxygen = 0.01182
			}
			BYPRODUCTS
			{
				Water = 0.00001266
			}
		}
	}
}

@PART[FuelCell]:NEEDS[ODFC]:AFTER[ODFC]
{
@MODULE[ODFC]
	{
		ODFCMaxEC = 5
		@MODE[MP]
		{
			@MaxEC = #$../ODFCMaxEC$
			@FUELS
			{
				@MonoPropellant *= #$../MaxEC$
			}
		}
		@MODE[LFO]
		{
			@MaxEC =#$../ODFCMaxEC$
			@FUELS
			{
				@LiquidFuel *= #$../MaxEC$
				@Oxidizer *= #$../MaxEC$
			}
		}
		@MODE[LFIA]
		{
			@MaxEC = #$../ODFCMaxEC$
			@FUELS
			{
				@LiquidFuel *= #$../MaxEC$
				@IntakeAir *= #$../MaxEC$
			}
		}
		@MODE[H2OW]:NEEDS[CommunityResourcePack]
		{
			@MaxEC = #$../ODFCMaxEC$
			@FUELS
			{
				@Hydrogen *= #$../MaxEC$
				@Oxygen *= #$../MaxEC$
			}
			@BYPRODUCTS
			{
				@Water *= #$../MaxEC$
			}
		}
		@MODE[LH2O]:NEEDS[CryoTanks]
		{
			@MaxEC = #$../ODFCMaxEC$
			@FUELS
			{
				@LqdHydrogen *= #$../MaxEC$
				@Oxidizer *= #$../MaxEC$
			}
			@BYPRODUCTS
			{
				@Water *= #$../MaxEC$
			}
		}
		@MODE[Hydrazine]:NEEDS[CommunityResourcePack]
		{
			@MaxEC = #$../ODFCMaxEC$
			@FUELS
			{
				@Hydrazine *= #$../MaxEC$
				@Oxygen *= #$../MaxEC$
			}
			@BYPRODUCTS
			{
				@Water *= #$../MaxEC$
			}
		}
		!ODFCMaxEC = dummy // clean up
	}
	
	@RESOURCE[electricCharge]
	{
		&amount = 5
		%maxAmount = #$amount$
		flowState = False
	}

	@RESOURCE[MonoPropellant]
	{
		&amount = 5
		%maxAmount = #$amount$
		%maxAmount += 5
	}
}

@PART[FuelCellArray]:NEEDS[ODFC]:AFTER[ODFC]
{
	@MODULE[ODFC]
	{
		ODFCMaxEC = 32
		@MODE[MP]
		{
			@MaxEC = #$../ODFCMaxEC$
			@FUELS
			{
				@MonoPropellant *= #$../MaxEC$
			}
		}
		@MODE[LFO]
		{
			@MaxEC =#$../ODFCMaxEC$
			@FUELS
			{
				@LiquidFuel *= #$../MaxEC$
				@Oxidizer *= #$../MaxEC$
			}
		}
		@MODE[LFIA]
		{
			@MaxEC = #$../ODFCMaxEC$
			@FUELS
			{
				@LiquidFuel *= #$../MaxEC$
				@IntakeAir *= #$../MaxEC$
			}
		}
		@MODE[H2OW]:NEEDS[CommunityResourcePack]
		{
			@MaxEC = #$../ODFCMaxEC$
			@FUELS
			{
				@Hydrogen *= #$../MaxEC$
				@Oxygen *= #$../MaxEC$
			}
			@BYPRODUCTS
			{
				@Water *= #$../MaxEC$
			}
		}
		@MODE[LH2O]:NEEDS[CryoTanks]
		{
			@MaxEC = #$../ODFCMaxEC$
			@FUELS
			{
				@LqdHydrogen *= #$../MaxEC$
				@Oxidizer *= #$../MaxEC$
			}
			@BYPRODUCTS
			{
				@Water *= #$../MaxEC$
			}
		}
		@MODE[Hydrazine]:NEEDS[CommunityResourcePack]
		{
			@MaxEC = #$../ODFCMaxEC$
			@FUELS
			{
				@Hydrazine *= #$../MaxEC$
				@Oxygen *= #$../MaxEC$
			}
			@BYPRODUCTS
			{
				@Water *= #$../MaxEC$
			}
		}
		!ODFCMaxEC = dummy // clean up
	}
	
	@RESOURCE[electricCharge]
	{
		&amount = 32
		%maxAmount = #$amount$
		flowState = False
	}

	@RESOURCE[MonoPropellant]
	{
		&amount = 15
		%maxAmount = #$amount$
		%maxAmount += 5
	}
}
// GPLv2
// zer0Kerbal

 

seems I messed up the math. took the values from the cryo patch and divided by 1.5 and also by 18 (two patches). the results came out the same, but somehow the numbers for LqdHydrogen and Oxidizer don't match the math. Fixed.

		MODE:NEEDS[CryoTanks]
		{
			name = LH2O
			MaxEC = 1.0
			FUELS
			{
				LqdHydrogen = 0.020625 // this was set to --> 0.02063
				Oxidizer = 0.001375 // this was set to --> 0.00138
			}
			BYPRODUCTS
			{
				Water = 0.00773
			}
		}

my apologies. good catch!

It looks like the calculator I was using rounded up; I should have caught that.

the other major change to this patch is it now fully cascade updates; so only have to set the $ODFCMaxEC$ in the specific part patch (not the initial patch) to set all the ratios. So now all modes in the Fuel Cell produce/consume at the 5 ec/sec rate; and the Fuel Cell Array has all modes produce/consume for the 32 ec/sec.

Edited by zer0Kerbal
Link to comment
Share on other sites

On 6/16/2021 at 11:50 PM, zer0Kerbal said:

something is confusing me - 

the EC production (and therefor the autoscaling of inputs/outputs) for the Stock Fuel Cell is 5 ec/sec and the Stock Fuel Cell Array is 32 ec/sec but I am seeing 1.5 and 18

 

I had to look at the patch I provided - here is the most recent version:

  Reveal hidden contents




// StockFuelCells.cfg v1.2.2.1
// On Demand Fuel Cells (ODFC)
// created: 13 Aug 19
// updated: 16 Jun 2021

@PART[FuelCell,FuelCellArray]:NEEDS[ODFC]:FOR[ODFC]
{
	@cost += 50
	@title ^= :$: <color=#6495ED> ODFC</color>:
	@description ^= :(.)$:$0\n<#6495ED><i>ODFC installed.</i></color>:
	@mass += 0.001
	@tags ^= :$: odfc demand:

	!MODULE[ModuleResourceConverter] {}
	MODULE,0
	{
		name = ODFC
		ODFCMaxEC = 1.0
		// scaleFactor = 1
		// threshold = 0.33
		// rateLimit = 0.75
		// fuelCellIsEnabled = false
		// fuelMode = 2
		MODE
		{
			name = MP
			MaxEC = 1.0
			FUELS
			{
				MonoPropellant = 0.001
			}
		}
		MODE
		{
			name = LFO
			MaxEC = 1.0
			FUELS
			{
				LiquidFuel = 0.001125
				Oxidizer = 0.0030555555555556
			}
		}
		MODE
		{
			name = LFIA
			MaxEC = 1.0
			FUELS
			{
				LiquidFuel = 0.000085
				IntakeAir = 0.0204
			}
		}
		MODE:NEEDS[CommunityResourcePack]
		{
			name = H2OW
			MaxEC = 1.0
			FUELS
			{
				Hydrogen = 0.20852969923455
				Oxygen = 0.1577243965100526
			}
			BYPRODUCTS
			{
				Water = 0.0001686838444
			}
		}
		MODE:NEEDS[CryoTanks]
		{
			name = LH2O
			MaxEC = 1.0
			FUELS
			{
				LqdHydrogen = 0.020625 //0.02063
				Oxidizer = 0.001375 // 0.00138
			}
			BYPRODUCTS
			{
				Water = 0.00773
			}
		}
		MODE:NEEDS[CommunityResourcePack]
		{
			name = Hydrazine
			MaxEC = 1.0
			FUELS
			{
				Hydrazine = 0.01564
				Oxygen = 0.01182
			}
			BYPRODUCTS
			{
				Water = 0.00001266
			}
		}
	}
}

@PART[FuelCell]:NEEDS[ODFC]:AFTER[ODFC]
{
@MODULE[ODFC]
	{
		ODFCMaxEC = 5
		@MODE[MP]
		{
			@MaxEC = #$../ODFCMaxEC$
			@FUELS
			{
				@MonoPropellant *= #$../MaxEC$
			}
		}
		@MODE[LFO]
		{
			@MaxEC =#$../ODFCMaxEC$
			@FUELS
			{
				@LiquidFuel *= #$../MaxEC$
				@Oxidizer *= #$../MaxEC$
			}
		}
		@MODE[LFIA]
		{
			@MaxEC = #$../ODFCMaxEC$
			@FUELS
			{
				@LiquidFuel *= #$../MaxEC$
				@IntakeAir *= #$../MaxEC$
			}
		}
		@MODE[H2OW]:NEEDS[CommunityResourcePack]
		{
			@MaxEC = #$../ODFCMaxEC$
			@FUELS
			{
				@Hydrogen *= #$../MaxEC$
				@Oxygen *= #$../MaxEC$
			}
			@BYPRODUCTS
			{
				@Water *= #$../MaxEC$
			}
		}
		@MODE[LH2O]:NEEDS[CryoTanks]
		{
			@MaxEC = #$../ODFCMaxEC$
			@FUELS
			{
				@LqdHydrogen *= #$../MaxEC$
				@Oxidizer *= #$../MaxEC$
			}
			@BYPRODUCTS
			{
				@Water *= #$../MaxEC$
			}
		}
		@MODE[Hydrazine]:NEEDS[CommunityResourcePack]
		{
			@MaxEC = #$../ODFCMaxEC$
			@FUELS
			{
				@Hydrazine *= #$../MaxEC$
				@Oxygen *= #$../MaxEC$
			}
			@BYPRODUCTS
			{
				@Water *= #$../MaxEC$
			}
		}
		!ODFCMaxEC = dummy // clean up
	}
	
	@RESOURCE[electricCharge]
	{
		&amount = 5
		%maxAmount = #$amount$
		flowState = False
	}

	@RESOURCE[MonoPropellant]
	{
		&amount = 5
		%maxAmount = #$amount$
		%maxAmount += 5
	}
}

@PART[FuelCellArray]:NEEDS[ODFC]:AFTER[ODFC]
{
	@MODULE[ODFC]
	{
		ODFCMaxEC = 32
		@MODE[MP]
		{
			@MaxEC = #$../ODFCMaxEC$
			@FUELS
			{
				@MonoPropellant *= #$../MaxEC$
			}
		}
		@MODE[LFO]
		{
			@MaxEC =#$../ODFCMaxEC$
			@FUELS
			{
				@LiquidFuel *= #$../MaxEC$
				@Oxidizer *= #$../MaxEC$
			}
		}
		@MODE[LFIA]
		{
			@MaxEC = #$../ODFCMaxEC$
			@FUELS
			{
				@LiquidFuel *= #$../MaxEC$
				@IntakeAir *= #$../MaxEC$
			}
		}
		@MODE[H2OW]:NEEDS[CommunityResourcePack]
		{
			@MaxEC = #$../ODFCMaxEC$
			@FUELS
			{
				@Hydrogen *= #$../MaxEC$
				@Oxygen *= #$../MaxEC$
			}
			@BYPRODUCTS
			{
				@Water *= #$../MaxEC$
			}
		}
		@MODE[LH2O]:NEEDS[CryoTanks]
		{
			@MaxEC = #$../ODFCMaxEC$
			@FUELS
			{
				@LqdHydrogen *= #$../MaxEC$
				@Oxidizer *= #$../MaxEC$
			}
			@BYPRODUCTS
			{
				@Water *= #$../MaxEC$
			}
		}
		@MODE[Hydrazine]:NEEDS[CommunityResourcePack]
		{
			@MaxEC = #$../ODFCMaxEC$
			@FUELS
			{
				@Hydrazine *= #$../MaxEC$
				@Oxygen *= #$../MaxEC$
			}
			@BYPRODUCTS
			{
				@Water *= #$../MaxEC$
			}
		}
		!ODFCMaxEC = dummy // clean up
	}
	
	@RESOURCE[electricCharge]
	{
		&amount = 32
		%maxAmount = #$amount$
		flowState = False
	}

	@RESOURCE[MonoPropellant]
	{
		&amount = 15
		%maxAmount = #$amount$
		%maxAmount += 5
	}
}
// GPLv2
// zer0Kerbal

 

seems I messed up the math. took the values from the cryo patch and divided by 1.5 and also by 18 (two patches). the results came out the same, but somehow the numbers for LqdHydrogen and Oxidizer don't match the math. Fixed.



		MODE:NEEDS[CryoTanks]
		{
			name = LH2O
			MaxEC = 1.0
			FUELS
			{
				LqdHydrogen = 0.020625 // this was set to --> 0.02063
				Oxidizer = 0.001375 // this was set to --> 0.00138
			}
			BYPRODUCTS
			{
				Water = 0.00773
			}
		}

my apologies. good catch!

It looks like the calculator I was using rounded up; I should have caught that.

the other major change to this patch is it now fully cascade updates; so only have to set the $ODFCMaxEC$ in the specific part patch (not the initial patch) to set all the ratios. So now all modes in the Fuel Cell produce/consume at the 5 ec/sec rate; and the Fuel Cell Array has all modes produce/consume for the 32 ec/sec.

Tried the new patch and generated 12 errors:

 

[WRN 22:18:11.013] Cannot find key ODFCMaxEC in MODULE
[ERR 22:18:11.013] Error - Cannot parse variable search when editing key MaxEC = #$../ODFCMaxEC$
[WRN 22:18:11.013] Cannot find key ODFCMaxEC in MODULE
[ERR 22:18:11.013] Error - Cannot parse variable search when editing key MaxEC = #$../ODFCMaxEC$
[WRN 22:18:11.014] Cannot find key ODFCMaxEC in MODULE
[ERR 22:18:11.014] Error - Cannot parse variable search when editing key MaxEC = #$../ODFCMaxEC$
[WRN 22:18:11.014] Cannot find key ODFCMaxEC in MODULE
[ERR 22:18:11.014] Error - Cannot parse variable search when editing key MaxEC = #$../ODFCMaxEC$
[WRN 22:18:11.014] Cannot find key ODFCMaxEC in MODULE
[ERR 22:18:11.014] Error - Cannot parse variable search when editing key MaxEC = #$../ODFCMaxEC$
[WRN 22:18:11.014] Cannot find key ODFCMaxEC in MODULE
[ERR 22:18:11.014] Error - Cannot parse variable search when editing key MaxEC = #$../ODFCMaxEC$
[LOG 22:18:11.019] Applying update OnDemandFuelCells/MM-Patches/Copy/StockFuelCells/@PART[FuelCellArray]:NEEDS[ODFC]:AFTER[ODFC] to Squad/Parts/Resources/FuelCell/FuelCellArray.cfg/PART[FuelCellArray]
[WRN 22:18:11.019] Cannot find key ODFCMaxEC in MODULE
[ERR 22:18:11.019] Error - Cannot parse variable search when editing key MaxEC = #$../ODFCMaxEC$
[WRN 22:18:11.019] Cannot find key ODFCMaxEC in MODULE
[ERR 22:18:11.019] Error - Cannot parse variable search when editing key MaxEC = #$../ODFCMaxEC$
[WRN 22:18:11.020] Cannot find key ODFCMaxEC in MODULE
[ERR 22:18:11.020] Error - Cannot parse variable search when editing key MaxEC = #$../ODFCMaxEC$
[WRN 22:18:11.020] Cannot find key ODFCMaxEC in MODULE
[ERR 22:18:11.020] Error - Cannot parse variable search when editing key MaxEC = #$../ODFCMaxEC$
[WRN 22:18:11.020] Cannot find key ODFCMaxEC in MODULE
[ERR 22:18:11.020] Error - Cannot parse variable search when editing key MaxEC = #$../ODFCMaxEC$
[WRN 22:18:11.020] Cannot find key ODFCMaxEC in MODULE
[ERR 22:18:11.020] Error - Cannot parse variable search when editing key MaxEC = #$../ODFCMaxEC$

 

Was ODFCMaxEC something from the latest dev branch?

Edited by Ender65535
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...