1
0
forked from noxious/server

A* and move logic improvements

This commit is contained in:
2024-08-20 21:33:57 +02:00
parent 079d9408a8
commit acc9eaae9e
3 changed files with 29 additions and 15 deletions

View File

@ -19,12 +19,7 @@ export default function (socket: TSocket, io: Server) {
const character = await CharacterRepository.getByUserAndId(socket.user?.id as number, socket.character?.id as number)
if (!character) return
// When 1 arg is provided, only send message. 2 includes a title
if (args.length === 1) {
return io.emit('notification', { message: args[0] })
}
io.emit('notification', { title: args[0], message: args.slice(1).join(' ') })
io.emit('notification', { title: 'Message from GM', message: args.join(' ') })
callback(true)
} catch (error: any) {
console.log(`---Error sending message: ${error.message}`)