From 21077be4e91bda7bc397c290ddb6bc7cc1378d87 Mon Sep 17 00:00:00 2001 From: Luan Himmlisch Date: Sun, 29 Mar 2026 00:53:42 -0600 Subject: [PATCH 1/2] add lobby member data getter and setter --- client.d.ts | 2 ++ src/api/matchmaking.rs | 27 ++++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/client.d.ts b/client.d.ts index 2834978..8a67919 100644 --- a/client.d.ts +++ b/client.d.ts @@ -243,6 +243,8 @@ export declare namespace matchmaking { setJoinable(joinable: boolean): boolean getData(key: string): string | null setData(key: string, value: string): boolean + getMemberData(steamId64: bigint, key: string): string | null + setMemberData(key: string, value: string): void deleteData(key: string): boolean /** Get an object containing all the lobby data */ getFullData(): Record diff --git a/src/api/matchmaking.rs b/src/api/matchmaking.rs index 441c9e6..47d3a99 100644 --- a/src/api/matchmaking.rs +++ b/src/api/matchmaking.rs @@ -5,7 +5,7 @@ pub mod matchmaking { use crate::api::localplayer::PlayerSteamId; use napi::bindgen_prelude::{BigInt, Error}; use std::collections::HashMap; - use steamworks::LobbyId; + use steamworks::{LobbyId, SteamId}; use tokio::sync::oneshot; #[napi] @@ -95,6 +95,31 @@ pub mod matchmaking { .set_lobby_data(self.lobby_id, &key, &value) } + #[napi] + pub fn get_member_data(&self, steam_id64: BigInt, key: String) -> Option { + let client = crate::client::get_client(); + client + .matchmaking() + .get_lobby_member_data( + self.lobby_id, + SteamId::from_raw(steam_id64.get_u64().1), + &key + ) + .map(|s| s.to_string()) + } + + #[napi] + pub fn set_member_data(&self, key: String, value: String) { + let client = crate::client::get_client(); + client + .matchmaking() + .set_lobby_member_data( + self.lobby_id, + &key, + &value + ) + } + #[napi] pub fn delete_data(&self, key: String) -> bool { let client = crate::client::get_client(); From f03a17b2d0546e3843a213af4aac4dc95693ccb7 Mon Sep 17 00:00:00 2001 From: Luan Himmlisch Date: Mon, 30 Mar 2026 12:31:18 -0600 Subject: [PATCH 2/2] fix formatting --- src/api/matchmaking.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/api/matchmaking.rs b/src/api/matchmaking.rs index 47d3a99..485866e 100644 --- a/src/api/matchmaking.rs +++ b/src/api/matchmaking.rs @@ -101,9 +101,9 @@ pub mod matchmaking { client .matchmaking() .get_lobby_member_data( - self.lobby_id, + self.lobby_id, SteamId::from_raw(steam_id64.get_u64().1), - &key + &key, ) .map(|s| s.to_string()) } @@ -113,11 +113,7 @@ pub mod matchmaking { let client = crate::client::get_client(); client .matchmaking() - .set_lobby_member_data( - self.lobby_id, - &key, - &value - ) + .set_lobby_member_data(self.lobby_id, &key, &value) } #[napi]