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;

View File

@@ -36,7 +36,7 @@ route.router.post("/create",
value: await newAcc.export(),
});
},
);
route.router.get("/bulk",
@@ -59,11 +59,7 @@ route.router.get("/bulk",
);
return;
} else {
rs.json(
[await Profile.getExportAccount(id)].filter((val) =>
val !== null
),
);
rs.json([await Profile.getExportAccount(id)].filter((val) => val !== null));
return;
}

View File

@@ -21,6 +21,10 @@ route.router.post('/login',
(_rq, rs) => {
// temporary
rs.sendStatus(200);
// check for existing login
// set login lock
// init presence
// use device_class from token request
},
)