Skip to content

Leases

Some parts of the game can only be handled by one plugin at a time. Plugins claim them, and get a lease.

Part Claim Only counts from the holder
Ticks threads.claimTicks threads.tick
Speed game.claimSpeed the speed handler
Camera camera.claim setWorld, camera
Posing posing.claim pose, shapes
View display.claimView setView, setColorSpace

The best placed claim holds each part: a game’s plugin, then a game engine’s, then the rest, then whichever loaded later. So a game’s plugin can take over the camera from the Unity plugin, and gives it back when it goes.

  • held() says whether you hold it now.
  • Pass a callback to be told when you get or lose it, so you can unhook what you don’t need. It can come on any thread.
  • release() gives it up. It happens anyway when your plugin unloads.
  • Any plugin can see who holds a part with leases().holder(part).
const lease = Wraith.camera().claim((held) => {
// Turn your camera hook on or off
});

Made with ♥ by Asgard