removed silent message

This commit is contained in:
Piotr 'pwh' Hanusiak 2022-04-14 11:41:01 +02:00
parent 8f0b02a9c8
commit 99854e2d62
12 changed files with 15 additions and 65 deletions

View File

@ -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.
*

View File

@ -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;
}

View File

@ -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,

View File

@ -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);

View File

@ -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: {

View File

@ -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 };

View File

@ -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);
}

View File

@ -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();
}
});

View File

@ -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();
}

View File

@ -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;

View File

@ -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()) {

View File

@ -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);