Ah, the joy of VESSELSTATUS/VESSELSTATUS2 handling...
vessel:get_rawstatus(1) returns an opaque object representing its VESSELSTATUS (you get a VESSELSTATUS2 if you pass 2 as a parameter). It's primary use if to forward it to oapi.create_vessel :
Code:
local vs = vi:get_rawstatus(1)
local hMMU = oapi.create_vessel(name, "Nasa_MMU", vs)
vi:dock(hMMU, 0, 0, 1)
oapi.set_focusobject(hMMU)
If for whatever reason you need to modify a field in the status, there is a set method on the object returned where you can pass a dictionnary with the fields to override, you can get a table representation with the get method :
Code:
local vs = vi:get_rawstatus(1)
local t = vs:get()
t.rvel = ...
vs:set(t)
I'm running an Oct. 6 build and I'm having some unexpected behavior.
Code:
local vs = vi:get_rawstatus(1)
local t = vs:get()
t.rpos = {x=0,y=0,z=-9.62}
vs:set(t)
oapi.create_vessel("OmegaBooster", "OmegaBooster", vs)
Throws the created vessel into space.
vrot and arot seem to work as advertised.
rvel throws the vessel off to one side no matter what values are used.
Perhaps I'm doing this wrong.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.