Settings screen, pause on furious customers, customer happiness overview (1.20.0)

Fixes #13, fixes #14, fixes #15
This commit is contained in:
Frederic Jung 2026-10-25 10:29:49 +01:00
parent dfa28506a7
commit f2379bf72c
No known key found for this signature in database
7 changed files with 209 additions and 16 deletions

View file

@ -6,6 +6,22 @@ All notable changes to this project are documented here. The project follows
## [Unreleased]
## [1.20.0] — 2026-10-25
- A proper Settings screen, from the menu or the title screen: alerts, animations,
sound and language in one place, saved on your device.
- The game can pause when a customer turns furious, so you no longer lose
customers to a notification you missed at 8× speed (#13). It is on by
default and can be switched off in Settings, where you can also choose to
pause on outages that cost you real traffic.
- Customer happiness is easier to keep an eye on (#15). You get an early warning
when a customer drops below 60%, with the reason. A Customers box in the top bar
(on phones, a red count on Deals) shows how happy they are overall.
- A Customers list in the NOC dashboard shows everyone who pays you, unhappiest
first, with what they pay, whether they are getting happier or angrier, and
exactly what is wrong. Filter it to the unhappy ones or by city, and tap Open
to go to them (#14).
## [1.19.0] — 2026-10-25
- See all your connections in one place (#31, #33, #38): a new Connections list

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "seriesoftubes",
"version": "1.19.0",
"version": "1.20.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "seriesoftubes",
"version": "1.19.0",
"version": "1.20.0",
"devDependencies": {
"jsdom": "24.1.3"
},

View file

@ -1,6 +1,6 @@
{
"name": "seriesoftubes",
"version": "1.19.0",
"version": "1.20.0",
"description": "A cartoon browser game about building the internet.",
"private": true,
"license": "MIT",

View file

@ -2122,4 +2122,40 @@
"It opens straight into your network, like any other app.":"Si apre direttamente sulla tua rete, come qualsiasi altra app.",
"Install the app":"Installa l’app",
"Play in the browser anyway":"Gioca comunque nel browser",
"Game paused.":"Gioco in pausa.",
"<b>{name} is getting unhappy.</b><br>Happiness {p}% in {city}.":"<b>{name} sta diventando scontento.</b><br>Soddisfazione {p}% a {city}.",
"Your customers":"I tuoi clienti",
"happiness {p}%":"soddisfazione {p}%",
"{n} unhappy customer, {price}/mo at risk":"{n} cliente scontento, {price}/mese a rischio",
"{n} unhappy customers, {price}/mo at risk":"{n} clienti scontenti, {price}/mese a rischio",
"See who":"Vedi chi",
"All customers":"Tutti i clienti",
"their fiber is down":"la loro fibra è giù",
"getting only {p} of the bandwidth they pay for":"ricevono solo {p} della banda che pagano",
"you cannot reach the whole internet ({p})":"non raggiungi tutta internet ({p})",
"No customers yet. Offers show up in the Deals tab.":"Ancora nessun cliente. Le offerte compaiono nella scheda Offerte.",
"Everyone who pays you, happiest last. Below 60% they start to grumble, below 30% they are furious, and at 0% they cancel.":"Tutti quelli che ti pagano, i più contenti in fondo. Sotto il 60% iniziano a brontolare, sotto il 30% sono furiosi, e a 0% disdicono.",
"Happiness":"Soddisfazione",
"weighted by what they pay":"pesata su quanto pagano",
"Unhappy":"Scontenti",
"{n} furious":"{n} furiosi",
"At risk":"A rischio",
"from unhappy customers":"dai clienti scontenti",
"Unhappy ({n})":"Scontenti ({n})",
"Nobody is unhappy. Enjoy it while it lasts.":"Nessuno è scontento. Goditela finché dura.",
"No customers here.":"Nessun cliente qui.",
"Name":"Nome",
"Resume":"Riprendi",
"Saved on this device.":"Salvate su questo dispositivo.",
"Customers and alerts":"Clienti e avvisi",
"Pause when a customer is furious":"Pausa quando un cliente è furioso",
"The game stops so you can fix their service before they cancel. Most useful at high speed.":"Il gioco si ferma così puoi sistemare il servizio prima che disdicano. Utilissimo ad alta velocità.",
"Warn when a customer gets unhappy":"Avvisa quando un cliente diventa scontento",
"An early heads-up below 60% happiness, long before they are furious.":"Un avviso in anticipo sotto il 60% di soddisfazione, molto prima che siano furiosi.",
"Pause on outages that hurt":"Pausa sui guasti che fanno male",
"Stops the game when a failure costs you real traffic, not when it reroutes by itself.":"Ferma il gioco quando un guasto ti costa traffico vero, non quando si reinstrada da solo.",
"Display and sound":"Schermo e audio",
"Viewport info":"Info viewport",
"For reporting layout bugs: shows what your screen tells the game.":"Per segnalare bug di layout: mostra cosa lo schermo dice al gioco.",
"Done":"Fatto",
};

File diff suppressed because one or more lines are too long

View file

@ -400,3 +400,75 @@ test('#31 #33 #38 connections overview lists every port, filters it and jumps to
assert.match(jump.textContent, /Transit.*Frankfurt/);
assert.deepEqual(errors, []);
});
test('#13 #15 unhappy customers warn early, furious ones pause the game (optional)', () => {
const { ev, errors } = load();
base(ev);
ev("S.biz.push({id:'b1',city:'fra',city2:null,reqs:[],name:'Llama Logistics',type:'dia',bw:5,rate:100,mood:100,since:-100});compute();ACT.speed({v:4})");
const toasts = () => ev("document.getElementById('toasts').textContent");
// service collapses: happiness falls through 60% (warning) then 30% (furious, paused)
ev("bizSf=()=>0.6");
for (let i = 0; i < 3; i++) ev('dayTick()');
assert.match(toasts(), /Llama Logistics is getting unhappy/);
assert.match(toasts(), /getting only 60%/, 'the warning says why');
assert.equal(ev('UI.speed'), 4, 'a warning does not pause');
for (let i = 0; i < 4 && ev('UI.speed') !== 0; i++) ev('dayTick()');
assert.match(toasts(), /Llama Logistics is furious/);
assert.equal(ev('UI.speed'), 0, 'furious pauses the game');
assert.match(toasts(), /Game paused/);
assert.equal(ev('UI.resumeSpeed'), 4, 'Resume goes back to the old speed');
// the setting turns it off
ev("setPref('pauseFurious',false);setPref('warnUnhappy',false);S.biz.push({id:'b2',city:'fra',city2:null,reqs:[],name:'Snack Overflow',type:'dia',bw:5,rate:100,mood:100,since:-100});ACT.speed({v:2})");
for (let i = 0; i < 5; i++) ev('dayTick()');
assert.ok(ev("S.biz.find(b=>b.id==='b2').mood") < 30);
assert.equal(ev('UI.speed'), 2, 'no pause with the setting off');
assert.doesNotMatch(toasts(), /Snack Overflow is getting unhappy/);
assert.equal(ev("JSON.parse(localStorage.getItem('sot-prefs')).pauseFurious"), false, 'stored per device');
assert.deepEqual(errors, []);
});
test('#14 customers overview lists everyone with happiness, reasons and a jump', () => {
const { ev, dom, errors } = load();
base(ev);
const doc = dom.window.document;
ev("ACT.buildPop({city:'ams'});S.biz.push({id:'c1',city:'fra',city2:null,reqs:[],name:'Happy Hamster',type:'dia',bw:10,rate:100,mood:95,since:-100},{id:'c2',city:'ams',city2:null,reqs:[],name:'Grumpy Goat',type:'host',bw:20,rate:100,mood:40,since:-100});compute();renderAll()");
const st = JSON.parse(ev('JSON.stringify(custStats())'));
assert.equal(st.n, 2);
assert.equal(st.unhappy, 1);
assert.equal(st.risk, 2000, 'the unhappy customer pays 2000/mo');
assert.ok(st.avg > 40 && st.avg < 95, 'happiness is weighted by what they pay');
assert.equal(ev("$('hCust').hidden"), false, 'HUD shows customer happiness');
assert.match(ev("$('hCustVal').textContent"), /%/);
ev('ACT.custOpen({})');
const names = () => [...doc.querySelectorAll('#custSec .row .nm')].map((n) => n.textContent);
assert.equal(names().length, 2);
assert.match(names()[0], /Grumpy Goat/, 'unhappiest first');
ev("ACT.custF({v:'sad'})");
assert.equal(names().length, 1);
ev("ACT.custF({v:''});ACT.custCity({v:'fra'})");
assert.deepEqual(names().map((n) => n.split(' ')[0]), ['Happy']);
ev("ACT.custGo({id:'c2'})");
assert.equal(ev("$('dash').hidden"), true);
assert.equal(ev('UI.sel.id'), 'ams');
assert.equal(ev('UI.tab'), 'cust');
// the Deals tab summary
ev("UI.left='deals';UI.leftOpen=true;UI.sel=null;renderLeft()");
assert.match(doc.getElementById('leftBody').textContent, /1 unhappy customer/);
assert.deepEqual(errors, []);
});
test('settings screen holds every option and opens from the menu and the title screen', () => {
const { ev, errors } = load();
ev('showTitle();ACT.settings()');
const card = () => ev("document.getElementById('modalCard').textContent");
for (const t of [/Pause when a customer is furious/, /Warn when a customer gets unhappy/, /Pause on outages/, /Animations/, /Sound/, /Language/]) assert.match(card(), t);
ev("ACT.prefSet({v:'pauseIncident:1'})");
assert.equal(ev("pref('pauseIncident')"), true);
ev("ACT.prefSet({v:'nope:1'})");
assert.equal(ev("'nope' in PREFS"), false, 'unknown settings are ignored');
ev('ACT.settingsClose()');
assert.match(card(), /Start building|Name your network/, 'back to the title screen');
ev('ACT.start({});ACT.menu();ACT.settings();ACT.settingsClose()');
assert.equal(ev("document.getElementById('modal').hidden"), true);
assert.deepEqual(errors, []);
});

View file

@ -106,6 +106,8 @@ test('the guided tutorial walks through the first steps and can be skipped', ()
test('animations can be switched off, on or follow the system, and the choice sticks', () => {
const { ev, errors } = load();
ev("ACT.start({});ACT.menu()");
assert.match(ev("document.getElementById('modalCard').textContent"), /Settings/);
ev("ACT.settings()");
assert.match(ev("document.getElementById('modalCard').textContent"), /Animations/);
ev("ACT.animSet({v:'off'})");
assert.equal(ev("document.documentElement.classList.contains('no-anim')"), true);