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});local lease = Wraith.camera():claim(function(held) -- Turn your camera hook on or offend)var lease = FreeCamera.Instance.Claim(held =>{ // Turn your camera hook on or off});auto lease = wraith::api().camera().claim(sal::keep<Wraith::Lease::Changed>([](bool held) { // Turn your camera hook on or off}));use wraith::LeaseChanged;
let lease = wraith::api() .camera() .claim(LeaseChanged::keep(|held: bool| { // Turn your camera hook on or off })) .ok()?;fn cameraChanged(self: *Plugin, held: bool) void { // Turn your camera hook on or off}
// in startself.camera = try sdk.Lease.claimCamera(.onChange(self, cameraChanged));static void changed(uintptr_t self, bool held) { (void)self; (void)held; /* Turn your camera hook on or off */}
static const Wraith_Lease_Changed_table changed_table = { SAL_TABLE(Wraith_Lease_Changed), .call = changed };
/* in start */Wraith_Lease lease;Wraith_FreeCamera_claim(Wraith_Api_camera(w), (Wraith_Lease_Changed){ 0, &changed_table }, &lease);wraith.io · Mods on the Hub · Get Wraith
Made with ♥ by Asgard
