Skip to content
Merged
22 changes: 11 additions & 11 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion e63334287a3deaa3/blockstorm/es.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 12 additions & 4 deletions e63334287a3deaa3/blockstorm/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ <h2 id="lobbyTitle">LOBBY</h2>
<select id="lobbyMode"><option value="ffa">Free-for-all: most kills wins</option><option value="ctf">Capture the flag: Blue vs Red</option></select>
<label for="lobbyBots">Bots in this lobby</label>
<select id="lobbyBots"><option value="0">No bots (players only, good for 1v1)</option><option value="1">Medium bots</option><option value="2">Hard bots</option><option value="3">Extreme bots</option></select></div>
<p class="muted" id="noBotsNote" hidden style="font-size:14px;margin:6px 0 0">No bots in party games</p>
<p class="muted" id="lobbyBotsText" hidden></p>
<ul class="lobby-list" id="lobbyList"></ul>
<div class="row">
Expand Down Expand Up @@ -2124,6 +2125,7 @@ <h2 id="lobbyTitle">LOBBY</h2>
const rs = NET.rs && typeof NET.rs.id === 'number' ? Object.assign({}, NET.rs) : null;
if (!rs) NET.rs = { id: 0, st: 'lobby', md: roomMode(), bl: botLevelSetting(), nb: NET.isPublic ? PUB_BOTS : profile.settings.bots, t0: 0, len: 0, et: 0 };
else NET.rs = rs;
if (partyRoom() && (NET.rs.bl | 0)) NET.rs = Object.assign({}, NET.rs, { bl: 0 });
if (rs && rs.st === 'play' && G.state === 'play' && G.matchId === rs.id) takeOverMatch();
else if (rs && rs.st === 'play') hostStartMatch();
if (was) addFeedNote("You're the host now");
Expand All @@ -2146,7 +2148,7 @@ <h2 id="lobbyTitle">LOBBY</h2>
if (NET.mode !== 'host') return;
const old = NET.rs || {};
const minutes = NET.isPublic ? PUB_MINUTES : profile.settings.minutes;
NET.rs = { id: (old.id | 0) + 1, st: 'play', md: NET.isPublic ? roomMode() : (old.md === 'ctf' ? 'ctf' : old.md === 'ffa' ? 'ffa' : roomMode()), bl: old.bl ?? botLevelSetting(), nb: old.nb || (NET.isPublic ? PUB_BOTS : profile.settings.bots), t0: Math.round(netNow()), len: minutes * 60000, et: 0 };
NET.rs = { id: (old.id | 0) + 1, st: 'play', md: NET.isPublic ? roomMode() : (old.md === 'ctf' ? 'ctf' : old.md === 'ffa' ? 'ffa' : roomMode()), bl: partyRoom() ? 0 : old.bl ?? botLevelSetting(), nb: old.nb || (NET.isPublic ? PUB_BOTS : profile.settings.bots), t0: Math.round(netNow()), len: minutes * 60000, et: 0 };
startMatch(); NET.soon = true;
}
function hostTick() {
Expand Down Expand Up @@ -2209,7 +2211,9 @@ <h2 id="lobbyTitle">LOBBY</h2>
$('#lobbyStatus').textContent = status;
$('#btnLobbyStart').hidden = !(host && !NET.isPublic && rs.st !== 'play');
$('#lobbyBotsWrap').hidden = !(host && !NET.isPublic);
$('#lobbyMode').value = rs.md === 'ctf' ? 'ctf' : 'ffa'; $('#lobbyBots').value = String(rs.bl ?? botLevelSetting());
const party = partyRoom();
$('#lobbyMode').value = rs.md === 'ctf' ? 'ctf' : 'ffa'; $('#lobbyBots').value = party ? '0' : String(rs.bl ?? botLevelSetting());
$('#lobbyBots').disabled = party; $('#noBotsNote').hidden = !party;
$('#lobbyBotsText').hidden = host && !NET.isPublic;
$('#lobbyBotsText').textContent = TX((rs.md === 'ctf' ? 'Capture the flag' : 'Free-for-all') + ' · Bots: {b}', { b: TX((rs.bl | 0) ? BOT_LEVELS[rs.bl | 0] : 'none, players only') });
const html = list.map(p => `<li><span>${esc(p.name)}${p.id === NET.uid ? ' <span class="muted">(you)</span>' : ''}</span>${p.id === NET.hostUid ? '<b>HOST</b>' : ''}</li>`).join('');
Expand All @@ -2221,6 +2225,10 @@ <h2 id="lobbyTitle">LOBBY</h2>
}

/* ---------- the menu's online buttons ---------- */
// A party launch (party.js, Play together) opens a room named p + 6 characters from party.js's own alphabet. Those
// rooms are for the party's people only: bot level 0 (players only), whoever hosts.
function isPartyRoom(r) { return /^p[a-hjkmnp-z2-9]{6}$/.test(sanitizeRoom(r)); }
function partyRoom() { return !!NET.room && !NET.isPublic && isPartyRoom(NET.code); }
function sanitizeRoom(s) { return String(s || '').toLowerCase().replace(/^bs-/, '').replace(/[^a-z0-9-]/g, '').slice(0, 17); }
function randomRoom() { return pick(['storm', 'tower', 'bolt', 'neon', 'block', 'maze', 'rain', 'sky']) + '-' + Math.floor(100 + Math.random() * 900); }
function setBusy(on) { for (const id of ['#quick', '#joinRoom', '#btnSolo', '#btnCreate']) { const b = $(id); if (b) b.disabled = on; } }
Expand Down Expand Up @@ -2311,7 +2319,7 @@ <h2 id="lobbyTitle">LOBBY</h2>
function botDiff() { return DIFF[Math.max(1, botLevel()) - 1]; }
// "No bots" applies to online lobbies; a solo match always gets bots (medium)
function wantedBots(humans) {
if (netActive()) { const rs = NET.rs || {}; return (rs.bl | 0) === 0 ? 0 : Math.max(0, (rs.nb || profile.settings.bots) - humans); }
if (netActive()) { const rs = NET.rs || {}; return (rs.bl | 0) === 0 || partyRoom() ? 0 : Math.max(0, (rs.nb || profile.settings.bots) - humans); }
return Math.max(0, profile.settings.bots - humans);
}

Expand Down Expand Up @@ -3439,7 +3447,7 @@ <h2 id="lobbyTitle">LOBBY</h2>
$('#btnLobbyLeave').onclick = () => quitToMenu();
// the host's choices go into the room's match node, so everyone's lobby shows them
$('#lobbyMode').onchange = e => { profile.settings.mode = e.target.value === 'ctf' ? 'ctf' : 'ffa'; saveProfile(); if (NET.mode === 'host' && NET.rs) { NET.rs = Object.assign({}, NET.rs, { md: profile.settings.mode }); NET.soon = true; } renderLobby(); };
$('#lobbyBots').onchange = e => { profile.settings.botLevel = clamp(+e.target.value, 0, 3); saveProfile(); if (NET.mode === 'host' && NET.rs) { NET.rs = Object.assign({}, NET.rs, { bl: profile.settings.botLevel, nb: profile.settings.bots }); NET.soon = true; } renderLobby(); };
$('#lobbyBots').onchange = e => { if (partyRoom()) { e.target.value = '0'; return; } profile.settings.botLevel = clamp(+e.target.value, 0, 3); saveProfile(); if (NET.mode === 'host' && NET.rs) { NET.rs = Object.assign({}, NET.rs, { bl: profile.settings.botLevel, nb: profile.settings.bots }); NET.soon = true; } renderLobby(); };
$('#btnMenu').onclick = quitToMenu;
bindTouch();
}
Expand Down
2 changes: 1 addition & 1 deletion e63334287a3deaa3/boostball/es.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 18 additions & 5 deletions e63334287a3deaa3/boostball/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@
.seg button[aria-pressed="true"]{background:var(--blue);color:#fff}
.opts{display:flex;flex-wrap:wrap;gap:8px 12px;align-items:center;margin-top:10px}
.opts .lbl{font-size:14px;color:var(--ink-2);min-width:62px}
.opts .nobots{font-size:13px;font-weight:600;color:var(--ink-2)}
.seg button:disabled{cursor:not-allowed;opacity:.6}
.split{display:flex;gap:10px;margin-top:12px;flex-wrap:wrap}
.split .btn{flex:1}
.msg{min-height:1.3em;margin:12px 0 0;color:var(--ink-2);font-size:16px;line-height:1.35}
Expand Down Expand Up @@ -287,6 +289,7 @@ <h1>Boostball</h1>
<span class="lbl">Teams</span>
<div class="seg" id="sizeSeg" role="group" aria-label="Team size"><button type="button" data-s="1">1v1</button><button type="button" data-s="2">2v2</button><button type="button" data-s="3">3v3</button></div>
<div class="seg" id="botSeg" role="group" aria-label="Fill empty spots with bots"><button type="button" data-b="1">Bots fill in</button><button type="button" data-b="0">No bots</button></div>
<span class="nobots" id="noBotsNote" hidden>No bots in party games</span>
</div>
<div class="opts">
<span class="lbl">Bots</span>
Expand Down Expand Up @@ -3400,7 +3403,7 @@ <h2 id="endTitle">Victory!</h2>
},
rematch(){
if(!online||!this.refs||!R)return;const id=R.id,sz=R.sz,bo=R.bo;
this.refs.round.transaction(cur=>(!cur||cur.id===id)?newRoundObj(cur||R,this.now(),sz,bo):undefined).catch(()=>{});
this.refs.round.transaction(cur=>(!cur||cur.id===id)?newRoundObj(cur||R,this.now(),sz,bo&&!isPartyRoom(this.room)):undefined).catch(()=>{});
},
leave(){
if(this.refs){const r=this.refs;try{r.players.off();r.events.off();r.round.off();r.me.onDisconnect().cancel();r.me.remove()}catch(e){}}
Expand Down Expand Up @@ -3529,7 +3532,7 @@ <h2 id="endTitle">Victory!</h2>
// a player who joins with a bot's name: that bot takes another one
for(const b of cars)if(b.isBot&&!b.remote&&cars.some(h=>!h.isBot&&String(h.name).toLowerCase()===b.name.toLowerCase()))b.name=botName(b);
// keep each team topped up with bots
const want=R.bo?R.sz:0;
const want=R.bo&&!isPartyRoom(Net.room)?R.sz:0;
for(const t of [0,1]){
const humans=cars.filter(c=>c.team===t&&!c.isBot).length;
let bots=cars.filter(c=>c.team===t&&c.isBot);
Expand Down Expand Up @@ -3578,6 +3581,9 @@ <h2 id="endTitle">Victory!</h2>
// Modes
// =====================================================================
function setMsg(t,err){const m=$('netMsg');m.textContent=t;m.classList.toggle('err',!!err)}
// A party launch (party.js, Play together) opens a room named p + 6 characters from party.js's own alphabet. Those
// rooms are for the party's people only: no bots, whatever this browser's Bots fill in says or the round's bo says.
function isPartyRoom(r){return /^p[a-hjkmnp-z2-9]{6}$/.test(sanitizeRoom(r))}
function sanitizeRoom(s){return String(s||'').toLowerCase().replace(/^bb-/,'').replace(/[^a-z0-9-]/g,'').slice(0,17)}
function randomRoom(){return pick(['nitro','kickoff','turbo','aerial','flip','boost','bicycle','ceiling'])+'-'+Math.floor(100+Math.random()*900)}
function busy(on){for(const id of ['quick','joinRoom','practice','freeplay'])$(id).disabled=on}
Expand Down Expand Up @@ -3630,7 +3636,7 @@ <h2 id="endTitle">Victory!</h2>
async function joinPrivate(){
const code=sanitizeRoom($('room').value)||randomRoom();$('room').value=code;store.set('room',code);
busy(true);setMsg('Connecting…');
try{Net.leave();prepOnline();await Net.joinRoom('bb-'+code,false,teamSize,botsOn);enterOnline();setMsg('')}
try{Net.leave();prepOnline();await Net.joinRoom('bb-'+code,false,teamSize,botsOn&&!isPartyRoom(code));enterOnline();setMsg('')}
catch(err){Net.leave();setupAttract();setMsg(err.message||String(err),true)}
finally{busy(false)}
}
Expand Down Expand Up @@ -3699,7 +3705,14 @@ <h2 id="endTitle">Victory!</h2>
el.addEventListener('click',e=>{const b=e.target.closest('button');if(!b)return;set(b.dataset[attr]);paint();sfx('click')});paint();
}
segBind('sizeSeg','s',()=>teamSize,v=>{teamSize=+v;store.set('size',teamSize)});
segBind('botSeg','b',()=>botsOn?1:0,v=>{botsOn=v==='1';store.set('bots',botsOn?1:0)});
segBind('botSeg','b',()=>botsOn&&!isPartyRoom($('room').value)?1:0,v=>{botsOn=v==='1';store.set('bots',botsOn?1:0)});
// A party code in the room box: Bots fill in shows off and can't be changed (the saved choice is kept for other rooms).
function paintBotLock(){
const party=isPartyRoom($('room').value);
$('botSeg').querySelectorAll('button').forEach(b=>{b.disabled=party;b.setAttribute('aria-pressed',String(b.dataset.b===(botsOn&&!party?'1':'0')))});
$('noBotsNote').hidden=!party;
}
$('room').addEventListener('input',paintBotLock);
segBind('diffSeg','d',()=>practiceDiff,v=>{practiceDiff=v;store.set('diff',v)});
segBind('gfxSeg','q',()=>gfx,v=>{gfx=v;store.set('gfx',v);fxTier=2;resize()});
segBind('markSeg','m',()=>markerOn?1:0,v=>{markerOn=v==='1';store.set('marker',markerOn?1:0)});
Expand Down Expand Up @@ -3897,7 +3910,7 @@ <h2 id="endTitle">Victory!</h2>
// An invite opens this page with #bb-<code>: fill in the room and point at the join button.
const inv=/^#bb-([a-z0-9-]{1,17})$/.exec(location.hash);
$('room').value=inv?inv[1]:store.get('room','')||'';
$('name').value=myName;
$('name').value=myName;paintBotLock();
if(inv){setMsg('You were invited to room bb-'+inv[1]+'. Press Play in room to join.');$('joinRoom').classList.remove('alt');$('quick').classList.add('alt')}

// ---- fetching kit.js (see KIT near the top) ----
Expand Down
7 changes: 5 additions & 2 deletions e63334287a3deaa3/coil/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ <h2 class="endtitle" id="endTitle">Cut off</h2>
function wantBots(){
if(mode==='attract')return 16;
if(mode==='practice')return DIFFS[diffKey].bots;
return Net.amHost?clamp(ROOM_FILL-Net.humans(),0,9):0;
return Net.amHost&&!isPartyRoom(Net.room)?clamp(ROOM_FILL-Net.humans(),0,9):0;
}
function tendBots(dt){
botTimer-=dt;if(botTimer>0)return;botTimer=.4;
Expand Down Expand Up @@ -1268,6 +1268,9 @@ <h2 class="endtitle" id="endTitle">Cut off</h2>
}
}
function setMsg(t,err){const m=$('netMsg');m.textContent=t;m.classList.toggle('err',!!err)}
// A party launch (party.js, Play together) opens a room named p + 6 characters from party.js's own alphabet. Those
// rooms are for the party's people only: the host runs no bots there.
function isPartyRoom(r){return /^p[a-hjkmnp-z2-9]{6}$/.test(sanitizeRoom(r))}
function sanitizeRoom(s){return String(s||'').toLowerCase().replace(/^cl-/,'').replace(/[^a-z0-9-]/g,'').slice(0,17)}
function randomRoom(){return pick(['noodle','coil','hiss','fang','scale','venom','loop','twist'])+'-'+Math.floor(100+Math.random()*900)}
function busy(on){for(const id of ['quick','joinRoom','practice'])$(id).disabled=on}
Expand Down Expand Up @@ -1519,7 +1522,7 @@ <h2 class="endtitle" id="endTitle">Cut off</h2>
addEventListener('DOMContentLoaded',()=>{wrSync();if(CAPTAINS)CAPTAINS.onChange(wrSync)});

// For automated tests only (Playwright sets navigator.webdriver): a way to reach the arena from outside.
if(navigator.webdriver)window.__coil={snakes,bots,cam,kill:s=>killLocal(s,null),get player(){return player},
if(navigator.webdriver)window.__coil={snakes,bots,cam,Net,get mode(){return mode},kill:s=>killLocal(s,null),get player(){return player},
get WR(){return WR},lookOf,wardrobeOn,get myLook(){return myLook},setLook(v){store.set('look',v);wrSync()},startPractice,get ctx(){return ctx},Net};

// boot
Expand Down
2 changes: 1 addition & 1 deletion e63334287a3deaa3/deepword/es.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading