diff --git a/ui/src/GameSpace/ConfigMenu/ConfigMenu.svelte b/ui/src/GameSpace/ConfigMenu/ConfigMenu.svelte index 785a2c9..491477d 100644 --- a/ui/src/GameSpace/ConfigMenu/ConfigMenu.svelte +++ b/ui/src/GameSpace/ConfigMenu/ConfigMenu.svelte @@ -15,6 +15,7 @@ export let onMoveZ: (z: 'top' | 'bottom' | 'up' | 'down') => void; export let onRemoveEl: () => void; export let onClose: () => void; + export let onDuplicate: () => void; export let el: GElement; export let gameSpace: GameSpaceSyn; @@ -50,6 +51,8 @@ } $: resolvedEl = { ...el, lock: resolvedLock } as any; + + $: console.log(el.wals);
+
diff --git a/ui/src/GameSpace/GameSpace.svelte b/ui/src/GameSpace/GameSpace.svelte index 29d75de..c8bbd71 100644 --- a/ui/src/GameSpace/GameSpace.svelte +++ b/ui/src/GameSpace/GameSpace.svelte @@ -21,6 +21,8 @@ import SpaceConfigurator from './sidebar/SpaceConfigurator.svelte'; import ConfigMenu from './ConfigMenu'; import { tooltip } from '~/shared/tooltip'; + import { cloneDeep } from 'lodash'; + import { uuid } from '~/lib/util'; export let gameSpace: GameSpaceSyn; export let asAsset: boolean = false; @@ -67,13 +69,19 @@ function handleRemoveElement(id: string) { gameSpace.change({ type: 'remove-element', uuid: id }); + closeContextMenu(); } - // Handle closing the context menu if an item was deleted - $: { - if (contextMenuState && !$state.elements.find((e) => e.uuid === contextMenuState.id)) { - closeContextMenu(); - } + function handleDuplicateElement(id: string) { + const el = $state.elements.find((el) => el.uuid === id); + if (!el) return; + const newEl = cloneDeep(el); + newEl.uuid = uuid(); + newEl.x += 5; + newEl.y += 5; + console.log(newEl); + gameSpace.change({ type: 'add-element', element: newEl }); + contextMenuState = { id: newEl.uuid, x: contextMenuState.x + 5, y: contextMenuState.y + 5 }; } function handleAddElementFromLibrary(element: LibraryElement, x?: number, y?: number) { @@ -186,6 +194,7 @@ onUpdateEl={handleUpdateElement} onMoveZ={(z) => gameSpace.change({ type: 'move-z', uuid: contextMenuState.id, z })} onRemoveEl={() => handleRemoveElement(contextMenuState.id)} + onDuplicate={() => handleDuplicateElement(contextMenuState.id)} /> {/if} {/if} diff --git a/ui/src/HomePage2/GamesList.svelte b/ui/src/HomePage2/GamesList.svelte index 9f5716e..c580b83 100644 --- a/ui/src/HomePage2/GamesList.svelte +++ b/ui/src/HomePage2/GamesList.svelte @@ -1,7 +1,7 @@ @@ -46,7 +48,10 @@ {#if tag === 'library' && $unimportedGlobalLibrary.length > 0}

Global library

{#each $unimportedGlobalLibrary as gameSpace (gameSpace.name)} - store.createGameSpace(gameSpace)} /> + store.createGameSpace({ ...gameSpace, creator: store.pubKey })} + /> {/each} {/if} diff --git a/ui/src/lib/util.ts b/ui/src/lib/util.ts index 4396303..d805bef 100644 --- a/ui/src/lib/util.ts +++ b/ui/src/lib/util.ts @@ -13,6 +13,8 @@ import { type EntryHash, } from '@holochain/client'; +export { v1 as uuid } from 'uuid'; + export const hashEqual = (a: EntryHash, b: EntryHash): boolean => { if (!a || !b) { return !a && !b; diff --git a/ui/src/store/index.ts b/ui/src/store/index.ts index f348f89..fd68935 100644 --- a/ui/src/store/index.ts +++ b/ui/src/store/index.ts @@ -3,4 +3,4 @@ export { createRootStore, type RootStore, setContext, getContext } from './rootS export { type GameSpaceSyn } from './gameSpaceStore'; export type { GameSpace, LockConfig, GElementBase, GElement } from './types'; export { type LibraryElement, createElement, LIBRARY } from './library'; -export * as defaultSpaces from './defaultSpaces'; +export * as presets from './presets'; diff --git a/ui/src/store/presets/checkers.ts b/ui/src/store/presets/checkers.ts new file mode 100644 index 0000000..8ffe137 --- /dev/null +++ b/ui/src/store/presets/checkers.ts @@ -0,0 +1,826 @@ +import type { GameSpace } from '../types'; + +export default { + creator: '', + elements: [ + { + height: 440, + lock: { + config: true, + position: true, + remove: true, + rotation: true, + size: true, + wals: true, + }, + rotation: 0, + type: 'Image', + url: 'https://upload.wikimedia.org/wikipedia/commons/thumb/2/25/Chessboard_green_squares.svg/512px-Chessboard_green_squares.svg.png', + uuid: 'c41c01f0-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 468, + x: 1.5, + y: 1, + z: 1, + }, + { + display: { + mode: 'emoji', + value: '⚫️', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'd042d120-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: -190.5, + y: -191, + z: 3, + }, + { + display: { + mode: 'emoji', + value: '⚫️', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'd1da6110-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: -134.5, + y: -191, + z: 4, + }, + { + display: { + mode: 'emoji', + value: '⚫️', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'd57fc260-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: -80.5, + y: -190, + z: 5, + }, + { + display: { + mode: 'emoji', + value: '⚫️', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'e82307b0-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: -24.5, + y: -190, + z: 6, + }, + { + display: { + mode: 'emoji', + value: '⚫️', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'eab8a6b0-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: 30.5, + y: -191, + z: 7, + }, + { + display: { + mode: 'emoji', + value: '⚫️', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'ed197a10-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: 87.5, + y: -189, + z: 8, + }, + { + display: { + mode: 'emoji', + value: '⚫️', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'eefae440-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: 143.5, + y: -190, + z: 9, + }, + { + display: { + mode: 'emoji', + value: '⚫️', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'f1ae6b80-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: 196.5, + y: -189, + z: 10, + }, + { + display: { + mode: 'emoji', + value: '⚫️', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'f46d8b80-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: -188.5, + y: -135, + z: 11, + }, + { + display: { + mode: 'emoji', + value: '⚫️', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'f5e31480-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: -133.5, + y: -135, + z: 12, + }, + { + display: { + mode: 'emoji', + value: '⚫️', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'f8c9b9b0-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: -81.5, + y: -135, + z: 13, + }, + { + display: { + mode: 'emoji', + value: '⚫️', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'fbc54670-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: -22.5, + y: -134, + z: 14, + }, + { + display: { + mode: 'emoji', + value: '⚫️', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'fe250860-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: 28.5, + y: -134, + z: 15, + }, + { + display: { + mode: 'emoji', + value: '⚫️', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '007c65e0-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: 85.5, + y: -135, + z: 16, + }, + { + display: { + mode: 'emoji', + value: '⚫️', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '021b6fe0-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: 142.5, + y: -135, + z: 17, + }, + { + display: { + mode: 'emoji', + value: '⚫️', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '043d1760-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: 196.5, + y: -133, + z: 18, + }, + { + display: { + mode: 'emoji', + value: '🔴', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '1339c2e0-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: -187.5, + y: 192, + z: 20, + }, + { + display: { + mode: 'emoji', + value: '🔴', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '15982540-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: -133.5, + y: 196, + z: 21, + }, + { + display: { + mode: 'emoji', + value: '🔴', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '174b5380-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: -78.5, + y: 194, + z: 22, + }, + { + display: { + mode: 'emoji', + value: '🔴', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '193214e0-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: -25.5, + y: 194, + z: 23, + }, + { + display: { + mode: 'emoji', + value: '🔴', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '1b4b09d0-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: 30.5, + y: 196, + z: 24, + }, + { + display: { + mode: 'emoji', + value: '🔴', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '1d4ccd40-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: 85.5, + y: 194, + z: 25, + }, + { + display: { + mode: 'emoji', + value: '🔴', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '1f9117f0-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: 138.5, + y: 194, + z: 26, + }, + { + display: { + mode: 'emoji', + value: '🔴', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '21795ff0-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: 196.5, + y: 194, + z: 27, + }, + { + display: { + mode: 'emoji', + value: '🔴', + }, + height: 42, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '2394c5e0-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: -189.5, + y: 138, + z: 28, + }, + { + display: { + mode: 'emoji', + value: '🔴', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '2545f850-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: -136.5, + y: 139, + z: 29, + }, + { + display: { + mode: 'emoji', + value: '🔴', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '277693f0-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: -81.5, + y: 137, + z: 30, + }, + { + display: { + mode: 'emoji', + value: '🔴', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '2960b0b0-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: -24.5, + y: 139, + z: 31, + }, + { + display: { + mode: 'emoji', + value: '🔴', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '2aeb4850-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: 30.5, + y: 139, + z: 32, + }, + { + display: { + mode: 'emoji', + value: '🔴', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '2cbc10b0-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: 86.5, + y: 141, + z: 33, + }, + { + display: { + mode: 'emoji', + value: '🔴', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '2e4bb160-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: 141.5, + y: 138, + z: 34, + }, + { + display: { + mode: 'emoji', + value: '🔴', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '3046be10-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: 196.5, + y: 138, + z: 35, + }, + { + height: 250, + lock: { + config: false, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + showTimers: true, + turnsLog: [], + type: 'TurnTracker', + uuid: 'b5ec7f90-a039-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 200, + x: 354.5, + y: -16, + z: 36, + }, + ], + isStewarded: false, + lastChangeAt: 1731335551423, + minMaxPlayers: [2, 2], + name: 'Checkers', + players: [], + status: 'library', + version: 4, + wals: [], +} as const satisfies GameSpace; diff --git a/ui/src/store/presets/chess.ts b/ui/src/store/presets/chess.ts new file mode 100644 index 0000000..1881a50 --- /dev/null +++ b/ui/src/store/presets/chess.ts @@ -0,0 +1,826 @@ +import type { GameSpace } from '../types'; + +export default { + creator: 'uhCAklTnHzbmUozGs_HpyzujdF4QKIZV77jBxuPotj7422aS453ZG', + elements: [ + { + height: 440, + lock: { + config: true, + position: true, + remove: true, + rotation: true, + size: true, + wals: true, + }, + rotation: 0, + type: 'Image', + url: 'https://upload.wikimedia.org/wikipedia/commons/thumb/2/25/Chessboard_green_squares.svg/512px-Chessboard_green_squares.svg.png', + uuid: 'c41c01f0-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 468, + x: 0.5, + y: 4, + z: 1, + }, + { + display: { + mode: 'emoji', + value: '♖', + }, + height: 54.88335925349926, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'e82307b0-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 53.32814930015555, + x: -190.90746500777627, + y: 194.13685847589477, + z: 6, + }, + { + display: { + mode: 'emoji', + value: '♙', + }, + height: 50.86438152011925, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'eab8a6b0-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 53.845007451564854, + x: 28.182557174889272, + y: 137.12463404742655, + z: 7, + }, + { + display: { + mode: 'emoji', + value: '♘', + }, + height: 54.88335925349926, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'ed197a10-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 53.32814930015556, + x: -135.67262830482144, + y: 193.58164852255106, + z: 8, + }, + { + display: { + mode: 'emoji', + value: '♚', + }, + height: 58, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'eefae440-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 60, + x: -25.5, + y: -191, + z: 9, + }, + { + display: { + mode: 'emoji', + value: '♛', + }, + height: 54, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'f1ae6b80-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 56, + x: 28.5, + y: -188, + z: 10, + }, + { + display: { + mode: 'emoji', + value: '♝', + }, + height: 60, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'f46d8b80-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 58, + x: -82.5, + y: -190, + z: 11, + }, + { + display: { + mode: 'emoji', + value: '♜', + }, + height: 56, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'f5e31480-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 54, + x: 191.5, + y: -191, + z: 12, + }, + { + display: { + mode: 'emoji', + value: '♟', + }, + height: 58, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'f8c9b9b0-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 56, + x: -80.5, + y: -136, + z: 13, + }, + { + display: { + mode: 'emoji', + value: '♞', + }, + height: 54, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'fbc54670-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 58, + x: 139.5, + y: -189, + z: 14, + }, + { + display: { + mode: 'emoji', + value: '♔', + }, + height: 57.99377916018666, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '2960b0b0-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 53.328149300155545, + x: 28.94323483670296, + y: 192.5552099533437, + z: 31, + }, + { + display: { + mode: 'emoji', + value: '♗', + }, + height: 56.43856920684296, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '2cbc10b0-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 54.88335925349925, + x: 83.38958009331259, + y: 194.6547433903578, + z: 33, + }, + { + display: { + mode: 'emoji', + value: '♕', + }, + height: 59.54898911353036, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '2e4bb160-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 53.32814930015555, + x: -26.055209953343702, + y: 195.66562986003112, + z: 34, + }, + { + height: 250, + lock: { + config: false, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + showTimers: true, + turnsLog: [], + type: 'TurnTracker', + uuid: 'b5ec7f90-a039-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 200, + x: 354.5, + y: -16, + z: 36, + }, + { + display: { + mode: 'emoji', + value: '♗', + }, + height: 54.88335925349926, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'ccd7ac10-a11b-11ef-9f8a-db717611525b', + version: 1, + wals: [], + width: 54.88335925349925, + x: -80.35069984447927, + y: 194.21150855365485, + z: 51, + }, + { + display: { + mode: 'emoji', + value: '♘', + }, + height: 56.43856920684296, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'd5cfd090-a11b-11ef-9f8a-db717611525b', + version: 1, + wals: [], + width: 53.32814930015556, + x: 139.15629860031112, + y: 194.69362363919186, + z: 52, + }, + { + display: { + mode: 'emoji', + value: '♖', + }, + height: 54.88335925349926, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'f44a3e70-a11b-11ef-9f8a-db717611525b', + version: 1, + wals: [], + width: 53.32814930015555, + x: 193.56376360808738, + y: 194.47122861586365, + z: 53, + }, + { + display: { + mode: 'emoji', + value: '♙', + }, + height: 50.86438152011925, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '8dfe1550-a11c-11ef-8a77-43e8a7312444', + version: 1, + wals: [], + width: 53.845007451564854, + x: -80.81744282511073, + y: 135.12463404742655, + z: 54, + }, + { + display: { + mode: 'emoji', + value: '♙', + }, + height: 50.86438152011925, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '8ed56280-a11c-11ef-8a77-43e8a7312444', + version: 1, + wals: [], + width: 53.845007451564854, + x: -27.39121331691409, + y: 137.43759977022833, + z: 55, + }, + { + display: { + mode: 'emoji', + value: '♙', + }, + height: 50.86438152011925, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '8eedcc80-a11c-11ef-8a77-43e8a7312444', + version: 1, + wals: [], + width: 53.845007451564854, + x: 190.72354078144684, + y: 134.24087845875292, + z: 56, + }, + { + display: { + mode: 'emoji', + value: '♙', + }, + height: 50.86438152011925, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '8fbd9fa0-a11c-11ef-8a77-43e8a7312444', + version: 1, + wals: [], + width: 53.845007451564854, + x: 138.34649160111888, + y: 136.2602525273073, + z: 57, + }, + { + display: { + mode: 'emoji', + value: '♙', + }, + height: 50.86438152011925, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '8ff85eb0-a11c-11ef-8a77-43e8a7312444', + version: 1, + wals: [], + width: 53.845007451564854, + x: 82.98881648934534, + y: 136.7893136301389, + z: 58, + }, + { + display: { + mode: 'emoji', + value: '♙', + }, + height: 50.86438152011925, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'cb08cd90-a11d-11ef-bec7-c5b65c84efe4', + version: 1, + wals: [], + width: 53.845007451564854, + x: -133.81744282511073, + y: 134.12463404742655, + z: 59, + }, + { + display: { + mode: 'emoji', + value: '♙', + }, + height: 50.86438152011925, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'ce1f0e40-a11d-11ef-bec7-c5b65c84efe4', + version: 1, + wals: [], + width: 53.845007451564854, + x: -192.81744282511073, + y: 133.12463404742655, + z: 60, + }, + { + display: { + mode: 'emoji', + value: '♝', + }, + height: 60, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '043f68d0-a11e-11ef-bec7-c5b65c84efe4', + version: 1, + wals: [], + width: 58, + x: 85.5, + y: -188, + z: 61, + }, + { + display: { + mode: 'emoji', + value: '♞', + }, + height: 54, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '06bcc4e0-a11e-11ef-bec7-c5b65c84efe4', + version: 1, + wals: [], + width: 58, + x: -134.5, + y: -192, + z: 62, + }, + { + display: { + mode: 'emoji', + value: '♜', + }, + height: 56, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '0df3b160-a11e-11ef-bec7-c5b65c84efe4', + version: 1, + wals: [], + width: 58, + x: -191.5, + y: -190, + z: 63, + }, + { + display: { + mode: 'emoji', + value: '♟', + }, + height: 58, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '18142940-a11e-11ef-bec7-c5b65c84efe4', + version: 1, + wals: [], + width: 56, + x: -190.5, + y: -138, + z: 64, + }, + { + display: { + mode: 'emoji', + value: '♟', + }, + height: 58, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '19014860-a11e-11ef-bec7-c5b65c84efe4', + version: 1, + wals: [], + width: 56, + x: -134.5, + y: -137, + z: 65, + }, + { + display: { + mode: 'emoji', + value: '♟', + }, + height: 58, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '1a467290-a11e-11ef-bec7-c5b65c84efe4', + version: 1, + wals: [], + width: 56, + x: -26.5, + y: -135, + z: 66, + }, + { + display: { + mode: 'emoji', + value: '♟', + }, + height: 58, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '1b4ac330-a11e-11ef-bec7-c5b65c84efe4', + version: 1, + wals: [], + width: 56, + x: 30.5, + y: -137, + z: 67, + }, + { + display: { + mode: 'emoji', + value: '♟', + }, + height: 58, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '1bc2d960-a11e-11ef-bec7-c5b65c84efe4', + version: 1, + wals: [], + width: 56, + x: 82.5, + y: -137, + z: 68, + }, + { + display: { + mode: 'emoji', + value: '♟', + }, + height: 58, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '1c3d3980-a11e-11ef-bec7-c5b65c84efe4', + version: 1, + wals: [], + width: 56, + x: 138.5, + y: -137, + z: 69, + }, + { + display: { + mode: 'emoji', + value: '♟', + }, + height: 58, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '1cbb6a30-a11e-11ef-bec7-c5b65c84efe4', + version: 1, + wals: [], + width: 56, + x: 192.5, + y: -138, + z: 70, + }, + ], + isStewarded: false, + lastChangeAt: 1731433629880, + minMaxPlayers: [2, 2], + name: 'Chess', + players: [], + status: 'library', + version: 4, + wals: [], +} as const satisfies GameSpace; diff --git a/ui/src/store/defaultSpaces.ts b/ui/src/store/presets/go.ts similarity index 99% rename from ui/src/store/defaultSpaces.ts rename to ui/src/store/presets/go.ts index 66e5efe..bfb82a7 100644 --- a/ui/src/store/defaultSpaces.ts +++ b/ui/src/store/presets/go.ts @@ -1,6 +1,6 @@ -import type { GameSpace } from './types'; +import type { GameSpace } from '../types'; -const checkers: GameSpace = { +export default { creator: '', elements: [ { @@ -817,12 +817,10 @@ const checkers: GameSpace = { ], isStewarded: false, lastChangeAt: 1731335551423, - minMaxPlayers: [1, 4], - name: 'Checkers', + minMaxPlayers: [2, 2], + name: 'Go', players: [], status: 'library', version: 4, wals: [], -}; - -export { checkers }; +} as const satisfies GameSpace; diff --git a/ui/src/store/presets/index.ts b/ui/src/store/presets/index.ts new file mode 100644 index 0000000..12fc712 --- /dev/null +++ b/ui/src/store/presets/index.ts @@ -0,0 +1,4 @@ +export { default as checkers } from './checkers'; +export { default as chess } from './chess'; +export { default as go } from './go'; +export { default as world } from './world'; diff --git a/ui/src/store/presets/world.ts b/ui/src/store/presets/world.ts new file mode 100644 index 0000000..7035cba --- /dev/null +++ b/ui/src/store/presets/world.ts @@ -0,0 +1,826 @@ +import type { GameSpace } from '../types'; + +export default { + creator: '', + elements: [ + { + height: 440, + lock: { + config: false, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Image', + url: 'https://upload.wikimedia.org/wikipedia/commons/thumb/2/25/Chessboard_green_squares.svg/512px-Chessboard_green_squares.svg.png', + uuid: 'c41c01f0-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 468, + x: 1.5, + y: 1, + z: 1, + }, + { + display: { + mode: 'emoji', + value: '⚫️', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'd042d120-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: -190.5, + y: -191, + z: 3, + }, + { + display: { + mode: 'emoji', + value: '⚫️', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'd1da6110-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: -134.5, + y: -191, + z: 4, + }, + { + display: { + mode: 'emoji', + value: '⚫️', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'd57fc260-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: -80.5, + y: -190, + z: 5, + }, + { + display: { + mode: 'emoji', + value: '⚫️', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'e82307b0-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: -24.5, + y: -190, + z: 6, + }, + { + display: { + mode: 'emoji', + value: '⚫️', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'eab8a6b0-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: 30.5, + y: -191, + z: 7, + }, + { + display: { + mode: 'emoji', + value: '⚫️', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'ed197a10-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: 87.5, + y: -189, + z: 8, + }, + { + display: { + mode: 'emoji', + value: '⚫️', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'eefae440-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: 143.5, + y: -190, + z: 9, + }, + { + display: { + mode: 'emoji', + value: '⚫️', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'f1ae6b80-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: 196.5, + y: -189, + z: 10, + }, + { + display: { + mode: 'emoji', + value: '⚫️', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'f46d8b80-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: -188.5, + y: -135, + z: 11, + }, + { + display: { + mode: 'emoji', + value: '⚫️', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'f5e31480-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: -133.5, + y: -135, + z: 12, + }, + { + display: { + mode: 'emoji', + value: '⚫️', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'f8c9b9b0-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: -81.5, + y: -135, + z: 13, + }, + { + display: { + mode: 'emoji', + value: '⚫️', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'fbc54670-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: -22.5, + y: -134, + z: 14, + }, + { + display: { + mode: 'emoji', + value: '⚫️', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: 'fe250860-a037-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: 28.5, + y: -134, + z: 15, + }, + { + display: { + mode: 'emoji', + value: '⚫️', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '007c65e0-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: 85.5, + y: -135, + z: 16, + }, + { + display: { + mode: 'emoji', + value: '⚫️', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '021b6fe0-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: 142.5, + y: -135, + z: 17, + }, + { + display: { + mode: 'emoji', + value: '⚫️', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '043d1760-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: 196.5, + y: -133, + z: 18, + }, + { + display: { + mode: 'emoji', + value: '🔴', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '1339c2e0-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: -187.5, + y: 192, + z: 20, + }, + { + display: { + mode: 'emoji', + value: '🔴', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '15982540-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: -133.5, + y: 196, + z: 21, + }, + { + display: { + mode: 'emoji', + value: '🔴', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '174b5380-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: -78.5, + y: 194, + z: 22, + }, + { + display: { + mode: 'emoji', + value: '🔴', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '193214e0-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: -25.5, + y: 194, + z: 23, + }, + { + display: { + mode: 'emoji', + value: '🔴', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '1b4b09d0-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: 30.5, + y: 196, + z: 24, + }, + { + display: { + mode: 'emoji', + value: '🔴', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '1d4ccd40-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: 85.5, + y: 194, + z: 25, + }, + { + display: { + mode: 'emoji', + value: '🔴', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '1f9117f0-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: 138.5, + y: 194, + z: 26, + }, + { + display: { + mode: 'emoji', + value: '🔴', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '21795ff0-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: 196.5, + y: 194, + z: 27, + }, + { + display: { + mode: 'emoji', + value: '🔴', + }, + height: 42, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '2394c5e0-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: -189.5, + y: 138, + z: 28, + }, + { + display: { + mode: 'emoji', + value: '🔴', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '2545f850-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: -136.5, + y: 139, + z: 29, + }, + { + display: { + mode: 'emoji', + value: '🔴', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '277693f0-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: -81.5, + y: 137, + z: 30, + }, + { + display: { + mode: 'emoji', + value: '🔴', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '2960b0b0-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: -24.5, + y: 139, + z: 31, + }, + { + display: { + mode: 'emoji', + value: '🔴', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '2aeb4850-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: 30.5, + y: 139, + z: 32, + }, + { + display: { + mode: 'emoji', + value: '🔴', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '2cbc10b0-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: 86.5, + y: 141, + z: 33, + }, + { + display: { + mode: 'emoji', + value: '🔴', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '2e4bb160-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: 141.5, + y: 138, + z: 34, + }, + { + display: { + mode: 'emoji', + value: '🔴', + }, + height: 30, + lock: { + config: true, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + type: 'Piece', + uuid: '3046be10-a038-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 30, + x: 196.5, + y: 138, + z: 35, + }, + { + height: 250, + lock: { + config: false, + position: false, + remove: false, + rotation: false, + size: false, + wals: false, + }, + rotation: 0, + showTimers: true, + turnsLog: [], + type: 'TurnTracker', + uuid: 'b5ec7f90-a039-11ef-8b06-8597ca08db5f', + version: 1, + wals: [], + width: 200, + x: 354.5, + y: -16, + z: 36, + }, + ], + isStewarded: false, + lastChangeAt: 1731335551423, + minMaxPlayers: [1, 12], + name: 'World', + players: [], + status: 'library', + version: 4, + wals: [], +} as const satisfies GameSpace;