isaacscript-common 51.2.3 → 51.3.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.
@@ -75,7 +75,7 @@ import { RoomTransitionAnim } from 'isaac-typescript-definitions';
75
75
  import { RoomType } from 'isaac-typescript-definitions';
76
76
  import type { SackSubType } from 'isaac-typescript-definitions';
77
77
  import { SeedEffect } from 'isaac-typescript-definitions';
78
- import type { SlotVariant } from 'isaac-typescript-definitions';
78
+ import { SlotVariant } from 'isaac-typescript-definitions';
79
79
  import type { StageID } from 'isaac-typescript-definitions';
80
80
  import { StageType } from 'isaac-typescript-definitions';
81
81
  import { TearFlag } from 'isaac-typescript-definitions';
@@ -7427,6 +7427,17 @@ export declare function getShootActions(controllerIndex: ControllerIndex): Butto
7427
7427
  */
7428
7428
  export declare function getSirenHelper(familiar: EntityFamiliar): Entity | undefined;
7429
7429
 
7430
+ /**
7431
+ * Helper function to get the name of a slot, as listed in the "entities2.xml" file. Returns
7432
+ * "Unknown" if the provided slot variant is not valid.
7433
+ *
7434
+ * This function only works for vanilla slot variants.
7435
+ *
7436
+ * For example, `getSlotName(SlotVariant.BLOOD_DONATION_MACHINE)` would return "Blood Donation
7437
+ * Machine".
7438
+ */
7439
+ export declare function getSlotName(slotVariant: SlotVariant): string;
7440
+
7430
7441
  /**
7431
7442
  * Helper function to get all of the slots in the room.
7432
7443
  *
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 51.2.3
3
+ isaacscript-common 51.3.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -39681,6 +39681,33 @@ function PlayerReorderedCallbacks.prototype.____constructor(self, postPEffectUpd
39681
39681
  self.postPlayerRenderReordered = postPlayerRenderReordered
39682
39682
  self.postPlayerUpdateReordered = postPlayerUpdateReordered
39683
39683
  end
39684
+ return ____exports
39685
+ end,
39686
+ ["src.objects.slotNames"] = function(...)
39687
+ local ____exports = {}
39688
+ local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
39689
+ local SlotVariant = ____isaac_2Dtypescript_2Ddefinitions.SlotVariant
39690
+ ____exports.DEFAULT_SLOT_NAME = "Unknown"
39691
+ ____exports.SLOT_NAMES = {
39692
+ [SlotVariant.SLOT_MACHINE] = "Slot Machine",
39693
+ [SlotVariant.BLOOD_DONATION_MACHINE] = "Blood Donation Machine",
39694
+ [SlotVariant.FORTUNE_TELLING_MACHINE] = "Fortune Telling Machine",
39695
+ [SlotVariant.BEGGAR] = "Beggar",
39696
+ [SlotVariant.DEVIL_BEGGAR] = "Devil Beggar",
39697
+ [SlotVariant.SHELL_GAME] = "Shell Game",
39698
+ [SlotVariant.KEY_MASTER] = "Key Master",
39699
+ [SlotVariant.DONATION_MACHINE] = "Donation Machine",
39700
+ [SlotVariant.BOMB_BUM] = "Bomb Bum",
39701
+ [SlotVariant.SHOP_RESTOCK_MACHINE] = "Shop Restock Machine",
39702
+ [SlotVariant.GREED_DONATION_MACHINE] = "Greed Donation Machine",
39703
+ [SlotVariant.MOMS_DRESSING_TABLE] = "Mom's Dressing Table",
39704
+ [SlotVariant.BATTERY_BUM] = "Battery Bum",
39705
+ [SlotVariant.ISAAC_SECRET] = "Isaac (secret)",
39706
+ [SlotVariant.HELL_GAME] = "Hell Game",
39707
+ [SlotVariant.CRANE_GAME] = "Crane Game",
39708
+ [SlotVariant.CONFESSIONAL] = "Confessional",
39709
+ [SlotVariant.ROTTEN_BEGGAR] = "Rotten Beggar"
39710
+ }
39684
39711
  return ____exports
39685
39712
  end,
39686
39713
  ["src.functions.slots"] = function(...)
@@ -39689,6 +39716,9 @@ local __TS__New = ____lualib.__TS__New
39689
39716
  local ____exports = {}
39690
39717
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
39691
39718
  local SlotVariant = ____isaac_2Dtypescript_2Ddefinitions.SlotVariant
39719
+ local ____slotNames = require("src.objects.slotNames")
39720
+ local DEFAULT_SLOT_NAME = ____slotNames.DEFAULT_SLOT_NAME
39721
+ local SLOT_NAMES = ____slotNames.SLOT_NAMES
39692
39722
  local ____ReadonlySet = require("src.types.ReadonlySet")
39693
39723
  local ReadonlySet = ____ReadonlySet.ReadonlySet
39694
39724
  local ____entityTypes = require("src.functions.entityTypes")
@@ -39704,6 +39734,9 @@ local SLOT_MACHINE_VARIANTS = __TS__New(ReadonlySet, {
39704
39734
  SlotVariant.CRANE_GAME,
39705
39735
  SlotVariant.CONFESSIONAL
39706
39736
  })
39737
+ function ____exports.getSlotName(self, slotVariant)
39738
+ return SLOT_NAMES[slotVariant] or DEFAULT_SLOT_NAME
39739
+ end
39707
39740
  function ____exports.isSlotMachine(self, entity)
39708
39741
  if not isSlot(nil, entity) then
39709
39742
  return false
@@ -39921,6 +39954,7 @@ return ____exports
39921
39954
  local ____exports = {}
39922
39955
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
39923
39956
  local PickupVariant = ____isaac_2Dtypescript_2Ddefinitions.PickupVariant
39957
+ ____exports.DEFAULT_CHEST_NAME = "Unknown"
39924
39958
  ____exports.CHEST_NAMES = {
39925
39959
  [PickupVariant.CHEST] = "Chest",
39926
39960
  [PickupVariant.BOMB_CHEST] = "Bomb Chest",
@@ -40394,6 +40428,7 @@ local BOMB_NAMES = ____bombNames.BOMB_NAMES
40394
40428
  local DEFAULT_BOMB_NAME = ____bombNames.DEFAULT_BOMB_NAME
40395
40429
  local ____chestNames = require("src.objects.chestNames")
40396
40430
  local CHEST_NAMES = ____chestNames.CHEST_NAMES
40431
+ local DEFAULT_CHEST_NAME = ____chestNames.DEFAULT_CHEST_NAME
40397
40432
  local ____coinNames = require("src.objects.coinNames")
40398
40433
  local COIN_NAMES = ____coinNames.COIN_NAMES
40399
40434
  local DEFAULT_COIN_NAME = ____coinNames.DEFAULT_COIN_NAME
@@ -40428,7 +40463,7 @@ function ____exports.getBombName(self, bombSubType)
40428
40463
  end
40429
40464
  function ____exports.getChestName(self, pickupVariant)
40430
40465
  local chestNames = CHEST_NAMES
40431
- return chestNames[pickupVariant] or "Unknown"
40466
+ return chestNames[pickupVariant] or DEFAULT_CHEST_NAME
40432
40467
  end
40433
40468
  function ____exports.getCoinName(self, coinSubType)
40434
40469
  return COIN_NAMES[coinSubType] or DEFAULT_COIN_NAME
@@ -11,6 +11,7 @@ local BOMB_NAMES = ____bombNames.BOMB_NAMES
11
11
  local DEFAULT_BOMB_NAME = ____bombNames.DEFAULT_BOMB_NAME
12
12
  local ____chestNames = require("src.objects.chestNames")
13
13
  local CHEST_NAMES = ____chestNames.CHEST_NAMES
14
+ local DEFAULT_CHEST_NAME = ____chestNames.DEFAULT_CHEST_NAME
14
15
  local ____coinNames = require("src.objects.coinNames")
15
16
  local COIN_NAMES = ____coinNames.COIN_NAMES
16
17
  local DEFAULT_COIN_NAME = ____coinNames.DEFAULT_COIN_NAME
@@ -64,7 +65,7 @@ end
64
65
  -- For example, `getChestName(PickupVariant.SPIKED_CHEST)` would return "Spiked Chest".
65
66
  function ____exports.getChestName(self, pickupVariant)
66
67
  local chestNames = CHEST_NAMES
67
- return chestNames[pickupVariant] or "Unknown"
68
+ return chestNames[pickupVariant] or DEFAULT_CHEST_NAME
68
69
  end
69
70
  --- Helper function to get the name of a coin, as listed in the "entities2.xml" file. Returns
70
71
  -- "Unknown" if the provided coin sub-type is not valid.
@@ -1,4 +1,14 @@
1
- /// <reference types="isaac-typescript-definitions" />
1
+ import { SlotVariant } from "isaac-typescript-definitions";
2
+ /**
3
+ * Helper function to get the name of a slot, as listed in the "entities2.xml" file. Returns
4
+ * "Unknown" if the provided slot variant is not valid.
5
+ *
6
+ * This function only works for vanilla slot variants.
7
+ *
8
+ * For example, `getSlotName(SlotVariant.BLOOD_DONATION_MACHINE)` would return "Blood Donation
9
+ * Machine".
10
+ */
11
+ export declare function getSlotName(slotVariant: SlotVariant): string;
2
12
  /** Returns true for the specific variants of `EntityType.SLOT` that are machines. */
3
13
  export declare function isSlotMachine(entity: Entity): boolean;
4
14
  //# sourceMappingURL=slots.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"slots.d.ts","sourceRoot":"","sources":["../../../src/functions/slots.ts"],"names":[],"mappings":";AAgBA,qFAAqF;AACrF,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAMrD"}
1
+ {"version":3,"file":"slots.d.ts","sourceRoot":"","sources":["../../../src/functions/slots.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAiB3D;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAI5D;AAED,qFAAqF;AACrF,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAMrD"}
@@ -3,6 +3,9 @@ local __TS__New = ____lualib.__TS__New
3
3
  local ____exports = {}
4
4
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
5
5
  local SlotVariant = ____isaac_2Dtypescript_2Ddefinitions.SlotVariant
6
+ local ____slotNames = require("src.objects.slotNames")
7
+ local DEFAULT_SLOT_NAME = ____slotNames.DEFAULT_SLOT_NAME
8
+ local SLOT_NAMES = ____slotNames.SLOT_NAMES
6
9
  local ____ReadonlySet = require("src.types.ReadonlySet")
7
10
  local ReadonlySet = ____ReadonlySet.ReadonlySet
8
11
  local ____entityTypes = require("src.functions.entityTypes")
@@ -18,6 +21,16 @@ local SLOT_MACHINE_VARIANTS = __TS__New(ReadonlySet, {
18
21
  SlotVariant.CRANE_GAME,
19
22
  SlotVariant.CONFESSIONAL
20
23
  })
24
+ --- Helper function to get the name of a slot, as listed in the "entities2.xml" file. Returns
25
+ -- "Unknown" if the provided slot variant is not valid.
26
+ --
27
+ -- This function only works for vanilla slot variants.
28
+ --
29
+ -- For example, `getSlotName(SlotVariant.BLOOD_DONATION_MACHINE)` would return "Blood Donation
30
+ -- Machine".
31
+ function ____exports.getSlotName(self, slotVariant)
32
+ return SLOT_NAMES[slotVariant] or DEFAULT_SLOT_NAME
33
+ end
21
34
  --- Returns true for the specific variants of `EntityType.SLOT` that are machines.
22
35
  function ____exports.isSlotMachine(self, entity)
23
36
  if not isSlot(nil, entity) then
@@ -1,3 +1,4 @@
1
+ export declare const DEFAULT_CHEST_NAME = "Unknown";
1
2
  /** Taken from "entities2.xml". */
2
3
  export declare const CHEST_NAMES: {
3
4
  readonly 50: "Chest";
@@ -1 +1 @@
1
- {"version":3,"file":"chestNames.d.ts","sourceRoot":"","sources":["../../../src/objects/chestNames.ts"],"names":[],"mappings":"AAGA,kCAAkC;AAClC,eAAO,MAAM,WAAW;;;;;;;;;;;;;CAamD,CAAC"}
1
+ {"version":3,"file":"chestNames.d.ts","sourceRoot":"","sources":["../../../src/objects/chestNames.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB,YAAY,CAAC;AAE5C,kCAAkC;AAClC,eAAO,MAAM,WAAW;;;;;;;;;;;;;CAamD,CAAC"}
@@ -1,6 +1,7 @@
1
1
  local ____exports = {}
2
2
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
3
3
  local PickupVariant = ____isaac_2Dtypescript_2Ddefinitions.PickupVariant
4
+ ____exports.DEFAULT_CHEST_NAME = "Unknown"
4
5
  --- Taken from "entities2.xml".
5
6
  ____exports.CHEST_NAMES = {
6
7
  [PickupVariant.CHEST] = "Chest",
@@ -0,0 +1,23 @@
1
+ export declare const DEFAULT_SLOT_NAME = "Unknown";
2
+ /** Taken from "entities2.xml". */
3
+ export declare const SLOT_NAMES: {
4
+ readonly 1: "Slot Machine";
5
+ readonly 2: "Blood Donation Machine";
6
+ readonly 3: "Fortune Telling Machine";
7
+ readonly 4: "Beggar";
8
+ readonly 5: "Devil Beggar";
9
+ readonly 6: "Shell Game";
10
+ readonly 7: "Key Master";
11
+ readonly 8: "Donation Machine";
12
+ readonly 9: "Bomb Bum";
13
+ readonly 10: "Shop Restock Machine";
14
+ readonly 11: "Greed Donation Machine";
15
+ readonly 12: "Mom's Dressing Table";
16
+ readonly 13: "Battery Bum";
17
+ readonly 14: "Isaac (secret)";
18
+ readonly 15: "Hell Game";
19
+ readonly 16: "Crane Game";
20
+ readonly 17: "Confessional";
21
+ readonly 18: "Rotten Beggar";
22
+ };
23
+ //# sourceMappingURL=slotNames.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slotNames.d.ts","sourceRoot":"","sources":["../../../src/objects/slotNames.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAE3C,kCAAkC;AAClC,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;CAmByB,CAAC"}
@@ -0,0 +1,26 @@
1
+ local ____exports = {}
2
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
3
+ local SlotVariant = ____isaac_2Dtypescript_2Ddefinitions.SlotVariant
4
+ ____exports.DEFAULT_SLOT_NAME = "Unknown"
5
+ --- Taken from "entities2.xml".
6
+ ____exports.SLOT_NAMES = {
7
+ [SlotVariant.SLOT_MACHINE] = "Slot Machine",
8
+ [SlotVariant.BLOOD_DONATION_MACHINE] = "Blood Donation Machine",
9
+ [SlotVariant.FORTUNE_TELLING_MACHINE] = "Fortune Telling Machine",
10
+ [SlotVariant.BEGGAR] = "Beggar",
11
+ [SlotVariant.DEVIL_BEGGAR] = "Devil Beggar",
12
+ [SlotVariant.SHELL_GAME] = "Shell Game",
13
+ [SlotVariant.KEY_MASTER] = "Key Master",
14
+ [SlotVariant.DONATION_MACHINE] = "Donation Machine",
15
+ [SlotVariant.BOMB_BUM] = "Bomb Bum",
16
+ [SlotVariant.SHOP_RESTOCK_MACHINE] = "Shop Restock Machine",
17
+ [SlotVariant.GREED_DONATION_MACHINE] = "Greed Donation Machine",
18
+ [SlotVariant.MOMS_DRESSING_TABLE] = "Mom's Dressing Table",
19
+ [SlotVariant.BATTERY_BUM] = "Battery Bum",
20
+ [SlotVariant.ISAAC_SECRET] = "Isaac (secret)",
21
+ [SlotVariant.HELL_GAME] = "Hell Game",
22
+ [SlotVariant.CRANE_GAME] = "Crane Game",
23
+ [SlotVariant.CONFESSIONAL] = "Confessional",
24
+ [SlotVariant.ROTTEN_BEGGAR] = "Rotten Beggar"
25
+ }
26
+ return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "51.2.3",
3
+ "version": "51.3.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -10,7 +10,7 @@ import type {
10
10
  import { CHEST_PICKUP_VARIANTS_SET } from "../core/constants";
11
11
  import { BATTERY_NAMES, DEFAULT_BATTERY_NAME } from "../objects/batteryNames";
12
12
  import { BOMB_NAMES, DEFAULT_BOMB_NAME } from "../objects/bombNames";
13
- import { CHEST_NAMES } from "../objects/chestNames";
13
+ import { CHEST_NAMES, DEFAULT_CHEST_NAME } from "../objects/chestNames";
14
14
  import { COIN_NAMES, DEFAULT_COIN_NAME } from "../objects/coinNames";
15
15
  import {
16
16
  COIN_SUB_TYPE_TO_VALUE,
@@ -62,7 +62,7 @@ export function getBombName(bombSubType: BombSubType): string {
62
62
  */
63
63
  export function getChestName(pickupVariant: PickupVariant): string {
64
64
  const chestNames = CHEST_NAMES as Partial<Record<PickupVariant, string>>;
65
- return chestNames[pickupVariant] ?? "Unknown";
65
+ return chestNames[pickupVariant] ?? DEFAULT_CHEST_NAME;
66
66
  }
67
67
 
68
68
  /**
@@ -1,4 +1,5 @@
1
1
  import { SlotVariant } from "isaac-typescript-definitions";
2
+ import { DEFAULT_SLOT_NAME, SLOT_NAMES } from "../objects/slotNames";
2
3
  import { ReadonlySet } from "../types/ReadonlySet";
3
4
  import { isSlot } from "./entityTypes";
4
5
 
@@ -14,6 +15,21 @@ const SLOT_MACHINE_VARIANTS = new ReadonlySet<SlotVariant>([
14
15
  SlotVariant.CONFESSIONAL, // 17
15
16
  ]);
16
17
 
18
+ /**
19
+ * Helper function to get the name of a slot, as listed in the "entities2.xml" file. Returns
20
+ * "Unknown" if the provided slot variant is not valid.
21
+ *
22
+ * This function only works for vanilla slot variants.
23
+ *
24
+ * For example, `getSlotName(SlotVariant.BLOOD_DONATION_MACHINE)` would return "Blood Donation
25
+ * Machine".
26
+ */
27
+ export function getSlotName(slotVariant: SlotVariant): string {
28
+ // Handle modded slots.
29
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
30
+ return SLOT_NAMES[slotVariant] ?? DEFAULT_SLOT_NAME;
31
+ }
32
+
17
33
  /** Returns true for the specific variants of `EntityType.SLOT` that are machines. */
18
34
  export function isSlotMachine(entity: Entity): boolean {
19
35
  if (!isSlot(entity)) {
@@ -1,6 +1,8 @@
1
1
  import { PickupVariant } from "isaac-typescript-definitions";
2
2
  import type { CHEST_PICKUP_VARIANTS } from "../core/constants";
3
3
 
4
+ export const DEFAULT_CHEST_NAME = "Unknown";
5
+
4
6
  /** Taken from "entities2.xml". */
5
7
  export const CHEST_NAMES = {
6
8
  [PickupVariant.CHEST]: "Chest", // 50
@@ -0,0 +1,25 @@
1
+ import { SlotVariant } from "isaac-typescript-definitions";
2
+
3
+ export const DEFAULT_SLOT_NAME = "Unknown";
4
+
5
+ /** Taken from "entities2.xml". */
6
+ export const SLOT_NAMES = {
7
+ [SlotVariant.SLOT_MACHINE]: "Slot Machine", // 1
8
+ [SlotVariant.BLOOD_DONATION_MACHINE]: "Blood Donation Machine", // 2
9
+ [SlotVariant.FORTUNE_TELLING_MACHINE]: "Fortune Telling Machine", // 3
10
+ [SlotVariant.BEGGAR]: "Beggar", // 4
11
+ [SlotVariant.DEVIL_BEGGAR]: "Devil Beggar", // 5
12
+ [SlotVariant.SHELL_GAME]: "Shell Game", // 6
13
+ [SlotVariant.KEY_MASTER]: "Key Master", // 7
14
+ [SlotVariant.DONATION_MACHINE]: "Donation Machine", // 8
15
+ [SlotVariant.BOMB_BUM]: "Bomb Bum", // 9
16
+ [SlotVariant.SHOP_RESTOCK_MACHINE]: "Shop Restock Machine", // 10
17
+ [SlotVariant.GREED_DONATION_MACHINE]: "Greed Donation Machine", // 11
18
+ [SlotVariant.MOMS_DRESSING_TABLE]: "Mom's Dressing Table", // 12
19
+ [SlotVariant.BATTERY_BUM]: "Battery Bum", // 13
20
+ [SlotVariant.ISAAC_SECRET]: "Isaac (secret)", // 14
21
+ [SlotVariant.HELL_GAME]: "Hell Game", // 15
22
+ [SlotVariant.CRANE_GAME]: "Crane Game", // 16
23
+ [SlotVariant.CONFESSIONAL]: "Confessional", // 17
24
+ [SlotVariant.ROTTEN_BEGGAR]: "Rotten Beggar", // 18
25
+ } as const satisfies Record<SlotVariant, string>;