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

View File

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

View File

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