mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-07-26 18:36:23 +09:00
Update to new version of SubscriptionRequest
This commit is contained in:
@@ -191,8 +191,8 @@ export class ControllerPlugin extends BaseControllerPlugin {
|
|||||||
|
|
||||||
async handleResolvedAssignmentSubscription(request: lib.SubscriptionRequest) {
|
async handleResolvedAssignmentSubscription(request: lib.SubscriptionRequest) {
|
||||||
// Check for any missing assignments to be computed on demand
|
// Check for any missing assignments to be computed on demand
|
||||||
const filters = Array.isArray(request.filters) ? request.filters : [request.filters!];
|
const filters = request.filters.toJSON();
|
||||||
if (request.filters && filters.length) {
|
if (filters.length) {
|
||||||
const missing = filters.filter(name => !this.resolvedAssignments.has(name));
|
const missing = filters.filter(name => !this.resolvedAssignments.has(name));
|
||||||
if (missing.length) {
|
if (missing.length) {
|
||||||
this.resolvedAssignments.setMany(await this.computeResolvedAssignments(missing));
|
this.resolvedAssignments.setMany(await this.computeResolvedAssignments(missing));
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ export class InstancePlugin extends BaseInstancePlugin {
|
|||||||
async onStart() {
|
async onStart() {
|
||||||
// We use Date.now() because we need to manually initialise the groups on the lua side
|
// We use Date.now() because we need to manually initialise the groups on the lua side
|
||||||
await this.instance.sendTo("controller", new lib.SubscriptionRequest(
|
await this.instance.sendTo("controller", new lib.SubscriptionRequest(
|
||||||
`exp_groups:${messages.GroupUpdatedEvent.name}`, true, Date.now()
|
`exp_groups:${messages.GroupUpdatedEvent.name}`, "subscribe", Date.now()
|
||||||
));
|
));
|
||||||
const groups = await this.instance.sendTo("controller", new messages.GroupListRequest())
|
const groups = await this.instance.sendTo("controller", new messages.GroupListRequest())
|
||||||
await this.luaSendInitialGroups(groups);
|
await this.luaSendInitialGroups(groups);
|
||||||
@@ -118,13 +118,13 @@ export class InstancePlugin extends BaseInstancePlugin {
|
|||||||
|
|
||||||
async subscribePlayerAssignment(playerName: string) {
|
async subscribePlayerAssignment(playerName: string) {
|
||||||
await this.instance.sendTo("controller", new lib.SubscriptionRequest(
|
await this.instance.sendTo("controller", new lib.SubscriptionRequest(
|
||||||
`exp_groups:${messages.ResolvedAssignmentUpdatedEvent.name}`, true, 0, playerName
|
`exp_groups:${messages.ResolvedAssignmentUpdatedEvent.name}`, "subscribe", 0, lib.SubscriptionFilters.fromShorthand(playerName)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
async unsubscribePlayerAssignment(playerName: string) {
|
async unsubscribePlayerAssignment(playerName: string) {
|
||||||
await this.instance.sendTo("controller", new lib.SubscriptionRequest(
|
await this.instance.sendTo("controller", new lib.SubscriptionRequest(
|
||||||
`exp_groups:${messages.ResolvedAssignmentUpdatedEvent.name}`, false, 0, playerName
|
`exp_groups:${messages.ResolvedAssignmentUpdatedEvent.name}`, "unsubscribe", 0, lib.SubscriptionFilters.fromShorthand(playerName)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user