Question what does "vessel:get_rawstatus(1)" return?

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)
 
Last edited:
I get the idea of what you're saying but I'm missing the details.
To my inexperienced mind a practical use of that code would be:
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)
But that's not correct.
Could you give me a hint?
 
Sorry I made a mistake, it is vs:set and vs:get, I corrected the example (and the bug is in Atlantis.lua also...).
 
Yes, I thought that was it but I still get
Code:
attempt to call method 'get' (a nil value)
Let me do some tests, I'll get back to you.
Edit : looks like you found a bug. I made a PR for the fix but sadly there is no workaround.
 
Last edited:
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.
 
If I'm not mistaken, rpos/rvel are related to the reference body (i.e. Earth if you're in Earth orbit), not the vessel you want to spawn from.
 
Back
Top