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.getUseruuid(),
joinRoomMessage.getIpaddress(), joinRoomMessage.getIpaddress(),
position, position,
false,
this.positionNotifier, this.positionNotifier,
joinRoomMessage.getStatus(), joinRoomMessage.getStatus(),
socket, 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. * 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 uuid: string,
public readonly IPAddress: string, public readonly IPAddress: string,
private position: PointInterface, private position: PointInterface,
public silent: boolean,
private positionNotifier: PositionNotifier, private positionNotifier: PositionNotifier,
private status: AvailabilityStatus, private status: AvailabilityStatus,
public readonly socket: UserSocket, public readonly socket: UserSocket,
@ -95,6 +94,10 @@ export class User implements Movable {
return this.status; return this.status;
} }
public get silent(): boolean {
return this.status === AvailabilityStatus.SILENT;
}
get following(): User | undefined { get following(): User | undefined {
return this._following; return this._following;
} }

View File

@ -22,7 +22,6 @@ import {
SendUserMessage, SendUserMessage,
ServerToAdminClientMessage, ServerToAdminClientMessage,
SetPlayerDetailsMessage, SetPlayerDetailsMessage,
SilentMessage,
UserMovesMessage, UserMovesMessage,
VariableMessage, VariableMessage,
WebRtcSignalToServerMessage, WebRtcSignalToServerMessage,
@ -80,8 +79,6 @@ const roomManager: IRoomManagerServer = {
user, user,
message.getUsermovesmessage() as UserMovesMessage message.getUsermovesmessage() as UserMovesMessage
); );
} else if (message.hasSilentmessage()) {
socketManager.handleSilentMessage(room, user, message.getSilentmessage() as SilentMessage);
} else if (message.hasItemeventmessage()) { } else if (message.hasItemeventmessage()) {
socketManager.handleItemEvent( socketManager.handleItemEvent(
room, room,

View File

@ -5,7 +5,6 @@ import {
PointMessage, PointMessage,
RoomJoinedMessage, RoomJoinedMessage,
ServerToClientMessage, ServerToClientMessage,
SilentMessage,
SubMessage, SubMessage,
UserMovedMessage, UserMovedMessage,
UserMovesMessage, UserMovesMessage,
@ -160,10 +159,6 @@ export class SocketManager {
room.updatePlayerDetails(user, playerDetailsMessage); room.updatePlayerDetails(user, playerDetailsMessage);
} }
handleSilentMessage(room: GameRoom, user: User, silentMessage: SilentMessage) {
room.setSilent(user, silentMessage.getSilent());
}
handleItemEvent(room: GameRoom, user: User, itemEventMessage: ItemEventMessage) { handleItemEvent(room: GameRoom, user: User, itemEventMessage: ItemEventMessage) {
const itemEvent = ProtobufUtils.toItemEvent(itemEventMessage); const itemEvent = ProtobufUtils.toItemEvent(itemEventMessage);

View File

@ -615,19 +615,6 @@ export class RoomConnection implements RoomConnection {
this.socket.send(bytes); 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 { public setViewport(viewport: ViewportInterface): void {
const bytes = ClientToServerMessageTsProto.encode({ const bytes = ClientToServerMessageTsProto.encode({
message: { message: {

View File

@ -73,7 +73,7 @@ export class PlayerStatusDot extends Phaser.GameObjects.Container {
return { filling: this.COLORS.online, outline: this.COLORS.onlineOutline }; return { filling: this.COLORS.online, outline: this.COLORS.onlineOutline };
case AvailabilityStatus.AWAY: case AvailabilityStatus.AWAY:
return { filling: this.COLORS.away, outline: this.COLORS.awayOutline }; return { filling: this.COLORS.away, outline: this.COLORS.awayOutline };
case AvailabilityStatus.SILENCED: case AvailabilityStatus.SILENT:
return { filling: this.COLORS.silenced, outline: this.COLORS.silencedOutline }; return { filling: this.COLORS.silenced, outline: this.COLORS.silencedOutline };
default: default:
return { filling: this.COLORS.never, outline: this.COLORS.never }; 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 type CancelablePromise from "cancelable-promise";
import { TalkIcon } from "../Components/TalkIcon"; import { TalkIcon } from "../Components/TalkIcon";
import { Deferred } from "ts-deferred"; 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 playerNameY = -25;
const interactiveRadius = 35; const interactiveRadius = 35;
@ -236,7 +237,7 @@ export abstract class Character extends Container implements OutlineableInterfac
this.talkIcon.show(show, forceClose); 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); this.statusDot.setStatus(status, instant);
} }

View File

@ -144,10 +144,10 @@ export class GameMapPropertiesListener {
this.gameMap.onPropertyChange(GameMapProperties.SILENT, (newValue) => { this.gameMap.onPropertyChange(GameMapProperties.SILENT, (newValue) => {
if (newValue === undefined || newValue === false || newValue === "") { if (newValue === undefined || newValue === false || newValue === "") {
this.scene.connection?.setSilent(false); // this.scene.connection?.setSilent(false);
this.scene.CurrentPlayer.noSilent(); this.scene.CurrentPlayer.noSilent();
} else { } else {
this.scene.connection?.setSilent(true); // this.scene.connection?.setSilent(true);
this.scene.CurrentPlayer.isSilent(); this.scene.CurrentPlayer.isSilent();
} }
}); });

View File

@ -709,7 +709,7 @@ export class GameScene extends DirtyScene {
}); });
this.privacyShutdownStoreUnsubscribe = privacyShutdownStore.subscribe((away) => { 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); this.connection?.emitPlayerStatusChange(away ? AvailabilityStatus.AWAY : AvailabilityStatus.ONLINE);
}); });
@ -2153,13 +2153,13 @@ ${escapedMessage}
} }
public enableMediaBehaviors() { public enableMediaBehaviors() {
const silent = this.gameMap.getCurrentProperties().get(GameMapProperties.SILENT); // const silent = this.gameMap.getCurrentProperties().get(GameMapProperties.SILENT);
this.connection?.setSilent(!!silent); // this.connection?.setSilent(!!silent);
mediaManager.showMyCamera(); mediaManager.showMyCamera();
} }
public disableMediaBehaviors() { public disableMediaBehaviors() {
this.connection?.setSilent(true); // this.connection?.setSilent(true);
mediaManager.hideMyCamera(); mediaManager.hideMyCamera();
} }

View File

@ -6,7 +6,7 @@ import "google/protobuf/wrappers.proto";
enum AvailabilityStatus { enum AvailabilityStatus {
ONLINE = 0; ONLINE = 0;
SILENCED = 1; SILENT = 1;
AWAY = 2; AWAY = 2;
} }
@ -35,10 +35,6 @@ message ViewportMessage {
int32 bottom = 4; int32 bottom = 4;
} }
message SilentMessage {
bool silent = 1;
}
message CharacterLayerMessage { message CharacterLayerMessage {
string url = 1; string url = 1;
string name = 2; string name = 2;
@ -112,7 +108,6 @@ message LockGroupPromptMessage {
message ClientToServerMessage { message ClientToServerMessage {
oneof message { oneof message {
UserMovesMessage userMovesMessage = 2; UserMovesMessage userMovesMessage = 2;
SilentMessage silentMessage = 3;
ViewportMessage viewportMessage = 4; ViewportMessage viewportMessage = 4;
ItemEventMessage itemEventMessage = 5; ItemEventMessage itemEventMessage = 5;
SetPlayerDetailsMessage setPlayerDetailsMessage = 6; SetPlayerDetailsMessage setPlayerDetailsMessage = 6;
@ -411,7 +406,6 @@ message PusherToBackMessage {
oneof message { oneof message {
JoinRoomMessage joinRoomMessage = 1; JoinRoomMessage joinRoomMessage = 1;
UserMovesMessage userMovesMessage = 2; UserMovesMessage userMovesMessage = 2;
SilentMessage silentMessage = 3;
ItemEventMessage itemEventMessage = 4; ItemEventMessage itemEventMessage = 4;
SetPlayerDetailsMessage setPlayerDetailsMessage = 5; SetPlayerDetailsMessage setPlayerDetailsMessage = 5;
WebRtcSignalToServerMessage webRtcSignalToServerMessage = 6; WebRtcSignalToServerMessage webRtcSignalToServerMessage = 6;

View File

@ -8,7 +8,6 @@ import {
ItemEventMessage, ItemEventMessage,
ViewportMessage, ViewportMessage,
ClientToServerMessage, ClientToServerMessage,
SilentMessage,
WebRtcSignalToServerMessage, WebRtcSignalToServerMessage,
PlayGlobalMessage, PlayGlobalMessage,
ReportPlayerMessage, ReportPlayerMessage,
@ -525,8 +524,6 @@ export class IoSocketController {
client, client,
message.getSetplayerdetailsmessage() as SetPlayerDetailsMessage message.getSetplayerdetailsmessage() as SetPlayerDetailsMessage
); );
} else if (message.hasSilentmessage()) {
socketManager.handleSilentMessage(client, message.getSilentmessage() as SilentMessage);
} else if (message.hasItemeventmessage()) { } else if (message.hasItemeventmessage()) {
socketManager.handleItemEvent(client, message.getItemeventmessage() as ItemEventMessage); socketManager.handleItemEvent(client, message.getItemeventmessage() as ItemEventMessage);
} else if (message.hasVariablemessage()) { } else if (message.hasVariablemessage()) {

View File

@ -24,7 +24,6 @@ import {
ServerToAdminClientMessage, ServerToAdminClientMessage,
ServerToClientMessage, ServerToClientMessage,
SetPlayerDetailsMessage, SetPlayerDetailsMessage,
SilentMessage,
SubMessage, SubMessage,
UserJoinedRoomMessage, UserJoinedRoomMessage,
UserLeftMessage, UserLeftMessage,
@ -334,13 +333,6 @@ export class SocketManager implements ZoneEventListener {
client.backConnection.write(pusherToBackMessage); 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) { handleItemEvent(client: ExSocketInterface, itemEventMessage: ItemEventMessage) {
const pusherToBackMessage = new PusherToBackMessage(); const pusherToBackMessage = new PusherToBackMessage();
pusherToBackMessage.setItemeventmessage(itemEventMessage); pusherToBackMessage.setItemeventmessage(itemEventMessage);