isaacscript-common 84.2.1 → 84.2.3

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 (111) hide show
  1. package/dist/{arrays/cachedEnumValues.d.ts → cachedEnumValues.d.ts} +4 -4
  2. package/dist/cachedEnumValues.d.ts.map +1 -0
  3. package/dist/{arrays/cachedEnumValues.js → cachedEnumValues.js} +5 -5
  4. package/dist/callbacks.js +1 -1
  5. package/dist/callbacks.lua +1 -1
  6. package/dist/classes/callbacks/PostItemDischarge.js +1 -1
  7. package/dist/classes/callbacks/PostItemDischarge.lua +1 -1
  8. package/dist/classes/callbacks/PostKeyboardChanged.js +1 -1
  9. package/dist/classes/callbacks/PostKeyboardChanged.lua +1 -1
  10. package/dist/classes/callbacks/PostPlayerChangeHealth.js +1 -1
  11. package/dist/classes/callbacks/PostPlayerChangeHealth.lua +1 -1
  12. package/dist/classes/callbacks/PostPlayerChangeStat.js +1 -1
  13. package/dist/classes/callbacks/PostPlayerChangeStat.lua +1 -1
  14. package/dist/classes/callbacks/PostTransformation.js +1 -1
  15. package/dist/classes/callbacks/PostTransformation.lua +1 -1
  16. package/dist/classes/callbacks/PreRoomEntitySpawnFilter.d.ts +1 -1
  17. package/dist/classes/features/callbackLogic/PlayerCollectibleDetection.js +1 -1
  18. package/dist/classes/features/callbackLogic/PlayerCollectibleDetection.lua +1 -1
  19. package/dist/classes/features/other/DeployJSONRoom.js +1 -1
  20. package/dist/classes/features/other/DeployJSONRoom.lua +1 -1
  21. package/dist/classes/features/other/ModdedElementSets.js +1 -1
  22. package/dist/classes/features/other/ModdedElementSets.lua +1 -1
  23. package/dist/classes/features/other/customStages/streakText.js +1 -1
  24. package/dist/classes/features/other/customStages/streakText.lua +1 -1
  25. package/dist/classes/features/other/extraConsoleCommands/commands.js +1 -1
  26. package/dist/classes/features/other/extraConsoleCommands/commands.lua +1 -1
  27. package/dist/functions/bitwise.d.ts.map +1 -1
  28. package/dist/functions/bitwise.js +2 -1
  29. package/dist/functions/bitwise.lua +3 -1
  30. package/dist/functions/cards.js +1 -1
  31. package/dist/functions/cards.lua +1 -1
  32. package/dist/functions/doors.d.ts.map +1 -1
  33. package/dist/functions/doors.js +1 -1
  34. package/dist/functions/doors.lua +1 -1
  35. package/dist/functions/enums.d.ts.map +1 -1
  36. package/dist/functions/enums.js +6 -11
  37. package/dist/functions/enums.lua +14 -7
  38. package/dist/functions/gridEntities.js +1 -1
  39. package/dist/functions/gridEntities.lua +1 -1
  40. package/dist/functions/input.js +1 -1
  41. package/dist/functions/input.lua +1 -1
  42. package/dist/functions/itemPool.js +1 -1
  43. package/dist/functions/itemPool.lua +1 -1
  44. package/dist/functions/level.js +1 -1
  45. package/dist/functions/level.lua +1 -1
  46. package/dist/functions/math.d.ts.map +1 -1
  47. package/dist/functions/math.js +2 -1
  48. package/dist/functions/math.lua +3 -2
  49. package/dist/functions/pills.js +1 -1
  50. package/dist/functions/pills.lua +1 -1
  51. package/dist/functions/playerCollectibles.js +1 -1
  52. package/dist/functions/playerCollectibles.lua +1 -1
  53. package/dist/functions/playerTrinkets.js +1 -1
  54. package/dist/functions/playerTrinkets.lua +1 -1
  55. package/dist/functions/pocketItems.js +1 -1
  56. package/dist/functions/pocketItems.lua +1 -1
  57. package/dist/functions/roomData.js +1 -1
  58. package/dist/functions/roomData.lua +1 -1
  59. package/dist/functions/roomShapeWalls.js +1 -1
  60. package/dist/functions/roomShapeWalls.lua +1 -1
  61. package/dist/functions/run.js +1 -1
  62. package/dist/functions/run.lua +1 -1
  63. package/dist/functions/sound.js +1 -1
  64. package/dist/functions/sound.lua +1 -1
  65. package/dist/functions/transformations.js +1 -1
  66. package/dist/functions/transformations.lua +1 -1
  67. package/dist/functions/types.js +1 -1
  68. package/dist/isaacscript-common.lua +1406 -1396
  69. package/dist/objects/itemPoolTypeToCollectibleTypesSet.js +1 -1
  70. package/dist/objects/itemPoolTypeToCollectibleTypesSet.lua +1 -1
  71. package/dist/serialization.js +1 -1
  72. package/dist/serialization.lua +1 -1
  73. package/dist/sets/bossSets.js +1 -1
  74. package/dist/sets/bossSets.lua +1 -1
  75. package/package.json +1 -1
  76. package/src/{arrays/cachedEnumValues.ts → cachedEnumValues.ts} +5 -5
  77. package/src/callbacks.ts +1 -1
  78. package/src/classes/callbacks/PostItemDischarge.ts +1 -1
  79. package/src/classes/callbacks/PostKeyboardChanged.ts +1 -1
  80. package/src/classes/callbacks/PostPlayerChangeHealth.ts +1 -1
  81. package/src/classes/callbacks/PostPlayerChangeStat.ts +1 -1
  82. package/src/classes/callbacks/PostTransformation.ts +1 -1
  83. package/src/classes/features/callbackLogic/PlayerCollectibleDetection.ts +1 -1
  84. package/src/classes/features/other/DeployJSONRoom.ts +1 -1
  85. package/src/classes/features/other/ModdedElementSets.ts +1 -1
  86. package/src/classes/features/other/customStages/streakText.ts +1 -1
  87. package/src/classes/features/other/extraConsoleCommands/commands.ts +1 -1
  88. package/src/functions/bitwise.ts +2 -1
  89. package/src/functions/cards.ts +1 -1
  90. package/src/functions/doors.ts +1 -4
  91. package/src/functions/enums.ts +9 -11
  92. package/src/functions/gridEntities.ts +1 -1
  93. package/src/functions/input.ts +1 -1
  94. package/src/functions/itemPool.ts +1 -1
  95. package/src/functions/level.ts +1 -1
  96. package/src/functions/math.ts +2 -1
  97. package/src/functions/pills.ts +1 -1
  98. package/src/functions/playerCollectibles.ts +1 -1
  99. package/src/functions/playerTrinkets.ts +1 -1
  100. package/src/functions/pocketItems.ts +1 -1
  101. package/src/functions/roomData.ts +1 -1
  102. package/src/functions/roomShapeWalls.ts +1 -1
  103. package/src/functions/run.ts +1 -1
  104. package/src/functions/sound.ts +1 -1
  105. package/src/functions/transformations.ts +1 -1
  106. package/src/functions/types.ts +1 -1
  107. package/src/objects/itemPoolTypeToCollectibleTypesSet.ts +1 -1
  108. package/src/serialization.ts +1 -1
  109. package/src/sets/bossSets.ts +1 -1
  110. package/dist/arrays/cachedEnumValues.d.ts.map +0 -1
  111. /package/dist/{arrays/cachedEnumValues.lua → cachedEnumValues.lua} +0 -0
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.ITEM_POOL_TYPE_TO_COLLECTIBLE_TYPES_SET = void 0;
27
- const cachedEnumValues_1 = require("../arrays/cachedEnumValues");
27
+ const cachedEnumValues_1 = require("../cachedEnumValues");
28
28
  const itemPoolsJSON = __importStar(require("../data/itempools.json"));
29
29
  const types_1 = require("../functions/types");
30
30
  const itemPoolTypeToItemPoolName_1 = require("../maps/itemPoolTypeToItemPoolName");
@@ -4,7 +4,7 @@ local __TS__New = ____lualib.__TS__New
4
4
  local __TS__ArrayFind = ____lualib.__TS__ArrayFind
5
5
  local ____exports = {}
6
6
  local getItemPoolJSON
7
- local ____cachedEnumValues = require("arrays.cachedEnumValues")
7
+ local ____cachedEnumValues = require("cachedEnumValues")
8
8
  local ITEM_POOL_TYPE_VALUES = ____cachedEnumValues.ITEM_POOL_TYPE_VALUES
9
9
  local itemPoolsJSON = require("data.itempools")
10
10
  local ____types = require("functions.types")
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isSerializationBrand = void 0;
4
- const cachedEnumValues_1 = require("./arrays/cachedEnumValues");
4
+ const cachedEnumValues_1 = require("./cachedEnumValues");
5
5
  const types_1 = require("./functions/types");
6
6
  const ReadonlySet_1 = require("./types/ReadonlySet");
7
7
  const SERIALIZATION_BRAND_SET = new ReadonlySet_1.ReadonlySet(cachedEnumValues_1.SERIALIZATION_BRAND_VALUES);
@@ -1,7 +1,7 @@
1
1
  local ____lualib = require("lualib_bundle")
2
2
  local __TS__New = ____lualib.__TS__New
3
3
  local ____exports = {}
4
- local ____cachedEnumValues = require("arrays.cachedEnumValues")
4
+ local ____cachedEnumValues = require("cachedEnumValues")
5
5
  local SERIALIZATION_BRAND_VALUES = ____cachedEnumValues.SERIALIZATION_BRAND_VALUES
6
6
  local ____types = require("functions.types")
7
7
  local isString = ____types.isString
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BOSS_ID_TO_STAGE_IDS = exports.NON_STORY_BOSSES = exports.ALL_BOSSES = exports.STAGE_TO_COMBINED_BOSS_SET_MAP = exports.STAGE_ID_TO_BOSS_IDS = void 0;
4
4
  const isaac_typescript_definitions_1 = require("isaac-typescript-definitions");
5
- const cachedEnumValues_1 = require("../arrays/cachedEnumValues");
5
+ const cachedEnumValues_1 = require("../cachedEnumValues");
6
6
  const storyBosses_1 = require("../functions/storyBosses");
7
7
  const ReadonlyMap_1 = require("../types/ReadonlyMap");
8
8
  const ReadonlySet_1 = require("../types/ReadonlySet");
@@ -12,7 +12,7 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitio
12
12
  local BossID = ____isaac_2Dtypescript_2Ddefinitions.BossID
13
13
  local LevelStage = ____isaac_2Dtypescript_2Ddefinitions.LevelStage
14
14
  local StageID = ____isaac_2Dtypescript_2Ddefinitions.StageID
15
- local ____cachedEnumValues = require("arrays.cachedEnumValues")
15
+ local ____cachedEnumValues = require("cachedEnumValues")
16
16
  local BOSS_ID_VALUES = ____cachedEnumValues.BOSS_ID_VALUES
17
17
  local ____storyBosses = require("functions.storyBosses")
18
18
  local isStoryBossID = ____storyBosses.isStoryBossID
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "84.2.1",
3
+ "version": "84.2.3",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -21,11 +21,11 @@ import {
21
21
  SoundEffect,
22
22
  TrinketSlot,
23
23
  } from "isaac-typescript-definitions";
24
- import { HealthType } from "../enums/HealthType";
25
- import { ModCallbackCustom } from "../enums/ModCallbackCustom";
26
- import { PlayerStat } from "../enums/PlayerStat";
27
- import { SerializationBrand } from "../enums/private/SerializationBrand";
28
- import { getEnumValues } from "../functions/enums";
24
+ import { HealthType } from "./enums/HealthType";
25
+ import { ModCallbackCustom } from "./enums/ModCallbackCustom";
26
+ import { PlayerStat } from "./enums/PlayerStat";
27
+ import { SerializationBrand } from "./enums/private/SerializationBrand";
28
+ import { getEnumValues } from "./functions/enums";
29
29
 
30
30
  export const ACTIVE_SLOT_VALUES = getEnumValues(ActiveSlot);
31
31
 
package/src/callbacks.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { MOD_CALLBACK_CUSTOM_VALUES } from "./arrays/cachedEnumValues";
1
+ import { MOD_CALLBACK_CUSTOM_VALUES } from "./cachedEnumValues";
2
2
  import * as cc from "./callbackClasses";
3
3
  import { ModCallbackCustom } from "./enums/ModCallbackCustom";
4
4
  import type { AnyClass } from "./types/AnyClass";
@@ -4,7 +4,7 @@ import {
4
4
  ModCallback,
5
5
  SuckerVariant,
6
6
  } from "isaac-typescript-definitions";
7
- import { ACTIVE_SLOT_VALUES } from "../../arrays/cachedEnumValues";
7
+ import { ACTIVE_SLOT_VALUES } from "../../cachedEnumValues";
8
8
  import { game } from "../../core/cachedClasses";
9
9
  import { ModCallbackCustom } from "../../enums/ModCallbackCustom";
10
10
  import { getTotalCharge } from "../../functions/charge";
@@ -1,6 +1,6 @@
1
1
  import type { Keyboard } from "isaac-typescript-definitions";
2
2
  import { ModCallback } from "isaac-typescript-definitions";
3
- import { KEYBOARD_VALUES } from "../../arrays/cachedEnumValues";
3
+ import { KEYBOARD_VALUES } from "../../cachedEnumValues";
4
4
  import type { ModCallbackCustom } from "../../enums/ModCallbackCustom";
5
5
  import { isKeyboardPressed } from "../../functions/input";
6
6
  import type { FireArgs, OptionalArgs } from "../private/CustomCallback";
@@ -1,4 +1,4 @@
1
- import { HEALTH_TYPE_VALUES } from "../../arrays/cachedEnumValues";
1
+ import { HEALTH_TYPE_VALUES } from "../../cachedEnumValues";
2
2
  import type { HealthType } from "../../enums/HealthType";
3
3
  import { ModCallbackCustom } from "../../enums/ModCallbackCustom";
4
4
  import { getPlayerHealthType } from "../../functions/playerHealth";
@@ -1,4 +1,4 @@
1
- import { PLAYER_STAT_VALUES } from "../../arrays/cachedEnumValues";
1
+ import { PLAYER_STAT_VALUES } from "../../cachedEnumValues";
2
2
  import { ModCallbackCustom } from "../../enums/ModCallbackCustom";
3
3
  import type { PlayerStat } from "../../enums/PlayerStat";
4
4
  import { isBitSet128 } from "../../functions/bitSet128";
@@ -1,5 +1,5 @@
1
1
  import type { PlayerForm } from "isaac-typescript-definitions";
2
- import { PLAYER_FORM_VALUES } from "../../arrays/cachedEnumValues";
2
+ import { PLAYER_FORM_VALUES } from "../../cachedEnumValues";
3
3
  import { ModCallbackCustom } from "../../enums/ModCallbackCustom";
4
4
  import { defaultMapGetPlayer } from "../../functions/playerDataStructures";
5
5
  import type { PlayerIndex } from "../../types/PlayerIndex";
@@ -6,7 +6,7 @@ import {
6
6
  ModCallback,
7
7
  PlayerType,
8
8
  } from "isaac-typescript-definitions";
9
- import { ACTIVE_SLOT_VALUES } from "../../../arrays/cachedEnumValues";
9
+ import { ACTIVE_SLOT_VALUES } from "../../../cachedEnumValues";
10
10
  import { ISCFeature } from "../../../enums/ISCFeature";
11
11
  import { ModCallbackCustom } from "../../../enums/ModCallbackCustom";
12
12
  import { arrayEquals } from "../../../functions/array";
@@ -8,7 +8,7 @@ import {
8
8
  PitfallVariant,
9
9
  RoomType,
10
10
  } from "isaac-typescript-definitions";
11
- import { GRID_ENTITY_XML_TYPE_VALUES } from "../../../arrays/cachedEnumValues";
11
+ import { GRID_ENTITY_XML_TYPE_VALUES } from "../../../cachedEnumValues";
12
12
  import { game } from "../../../core/cachedClasses";
13
13
  import { Exported } from "../../../decorators";
14
14
  import { ISCFeature } from "../../../enums/ISCFeature";
@@ -12,7 +12,7 @@ import {
12
12
  CACHE_FLAG_VALUES,
13
13
  ITEM_CONFIG_CARD_TYPE_VALUES,
14
14
  ITEM_CONFIG_TAG_VALUES,
15
- } from "../../../arrays/cachedEnumValues";
15
+ } from "../../../cachedEnumValues";
16
16
  import { itemConfig } from "../../../core/cachedClasses";
17
17
  import {
18
18
  FIRST_GLITCHED_COLLECTIBLE_TYPE,
@@ -1,5 +1,5 @@
1
1
  import { ButtonAction } from "isaac-typescript-definitions";
2
- import { CONTROLLER_INDEX_VALUES } from "../../../../arrays/cachedEnumValues";
2
+ import { CONTROLLER_INDEX_VALUES } from "../../../../cachedEnumValues";
3
3
  import { fonts, game } from "../../../../core/cachedClasses";
4
4
  import { KColorDefault, VectorOne } from "../../../../core/constants";
5
5
  import { UIStreakAnimation } from "../../../../enums/private/UIStreakAnimation";
@@ -60,7 +60,7 @@ import {
60
60
  SoundEffect,
61
61
  StageType,
62
62
  } from "isaac-typescript-definitions";
63
- import { GRID_ENTITY_TYPE_VALUES } from "../../../../arrays/cachedEnumValues";
63
+ import { GRID_ENTITY_TYPE_VALUES } from "../../../../cachedEnumValues";
64
64
  import { game, sfxManager } from "../../../../core/cachedClasses";
65
65
  import {
66
66
  DOGMA_ROOM_GRID_INDEX,
@@ -1,4 +1,5 @@
1
1
  import { addFlag } from "./flag";
2
+ import { parseIntSafe } from "./types";
2
3
  import { assertDefined } from "./utils";
3
4
 
4
5
  /** Helper function to convert a set of flags to a single `BitFlags` object. */
@@ -36,7 +37,7 @@ export function convertDecimalToBinary(
36
37
 
37
38
  const bitsString = num.toString(2);
38
39
  for (const bitString of bitsString) {
39
- const bit = tonumber(bitString);
40
+ const bit = parseIntSafe(bitString);
40
41
  assertDefined(
41
42
  bit,
42
43
  `Failed to convert the following number to binary: ${num}`,
@@ -1,6 +1,6 @@
1
1
  import type { CardType } from "isaac-typescript-definitions";
2
2
  import { ItemConfigCardType, UseFlag } from "isaac-typescript-definitions";
3
- import { POCKET_ITEM_SLOT_VALUES } from "../arrays/cachedEnumValues";
3
+ import { POCKET_ITEM_SLOT_VALUES } from "../cachedEnumValues";
4
4
  import { itemConfig } from "../core/cachedClasses";
5
5
  import { LAST_VANILLA_CARD_TYPE } from "../core/constantsFirstLast";
6
6
  import {
@@ -11,10 +11,7 @@ import {
11
11
  GridRoom,
12
12
  RoomType,
13
13
  } from "isaac-typescript-definitions";
14
- import {
15
- DOOR_SLOT_FLAG_VALUES,
16
- DOOR_SLOT_VALUES,
17
- } from "../arrays/cachedEnumValues";
14
+ import { DOOR_SLOT_FLAG_VALUES, DOOR_SLOT_VALUES } from "../cachedEnumValues";
18
15
  import { game } from "../core/cachedClasses";
19
16
  import { DISTANCE_OF_GRID_TILE } from "../core/constants";
20
17
  import {
@@ -34,24 +34,22 @@ export type TranspiledEnum = Record<
34
34
  export function getEnumEntries<T extends TranspiledEnum>(
35
35
  transpiledEnum: T,
36
36
  ): ReadonlyArray<[key: string, value: T[keyof T]]> {
37
- // The values cannot simply be type `T` due to the special construction of bit flag enums.
38
- const enumEntries: Array<[key: string, value: T[keyof T]]> = [];
39
- for (const [key, value] of pairs(transpiledEnum)) {
40
- // Ignore the reverse mappings created by TypeScriptToLua. Note that reverse mappings are not
41
- // created for string enums.
42
- if (isString(key)) {
43
- enumEntries.push([key, value]);
44
- }
45
- }
37
+ const entries = Object.entries(transpiledEnum);
38
+ const numberEntries = entries.filter(
39
+ ([_key, value]) => typeof value === "number",
40
+ );
41
+
42
+ // If there are no number values, then this must be a string enum, and no filtration is required.
43
+ const entriesToReturn = numberEntries.length > 0 ? numberEntries : entries;
46
44
 
47
45
  // The enums will be in a random order (because of "pairs"), so sort them based on the values.
48
46
  // https://stackoverflow.com/questions/5199901/how-to-sort-an-associative-array-by-its-values-in-javascript
49
- enumEntries.sort(
47
+ entriesToReturn.sort(
50
48
  ([_key1, value1], [_key2, value2]) =>
51
49
  value1 < value2 ? -1 : value1 > value2 ? 1 : 0, // eslint-disable-line no-nested-ternary
52
50
  );
53
51
 
54
- return enumEntries;
52
+ return entriesToReturn as never;
55
53
  }
56
54
 
57
55
  /**
@@ -8,7 +8,7 @@ import {
8
8
  StatueVariant,
9
9
  TrapdoorVariant,
10
10
  } from "isaac-typescript-definitions";
11
- import { GRID_ENTITY_XML_TYPE_VALUES } from "../arrays/cachedEnumValues";
11
+ import { GRID_ENTITY_XML_TYPE_VALUES } from "../cachedEnumValues";
12
12
  import { game } from "../core/cachedClasses";
13
13
  import { DISTANCE_OF_GRID_TILE, VectorOne } from "../core/constants";
14
14
  import { GRID_ENTITY_TYPE_TO_BROKEN_STATE_MAP } from "../maps/gridEntityTypeToBrokenStateMap";
@@ -4,7 +4,7 @@ import {
4
4
  ControllerIndex,
5
5
  Keyboard,
6
6
  } from "isaac-typescript-definitions";
7
- import { CONTROLLER_INDEX_VALUES } from "../arrays/cachedEnumValues";
7
+ import { CONTROLLER_INDEX_VALUES } from "../cachedEnumValues";
8
8
  import { KEYBOARD_TO_STRING_MAP } from "../maps/keyboardToStringMap";
9
9
  import { ReadonlySet } from "../types/ReadonlySet";
10
10
  import { trimPrefix } from "./string";
@@ -3,7 +3,7 @@ import type {
3
3
  TrinketType,
4
4
  } from "isaac-typescript-definitions";
5
5
  import { ItemPoolType } from "isaac-typescript-definitions";
6
- import { ITEM_POOL_TYPE_VALUES } from "../arrays/cachedEnumValues";
6
+ import { ITEM_POOL_TYPE_VALUES } from "../cachedEnumValues";
7
7
  import { game } from "../core/cachedClasses";
8
8
  import { ITEM_POOL_TYPE_TO_ITEM_POOL_NAME } from "../maps/itemPoolTypeToItemPoolName";
9
9
  import { ITEM_POOL_TYPE_TO_COLLECTIBLE_TYPES_SET } from "../objects/itemPoolTypeToCollectibleTypesSet";
@@ -1,6 +1,6 @@
1
1
  import type { BossID } from "isaac-typescript-definitions";
2
2
  import { RoomType, StageID } from "isaac-typescript-definitions";
3
- import { DOOR_SLOT_VALUES } from "../arrays/cachedEnumValues";
3
+ import { DOOR_SLOT_VALUES } from "../cachedEnumValues";
4
4
  import { game } from "../core/cachedClasses";
5
5
  import { filterMap } from "./array";
6
6
  import {
@@ -126,7 +126,8 @@ export function lerpAngleDegrees(
126
126
  * @param numDecimalPlaces Optional. Default is 0.
127
127
  */
128
128
  export function round(num: float, numDecimalPlaces = 0): float {
129
- const roundedNum = tonumber(string.format(`%.${numDecimalPlaces}f`, num));
129
+ const roundedString = string.format(`%.${numDecimalPlaces}f`, num);
130
+ const roundedNum = tonumber(roundedString);
130
131
  return roundedNum ?? 0;
131
132
  }
132
133
 
@@ -4,7 +4,7 @@ import type {
4
4
  PillEffect,
5
5
  } from "isaac-typescript-definitions";
6
6
  import { PillColor } from "isaac-typescript-definitions";
7
- import { PILL_COLOR_VALUES } from "../arrays/cachedEnumValues";
7
+ import { PILL_COLOR_VALUES } from "../cachedEnumValues";
8
8
  import { game, itemConfig } from "../core/cachedClasses";
9
9
  import {
10
10
  FIRST_HORSE_PILL_COLOR,
@@ -3,7 +3,7 @@ import {
3
3
  CollectibleType,
4
4
  PlayerType,
5
5
  } from "isaac-typescript-definitions";
6
- import { ACTIVE_SLOT_VALUES } from "../arrays/cachedEnumValues";
6
+ import { ACTIVE_SLOT_VALUES } from "../cachedEnumValues";
7
7
  import { game, itemConfig } from "../core/cachedClasses";
8
8
  import { ReadonlySet } from "../types/ReadonlySet";
9
9
  import { sumArray } from "./array";
@@ -3,7 +3,7 @@ import {
3
3
  TrinketSlot,
4
4
  TrinketType,
5
5
  } from "isaac-typescript-definitions";
6
- import { TRINKET_SLOT_VALUES } from "../arrays/cachedEnumValues";
6
+ import { TRINKET_SLOT_VALUES } from "../cachedEnumValues";
7
7
  import { itemConfig } from "../core/cachedClasses";
8
8
  import { getAllPlayers, getPlayers } from "./playerIndex";
9
9
  import { isCharacter } from "./players";
@@ -6,7 +6,7 @@ import {
6
6
  PillColor,
7
7
  PlayerType,
8
8
  } from "isaac-typescript-definitions";
9
- import { POCKET_ITEM_SLOT_VALUES } from "../arrays/cachedEnumValues";
9
+ import { POCKET_ITEM_SLOT_VALUES } from "../cachedEnumValues";
10
10
  import { PocketItemType } from "../enums/PocketItemType";
11
11
  import type { PocketItemDescription } from "../interfaces/PocketItemDescription";
12
12
  import { isCharacter } from "./players";
@@ -4,7 +4,7 @@ import type {
4
4
  RoomType,
5
5
  StageID,
6
6
  } from "isaac-typescript-definitions";
7
- import { DOOR_SLOT_FLAG_VALUES } from "../arrays/cachedEnumValues";
7
+ import { DOOR_SLOT_FLAG_VALUES } from "../cachedEnumValues";
8
8
  import { game } from "../core/cachedClasses";
9
9
  import { doorSlotFlagToDoorSlot } from "./doors";
10
10
  import { hasFlag } from "./flag";
@@ -1,5 +1,5 @@
1
1
  import { BossID, RoomShape } from "isaac-typescript-definitions";
2
- import { ROOM_SHAPE_VALUES } from "../arrays/cachedEnumValues";
2
+ import { ROOM_SHAPE_VALUES } from "../cachedEnumValues";
3
3
  import { game } from "../core/cachedClasses";
4
4
  import { CornerType } from "../enums/CornerType";
5
5
  import type { Corner } from "../interfaces/Corner";
@@ -3,7 +3,7 @@ import {
3
3
  PlayerType,
4
4
  SeedEffect,
5
5
  } from "isaac-typescript-definitions";
6
- import { SEED_EFFECTS } from "../arrays/cachedEnumValues";
6
+ import { SEED_EFFECTS } from "../cachedEnumValues";
7
7
  import { game } from "../core/cachedClasses";
8
8
  import { getCharacterName } from "./characters";
9
9
  import { log } from "./log";
@@ -4,7 +4,7 @@ import type {
4
4
  SoundEffect,
5
5
  StageType,
6
6
  } from "isaac-typescript-definitions";
7
- import { SOUND_EFFECT_VALUES } from "../arrays/cachedEnumValues";
7
+ import { SOUND_EFFECT_VALUES } from "../cachedEnumValues";
8
8
  import { game, sfxManager } from "../core/cachedClasses";
9
9
  import { STAGE_TO_MUSIC } from "../objects/stageToMusic";
10
10
  import type { TranspiledEnum } from "./enums";
@@ -1,6 +1,6 @@
1
1
  import type { CollectibleType } from "isaac-typescript-definitions";
2
2
  import { ItemConfigTag, PlayerForm } from "isaac-typescript-definitions";
3
- import { PLAYER_FORM_VALUES } from "../arrays/cachedEnumValues";
3
+ import { PLAYER_FORM_VALUES } from "../cachedEnumValues";
4
4
  import { TRANSFORMATION_NAMES } from "../objects/transformationNames";
5
5
  import { ReadonlyMap } from "../types/ReadonlyMap";
6
6
  import { ReadonlySet } from "../types/ReadonlySet";
@@ -240,6 +240,6 @@ export function parseIntSafe(string: string): int | undefined {
240
240
  return undefined;
241
241
  }
242
242
 
243
- const flooredNumber = math.floor(number);
243
+ const flooredNumber = Math.floor(number);
244
244
  return number === flooredNumber ? flooredNumber : undefined;
245
245
  }
@@ -2,7 +2,7 @@ import type {
2
2
  CollectibleType,
3
3
  ItemPoolType,
4
4
  } from "isaac-typescript-definitions";
5
- import { ITEM_POOL_TYPE_VALUES } from "../arrays/cachedEnumValues";
5
+ import { ITEM_POOL_TYPE_VALUES } from "../cachedEnumValues";
6
6
  import * as itemPoolsJSON from "../data/itempools.json";
7
7
  import { asCollectibleType, parseIntSafe } from "../functions/types";
8
8
  import { ITEM_POOL_TYPE_TO_ITEM_POOL_NAME } from "../maps/itemPoolTypeToItemPoolName";
@@ -1,4 +1,4 @@
1
- import { SERIALIZATION_BRAND_VALUES } from "./arrays/cachedEnumValues";
1
+ import { SERIALIZATION_BRAND_VALUES } from "./cachedEnumValues";
2
2
  import { isString } from "./functions/types";
3
3
  import { ReadonlySet } from "./types/ReadonlySet";
4
4
 
@@ -1,5 +1,5 @@
1
1
  import { BossID, LevelStage, StageID } from "isaac-typescript-definitions";
2
- import { BOSS_ID_VALUES } from "../arrays/cachedEnumValues";
2
+ import { BOSS_ID_VALUES } from "../cachedEnumValues";
3
3
  import { isStoryBossID } from "../functions/storyBosses";
4
4
  import { ReadonlyMap } from "../types/ReadonlyMap";
5
5
  import { ReadonlySet } from "../types/ReadonlySet";
@@ -1 +0,0 @@
1
- {"version":3,"file":"cachedEnumValues.d.ts","sourceRoot":"","sources":["../../src/arrays/cachedEnumValues.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,UAAU,EACV,MAAM,EAEN,eAAe,EACf,QAAQ,EAER,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAElB,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,UAAU,EACV,cAAc,EACd,SAAS,EACT,UAAU,EACV,WAAW,EACX,WAAW,EACZ,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAGzE,eAAO,MAAM,kBAAkB,uBAA4B,CAAC;AAE5D,eAAO,MAAM,cAAc,mBAAwB,CAAC;AAEpD,eAAO,MAAM,iBAAiB;;;;IAA2B,CAAC;AAE1D,eAAO,MAAM,uBAAuB,4BAAiC,CAAC;AAEtE,eAAO,MAAM,qBAAqB;;;;IAA8B,CAAC;AAEjE,eAAO,MAAM,gBAAgB,qBAA0B,CAAC;AAExD,eAAO,MAAM,uBAAuB,2BAAgC,CAAC;AAErE,eAAO,MAAM,2BAA2B,8BAAmC,CAAC;AAE5E,eAAO,MAAM,0BAA0B,8BAAmC,CAAC;AAE3E,eAAO,MAAM,sBAAsB;;;;IAA+B,CAAC;AAEnE,eAAO,MAAM,4BAA4B,+BAAoC,CAAC;AAE9E,eAAO,MAAM,qBAAqB,yBAA8B,CAAC;AAEjE,eAAO,MAAM,eAAe,qBAA0B,CAAC;AAEvD,eAAO,MAAM,kBAAkB,uBAA4B,CAAC;AAE5D,eAAO,MAAM,iBAAiB,sBAA2B,CAAC;AAE1D,eAAO,MAAM,kBAAkB,uBAA4B,CAAC;AAE5D,eAAO,MAAM,uBAAuB,2BAAgC,CAAC;AAErE,eAAO,MAAM,iBAAiB,sBAA2B,CAAC;AAE1D,eAAO,MAAM,YAAY,uBAA4B,CAAC;AAEtD,eAAO,MAAM,0BAA0B,+BAAoC,CAAC;AAE5E,eAAO,MAAM,mBAAmB,wBAA6B,CAAC;AAE9D,eAAO,MAAM,kBAAkB,uBAA4B,CAAC;AAE5D,eAAO,MAAM,mBAAmB,wBAA6B,CAAC"}