Skip to content

Commit 233d4a8

Browse files
protocolo v9: el mensaje 'apagon' del PR #77 sube la versión (norma de la casa)
Un cliente v8 ignoraría el apagón sin romperse, pero la subida fuerza el autoActualizar y garantiza que todos vean las fases a la vez. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 4a37c4b commit 233d4a8

8 files changed

Lines changed: 8 additions & 8 deletions

File tree

game/js/net/cliente.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
}
8686
ws = new WebSocket(urlServidor());
8787
ws.onopen = () => enviar({
88-
t: 'hola', nombre, token: token(), v: 8, // debe coincidir con protocolo.js
88+
t: 'hola', nombre, token: token(), v: 9, // debe coincidir con protocolo.js
8989
nivel: params.get('nivel') || undefined, // puerta de desarrollo (solo MMO_DEV=1)
9090
sala: salaActual || undefined,
9191
});

server/bots.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function bot(i) {
3030
const st = { x: 0, y: 0, rot: Math.PI, sec: 0, map: null, id: null };
3131
ws.on('open', () => {
3232
conectados++;
33-
ws.send(JSON.stringify({ t: 'hola', nombre: `Bot-${i}`, token: `bot-${i}`, v: 8, nivel: NIVEL }));
33+
ws.send(JSON.stringify({ t: 'hola', nombre: `Bot-${i}`, token: `bot-${i}`, v: 9, nivel: NIVEL }));
3434
let giro = 0;
3535
const paso = setInterval(() => {
3636
if (ws.readyState !== 1) { clearInterval(paso); return; }

server/protocolo.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
// {t:'pong'}
2020
'use strict';
2121

22-
const VERSION = 8; // v30: modo espectador del guardián (mensaje 'espectar')
22+
const VERSION = 9; // v30.13: apagones globales de Level 1 (mensaje 'apagon' + campo en estadoDinamico)
2323
const MAX_MSG = 512; // bytes por mensaje entrante
2424
const MAX_CHAT = 120; // caracteres de un chat
2525
const COOLDOWN_MOVER = 165; // ms entre pasos (el cliente usa 170: margen de jitter)

server/test-admin-clave.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function cliente(token) {
3030
const ws = new WebSocket(`ws://127.0.0.1:${PUERTO}/ws`);
3131
const msgs = [];
3232
ws.on('open', () => {
33-
ws.send(JSON.stringify({ t: 'hola', nombre: 'Arnes', token, v: 8, nivel: 'level-1' }));
33+
ws.send(JSON.stringify({ t: 'hola', nombre: 'Arnes', token, v: 9, nivel: 'level-1' }));
3434
});
3535
ws.on('message', (raw) => {
3636
const m = JSON.parse(raw.toString());

server/test-espectador.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class Cliente {
4242
return new Promise((res, rej) => {
4343
this.ws = new WebSocket(`ws://127.0.0.1:${PUERTO}/ws`);
4444
this.ws.on('open', () => {
45-
this.enviar({ t: 'hola', nombre: this.nombre, token: 'arnes-esp-' + this.nombre, v: 8, nivel: this.nivelPedido });
45+
this.enviar({ t: 'hola', nombre: this.nombre, token: 'arnes-esp-' + this.nombre, v: 9, nivel: this.nivelPedido });
4646
});
4747
this.ws.on('message', (raw) => {
4848
const m = JSON.parse(raw.toString());

server/test-integracion.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class Cliente {
5757
return new Promise((res, rej) => {
5858
this.ws = new WebSocket(`ws://127.0.0.1:${PUERTO}/ws`);
5959
this.ws.on('open', () => {
60-
this.enviar({ t: 'hola', nombre: this.nombre, token: 'arnes-' + this.nombre, v: 8, nivel: this.nivelPedido });
60+
this.enviar({ t: 'hola', nombre: this.nombre, token: 'arnes-' + this.nombre, v: 9, nivel: this.nivelPedido });
6161
res();
6262
});
6363
this.ws.on('message', (raw) => {

server/test-retorno.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class Cliente {
2828
return new Promise((res, rej) => {
2929
this.ws = new WebSocket(`ws://127.0.0.1:${PUERTO}/ws`);
3030
this.ws.on('open', () => {
31-
this.enviar({ t: 'hola', nombre: this.nombre, token: 'arnes2-' + this.nombre, v: 8, nivel: this.nivelPedido });
31+
this.enviar({ t: 'hola', nombre: this.nombre, token: 'arnes2-' + this.nombre, v: 9, nivel: this.nivelPedido });
3232
res();
3333
});
3434
this.ws.on('message', (raw) => {

server/test-riesgo-void.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Cliente {
3030
return new Promise((res, rej) => {
3131
this.ws = new WebSocket(`ws://127.0.0.1:${PUERTO}/ws`);
3232
this.ws.on('open', () => {
33-
this.enviar({ t: 'hola', nombre: this.nombre, token: 'arnes-void-' + this.nombre, v: 8, nivel: this.nivelPedido });
33+
this.enviar({ t: 'hola', nombre: this.nombre, token: 'arnes-void-' + this.nombre, v: 9, nivel: this.nivelPedido });
3434
res();
3535
});
3636
this.ws.on('message', (raw) => {

0 commit comments

Comments
 (0)