Jump to content

How to get number of overheating parts?


Recommended Posts

Is it possible to get the number of overheating parts? Also the amount each part is overheating? I've looked through the possible variables and classes but none seem to be what I'm looking for. PartThermalData seems like the right class but I can't get the right variable from it.  

Link to comment
Share on other sites

I would suspect you would need to iterate over the parts in the vessel checking each Part.temperature against Part.maxTemp. I don't know how the over temp works but had always thought that the over heat bars appeared when you got to some percentage of maxTemp and then the part would explode when temp>maxTemp (Though there's a tempExplodeChance that's suggestive). If you haven't seen it the KSP API site can be useful - Link to the KSP API Part page.

Link to comment
Share on other sites

PartThermalData is way more messy about internal heat model than you need, Part class has it all.

However do note that overheating has two separate aspects: Core and Skin temperature, so to get for instance the most critical percentage (vessel should be current Vessel object):

	double maxTempRatio = vessel.parts.Max(p => Math.Max(p.temperature / p.maxTemp, p.skinTemperature / p.skinMaxTemp) );

Or to get count above some limit

	double limit = 0.7;
	double maxTempRatio = vessel.parts.Count(p => (p.temperature >  p.maxTemp * limit || p.skinTemperature > p.skinMaxTemp * limit) );

If you need both at once, you should actually code the foreach loop on parts.

 
Edited by CBase
replaced division in loop with multiplication
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...