diff --git a/packages/web/src/App.svelte b/packages/web/src/App.svelte index 112de61..7c5dea3 100644 --- a/packages/web/src/App.svelte +++ b/packages/web/src/App.svelte @@ -351,6 +351,20 @@ function drop() { net.command({ type: "dropTreasure" }); } function pass() { net.command({ type: "pass" }); } + const me = $derived(view?.players.find((p) => p.id === view?.you) ?? null); + const carryingTreasure = $derived(me?.carriedTreasureId != null); + const treasureHere = $derived( + view != null && me != null && + view.treasures.some((t) => t.position && t.position.x === me.position.x && + t.position.y === me.position.y && !t.carriedBy), + ); + const onWarpToken = $derived( + view != null && me != null && + view.dimWarps.some((w) => + (w.a.x === me.position.x && w.a.y === me.position.y) || + (w.b.x === me.position.x && w.b.y === me.position.y)), + ); + let chronicleEl = $state(null); $effect(() => { void net.log.length; @@ -556,16 +570,13 @@ {/if}
- {#if isYourTurn && view.dimWarps.some((w) => { - const me = view.players.find((p) => p.id === view.you)!; - return (w.a.x === me.position.x && w.a.y === me.position.y) || - (w.b.x === me.position.x && w.b.y === me.position.y); - })} + {#if isYourTurn && onWarpToken} {/if} {#if isYourTurn} - - + +