mirror of
https://git.rezel.net/LudoTech/traque.git
synced 2026-02-09 02:10:18 +01:00
rever to 9615d4fecd
This commit is contained in:
@@ -2,8 +2,6 @@ import { io, game, penaltyController } from "./index.js";
|
||||
import { playersBroadcast, sendUpdatedTeamInformations } from "./team_socket.js";
|
||||
|
||||
import { config } from "dotenv";
|
||||
import { currentZone, initZone, removeZone } from "./zone_manager.js";
|
||||
import { GameState } from "./game.js";
|
||||
config()
|
||||
|
||||
const ADMIN_PASSWORD = process.env.ADMIN_PASSWORD;
|
||||
@@ -49,7 +47,12 @@ export function initAdminSocketHandler() {
|
||||
//Other settings that need initialization
|
||||
socket.emit("penalty_settings", penaltyController.settings)
|
||||
socket.emit("game_settings", game.settings)
|
||||
socket.emit("zone", currentZone)
|
||||
socket.emit("zone_settings", game.zone.zoneSettings)
|
||||
socket.emit("zone", game.zone.currentZone)
|
||||
socket.emit("new_zone", {
|
||||
begin: game.zone.currentStartZone,
|
||||
end: game.zone.nextZone
|
||||
})
|
||||
|
||||
} else {
|
||||
//Attempt unsuccessful
|
||||
@@ -69,25 +72,19 @@ export function initAdminSocketHandler() {
|
||||
playersBroadcast("game_settings", game.settings);
|
||||
})
|
||||
|
||||
socket.on("set_zone", (zone) => {
|
||||
socket.on("set_zone_settings", (settings) => {
|
||||
if (!loggedIn) {
|
||||
socket.emit("error", "Not logged in");
|
||||
return;
|
||||
}
|
||||
if(game.state != GameState.PLAYING) {
|
||||
initZone(zone)
|
||||
}else {
|
||||
socket.emit("error", "Game is not in setup state")
|
||||
if (!game.setZoneSettings(settings)) {
|
||||
socket.emit("error", "Error changing zone");
|
||||
socket.emit("zone_settings", game.zone.zoneSettings) //Still broadcast the old config to the client who submited an incorrect config to keep the client up to date
|
||||
} else {
|
||||
secureAdminBroadcast("zone_settings", game.zone.zoneSettings)
|
||||
}
|
||||
})
|
||||
|
||||
socket.on("remove_zone", (zone, time) => {
|
||||
if (!loggedIn) {
|
||||
socket.emit("error", "Not logged in");
|
||||
return;
|
||||
}
|
||||
removeZone(zone, time)
|
||||
});
|
||||
})
|
||||
|
||||
socket.on("set_penalty_settings", (settings) => {
|
||||
if (!loggedIn) {
|
||||
|
||||
Reference in New Issue
Block a user