Fix issue #38: Implement tokens on maps
All checks were successful
Test / test (push) Successful in 2s
All checks were successful
Test / test (push) Successful in 2s
This commit is contained in:
12
AGENTS.md
12
AGENTS.md
@@ -14,7 +14,7 @@ items, maps, dice widgets, sounds).
|
||||
- `discord-bot/` — Discord bot (slash commands) that talks to the backend with a shared service secret, no login.
|
||||
- `dragonroll-foundry/` — Foundry VTT module (`scripts/api.js`) + optional read-only snapshot bridge.
|
||||
- `obsidian-plugin/` — plain JavaScript Obsidian plugin that imports/pushes campaign notes.
|
||||
- `tests/` — `npm test` (`node --test`, no dependencies installed): Foundry sync toggle and pairing status, map pins, sidebar entries.
|
||||
- `tests/` — `npm test` (`node --test`, no dependencies installed): Foundry sync toggle and pairing status, map pins and tokens, sidebar entries.
|
||||
|
||||
No DB seeding, no migrations, no linter/formatter, no Pinia/Vuex. Git: default branch `master` on a
|
||||
self-hosted Gitea; `.gitea/workflows/deploy.yml` builds and deploys Docker images on push to `master`,
|
||||
@@ -87,7 +87,7 @@ campaign, and handlers check ownership with a `userOwnsCampaign(campaignId, user
|
||||
- `Folder` — `name*`, `campaign*`, `parentFolder` (null = root, self-ref), `color`
|
||||
- `Actor` — `name*`, `campaign*`, `foundryActorId` (unique per campaign), plus free-form sheet fields (`type`, `species`, `className`, `level`, `abilityScores`, `armorClass`, `speed`, `proficiencies`, `traits`, `spells`, `image`) and `inventory[{name,quantity,weight}]` (flattened Foundry items, **not** `Item` docs)
|
||||
- `Item` — `name*`, `campaign*`, `foundryItemId` (unique per campaign), `foundryNames`, `category`, `rarity`, `quantity`, `weight`, `properties`, `description`
|
||||
- `Map` — `name*`, `campaign*`, `image` (filename in `src/uploads`), `gridSize`/`offsetX`/`offsetY`/`scale` (image px), `pins[{note→Note, x, y}]` (addressed by the pin's own `_id`)
|
||||
- `Map` — `name*`, `campaign*`, `image` (filename in `src/uploads`), `gridSize`/`offsetX`/`offsetY`/`scale` (image px), `pins[{note→Note, x, y}]` (addressed by the pin's own `_id`), `tokens[{actor→Actor, x, y}]` (the centre of the grid cell the token stands in, also addressed by its own `_id`)
|
||||
- `ServiceLinkRequest` — the pending/completed service pairings of §4; `DiscordGuildLink` maps a Discord guild to the Dragonroll user who claimed it
|
||||
|
||||
**API surface** (all under `/api`, all `{status,msg}`):
|
||||
@@ -98,7 +98,7 @@ campaign, and handlers check ownership with a `userOwnsCampaign(campaignId, user
|
||||
- `folder` — `list`, `create`, `update`, `rename`, `delete` (recursive: inner notes go to `folder: null`, subfolders re-parent then delete)
|
||||
- `actor` — `list`, `create`, `update` (partial, ownership checked), `upload-image?actor=` (multipart), `delete`
|
||||
- `item` — `list`, `create`, `update` (partial), `delete`
|
||||
- `map` — `list`, `create` (multipart `image` or JSON), `update` (multipart to replace the photo), `delete`, `pin` (`{id,note,x,y}`, re-pinning moves the marker), `unpin` (`{id,pin}`)
|
||||
- `map` — `list`, `create` (multipart `image` or JSON), `update` (multipart to replace the photo), `delete`, `pin` (`{id,note,x,y}`, re-pinning moves the marker), `unpin` (`{id,pin}`), `place-token` (`{id,actor,x,y}`, snapped to a cell centre, re-placing moves the token), `remove-token` (`{id,token}`)
|
||||
- `foundry` — read-only proxy over the bridge (`/world`, `/actors`, `/characters`, `/items`, `/actors/:id`, `/items/:id`, `/actors/:id/items`), needs `FOUNDRY_API_URL`
|
||||
|
||||
## 4. Service integrations (Foundry, Discord, Obsidian)
|
||||
@@ -138,7 +138,9 @@ campaign workspace (`TopBar` + `ContentSidebar` + note column + `StatusBar`), tu
|
||||
(`ActivePane` / `AnchoredMap` / `AnchorMap` in `services/Content.js`); `viewer/map/MapViewerPane.vue`
|
||||
renders it both there and in the detached `map_viewer` window. Right-clicking that map pins a campaign
|
||||
note at the spot (`services/MapPins.js` translates image px ↔ screen), clicking the marker opens
|
||||
`pinned_note`.
|
||||
`pinned_note`. Dragging an actor row out of the sidebar onto the map makes it stand on that grid cell
|
||||
as a token (`services/MapTokens.js` snaps to cell centres and sizes the token by its cell); the token
|
||||
drags on with the pointer, steps over the grid with the arrow keys, and Delete takes it off.
|
||||
|
||||
### 5.2 The window system
|
||||
|
||||
@@ -162,7 +164,7 @@ DOM ids these services depend on — **do not rename**: `window-wrapper-{id}`, `
|
||||
writes `localStorage.selectedCampaignId`, `RestoreCampaign`), `Content.js` (§5.1), `Emitter.js`
|
||||
(`mitt()` bus), `Toaster.js`, `Tooltip.js`, `ContextMenu.js`, `Sound.js` (`AddSound` binds
|
||||
`snap.wav` to `.sound-click`), `Marker.js` (marked + widgets), `ActionRegistry.js` (command palette:
|
||||
`register/unregister/search/execute`), `Windows.js` / `WindowDefinitions.js`, `MapPins.js`,
|
||||
`register/unregister/search/execute`), `Windows.js` / `WindowDefinitions.js`, `MapPins.js`, `MapTokens.js`,
|
||||
`widgets/DiceParser.js`.
|
||||
|
||||
### 5.4 Markdown → widgets
|
||||
|
||||
Reference in New Issue
Block a user