Jump to content

[removed]


AliceTheGorgon

Recommended Posts

@AliceTheGorgon

Getting back to our conversation in the KIS thread. I checked the code and found a way (not really cute, though). You may implement your own module overriding standard behavior of the propellant canister. You may either copy original code and edit for your purpose, or let base code to work and then calculate the fuel delta.

public class ModuleKISItemEvaPropellantProxy : ModuleKISItemEvaPropellant {
  public override void OnItemUse(KIS_Item item, KIS_Item.UseFrom useFrom) {
    if (useFrom != KIS_Item.UseFrom.KeyUp
        && item.inventory.invType == ModuleKISInventory.InventoryType.Pod) {
      Logger.logInfo("Refuel {0} from pod's monopropellant tank", item.availablePart.name);
      // ... here goes your logic...
    } else {
      base.OnItemUse(item, useFrom);
    }
  }
}

Then, make MM replacing the original module by your "proxy". Not sure how exactly to do that but as far as I can tell MM can copy, edit and delete modules.

More cute way would be sending events from KIS when item's changing but I need more time to make a good design. For now I'm a bit overloaded by other features/bugs.

Let me know if you figure out the solution. If not then, well, may be I'll add some dirty hack in KIS after all :)

EDIT: Just to not forget I've added a feature request.

Edited by IgorZ
Link to comment
Share on other sites

20 minutes ago, carlorizzante said:

Why would you screw you poor Kerbals that way? :-D

Beside the joke, is it realistic to have monopropellant going from a EVA suit back and forward into a capsule tank?

Where would you store mono-propellant if it happen to be a reality? :)

Link to comment
Share on other sites

In reality space suits do not run on monoprop. And it would be a short road to suicide trying to refuel anything with monoprop inside a crewed capsule as the thing is toxic.

But this is not real life, so just thanks for abiding the law of conservation of stuff :)

I hope someone would find the way to add a tiny bit of monoprop to derbis in rescue contracts.

Edited by Psycho_zs
Link to comment
Share on other sites

3 hours ago, AliceTheGorgon said:

@IgorZ
Okay, I seem to have everything working now, except for finding out how much EVA Propellant is actually in the tank.
It looks like I'd have to use "item.GetResources" somehow, but I'm not sure how to extract any useful info out of it, since it's not as simple as "GetResources("EVA Propellant")" or anything.

Anyway, thanks so much for all your help so far, I really appreciate it!

Yeah, KISItem doesn't provide the same functionality as a regular part does. So, you get all resources and then iterate thru them until " "EVA Propellant" " is found. Her is a snippet from the original canister's code:

      if (item.inventory.invType == ModuleKISInventory.InventoryType.Pod) {
        // Refuel item
        ScreenMessages.PostScreenMessage("Fuel tank refueled", 5, ScreenMessageStyle.UPPER_CENTER);
        foreach (KIS_Item.ResourceInfo itemRessource in item.GetResources()) {
          if (itemRessource.resourceName == EvaPropellantResource) {
            item.SetResource(EvaPropellantResource, itemRessource.maxAmount);
            item.inventory.PlaySound(refuelSndPath, false, false);
          }
        }
      }

 

Link to comment
Share on other sites

On 4/30/2016 at 10:57 AM, IgorZ said:

Where would you store mono-propellant if it happen to be a reality? :)

I'm not an expert on the topic in any sense, but I'd expect EVA suits to have their own gas tank or equivalent well isolated and secured built in in the suit. It seems pretty risky to me to have to transfer monopropellant in and out gas tanks while inside a capsule floating in space.

But hej, KSP is primarily a game, so what ever makes you happy, it's totally fine. I was just asking 'cos I was curious to know if this mod adds a bit of realism, or a bit of gameplay.

Link to comment
Share on other sites

7 hours ago, AliceTheGorgon said:

Okay everyone, KIS integration is working now! Tanks will now take monopropellant from the ship, just like kerbals.

Tons of thanks to @IgorZ for all the help!

Great! Thanks for keeping this mod compatible with KIS.

Link to comment
Share on other sites

[ERR 16:18:31.585] AssemblyLoader: Exception loading 'EvaFuel-KISCompat': System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
  at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
  at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0 
  at AssemblyLoader.LoadAssemblies () [0x00000] in <filename unknown>:0 

Additional information about this exception:

 System.IO.FileNotFoundException: Could not load file or assembly 'KIS, Version=1.2.7.6, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
File name: 'KIS, Version=1.2.7.6, Culture=neutral, PublicKeyToken=null'

Getting this in my log file. KIS has been updated to v1.2.9. Will this happen every time KIS is updated?

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 weeks later...

Let's say someone emptied all the monoprop from their spaceship before launch (by habit - no docking required on the mission), went to space, did a quick EVA and accidentally let go of the ship...  What would you do next? Asking for a friend

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