Jump to content

Change tank resource


Tz86

Recommended Posts

Hi all guys,

I'm new to the forum, but no so new with KSP. :)

Please, could you tell me if exists a mod that can change the resource a tank can store?

In short, I'm looking for something like "Modular Fuel Tanks" but usable while flying.

I mean, for example: I reach Mun with a lander, and after the landing I would like to store in the empty fuel tanks (or partially empty) other resources, as Waste or Food. Total volume of tanks is not changed, but empty space is now used to store other things rather than fuel/oxidizer.

I also tried to play with the Modular Fuel Tank source code, in order to add the button "Show GUI" also during the flight. But without any success.

Thanks in advance for your help!

Link to comment
Share on other sites

FireSpitter's FSfuelSwitch module allow such thing, take a look at the documentation, you just need to edit config file yourself or use a Module Manager "patch" to do it.

But that just like Modular Fuel Tanks you still have to change the total mass to make it work so your still not using the empty space.

Edited by Mecripp2
Link to comment
Share on other sites

Thank you for the replies, guys.

I'll check the FireSpitter's module.

I have to understand about the total mass. Actually, my goal is to use the total volume of tanks. Of course, if I'm only relocating resources I have in my ship, the mass will not change, but diferent is if I'll mine Karbonite or other.

Quite confused! :)

Link to comment
Share on other sites

Well, I tried doing something.

I have to set max tank resource capacity, but is a static setting.

FSFuelSwitch also puts the max amount for the resource, while switching tanks. So, I'm not really managing the empty space.

Maybe it's possible to override this, but I have no skills for that.

Anyway, thank you for the suggestion.

Link to comment
Share on other sites

Ok, updates.

I modded the MFT source, and obtained the Tank GUI also in Flight Mode.

The only problem: when I modify the tank volume distribution, in flight mode, the volume available remains at maximum. While in VAB (Editor) mode, the volume available auto-updates.

Here the modded parts code:

        #region GUI Display

//[KSPField(isPersistant = true)]
public bool dedicated = false;


[KSPField(isPersistant = false, guiActiveEditor = true, [COLOR=#ff0000][B]guiActive = true[/B][/COLOR], guiName = "Show Tank"),
UI_Toggle(enabledText = "Tank GUI", disabledText = "GUI")]
[NonSerialized]
public bool showRFGUI;


private static GUIStyle unchanged;
private static GUIStyle changed;
private static GUIStyle greyed;
private static GUIStyle overfull;
public static string myToolTip = "";


private int counterTT;
private Vector2 scrollPos;


private void OnPartActionGuiDismiss(Part p)
{
if (p == part)
showRFGUI = false;
}


[PartMessageListener(typeof(PartResourceListChanged))]
private void MarkWindowDirty()
{
if (_myWindow == null)
_myWindow = part.FindActionWindow();
if(_myWindow == null)
return;
_myWindow.displayDirty = true;
}
private UIPartActionWindow _myWindow;


[PartMessageListener(typeof(PartChildAttached), relations: PartRelationship.AnyPart, scenes: GameSceneFilter.[COLOR=#ff0000][B]AnyEditorOrFlight[/B][/COLOR])]
[PartMessageListener(typeof(PartChildDetached), relations: PartRelationship.AnyPart, scenes: GameSceneFilter.[COLOR=#ff0000][B]AnyEditorOrFlight[/B][/COLOR])]
public void VesselAttachmentsChanged(Part childPart)
{
UpdateUsedBy();
}


[PartMessageListener(typeof (PartEngineConfigChanged), relations: PartRelationship.AnyPart, scenes: GameSceneFilter.[COLOR=#ff0000][B]AnyEditorOrFlight[/B][/COLOR])]
public void EngineConfigsChanged()
{
UpdateUsedBy();
}


public void OnGUI()
{
EditorLogic editor = EditorLogic.fetch;
[COLOR=#ff0000][B] //if (!HighLogic.LoadedSceneIsEditor || !editor || dedicated) {[/B]
[B] // return;[/B]
[B] // }[/B][/COLOR]


//UpdateMixtures();


Rect screenRect;
Rect tooltipRect;
int posMult = 0;
if (offsetGUIPos != -1)
posMult = offsetGUIPos;
if (editor.editorScreen == EditorLogic.EditorScreen.Actions && EditorActionGroups.Instance.GetSelectedParts ().Contains (part))
{
screenRect = new Rect(430 * posMult, 365, 438, (Screen.height - 365));
tooltipRect = new Rect(430 * posMult+10, Screen.height - Input.mousePosition.y, 300, 20);
}
else if (showRFGUI && editor.editorScreen == EditorLogic.EditorScreen.Parts)
{
screenRect = new Rect((Screen.width - 8 - 430 * (posMult+1)), 365, 438, (Screen.height - 365));
tooltipRect = new Rect(Screen.width - 230 - 430 * (posMult+1), Screen.height - Input.mousePosition.y, 220, 20);
}
else
{
showRFGUI = false;
return;
}


GUI.Label(tooltipRect, myToolTip);
GUILayout.Window(part.name.GetHashCode(), screenRect, GUIWindow, "Fuel Tanks for " + part.partInfo.title);
}


Any suggestion is welcome!

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

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...