Although (objGetProperty obj 'interiorHP) will give the total interior HP I'm not aware of any way of getting the separate compartment HP.

Something like:
(objGetProperty obj 'interiorHP "main drive") returning the current HP
(objGetProperty obj 'maxInteriorHP "cargo containers") returning the maximum HP
and
(objSetProperty obj 'interiorHP "interior" number) setting the current HP

This would allow EDIT:(disregard following: -Assumed Pseudonym's- sheesh, you go to the trouble to type the entire name in... shakes head :) ) 'Nym's interior patches to be applied to separate compartments via a deviceSelector type dockscreen.

EDIt: Also (objGetCompartments obj) or something that gives a list of compartments would be good although this can be done with the XML functions (I think).

assumedpseudonym 19 Jul 2017:

 *Ahem.* AssumedPseudonym. No space. ^.~

 More seriously though, we really do need a way to specify compartments, though backward compatibility might demand that not including the compartment argument automatically defaults to general interior HP as it currently does. So, (objSetProperty obj 'interiorHP [compartment] number) (for example), to avoid breaking mods (like the one mentioned above).

0xabcdef 20 Jul 2017:

There should be a function that returns structs containing information (including hp, max hp, type, etc) about an object's compartments.

relanat 4 Jul 2018:

Could probably add a function that returns the percentage of damage as well.
This would complement objGetVisibleDamage and objGetShieldLevel.
It would save calculating it all the time.
A handy feature would be to also have an option to get the percent damage of an individual compartment.

Related:
objGetVisibleDamage will return a positive value if all armor segments are at 100% and there is interior damage but returns zero after the interior is repaired.
It would seem that this function uses interior damage values in the calculations. May need to reset this to armor damage values only or maybe have a specific function to get only armor damage percentage that isn't affected by interior hp .

Noticed in a custom wingman "Status" message (the wingman ship contained compartments) where using objGetVisibleDamage to get armor damage was affected by the level of interior HP. Armor damage would show as positive when there was interior damage even if all the armor segments were fixed.

Additionally some way of having a 'compartmentSelector' screen where individual compartments can be repaired would be good. I haven't been able to modify any of the existing ship screen types to any useful result.