Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions client.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, string>
Expand Down
23 changes: 22 additions & 1 deletion src/api/matchmaking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -95,6 +95,27 @@ pub mod matchmaking {
.set_lobby_data(self.lobby_id, &key, &value)
}

#[napi]
pub fn get_member_data(&self, steam_id64: BigInt, key: String) -> Option<String> {
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();
Expand Down
Loading