Lehrer-Live: laufende Klima-Balken farbig (Ampel) + "Heute bereits erledigt" zeigt alle heutigen Durchgaenge
- klima game-2d/3d: GGS_LIVE_STATE liefert laufenden Punktestand (score, gleiche Formel wie Endbewertung) - live.php summary: laufende Sessions jeder Sim bekommen Ampel-Score (nicht mehr nur Farmer) -> Tag-Ansicht faerbt laufende Balken statt grau - teacher.html _renderInactiveToday: zeigt jetzt ALLE heute abgeschlossenen Laeufe (auch von gerade aktiven Schueler:innen); nur das laufende Spiel bleibt oben. Titel -> "Heute bereits erledigt" Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1570,8 +1570,22 @@ window.GGS_LIVE_STATE = function () {
|
||||
hasShield: !!state.hasMountainShield,
|
||||
hasBeach: !!state.hasSandBeach,
|
||||
placing: typeof placementId !== 'undefined' && placementId !== null ? placementId : null,
|
||||
// Laufender Punktestand (0–100, gleiche Formel wie am Ende) → Ampelfarbe im
|
||||
// Lehrer-Live (Tag-Ansicht färbt laufende Balken danach ein).
|
||||
score: _liveKlimaScore(),
|
||||
};
|
||||
};
|
||||
// Live-Score aus dem aktuellen Stand — nur während des Spiels sinnvoll.
|
||||
function _liveKlimaScore() {
|
||||
if (!state || !state.diff) return null;
|
||||
if (state.phase !== 'playing' && state.phase !== 'citizen' && state.phase !== 'end') return null;
|
||||
var sp = state.diff.startPopulation || 6000;
|
||||
var tempScore = Math.max(0, Math.min(35, 35 - ((state.currentTemp||0) - 15.5) * 20));
|
||||
var floodScore = Math.max(0, 25 - (state.floodedPct||0) * 0.8);
|
||||
var budgetScore = Math.max(0, Math.min(20, (state.budget||0) / 10));
|
||||
var popScore = Math.max(0, Math.min(20, ((state.population||0) / sp) * 20));
|
||||
return Math.round(tempScore + floodScore + budgetScore + popScore);
|
||||
}
|
||||
|
||||
/* ============================================================
|
||||
UI HELPERS
|
||||
|
||||
Reference in New Issue
Block a user