Programming Question Help with changing docked vessel fuel content

Mr Martian

Orbinaut/Addon dev/Donator
Addon Developer
Donator
Joined
Jun 6, 2012
Messages
288
Reaction score
67
Points
28
Location
Sydney, Australia, Earth, Sol
Website
www.orbithangar.com
Hi, I am wondering how I would go about changing the amount of fuel in a docked vessel? (Example being, say I am in a.delta glider and am docked to a ShuttlePB, the focus vessel is the Delta Glider (im in that) and iI want to change the fuel content of the ShuttlePB from the Delta Glider)... Hope that makes sense.

Any help would be much appreciated.
 

Loru

Retired Staff Member
Retired Staff
Addon Developer
Donator
Joined
Sep 30, 2008
Messages
3,731
Reaction score
6
Points
36
Location
Warsaw
[ame="http://www.orbithangar.com/searchid.php?ID=3320"]Fuel MFD[/ame]

[ame="http://www.orbithangar.com/searchid.php?ID=4725"]Refuel MFD[/ame]
 

Izack

Non sequitur
Addon Developer
Joined
Feb 4, 2010
Messages
6,665
Reaction score
13
Points
113
Location
The Wilderness, N.B.
You can use oapiGetDockStatus to get the handle of the vessel docked at a docking port. From there, you get get the PROPELLANT_HANDLE of the fuel tank you want, and alter its contents.

oapiGetDockStatus will return NULL if there is no docked vessel, so make sure to use a sanity check to prevent CTDs when trying to use an invalid vessel handle (oapiIsVessel).
 
Last edited:
Top