API Question Detecting a docked vessel's actual thruster count

dbeachy1

O-F Administrator
Administrator
Orbiter Contributor
Addon Developer
Donator
Beta Tester
Joined
Jan 14, 2008
Messages
9,218
Reaction score
1,566
Points
203
Location
VA
Website
alteaaerospace.com
Preferred Pronouns
he/him
I'm calling pVessel->GetThrusterCount() to detect whether another vessel has at least one thruster defined. It works fine unless the vessel happens to be docked to another vessel -- for example, when a payload vessel with no thrusters is docked to its parent vessel that does have thrusters. In that case, calling GetThrusterCount() on the payload vessel returns the parent vessel's thruster count (??). I assume this is by design since a docked vessel is part of a superstructure? So I'm trying to figure out a way to reliably detect if a given vessel has thrusters defined, even if it's docked. I keep thinking I'm missing something obvious...any ideas?? Thanks. :)
 

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
5,927
Reaction score
2,937
Points
188
Website
github.com
Loop GetThrusterHandleByIndex() until it returns NULL?
 

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,882
Reaction score
2,133
Points
203
Location
between the planets
In that case, calling GetThrusterCount() on the payload vessel returns the parent vessel's thruster count (??).

Are you certain that you have the right vessel (It's a dumb question, I know, but... it's code. Better check twice for silly mistakes)? Going on the documentation, that would clearly be a bug.

Moreover, docking establishes flat relationships, not hierarchical ones, so there wouldn't even be a way for Orbiter to determine parent and child.
Orbiter 2016 has new handling for docked stacks, but nothing in the documentation suggests that GetThrusterCount() would be affected by this.
 

dbeachy1

O-F Administrator
Administrator
Orbiter Contributor
Addon Developer
Donator
Beta Tester
Joined
Jan 14, 2008
Messages
9,218
Reaction score
1,566
Points
203
Location
VA
Website
alteaaerospace.com
Preferred Pronouns
he/him
Thanks for the ideas, guys, I'll look into it more tonight and report back.

EDIT:
So I tracked down the issue: a payload vessel only shows a thruster count when its .cfg file specifies any of these settings (even setting them to 0):

Code:
MaxMainThrust = 0
MaxRetroThrust = 0
MaxHoverThrust = 0
MaxAttitudeThrust = 0

If a payload vessel specifies all of those, the Orbiter core creates a total of 21 thrusters for it. So it turns out that GetThrusterCount() is fine, and docking it to a vessel is not the issue. The fix in my case here was to edit these payload vessel .cfg files to remove those lines above.

Thanks the advice, guys, it was indeed a separate bug, and not Orbiter core-related! :tiphat:
 
Last edited:
Top