forked from zombieb/galvanic-corrosion-rewrite
asdfasdf
This commit is contained in:
@@ -34,7 +34,7 @@ export class ServerMatchmakingBase extends ServerContentBase {
|
||||
if (options.roomName === 'DormRoom')
|
||||
return `@${options.profile.getUsername()}'s Dorm`;
|
||||
else {
|
||||
if (options.subRoomName || options.subRoomName !== "Home") return `^${options.roomName}.${options.subRoomName}`;
|
||||
if (typeof options.subRoomName !== 'undefined' && options.subRoomName !== "Home") return `^${options.roomName}.${options.subRoomName}`;
|
||||
else return `^${options.roomName}`;
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,10 @@ export class ServerMatchmakingBase extends ServerContentBase {
|
||||
let allInstances = this.server.Instances.getAllInstances();
|
||||
const subroom = (await targetRoom.getAllSubrooms()).values().find(factory => factory.Name == options.subRoomName);
|
||||
|
||||
// if a subroom was specified, filter instances that
|
||||
// filter by instances with the same room ID
|
||||
allInstances = new Set(allInstances.values().filter(inst => inst.roomId == targetRoom.getRoomId()));
|
||||
|
||||
// if a subroom was specified, filter by instances with the same scene ID
|
||||
if (subroom) allInstances = new Set(allInstances.values().filter(inst => inst.subRoomId == subroom.RoomSceneId));
|
||||
|
||||
// filter out instances that are in progress and do not support joininprogress
|
||||
@@ -86,6 +89,7 @@ export class ServerMatchmakingBase extends ServerContentBase {
|
||||
if (!foundInstance) {
|
||||
|
||||
const matchmakeableSubrooms = (await targetRoom.getAllSubrooms()).values().filter(scene => scene.CanMatchmakeInto).toArray();
|
||||
if (matchmakeableSubrooms.length === 0) return { errorCode: MatchmakingErrorCode.RoomIsNotActive };
|
||||
const index = Math.floor(Math.random() * matchmakeableSubrooms.length);
|
||||
|
||||
log.d(`Scene ${matchmakeableSubrooms[index].RoomSceneId} was chosen for matchmaking into new instance of room ${targetRoom.getRoomId()}`);
|
||||
|
||||
Reference in New Issue
Block a user