decord/source/modules/guild_rooms/GuildRoomSpatialAudio.tsx
2026-08-05 07:35:12 +00:00

94 lines
3.2 KiB
TypeScript

// Module ID: 16303
// Function ID: 16304
// Name: computeLivingRoomWorldPoints
// Dependencies: [1218, 16292, 16297, 16298, 589, 16293, 2]
// Exports: livingRoomWorldPointToMediaEnginePoint, useGuildRoomSpatialAudio
// Module 16303 (computeLivingRoomWorldPoints)
import fetchFingerprint from "fetchFingerprint";
import handleSelectedChannelStoreChange from "handleSelectedChannelStoreChange";
import getName from "getName";
let c5;
let closure_6;
const require = arg1;
function computeLivingRoomWorldPoints(channelId) {
let currentUserId;
let users;
({ users, currentUserId } = channelId);
let position;
let aspectRatio;
const value = users.get(currentUserId);
position = undefined;
if (value != null) {
position = value.position;
}
if (position == null) {
position = null;
}
room = room.getRoom(channelId.channelId);
let background;
if (room != null) {
background = room.background;
}
if (background == null) {
background = currentUserId(aspectRatio[3]).GuildRoomBackgrounds.DEFAULT;
}
aspectRatio = table[background].aspectRatio;
let items = [...users.values()];
const found = items.filter((userId) => userId.userId !== currentUserId);
return Object.fromEntries(found.map((position) => {
position = position.position;
const items = [position.userId, ];
let point = position;
if (position == null) {
point = outer1_7;
}
items[1] = { worldX: (position.x - point.x) / 100 * aspectRatio * 8, worldY: 0, worldZ: 8 * ((position.y - point.y) / 100) };
return items;
}));
}
({ GUILD_ROOM_BACKGROUND_CONFIG: c5, GUILD_ROOM_SPATIAL_AUDIO_MODE: closure_6 } = getName);
let closure_7 = { x: 50, y: 50 };
const result = require("getName").fileFinishedImporting("modules/guild_rooms/GuildRoomSpatialAudio.tsx");
export { computeLivingRoomWorldPoints };
export const livingRoomWorldPointToMediaEnginePoint = function livingRoomWorldPointToMediaEnginePoint(worldX) {
return { x: worldX.worldX, y: worldX.worldY, z: worldX.worldZ };
};
export const useGuildRoomSpatialAudio = function useGuildRoomSpatialAudio(channelId) {
channelId = channelId.channelId;
const guildId = channelId.guildId;
let stateFromStores;
let dependencyMap;
let obj = channelId(589);
const items = [fetchFingerprint];
stateFromStores = obj.useStateFromStores(items, () => id.getId());
let interactionsEnabled = stateFromStores(16293).useExperiment({ guildId, location: "SpatialAudioPanel" }).interactionsEnabled;
if (interactionsEnabled) {
interactionsEnabled = null != guildId;
}
let tmp5 = interactionsEnabled;
if (interactionsEnabled) {
tmp5 = channelId.mode === closure_6;
}
dependencyMap = tmp5;
obj = { available: interactionsEnabled, worldPoints: null };
const obj2 = stateFromStores(16293);
const tmp = channelId;
const items1 = [handleSelectedChannelStoreChange];
const items2 = [tmp5, channelId, stateFromStores];
obj[1] = channelId(589).useStateFromStores(items1, () => {
if (c2) {
if (null != channelId) {
const obj = { users: null, currentUserId: null, channelId: null };
obj[0] = outer1_4.getRoomUsers(tmp);
obj[1] = stateFromStores;
obj[2] = tmp;
outer1_8(obj);
}
return {};
}
}, items2);
return obj;
};