diff --git a/.changeset/popular-socks-check.md b/.changeset/popular-socks-check.md new file mode 100644 index 0000000..7b23319 --- /dev/null +++ b/.changeset/popular-socks-check.md @@ -0,0 +1,5 @@ +--- +"@slimevr/tracker-emulation": patch +--- + +added the ability to remove all sensors or individually diff --git a/packages/tracker-emulation/src/EmulatedTracker.ts b/packages/tracker-emulation/src/EmulatedTracker.ts index e9cb1ea..1514d86 100644 --- a/packages/tracker-emulation/src/EmulatedTracker.ts +++ b/packages/tracker-emulation/src/EmulatedTracker.ts @@ -125,6 +125,17 @@ export class EmulatedTracker extends (EventEmitter as { return sensor; } + removeSensor(sensor: EmulatedSensor) { + const index = this.sensors.indexOf(sensor); + if (index === -1) return; + + this.sensors.splice(index, 1); + } + + async clearSensors() { + this.sensors = []; + } + async init() { if (this.state.status !== 'initializing') return; @@ -171,10 +182,6 @@ export class EmulatedTracker extends (EventEmitter as { this.emit('stopped-searching-for-server', 'manual'); } - private log(msg: string) { - console.log(`[Tracker:${this.mac}] ${msg}`); - } - async changeBatteryLevel(batteryVoltage: number, batteryPercentage: number) { this.batteryVoltage = batteryVoltage; this.batteryPercentage = batteryPercentage;