Aufwärmphase vor mp_warmup_end als beendet markieren

CS2 sendet Match_Start sofort nach mp_warmup_end, oft bevor die
RCON-Antwort da ist. Bei fehlgeschlagenem Befehl wird die Markierung
zurückgenommen.
This commit is contained in:
mregosar committed 2026-10-25 19:23:53 +01:00
1 parent 263c7e7b7c
commit ea2207899f
2 files changed
+5 -3

No files matched your search

+2 -2
View File
@@ -449,12 +449,12 @@ export class MatchService extends EventEmitter {
}
/** Organisator hat die Aufwärmphase beendet: ab dem nächsten Match_Start wird gezählt. */
markWarmupEnded(matchId) {
markWarmupEnded(matchId, ended = true) {
const match = this.getMatch(matchId);
const row = this.seriesMaps(matchId).find((m) => m.number === match.current_map_number);
if (!row) return;
const state = row.live ? JSON.parse(row.live) : initialLiveState({ map: row.map, ctTeam: row.ct_team });
state.warmupEnded = true;
state.warmupEnded = ended;
this.db
.prepare('UPDATE series_maps SET live = ? WHERE match_id = ? AND number = ?')
.run(JSON.stringify(state), matchId, row.number);
+3 -1
View File
@@ -322,13 +322,15 @@ export class ServerManager {
const row = this.row(viewer.matchId);
if (row?.status !== 'configured') throw new HttpError(409, 'Der Server ist noch nicht konfiguriert', 'wrong_state');
if (!this.adapter.sendCommands) throw new HttpError(501, 'Dieser Adapter unterstützt keine Befehle', 'unsupported');
// Vor dem Befehl markieren: CS2 schickt Match_Start sofort nach mp_warmup_end, oft bevor RCON antwortet.
this.service.markWarmupEnded(viewer.matchId, true);
try {
await this.adapter.sendCommands(JSON.parse(row.handle), ['mp_warmup_pausetimer 0', 'mp_warmup_end']);
} catch (err) {
this.service.markWarmupEnded(viewer.matchId, false);
throw new HttpError(502, `Befehl konnte nicht gesendet werden: ${err.message}`, 'server_error');
}
this.service.log(viewer.matchId, 'server', this.adapter.simulated ? 'Aufwärmphase beendet (simuliert)' : 'Aufwärmphase beendet – Match startet');
this.service.markWarmupEnded(viewer.matchId);
if (this.adapter.simulated) this.startDemoSimulation(viewer.matchId);
this.service.changed(viewer.matchId);
}