Jump to content

1.2 - How do I do the equivalent of vessel.GetResource("ElectricCharge") now?


Recommended Posts

2 minutes ago, genericeventhandler said:

current amount and max amount of a resource by name. 

As far as I can read in the object browser, we now have

vessel.resourcePartSet.GetConnectedResourceTotals(int id, out double amount, out double maxAmount, [bool pulling = True])

That should yield the figures you are looking for. You need the id though, which I think you need to retrieve from the partresourcelibrary

PartResourceLibrary.Instance.GetDefinition("resourceNAME").id

 

Link to comment
Share on other sites

4 minutes ago, Warezcrawler said:

As far as I can read in the object browser, we now have


vessel.resourcePartSet.GetConnectedResourceTotals(int id, out double amount, out double maxAmount, [bool pulling = True])

That should yield the figures you are looking for. You need the id though, which I think you need to retrieve from the partresourcelibrary


PartResourceLibrary.Instance.GetDefinition("resourceNAME").id

 

Thanks, the get definition was what I was missing.  I'll write an helper function for it. 

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