#Vs API documentation

1 messages · Page 1 of 1 (latest)

arctic lion
#

Where I can find vs API documentation?

I made Create addon that adds springs and now I want to add vs compatibility so springs could push vs ships, I successfully added vs to my project using instructions on GitHub

And also do I need kotlin knowledge to work with vs API?

vapid jungle
#

the api is usable in java

#

you just lose a bit of qol

#

as for documentation, the best there is right now is looking at other addon source code

#

and asking questions in #addon-talk

arctic lion
vapid jungle
#

its just how create propulsion is setup

vapid jungle
#

especially the gradle section, don't follow that, its outdated

vapid jungle
#

a bit more outdated but has more useful info

arctic lion
#

Thanks

arctic lion
vapid jungle
#

its an important destinction because its not thread safe

#

you shouldn't do game tick stuff (basically anything involving a Level) on the physics tick

#

at the risk of Concurrent modification exceptions randomly

arctic lion
#

Ok

vapid jungle
#

and in terms of "activation"

#

it does need to be added to ships

#

usually on the ship load event

#

so the usual setup looks something like this

#

force applier has:

  • get or create function. Gets it from a ship or adds it to the ship then gets it from the ship
  • add thruster, adds thruster data (pos, strength, etc) to a Concurrent variable (aka a ConcurrentHashMap or something)
  • remove thruster, removes thruster data from the concurrent variable
  • physics tick function, loops over every thruster data in the concurrent variable and applies the actual forces based on that
arctic lion
#

Ok

arctic lion
vapid jungle
#

its only run on server side

arctic lion
#

Ok

vapid jungle
#

but you can kinda think of it like

#

a third side

arctic lion
#

Why

vapid jungle
#

because you should avoid doing server-side stuff in the physics tick, at the risk of CME crashes

#

so you have to use (concurrent) variables to bridge the gap

arctic lion
#

Ok

vapid jungle
#

hope that helps, feel free to ask questions in #addon-talk or here any time

arctic lion
#

Thanks

#

You helped me a lot