Hello, I was wondering how I would go about using the VS2 api to say, assemble a ship and apply impulses to it. I am confused as in the api there is PhysShip, Ship, ServerShip, ClientShip, and a bunch of others, and there is no proper documentation on this; it is overall very confusing. Could somebody help? btw im using fabric 1.21.1 yarn
Reply chain from #44
import org.jetbrains.annotations.ApiStatus.Experimental
import org.valkyrienskies.core.api.ships.properties.ShipInertiaData
import org.valkyrienskies.core.api.ships.properties.ShipTransform
interface ServerShip : Ship {
// Slug is modifiable on server-side
override var slug: String?
var isStatic: Boolean
val inertiaData: ShipInertiaData
var enableKinematicVelocity: Boolean
var transformProvider: ServerShipTransformProvider?
@Experimental
fun unsafeSetTransform(transform: ShipTransform)
/**
* Sets data in the persistent storage
*
* @param T
* @param clazz of T
* @param value the data that will be stored, if null will be removed
*/
@Experimental
fun <T> saveAttachment(clazz: Class<T>, value: T?)
/**
* Gets from the ship storage the specified class
* it tries it first from the non-persistent storage
* and afterwards from the persistent storage
* @param T
* @param clazz of T
* @return the data stored inside the ship
*/
@Experimental
fun <T> getAttachment(clazz: Class<T>): T?
}
@Experimental
inline fun <reified T> ServerShip.saveAttachment(value: T?) = saveAttachment(T::class.java, value)
@Experimental
inline fun <reified T> ServerShip.getAttachment() = getAttachment(T::class.java)
This conversation is on Discord · Reply there