mirror of
https://git.rezel.net/LudoTech/traque.git
synced 2026-02-09 10:20:16 +01:00
added live map
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { secureAdminBroadcast } from "./admin_socket.js";
|
||||
import { io, game } from "./index.js";
|
||||
import { currentZone } from "./zone_manager.js";
|
||||
|
||||
/**
|
||||
* Send a socket message to all the players of a team
|
||||
@@ -8,9 +9,13 @@ import { io, game } from "./index.js";
|
||||
* @param {*} data The payload
|
||||
*/
|
||||
export function teamBroadcast(teamId, event, data) {
|
||||
if(!game.getTeam(teamId)) {
|
||||
return false;
|
||||
}
|
||||
for (let socketId of game.getTeam(teamId).sockets) {
|
||||
io.of("player").to(socketId).emit(event, data)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,11 +84,7 @@ export function initTeamSocket() {
|
||||
socket.emit("login_response", true);
|
||||
socket.emit("game_state", game.state)
|
||||
socket.emit("game_settings", game.settings)
|
||||
socket.emit("zone", game.zone.currentZone)
|
||||
socket.emit("new_zone", {
|
||||
begin: game.zone.currentStartZone,
|
||||
end: game.zone.nextZone
|
||||
})
|
||||
socket.emit("zone", currentZone)
|
||||
});
|
||||
|
||||
socket.on("logout", () => {
|
||||
|
||||
Reference in New Issue
Block a user