diff --git a/back/src/Model/GameRoom.ts b/back/src/Model/GameRoom.ts index 2971557d..ba1a7f0c 100644 --- a/back/src/Model/GameRoom.ts +++ b/back/src/Model/GameRoom.ts @@ -144,7 +144,6 @@ export class GameRoom { joinRoomMessage.getUseruuid(), joinRoomMessage.getIpaddress(), position, - false, this.positionNotifier, joinRoomMessage.getStatus(), socket, @@ -345,21 +344,6 @@ export class GameRoom { }); } - setSilent(user: User, silent: boolean) { - if (user.silent === silent) { - return; - } - - user.silent = silent; - if (silent && user.group !== undefined) { - this.leaveGroup(user); - } - if (!silent) { - // If we are back to life, let's trigger a position update to see if we can join some group. - this.updatePosition(user, user.getPosition()); - } - } - /** * Makes a user leave a group and closes and destroy the group if the group contains only one remaining person. * diff --git a/back/src/Model/User.ts b/back/src/Model/User.ts index ec31d1f0..6d5fd30b 100644 --- a/back/src/Model/User.ts +++ b/back/src/Model/User.ts @@ -31,7 +31,6 @@ export class User implements Movable { public readonly uuid: string, public readonly IPAddress: string, private position: PointInterface, - public silent: boolean, private positionNotifier: PositionNotifier, private status: AvailabilityStatus, public readonly socket: UserSocket, @@ -95,6 +94,10 @@ export class User implements Movable { return this.status; } + public get silent(): boolean { + return this.status === AvailabilityStatus.SILENT; + } + get following(): User | undefined { return this._following; } diff --git a/back/src/RoomManager.ts b/back/src/RoomManager.ts index c07d7e76..7211facb 100644 --- a/back/src/RoomManager.ts +++ b/back/src/RoomManager.ts @@ -22,7 +22,6 @@ import { SendUserMessage, ServerToAdminClientMessage, SetPlayerDetailsMessage, - SilentMessage, UserMovesMessage, VariableMessage, WebRtcSignalToServerMessage, @@ -80,8 +79,6 @@ const roomManager: IRoomManagerServer = { user, message.getUsermovesmessage() as UserMovesMessage ); - } else if (message.hasSilentmessage()) { - socketManager.handleSilentMessage(room, user, message.getSilentmessage() as SilentMessage); } else if (message.hasItemeventmessage()) { socketManager.handleItemEvent( room, diff --git a/back/src/Services/SocketManager.ts b/back/src/Services/SocketManager.ts index 9a70a148..8d71f4d8 100644 --- a/back/src/Services/SocketManager.ts +++ b/back/src/Services/SocketManager.ts @@ -5,7 +5,6 @@ import { PointMessage, RoomJoinedMessage, ServerToClientMessage, - SilentMessage, SubMessage, UserMovedMessage, UserMovesMessage, @@ -160,10 +159,6 @@ export class SocketManager { room.updatePlayerDetails(user, playerDetailsMessage); } - handleSilentMessage(room: GameRoom, user: User, silentMessage: SilentMessage) { - room.setSilent(user, silentMessage.getSilent()); - } - handleItemEvent(room: GameRoom, user: User, itemEventMessage: ItemEventMessage) { const itemEvent = ProtobufUtils.toItemEvent(itemEventMessage); diff --git a/front/src/Connexion/RoomConnection.ts b/front/src/Connexion/RoomConnection.ts index 06a752f9..04993226 100644 --- a/front/src/Connexion/RoomConnection.ts +++ b/front/src/Connexion/RoomConnection.ts @@ -615,19 +615,6 @@ export class RoomConnection implements RoomConnection { this.socket.send(bytes); } - public setSilent(silent: boolean): void { - const bytes = ClientToServerMessageTsProto.encode({ - message: { - $case: "silentMessage", - silentMessage: { - silent, - }, - }, - }).finish(); - - this.socket.send(bytes); - } - public setViewport(viewport: ViewportInterface): void { const bytes = ClientToServerMessageTsProto.encode({ message: { diff --git a/front/src/Phaser/Components/PlayerStatusDot.ts b/front/src/Phaser/Components/PlayerStatusDot.ts index fe739bda..168a1b48 100644 --- a/front/src/Phaser/Components/PlayerStatusDot.ts +++ b/front/src/Phaser/Components/PlayerStatusDot.ts @@ -73,7 +73,7 @@ export class PlayerStatusDot extends Phaser.GameObjects.Container { return { filling: this.COLORS.online, outline: this.COLORS.onlineOutline }; case AvailabilityStatus.AWAY: return { filling: this.COLORS.away, outline: this.COLORS.awayOutline }; - case AvailabilityStatus.SILENCED: + case AvailabilityStatus.SILENT: return { filling: this.COLORS.silenced, outline: this.COLORS.silencedOutline }; default: return { filling: this.COLORS.never, outline: this.COLORS.never }; diff --git a/front/src/Phaser/Entity/Character.ts b/front/src/Phaser/Entity/Character.ts index 0982351e..10578416 100644 --- a/front/src/Phaser/Entity/Character.ts +++ b/front/src/Phaser/Entity/Character.ts @@ -19,7 +19,8 @@ import type { OutlineableInterface } from "../Game/OutlineableInterface"; import type CancelablePromise from "cancelable-promise"; import { TalkIcon } from "../Components/TalkIcon"; import { Deferred } from "ts-deferred"; -import { PlayerStatus, PlayerStatusDot } from "../Components/PlayerStatusDot"; +import { PlayerStatusDot } from "../Components/PlayerStatusDot"; +import { AvailabilityStatus } from "../../Messages/ts-proto-generated/protos/messages"; const playerNameY = -25; const interactiveRadius = 35; @@ -236,7 +237,7 @@ export abstract class Character extends Container implements OutlineableInterfac this.talkIcon.show(show, forceClose); } - public setStatus(status: PlayerStatus, instant: boolean = false): void { + public setStatus(status: AvailabilityStatus, instant: boolean = false): void { this.statusDot.setStatus(status, instant); } diff --git a/front/src/Phaser/Game/GameMapPropertiesListener.ts b/front/src/Phaser/Game/GameMapPropertiesListener.ts index 1dffd434..8ffefefc 100644 --- a/front/src/Phaser/Game/GameMapPropertiesListener.ts +++ b/front/src/Phaser/Game/GameMapPropertiesListener.ts @@ -144,10 +144,10 @@ export class GameMapPropertiesListener { this.gameMap.onPropertyChange(GameMapProperties.SILENT, (newValue) => { if (newValue === undefined || newValue === false || newValue === "") { - this.scene.connection?.setSilent(false); + // this.scene.connection?.setSilent(false); this.scene.CurrentPlayer.noSilent(); } else { - this.scene.connection?.setSilent(true); + // this.scene.connection?.setSilent(true); this.scene.CurrentPlayer.isSilent(); } }); diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index 8c2c5afc..84812a49 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -709,7 +709,7 @@ export class GameScene extends DirtyScene { }); this.privacyShutdownStoreUnsubscribe = privacyShutdownStore.subscribe((away) => { - // TODO: Might be a problem with SILENCED here + // TODO: Might be a problem with SILENT here this.connection?.emitPlayerStatusChange(away ? AvailabilityStatus.AWAY : AvailabilityStatus.ONLINE); }); @@ -2153,13 +2153,13 @@ ${escapedMessage} } public enableMediaBehaviors() { - const silent = this.gameMap.getCurrentProperties().get(GameMapProperties.SILENT); - this.connection?.setSilent(!!silent); + // const silent = this.gameMap.getCurrentProperties().get(GameMapProperties.SILENT); + // this.connection?.setSilent(!!silent); mediaManager.showMyCamera(); } public disableMediaBehaviors() { - this.connection?.setSilent(true); + // this.connection?.setSilent(true); mediaManager.hideMyCamera(); } diff --git a/messages/protos/messages.proto b/messages/protos/messages.proto index 43bb185c..12163fac 100644 --- a/messages/protos/messages.proto +++ b/messages/protos/messages.proto @@ -6,7 +6,7 @@ import "google/protobuf/wrappers.proto"; enum AvailabilityStatus { ONLINE = 0; - SILENCED = 1; + SILENT = 1; AWAY = 2; } @@ -35,10 +35,6 @@ message ViewportMessage { int32 bottom = 4; } -message SilentMessage { - bool silent = 1; -} - message CharacterLayerMessage { string url = 1; string name = 2; @@ -112,7 +108,6 @@ message LockGroupPromptMessage { message ClientToServerMessage { oneof message { UserMovesMessage userMovesMessage = 2; - SilentMessage silentMessage = 3; ViewportMessage viewportMessage = 4; ItemEventMessage itemEventMessage = 5; SetPlayerDetailsMessage setPlayerDetailsMessage = 6; @@ -411,7 +406,6 @@ message PusherToBackMessage { oneof message { JoinRoomMessage joinRoomMessage = 1; UserMovesMessage userMovesMessage = 2; - SilentMessage silentMessage = 3; ItemEventMessage itemEventMessage = 4; SetPlayerDetailsMessage setPlayerDetailsMessage = 5; WebRtcSignalToServerMessage webRtcSignalToServerMessage = 6; diff --git a/pusher/src/Controller/IoSocketController.ts b/pusher/src/Controller/IoSocketController.ts index 696abbfa..4c5137b1 100644 --- a/pusher/src/Controller/IoSocketController.ts +++ b/pusher/src/Controller/IoSocketController.ts @@ -8,7 +8,6 @@ import { ItemEventMessage, ViewportMessage, ClientToServerMessage, - SilentMessage, WebRtcSignalToServerMessage, PlayGlobalMessage, ReportPlayerMessage, @@ -525,8 +524,6 @@ export class IoSocketController { client, message.getSetplayerdetailsmessage() as SetPlayerDetailsMessage ); - } else if (message.hasSilentmessage()) { - socketManager.handleSilentMessage(client, message.getSilentmessage() as SilentMessage); } else if (message.hasItemeventmessage()) { socketManager.handleItemEvent(client, message.getItemeventmessage() as ItemEventMessage); } else if (message.hasVariablemessage()) { diff --git a/pusher/src/Services/SocketManager.ts b/pusher/src/Services/SocketManager.ts index 8f547cd2..d1e52423 100644 --- a/pusher/src/Services/SocketManager.ts +++ b/pusher/src/Services/SocketManager.ts @@ -24,7 +24,6 @@ import { ServerToAdminClientMessage, ServerToClientMessage, SetPlayerDetailsMessage, - SilentMessage, SubMessage, UserJoinedRoomMessage, UserLeftMessage, @@ -334,13 +333,6 @@ export class SocketManager implements ZoneEventListener { client.backConnection.write(pusherToBackMessage); } - handleSilentMessage(client: ExSocketInterface, silentMessage: SilentMessage) { - const pusherToBackMessage = new PusherToBackMessage(); - pusherToBackMessage.setSilentmessage(silentMessage); - - client.backConnection.write(pusherToBackMessage); - } - handleItemEvent(client: ExSocketInterface, itemEventMessage: ItemEventMessage) { const pusherToBackMessage = new PusherToBackMessage(); pusherToBackMessage.setItemeventmessage(itemEventMessage);