Valkyrien Skies 2.4 introduced a number of breaking API changes. Addon developers and other mod developers with VS integration will need to update their mods.
Required changes
These changes are required for your mod or addon to continue functioning with VS 2.4.
Migrate to the new attachments system
Change your attachment imports
The extension functions in org.valkyrienskies.core.api.ships.* have been moved to org.valkyrienskies.core.api.attachments.*.
Attachment classes are now required to be final - meaning they can't be interfaces and they can't be extended.
class MyAttachment {
// ...
}
final class MyAttachment {
// ...
}
Migrate from constraints to joints
Constraints are now joints, and everything in org.valkyrienskies.core.apigame.constraints has been removed.
Migrate to new force application methods
Force application has been revamped. The old methods in org.valkyrienskies.core.api.ships.PhysShip have been marked as deprecated, and point to their new counterparts.
Additionally, there are new methods to apply forces/torques in ship-space coordinates; you can find all of these methods and further documentation in the javadocs for PhysShip.
Migrate from ShipForceAppliers to ShipPhysicsListeners
The ShipForceApplier interface has been removed. Use ShipPhysicsListener instead, which takes advantage of the new PhysLevels to provide a more cohesive way to access things that reside on the Physics Thread.
applyForces and applyForcesToNearbyShips have been replaced with physTick(physShip, physLevel). This allows you to add/update/remove joints, enable and disable collision pairs, and access other ships through the provided PhysLevel. Experimental API features such as retrieving all joints in the world can be accessed through VsiPhysLevel, though this is not advised for general use, as it may change in future versions.
Recommended changes
These changes aren't strictly required, but they will make your life easier during future updates and improve the quality of your code.
Use rebuild and toBuilder instead of ShipTransform.copy
val transform: ShipTransform = ...
val newTransform: ShipTransform = transform.copy(
positionInWorld = Vector3d(123)
)
val transform: ShipTransform = ...
val newTransform: BodyTransform = transform.rebuild {
position.set(Vector3d(123))
}