Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@
<div id="mode-badge" class="hidden">FLYING</div>
<div id="hint" role="status"></div>
<div id="quest-tracker">
<button id="qt-head" type="button"><span id="qt-stars">⭐ 0</span><span class="qt-key">Quests (Q)</span></button>
<div class="qt-row">
<button id="qt-head" type="button"><span id="qt-stars">⭐ 0</span><span id="qt-mini"></span><span class="qt-key">Quests (Q)</span></button>
<button id="qt-fold" type="button" aria-label="Hide quests" aria-expanded="true">▴</button>
</div>
<div id="qt-list"></div>
</div>
<div id="celebrate" role="status"><div class="c-title">Quest complete!</div><div class="c-name"></div><div class="c-stars"></div><div class="c-reveal"></div></div>
Expand Down Expand Up @@ -124,6 +127,9 @@ <h1>MiniCrafter</h1>
<label>Field of view <span id="fov-val"></span>
<input id="fov" type="range" min="55" max="100" step="1">
</label>
<label>Quests on screen
<select id="quest-view"><option value="open">Shown</option><option value="folded">Folded (tap ⭐ to open)</option><option value="off">Hidden</option></select>
</label>
<label>Night creatures (⚔️ Adventure only)
<select id="monsters"><option value="easy">Easy: fewer, gentler</option><option value="normal">Normal</option></select>
</label>
Expand Down
33 changes: 32 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -592,11 +592,36 @@ quests.ctx = {

const starStr = (n) => '⭐'.repeat(n);

// Quest tracker: shown, folded to a small pill, or hidden (Settings). Phones start folded so it
// doesn't cover the view; desktops start shown. A folded tracker peeks open for a few seconds
// when a quest finishes or a new one starts, so nobody misses it.
const questView = () => settings.quests || (touchMode ? 'folded' : 'open');
function applyQuestView() {
const v = questView(), folded = v === 'folded';
$('quest-tracker').classList.toggle('folded', folded);
$('quest-tracker').classList.toggle('off', v === 'off');
$('qt-fold').textContent = folded ? '▾' : '▴';
$('qt-fold').setAttribute('aria-label', folded ? 'Show quests' : 'Hide quests');
$('qt-fold').setAttribute('aria-expanded', String(!folded));
$('quest-view').value = v;
}
function setQuestView(v) { settings.quests = v; store.set(SETTINGS_KEY, settings); $('quest-tracker').classList.remove('peek'); applyQuestView(); }
let shownQuests = null, peekTimer;

function renderQuests() {
$('qt-stars').textContent = `⭐ ${quests.stars}`;
$('menu-stars').textContent = `(${quests.stars} / ${quests.maxStars})`;
const list = $('qt-list');
const act = quests.active();
const top = act[0];
$('qt-mini').textContent = top ? `· ${top.icon} ${quests.progress(top)}/${top.count}` : '· 🏆';
const ids = act.map((q) => q.id).join();
if (shownQuests !== null && ids !== shownQuests && questView() === 'folded') {
$('quest-tracker').classList.add('peek');
clearTimeout(peekTimer);
peekTimer = setTimeout(() => $('quest-tracker').classList.remove('peek'), 5000);
}
shownQuests = ids;
list.innerHTML = act.length ? '' : '<div class="q-card">All quests done! You are a MiniCrafter star! 🏆</div>';
for (const q of act) {
const p = quests.progress(q);
Expand Down Expand Up @@ -1047,7 +1072,13 @@ $('craft-done').addEventListener('click', () => closeOverlay(true));
$('pet-done').addEventListener('click', () => closeOverlay(true));
$('qb-done').addEventListener('click', () => closeOverlay(true));
$('btn-quests').addEventListener('click', () => openQuestBook(true));
$('qt-head').addEventListener('click', () => { if (state === 'playing') openQuestBook(false); });
$('qt-head').addEventListener('click', () => {
if (questView() === 'folded') setQuestView('open');
else if (state === 'playing') openQuestBook(false);
});
$('qt-fold').addEventListener('click', () => setQuestView(questView() === 'folded' ? 'open' : 'folded'));
$('quest-view').addEventListener('change', (e) => setQuestView(e.target.value));
applyQuestView();
// ---------- Play Together screens ----------
let knockId = null;
let emojiOpen = false;
Expand Down
8 changes: 8 additions & 0 deletions src/news.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
// the same number. Small bug-fix releases can skip the news (the card only shows entries
// newer than the last one this player saw).
export const NEWS = [
{
v: 34,
title: 'More room to play',
items: [
['⭐', 'The quest list can fold away: tap ▴ to fold it, tap ⭐ to open it again. Phones start folded.'],
['⚙️', 'Settings has a new choice: show, fold or hide quests on screen.'],
],
},
{
v: 31,
title: 'Pets got upgrades!',
Expand Down
8 changes: 8 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,14 @@ button.done { margin-top: 14px; }
.wide-btn { display: block; width: 100%; margin-top: 8px; }
#quest-tracker { position: absolute; top: 10px; right: max(10px, env(safe-area-inset-right)); width: 250px; max-width: 46vw; }
#qt-head { pointer-events: auto; width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 5px 10px; background: rgba(0,0,0,.5); border: 2px solid rgba(255,215,90,.6); font-weight: 700; color: #ffe27a; }
.qt-row { display: flex; gap: 4px; }
#qt-fold { pointer-events: auto; flex: none; min-width: 36px; padding: 0 8px; background: rgba(0,0,0,.5); border: 2px solid rgba(255,215,90,.6); color: #ffe27a; font: inherit; font-weight: 700; cursor: pointer; }
#qt-mini { display: none; margin-left: 8px; font-weight: 400; color: #fff; white-space: nowrap; }
/* Folded: just a small "⭐ 3 · 🔨 4/20" pill. It opens by itself for a few seconds when a quest finishes or a new one starts. */
#quest-tracker.folded:not(.peek) { width: auto; }
#quest-tracker.folded:not(.peek) #qt-list, #quest-tracker.folded:not(.peek) .qt-key { display: none; }
#quest-tracker.folded:not(.peek) #qt-mini { display: inline; }
#quest-tracker.off { display: none; }
.qt-key { font-size: .72rem; color: #cfd6e4; font-weight: 400; }
body.touch .qt-key { display: none; }
.q-card { margin-top: 5px; padding: 6px 9px; background: rgba(0,0,0,.45); border-radius: 6px; font-size: .8rem; }
Expand Down
2 changes: 1 addition & 1 deletion sw.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Service worker: caches the whole game so it works offline once loaded.
// Bump VERSION whenever files change so players get the update.
const VERSION = 'minicrafter-v33';
const VERSION = 'minicrafter-v34';
const CORE = [
'./', './index.html', './style.css', './privacy.html', './terms.html', './legal.css', './features.html', './features.css', './manifest.webmanifest', './site-config.json',
'./icons/icon-192.png', './icons/icon-512.png', './icons/icon-maskable-512.png', './icons/apple-touch-icon.png', './icons/favicon-32.png',
Expand Down
14 changes: 13 additions & 1 deletion tests/smoke.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ try {
ok(core.lit, 'chunks carry voxel light data');
ok(core.worlds >= 1, 'a saved world exists');
ok(core.hotbar === 9, 'hotbar has 9 slots');
ok(await page.evaluate(() => !document.getElementById('quest-tracker').classList.contains('folded')), 'quest tracker: shown in full on desktop');

// What's new: hidden for a brand-new player; shown once to a returning player after an update.
const news = await page.evaluate(async () => {
Expand All @@ -100,7 +101,7 @@ try {
return { newHidden: document.getElementById('news').classList.contains('hidden'), shown, after: unseenNews(returning).length,
sameVersion: sw.includes(`minicrafter-v${NEWS[0].v}'`) || Number(/minicrafter-v(\d+)/.exec(sw)[1]) > NEWS[0].v };
});
ok(news.newHidden && news.shown === 1 && news.after === 0, "what's new: hidden for new players, shown once to returning players", JSON.stringify(news));
ok(news.newHidden && news.shown >= 1 && news.after === 0, "what's new: hidden for new players, shown once to returning players", JSON.stringify(news));
ok(news.sameVersion, "what's new: the newest news is not ahead of sw.js VERSION");

const features = await page.evaluate(async () => {
Expand Down Expand Up @@ -319,6 +320,17 @@ try {
return document.getElementById('touch').classList.contains('active');
});
ok(touch, 'touch controls appear in touch mode');
const qt = await t.page.evaluate(() => {
const el = document.getElementById('quest-tracker');
const r = { startFolded: el.classList.contains('folded'), listHidden: getComputedStyle(document.getElementById('qt-list')).display === 'none' };
document.getElementById('qt-fold').click();
r.opens = !el.classList.contains('folded');
document.getElementById('quest-view').value = 'off'; document.getElementById('quest-view').dispatchEvent(new Event('change'));
r.hides = getComputedStyle(el).display === 'none';
document.getElementById('quest-view').value = 'folded'; document.getElementById('quest-view').dispatchEvent(new Event('change'));
return r;
});
ok(qt.startFolded && qt.listHidden && qt.opens && qt.hides, 'quest tracker: folded on touch screens, opens with a tap, can be hidden in Settings', JSON.stringify(qt));
// Phones: turning the phone upright pauses and asks for sideways; turning it back carries on.
// (Waits for the change itself: CI runners render slowly, so a fixed pause isn't enough.)
const settle = (fn) => t.page.waitForFunction(fn, null, { timeout: 15000 }).then(() => true).catch(() => false);
Expand Down
Loading