diff --git a/client.d.ts b/client.d.ts index fec221a..ad0e1af 100644 --- a/client.d.ts +++ b/client.d.ts @@ -108,6 +108,7 @@ export declare namespace input { isDigitalActionPressed(actionHandle: bigint): boolean getAnalogActionVector(actionHandle: bigint): AnalogActionVector getType(): InputType + getHandle(): bigint } } export declare namespace localplayer { diff --git a/src/api/input.rs b/src/api/input.rs index 20edc2e..f130917 100644 --- a/src/api/input.rs +++ b/src/api/input.rs @@ -89,6 +89,11 @@ pub mod input { .get_input_type_for_handle(self.handle.get_u64().1) .into() } + + #[napi] + pub fn get_handle(&self) -> BigInt { + self.handle.clone() + } } #[napi(object)] diff --git a/test/input.js b/test/input.js index 792bbcb..d168666 100644 --- a/test/input.js +++ b/test/input.js @@ -19,6 +19,7 @@ setInterval(() => { controller.activateActionSet(actionset) console.log('============') + console.log('Handle: ' + controller.getHandle()) console.log('Affirm: ' + controller.isDigitalActionPressed(affirm)) console.log('Cancel: ' + controller.isDigitalActionPressed(cancel)) console.log('Control: ' + JSON.stringify(controller.getAnalogActionVector(control)))