Skip to content

Commit

Permalink
added functionality for sending proximity messages
Browse files Browse the repository at this point in the history
  • Loading branch information
barolick committed Apr 15, 2022
1 parent df61d92 commit df0a7bf
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,13 @@ function townSocketAdapter(
}
case ChatType.PROXIMITY: {
const { recipients } = message;
if (recipients && recipients.length > 1) {
if (recipients && recipients.length >= 1) {
recipients.forEach(recipient => {
const toSocketId = playerIdToSocketId.get(recipient);
if (toSocketId) socket.to(toSocketId).emit('chatMessage', message);
const senderSocketId = playerIdToSocketId.get(message.senderID);
if (toSocketId && senderSocketId && (senderSocketId === socket.id || toSocketId === socket.id)){
socket.to(toSocketId).emit('chatMessage', message);
}
});
}
break;
Expand Down

0 comments on commit df0a7bf

Please # to comment.