adventure: draw the dungeon as a fog-of-war map, not a room tally
This commit is contained in:
@@ -23,6 +23,21 @@
|
||||
</li>
|
||||
{{end}}
|
||||
|
||||
{{/* The dungeon map. Laid out server-side (who_map.go) into an x/y node field;
|
||||
this just draws it. Edges first so nodes sit on top of the lines. Nothing
|
||||
here is a player-authored string — node kinds are a fixed vocabulary and
|
||||
ids are zone-prefixed — so the SVG carries no injection surface. */}}
|
||||
{{define "dungeonmap"}}
|
||||
<svg viewBox="0 0 {{.W}} {{.H}}" width="{{.W}}" height="{{.H}}" role="img" aria-label="Dungeon map" class="map-svg max-w-full h-auto">
|
||||
<g>
|
||||
{{range .Edges}}<line x1="{{.X1}}" y1="{{.Y1}}" x2="{{.X2}}" y2="{{.Y2}}" class="map-edge{{if .Locked}} map-edge-locked{{end}}">{{if .Lock}}<title>{{.Lock}}</title>{{end}}</line>{{end}}
|
||||
</g>
|
||||
<g>
|
||||
{{range .Nodes}}<g class="map-node {{.Class}}{{if .Current}} map-node-current{{end}}" transform="translate({{.X}},{{.Y}})">{{if .Current}}<circle r="21" class="map-ring"></circle>{{end}}<circle r="15" class="map-disc"></circle><text text-anchor="middle" dominant-baseline="central" class="map-glyph">{{.Glyph}}</text><title>{{.Label}}{{if .Current}} — you are here{{end}}</title></g>{{end}}
|
||||
</g>
|
||||
</svg>
|
||||
{{end}}
|
||||
|
||||
{{define "main"}}
|
||||
<article class="mt-2 mb-10 max-w-3xl mx-auto" id="who" data-token="{{.Mark.Token}}">
|
||||
<nav class="mb-4">
|
||||
@@ -96,6 +111,28 @@
|
||||
{{end}}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{{if .MapView}}
|
||||
<!-- The dungeon map: the fog-of-war cut gogobee sent. Visited rooms drawn in
|
||||
full, the doors leading out of them, and the unopened rooms behind those
|
||||
doors as question marks. Pete lays it out; it is never told what a room
|
||||
holds, only that a door is there. -->
|
||||
<section class="mt-6 rounded-3xl bg-[color:var(--card)] border-2 border-[color:var(--ink)]/10 p-6 shadow-pete">
|
||||
<div class="flex items-baseline justify-between mb-4">
|
||||
<h2 class="font-display text-xl font-bold">The map</h2>
|
||||
{{if .Detail.Room}}<span class="text-sm text-[color:var(--ink)]/50">Room <span class="font-semibold text-[color:var(--ink)]/70">{{.Detail.Room}}</span></span>{{end}}
|
||||
</div>
|
||||
<div class="overflow-x-auto">
|
||||
{{template "dungeonmap" .MapView}}
|
||||
</div>
|
||||
<div class="mt-4 flex flex-wrap gap-x-4 gap-y-1.5 text-xs text-[color:var(--ink)]/55">
|
||||
<span class="inline-flex items-center gap-1.5"><span class="map-dot map-node-entry"></span>entrance</span>
|
||||
<span class="inline-flex items-center gap-1.5"><span class="map-dot map-node-boss"></span>boss</span>
|
||||
<span class="inline-flex items-center gap-1.5"><span class="map-dot map-node-unknown"></span>unexplored</span>
|
||||
<span class="inline-flex items-center gap-1.5"><span class="map-door-legend"></span>locked door</span>
|
||||
</div>
|
||||
</section>
|
||||
{{end}}
|
||||
{{else}}
|
||||
<section class="mt-8 rounded-3xl bg-[color:var(--card)] border-2 border-[color:var(--ink)]/10 p-6 shadow-pete">
|
||||
<p class="text-sm text-[color:var(--ink)]/60">No detailed sheet on file for this adventurer yet — check back after the next snapshot.</p>
|
||||
|
||||
Reference in New Issue
Block a user