rpg-engine 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -60,11 +60,11 @@ function App() {
60
60
  const [address, setAddress] = useState(() => readAddress(window.location.hash));
61
61
  const reading = useRef(0);
62
62
  // Whose sheet the Party section opened by itself, kept until the address changes.
63
- const opened = useRef();
63
+ const opened = useRef(undefined);
64
64
  // Whose card the player chose at hand in a fight, with more than one player character (D-480 (7)): kept through that turn alone.
65
- const handed = useRef();
65
+ const handed = useRef(undefined);
66
66
  // The rolls already read, from the first reading on: a check rolled after it is thrown on the page; the rolls new since come into the list as new.
67
- const seen = useRef();
67
+ const seen = useRef(undefined);
68
68
  const [thrown, setThrown] = useState();
69
69
  // The roll whose dice are in the air: its line comes into the rolls only as they go (D-300).
70
70
  const [held, setHeld] = useState();
@@ -73,13 +73,13 @@ function App() {
73
73
  const rollsAsked = useRef(firstRolls);
74
74
  // The robot's face for a moment (D-305): the master's last moment once it is new, or a new roll's reaction, whichever came last.
75
75
  const [moment, setMoment] = useState();
76
- const toldMoment = useRef();
76
+ const toldMoment = useRef(undefined);
77
77
  // A number of the sheet rolled for fun, from its explanation (D-280): each a throw of its own, even of the same number.
78
78
  const [sheetThrow, setSheetThrow] = useState();
79
79
  // The question answered from the sheet or the tray, while the engine rolls it (D-330); the free rolls, in this browser alone.
80
80
  const [answering, setAnswering] = useState();
81
81
  // The roll that answers a card, or a die of a rest, while its dice fly: what it changes of the sheet waits for them (D-461).
82
- const holding = useRef();
82
+ const holding = useRef(undefined);
83
83
  const [free, setFree] = useState([]);
84
84
  // On a wide screen the table stands beside the page, unless the player folded it; folded, or under that width, the turns and the followed quest go back to
85
85
  // the page.
@@ -110,13 +110,13 @@ function App() {
110
110
  const widgetReading = useRef({ asked: 0, shown: 0 });
111
111
  const moduleReading = useRef({ asked: 0, shown: 0 });
112
112
  // The card of a package's question as last read, even while the dice that changed it fly; the attempts the player let go, with the question then (D-507).
113
- const packNow = useRef();
113
+ const packNow = useRef(undefined);
114
114
  const packsGone = useRef(new Map());
115
115
  // In the card of a rest's dice, how many dice were rolled as the player pressed one, until its roll lands.
116
- const restSent = useRef();
116
+ const restSent = useRef(undefined);
117
117
  // The widgets as read while a card's dice fly, which show only once they land, as the rest of what the roll changed: a panel on the party never tells the
118
118
  // outcome of a death save before its die (D-461).
119
- const widgetsHeld = useRef();
119
+ const widgetsHeld = useRef(undefined);
120
120
  // Reads view again for whom the address names, or the player character the master calls, and what the master asks; an answer that comes after a newer one
121
121
  // is left out.
122
122
  const read = async () => {
@@ -50,8 +50,8 @@ export function AskedBanner({ asked, yourTurn, who, turnName, map, place, answer
50
50
  const travel = useRef({ from: window.scrollY, last: window.scrollY });
51
51
  // Its height before it folded or opened, which it grows or shrinks from; folded down the page, the room it kept open, its height and margin, so that the
52
52
  // page under it neither moves nor changes its length.
53
- const before = useRef();
54
- const kept = useRef();
53
+ const before = useRef(undefined);
54
+ const kept = useRef(undefined);
55
55
  const moving = useRef(false);
56
56
  const [sent, setSent] = useState();
57
57
  const [byHand, setByHand] = usePref(byHandPref);
@@ -73,7 +73,8 @@ export function throwDice(shapes, tray, random = Math.random, lying = [], clock
73
73
  const run = simulate(shapes, normals, tray, lying, start, from);
74
74
  frames = [...frames.slice(0, from), ...run.frames];
75
75
  motions = [...motions.slice(0, from), ...run.motions];
76
- knocks = [...knocks.filter((knock) => knock.frame < from), ...run.knocks];
76
+ // The run taken again keeps quiet in its first frames, so the knocks the last run had there stay: the first on the floor, too.
77
+ knocks = [...knocks.filter((knock) => knock.frame < from + knockGap), ...run.knocks];
77
78
  if (!run.leaned) {
78
79
  return { frames, knocks };
79
80
  }
@@ -34,7 +34,7 @@ export function DiceTray({ requested, sheetThrow, party, campaign, onLanded, onS
34
34
  const button = useRef(null);
35
35
  const controls = useRef(null);
36
36
  const tray = useRef(null);
37
- const roller = useRef();
37
+ const roller = useRef(undefined);
38
38
  // The number of the throw shown now: a newer throw ends an older one's animation and timers.
39
39
  const throwing = useRef(0);
40
40
  const skipping = useRef(false);
@@ -69,7 +69,7 @@ export function FollowedQuests({ version, campaign, beside = false }) {
69
69
  export function QuestEndings({ version, campaign, beside = false }) {
70
70
  const journal = useJournal(version);
71
71
  const [followed] = useFollowed(campaign, journal.read?.quests);
72
- const before = useRef();
72
+ const before = useRef(undefined);
73
73
  const [endings, setEndings] = useState([]);
74
74
  const [told, setTold] = useState("");
75
75
  useEffect(() => {
@@ -58,11 +58,11 @@ export function PackagesPage({ version, tab }) {
58
58
  const [asking, setAsking] = useState();
59
59
  const reads = useRef(0);
60
60
  const catalogReads = useRef(0);
61
- const before = useRef();
61
+ const before = useRef(undefined);
62
62
  const mine = useRef(0);
63
63
  // The rows here before the last addition: those not among them are new.
64
- const known = useRef();
65
- const seeing = useRef();
64
+ const known = useRef(undefined);
65
+ const seeing = useRef(undefined);
66
66
  const shownTab = tab === "add" || tab === "library" ? tab : "installed";
67
67
  const [library, setLibrary] = useState();
68
68
  const [libraryProblem, setLibraryProblem] = useState();
@@ -314,7 +314,7 @@ function breakablePath(path) {
314
314
  function LibraryField({ state, onAdd }) {
315
315
  const [path, setPath] = useState("");
316
316
  const [empty, setEmpty] = useState(false);
317
- const sent = useRef();
317
+ const sent = useRef(undefined);
318
318
  useEffect(() => {
319
319
  if (state.said?.problem === false && sent.current === path) {
320
320
  setPath("");
@@ -356,7 +356,7 @@ function AddField({ state, onAdd, onFile }) {
356
356
  const [source, setSource] = useState("");
357
357
  const [empty, setEmpty] = useState(false);
358
358
  const picker = useRef(null);
359
- const sent = useRef();
359
+ const sent = useRef(undefined);
360
360
  // Added: the field is ready for the next one.
361
361
  useEffect(() => {
362
362
  if (state.said?.problem === false && sent.current === source) {
@@ -211,7 +211,7 @@ function Marks({ track, place, change }) {
211
211
  }
212
212
  /** A figure of an extension, given what it drew before once what it draws changes, for it to move from one to the other. */
213
213
  export function Figure({ owner, name, part }) {
214
- const looks = useRef();
214
+ const looks = useRef(undefined);
215
215
  const said = JSON.stringify([part, owner.data]);
216
216
  // The data it drew before, once what it draws changes: in a card of a roll that is once the dice land, as the card changes only then.
217
217
  if (looks.current?.said !== said) {
@@ -80,7 +80,7 @@ function offBy(setting, settings) {
80
80
  function SettingRow({ setting, off, several = false, onChange }) {
81
81
  // The value just picked shows at once, until the setting is read again.
82
82
  const [picked, setPicked] = useState();
83
- const resting = useRef();
83
+ const resting = useRef(undefined);
84
84
  const said = useSaid();
85
85
  const value = picked ?? setting.value;
86
86
  const id = `setting-${idOf(setting.name)}`;
@@ -168,7 +168,7 @@ function choiceLabel(setting, choice, capital = true) {
168
168
  /** What a change said, in its row: saved for a few seconds, what went wrong until the next change. */
169
169
  function useSaid() {
170
170
  const [now, setNow] = useState();
171
- const timer = useRef();
171
+ const timer = useRef(undefined);
172
172
  useEffect(() => () => clearTimeout(timer.current), []);
173
173
  const show = (problem) => {
174
174
  clearTimeout(timer.current);
@@ -60,7 +60,7 @@ export function SetupView({ setup }) {
60
60
  */
61
61
  function Question({ question, count, left, focus, onBack, onNext, onLeave, onProblem }) {
62
62
  const [picked, setPicked] = useState();
63
- const resting = useRef();
63
+ const resting = useRef(undefined);
64
64
  const heading = useRef(null);
65
65
  const value = picked ?? question.value;
66
66
  const title = question.question === undefined ? settingLabel(question.name) : t(question.question);
@@ -92,7 +92,7 @@ function documentLabel(document) {
92
92
  */
93
93
  function Browse({ open, explicit, back, backLabel, children }) {
94
94
  const box = useRef(null);
95
- const last = useRef();
95
+ const last = useRef(undefined);
96
96
  useEffect(() => {
97
97
  if (explicit) {
98
98
  last.current = open;
@@ -144,7 +144,7 @@ function MapCard({ map, full, part, layout, lead, chosen, focus, onChoose, onGo,
144
144
  return { ways: wayShapes({ ...full, places, roads }), spots: places.filter((place) => place.x !== undefined && place.y !== undefined && place.radius === undefined) };
145
145
  }, [part, full]);
146
146
  const pointers = useRef(new Map());
147
- const drag = useRef();
147
+ const drag = useRef(undefined);
148
148
  const narrow = size !== undefined && size.width < 600;
149
149
  // The map's size, as the window changes it.
150
150
  useEffect(() => {
@@ -40,9 +40,9 @@ export const builtPage = fileURLToPath(new URL("../../../dist/dashboard/", impor
40
40
  // beside it; three's loader of the dice's models imports two of its utilities beside it; the room the metal dice mirror is three's too; Rapier's module
41
41
  // moves the dice.
42
42
  const vendorModules = {
43
- "preact.js": ["preact", "dist/preact.module.js"],
44
- "hooks.js": ["preact", "hooks/dist/hooks.module.js"],
45
- "jsx-runtime.js": ["preact", "jsx-runtime/dist/jsxRuntime.module.js"],
43
+ "preact.js": ["preact", "dist/preact.mjs"],
44
+ "hooks.js": ["preact", "hooks/dist/hooks.mjs"],
45
+ "jsx-runtime.js": ["preact", "jsx-runtime/dist/jsxRuntime.mjs"],
46
46
  "three.module.js": ["three", "build/three.module.js"],
47
47
  "three.core.js": ["three", "build/three.core.js"],
48
48
  "three/addons/loaders/GLTFLoader.js": ["three", "examples/jsm/loaders/GLTFLoader.js"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rpg-engine",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "Play a tabletop role-playing game with an AI as your game master: the AI tells the story; RPG Engine remembers the world, rolls the dice and keeps the accounts.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -74,22 +74,22 @@
74
74
  "devDependencies": {
75
75
  "@stylistic/eslint-plugin": "^5.10.0",
76
76
  "@types/node": "^22.20.4",
77
- "@types/three": "^0.186.0",
77
+ "@types/three": "^0.187.0",
78
78
  "@typescript-eslint/parser": "^8.71.0",
79
79
  "betasim": "git+https://github.com/stefanocaronia/betasim.git",
80
- "dprint": "^0.58.0",
80
+ "dprint": "^0.64.3",
81
81
  "eslint": "^10.11.0",
82
82
  "fast-check": "^4.10.2",
83
- "playwright-core": "~1.63.0",
83
+ "playwright-core": "~1.64.1",
84
84
  "typescript": "^6.0.3",
85
- "vitest": "^5.0.3"
85
+ "vitest": "^5.0.5"
86
86
  },
87
87
  "dependencies": {
88
- "@dimforge/rapier3d-compat": "^0.20.0",
89
- "@modelcontextprotocol/sdk": "^1.32.0",
88
+ "@dimforge/rapier3d-compat": "^0.21.0",
89
+ "@modelcontextprotocol/sdk": "^1.32.2",
90
90
  "fflate": "^0.8.2",
91
- "preact": "^10.29.8",
92
- "three": "^0.186.1",
91
+ "preact": "^11.2.0",
92
+ "three": "^0.187.0",
93
93
  "unpdf": "1.8.1",
94
94
  "yaml": "^2.9.1",
95
95
  "zod": "^4.6.5"