FEATURE: added the possibility toplay emotes
This commit is contained in:
@@ -6,13 +6,11 @@ import {
|
||||
PointMessage, PositionMessage, UserJoinedMessage,
|
||||
UserJoinedZoneMessage, UserLeftZoneMessage, UserMovedMessage,
|
||||
ZoneMessage,
|
||||
EmoteEventMessage,
|
||||
CompanionMessage
|
||||
} from "../Messages/generated/messages_pb";
|
||||
import * as messages_pb from "../Messages/generated/messages_pb";
|
||||
import {ClientReadableStream} from "grpc";
|
||||
import {PositionDispatcher} from "_Model/PositionDispatcher";
|
||||
import {socketManager} from "../Services/SocketManager";
|
||||
import {ProtobufUtils} from "_Model/Websocket/ProtobufUtils";
|
||||
import Debug from "debug";
|
||||
|
||||
const debug = Debug("zone");
|
||||
@@ -24,6 +22,7 @@ export interface ZoneEventListener {
|
||||
onGroupEnters(group: GroupDescriptor, listener: ExSocketInterface): void;
|
||||
onGroupMoves(group: GroupDescriptor, listener: ExSocketInterface): void;
|
||||
onGroupLeaves(groupId: number, listener: ExSocketInterface): void;
|
||||
onEmote(emoteMessage: EmoteEventMessage, listener: ExSocketInterface): void;
|
||||
}
|
||||
|
||||
/*export type EntersCallback = (thing: Movable, listener: User) => void;
|
||||
@@ -184,6 +183,9 @@ export class Zone {
|
||||
userDescriptor.update(userMovedMessage);
|
||||
|
||||
this.notifyUserMove(userDescriptor);
|
||||
} else if(message.hasEmoteeventmessage()) {
|
||||
const emoteEventMessage = message.getEmoteeventmessage() as EmoteEventMessage;
|
||||
this.notifyEmote(emoteEventMessage);
|
||||
} else {
|
||||
throw new Error('Unexpected message');
|
||||
}
|
||||
@@ -262,6 +264,15 @@ export class Zone {
|
||||
}
|
||||
}
|
||||
|
||||
private notifyEmote(emoteMessage: EmoteEventMessage) {
|
||||
for (const listener of this.listeners) {
|
||||
if (listener.userId === emoteMessage.getActoruserid()) {
|
||||
continue;
|
||||
}
|
||||
this.socketListener.onEmote(emoteMessage, listener);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify listeners of this zone that this group left
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user