A FoundryVTT module for playing at an in-person table.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Adding general usage for systems that aren't PF2E

+93 -10
+21 -9
public/style.css
··· 17 17 width: 70% !important; 18 18 } 19 19 20 - .mobile-mode.system-pf2e #scene-navigation, 21 - .mobile-mode.system-pf2e #hotbar, 22 - .mobile-mode.system-pf2e #players, 23 - .mobile-mode.system-pf2e #scene-controls, 24 - .mobile-mode.system-pf2e #sidebar, 25 - .mobile-mode.system-pf2e #effects-panel, 26 - .mobile-mode.system-pf2e #chat-notifications, 27 - .mobile-mode.system-pf2e #notifications, 28 - .mobile-mode.system-pf2e header.window-header a { 20 + .mobile-mode #scene-navigation, 21 + .mobile-mode #hotbar, 22 + .mobile-mode #players, 23 + .mobile-mode #scene-controls, 24 + .mobile-mode #sidebar, 25 + .mobile-mode #effects-panel, 26 + .mobile-mode #chat-notifications, 27 + .mobile-mode #notifications, 28 + .mobile-mode header.window-header a, 29 + .mobile-mode header.window-header button { 29 30 display: none !important; 31 + } 32 + 33 + .mobile-mode:not(.system-pf2e) section.token-buttons button { 34 + width: 90%; 35 + margin: 20px auto; 36 + height: fit-content; 37 + } 38 + 39 + .mobile-mode:not(.system-pf2e) section.token-buttons button * { 40 + padding: 1.25rem; 41 + width: 100%; 30 42 }
+3 -1
src/main.ts
··· 1 1 import { registerSocket } from "./socket"; 2 + import UniversalControl from "./unicontrol"; 2 3 import { editPlayerModes, tokenControlCB } from "./utils"; 3 4 4 5 Hooks.once("init", (): void => { ··· 18 19 if (document.body.classList.contains("system-pf2e")) { 19 20 (game as foundry.Game).user.character.sheet.render(true); 20 21 } else { 21 - ui.notifications?.warn((game as foundry.Game).i18n!.localize("pf2e-table-mode.featureMissing")); 22 + const app = new UniversalControl(); 23 + app.render(true); 22 24 } 23 25 } 24 26
+10
src/svelte/unicontrol.svelte
··· 1 + <script lang="ts"> 2 + import { tokenControlCB } from "../utils"; 3 + </script> 4 + 5 + <section class="token-buttons"> 6 + <button onclick={tokenControlCB} data-direction="left" aria-label="left"><i class="fas fa-arrow-left"></i></button> 7 + <button onclick={tokenControlCB} data-direction="right" aria-label="right"><i class="fas fa-arrow-right"></i></button> 8 + <button onclick={tokenControlCB} data-direction="down" aria-label="down"><i class="fas fa-arrow-down"></i></button> 9 + <button onclick={tokenControlCB} data-direction="up" aria-label="up"><i class="fas fa-arrow-up"></i></button> 10 + </section>
+59
src/unicontrol.ts
··· 1 + import { mount } from "svelte"; 2 + import UniControl from "./svelte/unicontrol.svelte"; 3 + 4 + export default class UniversalControl extends foundry.applications.api.ApplicationV2 { 5 + static override get DEFAULT_OPTIONS() { 6 + return foundry.utils.mergeObject( 7 + super.DEFAULT_OPTIONS, 8 + { 9 + actions: [], 10 + classes: [ 11 + "sheet", 12 + "application" 13 + ], 14 + id: "universal-control", 15 + position: { 16 + left: 0, 17 + top: 0, 18 + width: window.innerWidth, 19 + height: window.innerHeight 20 + }, 21 + window: { 22 + resizable: false 23 + } 24 + } 25 + ); 26 + } 27 + 28 + _renderHTML(context: any, options: foundry.applications.types.ApplicationRenderOptions): Promise<any> { 29 + console.log(context); 30 + 31 + return new Promise((resolve: (value: string) => void): void => { 32 + resolve((game as foundry.Game).user.id); 33 + }); 34 + } 35 + 36 + /*override render(options?: boolean | foundry.applications.types.ApplicationRenderOptions, _options?: foundry.applications.types.ApplicationRenderOptions): Promise<this> { 37 + if (document.getElementById("universal-control") === null) { 38 + super.render(options).then((value: this): void => { 39 + mount(UniControl, { 40 + target: value.element, 41 + props: {} 42 + }); 43 + }); 44 + } 45 + 46 + return new Promise((resolve: (value: this) => void): void => { 47 + resolve(this); 48 + }); 49 + }*/ 50 + 51 + _replaceHTML(id: string, element: HTMLElement, options: any): void { 52 + element.innerHTML = ""; 53 + 54 + mount(UniControl, { 55 + target: element, 56 + props: {} 57 + }); 58 + } 59 + }