Snark

[1.7.1+] SimpleFuelSwitch v1.3.1: Toggle tanks' fuel type in the editor. Simple and lightweight.

Recommended Posts

What it does

  • Adds the ability to toggle between LFO and liquid-fuel-only for stock fuel tanks.
  • Configurable via ModuleManager; you can customize its behavior or support other mods.
  • Very lightweight. No new parts. No dependencies other than ModuleManager.
  • Third-party mod support includes the ability to switch resources based on part variants.
  • Ability to customize the format of resource display in the editor, via config.

Download from SpaceDock
Source code

 

How to install

Unzip the contents of "GameData" to your GameData folder, same as with most mods. (Note, includes ModuleManager.)

 

How to use? What changes?

When you place a fuel tank in the VAB, there's a new "Fuel Type" button, which you can click to toggle among the fuel options.

selectLF.pngselectLFO.png

Click the button to pick the one you want.  Then launch and fly your ship.

That's it.  That's all there is to do.

 

Changes to the part info panel

Take a look at an LFO fuel tank's info panel in stock KSP.  It looks like this:

stockInfo.png

With SimpleFuelSwitch installed, it changes to look like this:

sfsInfo.png

Notable changes that you can see in the above:

  • Instead of showing the "wet" mass, it shows the "dry" mass. (Not by design... I just couldn't figure out how to make it not do this.)
  • Main info pane: Instead of showing units of each individual resource type, it shows total mass of each fuel option.
  • Detail panes at right: Instead of showing one pane per resource (with amount/mass/cost for each), it instead shows one pane per fuel option, listing each resource therein (by mass).

NOTE:  If you'd prefer some other format for the resources display in these panels, you can customize it via config.  See the "Custom resource formatting" section below.

 

Other part changes

A few fuel tanks have been removed, now that this mod has made them redundant.

Rationale:  With this mod, pretty much every stock LFO tank can now be LF if you want, and vice versa.  This means that there are some stock KSP tanks that are now completely superfluous-- i.e. there are a few cases where there are two stock tanks that are completely identical except for having one be LFO and the other be LF. With this mod in place, there's no longer any point to having such duplicates, so in the interest of removing part-tab clutter, these redundant parts have been removed.

Removed parts include the Mk1 Liquid Fuel Fuselage, the short and long Mk2 liquid fuel fuselages, and the short, medium, and long Mk3 liquid fuel fuselages.  For the "removed" Mk2 and Mk3 parts, their textures have been made available on the remaining parts as variants.

(If you don't like that, you can just delete the Hide_redundant_parts.cfg file to restore them.)

 

Why would anyone want this?

Stock KSP has a glaring "hole" in its parts lineup:  there aren't any good liquid-fuel tanks for rockets!  Plenty of 'em for airplanes in the Mk2 and Mk3 sizes... but rockets get one itty-bitty 2-ton 1.25m tank, and that's it. :mad:

This mod aims to fix that hole by making it possible to just pick whichever fuel you want, simply and easily in the editor.

"But why would anyone want *this* mod, when there's already Interstellar Fuel Switch, which is so much fancier?"

Because Interstellar Fuel Switch is so much fancier, that's why. ;)

Look, IFS is a great mod, been around for years, has had two-thirds of a million downloads just on SpaceDock alone.  It's big, it's fancy, and clearly lots of people love it.

However... it's got a lot of stuff in there, such that I don't want to use it for my own gameplay.  I like keeping KSP as simple as possible; I don't want to change gameplay mechanics in flight, I don't want to add new parts, I don't need parts that switch textures or models when you switch contents.  Interstellar Fuel Switch does all kinds of stuff that I don't need or want (in-flight switching; very complex config options; many new tank models), and it also brings some dependencies along for the ride.

I want to keep my dependencies to a minimum; I don't need or want any new parts; I don't need fancy config options.  All I want is a thing that lets me toggle stock tanks between LFO and LF in the editor, with no added dependencies, and this lets me do that.

So if you like Interstellar Fuel Switch and are using it already... then you don't need this mod.  And that's fine.  :)  But if you've been looking for a lightweight alternative to IFS, hopefully this mod may be useful to you.

 

Third-party mod support

SimpleFuelSwitch behavior is entirely driven by config files, so it's easy to add support to other parts, either directly in part config or via ModuleManager.

Instructions here for how to work with the config, or just look at the config installed with the mod.  If you have any questions, please ask me!  :)

Note:  In addition to having the ability to add a "choose resource type" button to a part (such as what I've done to the stock fuel tanks in my config), the mod also supports a feature that allows you to use part variants to select resource types.  Thus, for example, if you're producing a life support mod that has "Chips", "Soda", and "Pizza" as three new resource types... you could create a "Snacks Container" with different variants for those, and tie them together in config so that when you switch variants in the editor it would automatically configure it to the correct resource type.  See the examples folder on the github repo for how to do this.

Third-party mods with compatibility patches included in SimpleFuelSwitch:

Known mods that currently support SimpleFuelSwitch:

 

Custom resource formatting

By default, SimpleFuelSwitch displays the resource amounts in the editor using mass only (unless it's a massless resource, then it shows units). However, if you prefer it to look different, the mod allows customizing the display via config (e.g. with a ModuleManager patch).

For details on the format specifiers, see comments in the SimpleFuelSwitch.cfg file that gets installed with the mod. There's also a sample config file in the github repo that shows how it's done.

Edited by Snark
Update to v1.3.1 (bugfix for KSP 1.7.1)

Share this post


Link to post
Share on other sites

Awesome. The second I finish my current challenge this (and Missing History :) ) is going in the hopper.

Share this post


Link to post
Share on other sites

Could you add a list of the parts you hid to your post, @Snark

Also it's great to have a simple fuel switch mod! 

Share this post


Link to post
Share on other sites

The usual caveat:  this is a just-released mod, so there may be some bugs in there. ;)  I've done some attempt at due diligence, kicking the tires and so forth, but I'm not a professional tester and don't have days of time for it.  So use with caution, at least if you're an early adopter.

This is true of any new mod, of course.  I only mention it because unlike most of my mods, this one definitely touches your save game files and your saved craft files (since it adds some PartModules and affects the state of saves), which means that if I did have a bug in there, it has the potential to affect things even after you uninstall it.

I don't want to frighten anyone off-- I'm confident enough in it that I'm using it in my own career game, for example.  But then again, I make a habit of starting a new career every month or two anyway, so if there were a problem, that's all I'm risking.  If you're one of these folks who likes to have one career game that you just keep going for years and years across multiple KSP versions, then you might want to be a little more cautious-- I'd hate to rain on your parade.

3 minutes ago, EchoLima said:

Could you add a list of the parts you hid to your post, @Snark?

Good idea, I'll do that.

9 minutes ago, 5thHorseman said:

Awesome. The second I finish my current challenge this (and Missing History :) ) is going in the hopper.

Amusingly enough, MissingHistory is what finally prodded me into getting off my duff and writing this mod.

I recently added a couple more nuclear (i.e. liquid-fuel-only) rocket engines to MissingHistory.  One of them's 0.625m, the other is 1.875m.  It really annoyed me not to have a decent selection of appropriately sized liquid fuel tanks.  This takes care of that little problem quite nicely.  :)

And now I can build ships like this:

mO4ALav.png

^ those are all stock fuel tanks, but switched over to LF.  (You can't see the 1.875m tank in the center, since it's got those droptanks all 'round it.)

Share this post


Link to post
Share on other sites

Awesome @Snark I remember a mod that used IFS to do the same think many moons ago but you are right... who needs all the extra IFS stuff?

Then I was looking through it.  Can you change tanks on the fly?

Also, would you consider tying it into the stock texture variant system? So that people could make ther own textures? Or is that basically IFS?

Thanks for this though :)

Peace. 

Edited by theJesuit

Share this post


Link to post
Share on other sites

Yeah, it'd be cool to be able to change them midflight for, say, refueling at a mining base and then using those LF/O engines that you carried all the way there to descend to the surface without all that extra tankage for both fuel types...

Maybe I'll make a PR!

Share this post


Link to post
Share on other sites
38 minutes ago, theJesuit said:

Can you change tanks on the fly?

Nope.  Editor only-- very deliberately, and that's the way it's going to stay.

Rationale:  First, I don't want them to be changeable in-flight.  To me, a fuel tank is built the way it is, that's a physical thing, and I don't want to be able to switch fuel tank types in flight any more than I want to be able to turn an engine into a crew pod.  That's the gameplay I want, and since it's my mod... well, it's a system of "one man, one vote."  I'm the man, and the vote is mine.  ;)

It actually wouldn't be hard to code it to do changes in flight.  However, if I did that, it would be that much more to maintain and test, and a much bigger "attack surface" for potential bugs.  So that's another strong reason I don't want it to be changeable in flight.

40 minutes ago, theJesuit said:

Also, would you consider tying it into the stock texture variant system? So that people could make ther own textures?

I thought about it, but decided not.  Main thing is... it would be a bunch of code to write, test, and maintain, which is useless without actually having a set of skins to do it with.  Which I don't.  And even if someone handed me a full set of skins on a platter, that would start turning this into a big-fancy thing, and at that point it almost might as well be,

41 minutes ago, theJesuit said:

Or is that basically IFS?

...kinda heading in that direction, yes.  ;)

So I'm not planning on doing that in the near term, no.  It's possible I might reconsider at some point, but don't hold your breath.

2 minutes ago, Benjamin Kerman said:

Yeah, it'd be cool to be able to change them midflight for, say, refueling at a mining base and then using those LF/O engines that you carried all the way there to descend to the surface without all that extra tankage for both fuel types...

Maybe I'll make a PR!

Sorry to rain on folks' parade-- it's a very deliberate design choice not to support that, and I am prepared to be mulishly stubborn on the point.  The reason I didn't do it is not because "I don't have time to code it"-- that's simply not the direction I want to go.

Thank you for the suggestions, though.  :)

Share this post


Link to post
Share on other sites

In the end it's your decision, and I wouldn't want to spend time writing code that would get rejected :p Thanks for the reasoning behind it!

Share this post


Link to post
Share on other sites

@Snark I salute your choices and agree wholeheartedly.  People can add their own texture variants and make it a two click process :)

And the changing on the fly, I agree with you.  I just cant download amd test for another week or so.

Nice to see that further resources could be patched in via MM.  I might add that to an update to SIMPLEX Resources with the ore tanks.

Peace.

Share this post


Link to post
Share on other sites

@Snark! Stop making fantastic mods that I need to download! You’re going to fill up my GameData folder!

:sticktongue: Fantastic work! I’ll give it a go as soon as I get a chance to play KSP.

EDIT: Does this make changes to modded fuel tanks too, or will we need to specify that ourselves?

Edited by RealKerbal3x

Share this post


Link to post
Share on other sites

@Snark Nice simple mod :)

I just tried it and found a little bug: If you take out some/all the fuel from a tank, keep the engineer report open and then switch the fuel type, it will refill the tank to the max amount of fuel but the engineer report doesn't update the vessel mass:

Spoiler

mN0Zxyl.png

Sorry for the german interface, I forgot to switch the language after loading the 1.6.1 update...so here's a quick translation: Masse = Mass :confused:
Adding a part to the vessel, switch the variant theme or close and open the report again will cause the it to update though.

Also, I have a suggestion: I can totally understand that you want to hide some redundant parts but since they got a different texture and the parts can still be used through the 'advanced mode', it would be nice to add the fuel switch feature to these parts as well, so if you want to use them for a different look, you can still switch the fuel :)
Also, is it intented that wings with fuel capacity are not able to switch the fuel? Would be nice for some spaceplanes :)

Share this post


Link to post
Share on other sites

My one problem with this mod is that I'm running other mods that require three other fuel switchers, and I'm not sure how they'd interact.  ;)   Otherwise, I'd install for the part info panel alone.

 

The question I haven't seen asked: What about other fuels?  Stock KSP has Xenon, and there's of course other fuels out there.  Outside of the scope, or just not implemented?  (There's even rare cases where it might be nice to have an Oxidizer tank - though admittedly that's uncommon.)

Share this post


Link to post
Share on other sites

Cool Snark! I'll check it out.

Could you please add MonoProp as well? That's also a stock fuel, so it's a bit of feature creep (sorry) but pretty straightforward.

 

Edited by Tyko

Share this post


Link to post
Share on other sites

Just found a small bug, and I guess it's pretty common.

If a tank has a config like this:

RESOURCE
{
      name = Oxidizer
      amount = 0
      maxAmount = 90
}


RESOURCE
{
      name = LiquidFuel
      amount = 110
      maxAmount = 110
}

Then it hangs on game loading screen.

I've encountered this several times in the last few mins, and edited the tanks to be full.... here goes 4th attempt to load the game :)

 

Edited by TheKurgan

Share this post


Link to post
Share on other sites

I've created a config to add all fuels to all tanks, with a few exceptions:

Not affected tanks are:

  • Wings (because of the issue mentioned by @TheKurgan in the post above)
  • Command Pods (There is no point to change the MonoProp there, right?)
  • Engine Pre-cooler,  Engine Nacelle, MK1 Supersonic Intake (Like the Command Pods, I don't see any reason to change the fuel on this)
  • Twin Boar engine (Well, this engine needs LFO....)
  • MK2 Liquid Fuel tanks (not intended, have to fix that tomorrow...sry)

LF only and Ox only is balanced for the same tanks so if you take two tanks of the same type&size, set one to LF only and the other to Ox only, you will have the perfect ratio of LF/Ox.

Also, I want to mention that the fuel amount is probably not balanced very well. I basically compared tank sizes, calculated the ratio of fuel for these tanks and used the same ratio for all the other tanks as well. This might need some fine tuning ;)

For anyone who want to try it already: https://www.dropbox.com/s/jibrizqhfk4bft2/SFS_alternative_v_0_1.cfg?dl=0

To install:

Copy the file somewhere in your GameData folder and delete 'Add_LF_to_LFO_tanks.cfg' and 'Add_LFO_to_LF_tanks.cfg' from 'GameData\SimpleFuelSwitch\configs'. Yeah, I know, it's not cool to delete stuff but right now, it is necessary. I hope I can manage to avoid this in the next version ;)

Maybe, I'll also split the file into many small files so everyone can easily choose which tank type shoud get which fuel types :)

Share this post


Link to post
Share on other sites
17 minutes ago, 4x4cheesecake said:

Maybe, I'll also split the file into many small files so everyone can easily choose which tank type shoud get which fuel types :)

That would be great!

Question, I can change LFO tanks into LF tanks

but

You can't turn an LF tank into an LFO tank... right? This is by design?

------------------------------------------------------------------------------------------------------------------------------------------------------------------

OH, one other thing, this doesn't seem to affect craft that were built prior to installing the mod. The button to switch resources is there, but non functional.

 

Besides manually editing the craft file, is there a way to get this mod's modules into the saved craft?

I know many other mods, like IFS, **shiver** adds ALL of it's modules to a craft when you load them... I think.

Edited by TheKurgan

Share this post


Link to post
Share on other sites
4 minutes ago, TheKurgan said:

You can't turn an LF tank into an LFO tank... right? This is by design?

Should work and works for me, except for the MK2 LF tanks because I've filtered out everthing wich got a lifting surface to get around the wings but I forgot that the MK2 parts also provide some lift :/

CJ1KJwS.png

Share this post


Link to post
Share on other sites

I applaud your decision to not allow changes in flight.  That just diesnt make sense, you can't remanufactured a tank on the fly.

Does this support Xenon as a fuel?

Share this post


Link to post
Share on other sites
Just now, TheKurgan said:

@4x4cheesecake no, no, sorry I didn't mean with your config :)

My apologies for not being clear, I meant with the original cfg for the mod.

:D

Should work as well, that's what the 'Add_LFO_to_LF_tanks.cfg' is for.

Share this post


Link to post
Share on other sites

Ah, NM, I get it.

It only works for the tanks that are already in that cfg, or ones you add.

 

 

Edited by TheKurgan

Share this post


Link to post
Share on other sites
9 minutes ago, TheKurgan said:

Hmm... weird, it's an AirplanePlus LF tank that is missing the button... but I cannot figure out why.

Oh, that's because the mod works just with stock parts and I'm pretty sure that's intended ;)

@Snark adresses the LF tanks by name and not by the resource so no mod part will be affected.

edit: on the other hand, it works with LFO tanks....now I'm confused :confused:

Edited by 4x4cheesecake

Share this post


Link to post
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.