give myself something to do tomorrow

Matchmaking base
This commit is contained in:
2025-03-25 23:08:28 -04:00
parent 474e4ddfef
commit e2ae95f6a3
3 changed files with 21 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
import Logging from "@proxnet/undead-logging";
import Profile from "../profiles.ts";
import { IntegratedRoomScene } from "../content/roomtypes.ts";
import { IntegratedRoomScene, RoomDetails } from "../content/roomtypes.ts";
const log = new Logging("Instances");
@@ -22,6 +22,16 @@ export interface RoomInstance {
}
interface InstanceOptions {
Room: RoomDetails,
SceneIndex?: number,
EventId?: number,
Name?: string,
Private?: boolean
}
const instancePlayers: Map<RoomInstance, Set<Profile>> = new Map();
/**
* `Map<roomId (number), RoomInstance>`
@@ -91,8 +101,10 @@ class InstancesBase {
return this.getInstancePlayers(instance).size < instance.maxCapacity;
}
// add, remove, check for, get profile(s) in instances
// synchronize profile.#instance with the profile's current instance (profile.setInstance(RoomInstance)?)
createInstance(options: InstanceOptions) {
// todo: use room data to create room instance
}
setPlayerInstance(player: Profile, instance: RoomInstance) {
const currentInstance = player.getInstance();
if (currentInstance === instance) return;