@scrthq/runlog 0.0.44 → 0.0.45

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.
Files changed (2) hide show
  1. package/dist/runlog.js +33 -0
  2. package/package.json +1 -1
package/dist/runlog.js CHANGED
@@ -26525,6 +26525,9 @@ var EntryBase = {
26525
26525
  tags: external_exports.array(external_exports.string()).optional().describe("Free tags, for cross-referencing and for filtering results out in some modes."),
26526
26526
  points: external_exports.number().int().min(0).optional().describe(
26527
26527
  "What a contestant earns for completing this result in a moderated mode. A result with points is a challenge the moderator can award; one without is an effect that lands on everyone."
26528
+ ),
26529
+ needs: external_exports.array(Id).optional().describe(
26530
+ "Requirements this result depends on, by id from the pack's `requires`. A run that said it lacks one of them draws again instead of landing here \u2014 a barbell movement for someone without a barbell, an oven dish in a kitchen without one."
26528
26531
  )
26529
26532
  };
26530
26533
  var LookupEntry = external_exports.object({
@@ -26715,6 +26718,14 @@ var ResourceDef = external_exports.object({
26715
26718
  }).strict().describe(
26716
26719
  "A numeric track the player fills or spends: a progress clock, a word count, training volume, stock on hand."
26717
26720
  );
26721
+ var Requirement = external_exports.object({
26722
+ id: Id.describe("Unique among requirements. Table entries name it in `needs`."),
26723
+ label: external_exports.string().min(1).describe("What it is, in the words a person would use: Rocket League, a potter's wheel, an oven."),
26724
+ kind: external_exports.enum(["game", "platform", "software", "equipment", "supplies", "space", "other"]).default("other").describe("What sort of thing it is, so a catalog can say 'needs a game' or 'needs equipment' at a glance."),
26725
+ optional: external_exports.boolean().default(false).describe("Nice to have rather than needed. A player says at the start whether they have it, and results that `need` it are drawn again when they do not."),
26726
+ note: external_exports.string().optional().describe("A line on where to get it, which version, or what will do instead."),
26727
+ url: external_exports.string().url().optional().describe("Where to find it.")
26728
+ }).strict().describe("A physical or software requirement: the game and the system to play it on, a mod or training pack, a wheel, a kitchen, supplies.");
26718
26729
  var ChecklistItem = external_exports.union([
26719
26730
  external_exports.string().min(1),
26720
26731
  external_exports.object({
@@ -26944,6 +26955,11 @@ var Pack = external_exports.object({
26944
26955
  author: external_exports.string().optional().describe("Who wrote the game."),
26945
26956
  description: external_exports.string().optional().describe("One or two sentences on what the game is."),
26946
26957
  homepage: external_exports.string().url().optional().describe("Where to find out more."),
26958
+ category: external_exports.string().min(1).max(40).optional().describe("What kind of thing this is, in a word or two, for a catalog to group by: everyday, games, craft, fitness, cooking, writing\u2026"),
26959
+ tags: external_exports.array(external_exports.string().min(1).max(40)).max(12).optional().describe("Free tags for a catalog to filter by: the game it is for, the hobby, the shape of play. Short, and in the words a person would search for."),
26960
+ requires: external_exports.array(Requirement).max(20).optional().describe(
26961
+ "What a person needs before playing, shown in the catalog and the rulebook: the game and a system that runs it, mods or training packs, a wheel, a kitchen, supplies. Mark the ones that are nice to have `optional`; results can `need` those and be drawn again for a player who lacks them."
26962
+ ),
26947
26963
  license: License,
26948
26964
  capabilities: external_exports.array(Capability).default([]).describe(
26949
26965
  "Engine features this pack needs. Declaring them lets an older app refuse the pack with a clear message instead of misplaying it."
@@ -27320,6 +27336,18 @@ function lintPack(pack) {
27320
27336
  }
27321
27337
  });
27322
27338
  }
27339
+ const requirements = new Map((pack.requires ?? []).map((r) => [r.id, r]));
27340
+ for (const [tableId, table] of Object.entries(pack.tables)) {
27341
+ table.entries.forEach((e, i) => {
27342
+ for (const need of e.needs ?? []) {
27343
+ const r = requirements.get(need);
27344
+ if (!r) d.push(err("ref/unknown-requirement", `tables.${tableId}.entries[${i}].needs`, `needs unknown requirement ${need}`));
27345
+ else if (!r.optional) {
27346
+ d.push(warn("requirement/never-lacked", `tables.${tableId}.entries[${i}].needs`, `needs ${need}, which is not optional, so no run can lack it; the entry will never be skipped`));
27347
+ }
27348
+ }
27349
+ });
27350
+ }
27323
27351
  const predicateSites = [];
27324
27352
  for (const [tableId, table] of Object.entries(pack.tables)) {
27325
27353
  table.entries.forEach(
@@ -28272,6 +28300,9 @@ function stepDetail(pack, step) {
28272
28300
  function whatYouNeed(pack) {
28273
28301
  const n = nouns(pack);
28274
28302
  const items = [];
28303
+ for (const r of pack.requires ?? []) {
28304
+ items.push(`${cap(r.label)}${r.optional ? " (optional; results that need it are drawn again without it)" : ""}${r.note ? ` \u2014 ${r.note}` : ""}${r.url ? ` (${r.url})` : ""}.`);
28305
+ }
28275
28306
  const dice = diceInWords(diceNeeded(pack));
28276
28307
  if (dice) items.push(cap(dice) + ".");
28277
28308
  for (const deck of Object.values(pack.decks ?? {})) {
@@ -28349,6 +28380,7 @@ function summaryDoc(pack) {
28349
28380
  const n = nouns(pack);
28350
28381
  const b = new Builder();
28351
28382
  b.p(pack.description);
28383
+ b.p([pack.category ? `Category: ${pack.category}` : "", pack.tags?.length ? `Tags: ${pack.tags.join(", ")}` : ""].filter(Boolean).join(" \xB7 "), "muted");
28352
28384
  b.p(license(pack), "muted");
28353
28385
  b.h(2, "How it plays");
28354
28386
  const unitRange = `${pack.unit.min === pack.unit.max ? pack.unit.min : `${pack.unit.min}\u2013${pack.unit.max}`}`;
@@ -28817,6 +28849,7 @@ function initialState(pack, e) {
28817
28849
  outcomes: [],
28818
28850
  obligations: [],
28819
28851
  firedOnce: [],
28852
+ lacks: e.lacks ?? [],
28820
28853
  contestants: [],
28821
28854
  awards: [],
28822
28855
  ending: null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scrthq/runlog",
3
- "version": "0.0.44",
3
+ "version": "0.0.45",
4
4
  "description": "Validate, lint, bundle and test Runlog rule packs.",
5
5
  "type": "module",
6
6
  "license": "MIT",