@adatechnology/game-items-goods 0.6.3 → 0.7.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.
@@ -66,7 +66,7 @@ var GameItemsGoods = (() => {
66
66
  var positive = (n) => finite(n) && n > 0;
67
67
  var vec3 = (v) => Array.isArray(v) && v.length === 3 && v.every(finite);
68
68
  var nonNegative = (n) => n === void 0 || finite(n) && n >= 0;
69
- var FACES = ["both", "+", "-"];
69
+ var FACES = ["both", "+", "-", "all"];
70
70
  var BONDS = ["running", "stack"];
71
71
  var checkStagedFields = (p, label, materials, problems) => {
72
72
  const known = (m, what) => {
@@ -536,6 +536,15 @@ var GameItemsGoods = (() => {
536
536
  { id: "collectibles", name: "Collectibles" },
537
537
  { id: "keys", name: "Keys" }
538
538
  ];
539
+ var consumableProblems = (spec) => {
540
+ const problems = [];
541
+ if (!(spec.amount > 0) || !Number.isFinite(spec.amount)) problems.push(`holds ${spec.amount} ${spec.unit} when new`);
542
+ if (!(spec.dose > 0) || !(spec.dose <= spec.amount)) problems.push(`spends ${spec.dose} ${spec.unit} a use (above 0, at most what it holds)`);
543
+ if (!(spec.emptyKg >= 0) || !Number.isFinite(spec.emptyKg)) problems.push(`has packaging of ${spec.emptyKg} kg`);
544
+ if (spec.density !== void 0 && !(spec.density > 0)) problems.push(`has a density of ${spec.density} kg/L`);
545
+ if (spec.form === "bar" && spec.unit !== "g") problems.push("is a bar measured in millilitres");
546
+ return problems;
547
+ };
539
548
  var RARITIES = ["common", "uncommon", "rare", "very_rare", "legendary", "unique"];
540
549
  var BODY_SLOTS = ["head", "eyes", "torso", "arms", "hands", "legs", "feet", "over"];
541
550
  var DURABILITY_KINDS = ["uses", "portions", "doses", "hits", "cuts", "shots", "condition", "charges", "seconds", "days", "infinite", "container"];
@@ -561,6 +570,7 @@ var GameItemsGoods = (() => {
561
570
  if (item.shelfLife !== void 0 && !isPositive(item.shelfLife)) issue(`has a shelf life of ${item.shelfLife} days`);
562
571
  if (item.portions !== void 0 && !(Number.isInteger(item.portions) && item.portions > 0)) issue(`has ${item.portions} portions`);
563
572
  if (item.durability && !DURABILITY_KINDS.includes(item.durability.kind)) issue(`has unknown durability kind "${item.durability.kind}"`);
573
+ if (item.consumable) for (const problem of consumableProblems(item.consumable)) issue(problem);
564
574
  const { protection } = item;
565
575
  if (protection) {
566
576
  for (const slot of protection.slots) if (!BODY_SLOTS.includes(slot)) issue(`protects unknown body slot "${slot}"`);
@@ -11928,7 +11938,14 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
11928
11938
  ],
11929
11939
  estimated: [
11930
11940
  "parts"
11931
- ]
11941
+ ],
11942
+ consumable: {
11943
+ form: "bar",
11944
+ unit: "g",
11945
+ amount: 100,
11946
+ dose: 1.5,
11947
+ emptyKg: 0
11948
+ }
11932
11949
  },
11933
11950
  {
11934
11951
  id: "shampoo",
@@ -11946,7 +11963,15 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
11946
11963
  stack: 3,
11947
11964
  shape: "bottle",
11948
11965
  color: 4885200,
11949
- rarity: "common"
11966
+ rarity: "common",
11967
+ consumable: {
11968
+ form: "liquid",
11969
+ unit: "ml",
11970
+ amount: 300,
11971
+ dose: 8,
11972
+ emptyKg: 0.044,
11973
+ density: 1.02
11974
+ }
11950
11975
  },
11951
11976
  {
11952
11977
  id: "toothpaste",
@@ -11964,7 +11989,14 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
11964
11989
  stack: 3,
11965
11990
  shape: "tube",
11966
11991
  color: 15790320,
11967
- rarity: "common"
11992
+ rarity: "common",
11993
+ consumable: {
11994
+ form: "paste",
11995
+ unit: "g",
11996
+ amount: 90,
11997
+ dose: 1,
11998
+ emptyKg: 0.01
11999
+ }
11968
12000
  },
11969
12001
  {
11970
12002
  id: "toothbrush",