isaacscript-common 4.3.3 → 4.5.1

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 (58) hide show
  1. package/constants.d.ts +1 -1
  2. package/features/characterHealthConversion.lua +4 -1
  3. package/features/characterStats.lua +1 -1
  4. package/features/collectibleItemPoolType.lua +2 -2
  5. package/features/customTrapdoor/constants.d.ts +1 -1
  6. package/features/customTrapdoor/constants.lua +1 -1
  7. package/features/customTrapdoor/exports.lua +4 -0
  8. package/features/customTrapdoor/init.lua +2 -2
  9. package/features/debugDisplay/debugDisplay.d.ts +4 -0
  10. package/features/debugDisplay/debugDisplay.lua +2 -0
  11. package/features/deployJSONRoom.lua +2 -2
  12. package/features/{disableSound.d.ts → disableAllSound.d.ts} +3 -0
  13. package/features/{disableSound.lua → disableAllSound.lua} +3 -3
  14. package/features/disableInputs.lua +2 -2
  15. package/features/extraConsoleCommands/exports.d.ts +26 -0
  16. package/features/extraConsoleCommands/exports.lua +54 -0
  17. package/features/extraConsoleCommands/init.d.ts +1 -25
  18. package/features/extraConsoleCommands/init.lua +166 -195
  19. package/features/extraConsoleCommands/v.d.ts +8 -0
  20. package/features/extraConsoleCommands/v.lua +11 -0
  21. package/features/fadeInRemover.lua +2 -2
  22. package/features/fastReset.lua +1 -1
  23. package/features/forgottenSwitch.lua +2 -2
  24. package/features/persistentEntities.lua +6 -1
  25. package/features/playerInventory.lua +2 -2
  26. package/features/ponyDetection.lua +2 -2
  27. package/features/preventCollectibleRotation.lua +2 -2
  28. package/features/registerHotkey.d.ts +3 -0
  29. package/features/registerHotkey.lua +50 -0
  30. package/features/roomClearFrame.lua +2 -2
  31. package/features/runInNFrames.lua +2 -2
  32. package/features/saveDataManager/exports.lua +1 -0
  33. package/features/sirenHelpers.lua +2 -2
  34. package/features/stageHistory.lua +2 -2
  35. package/features/taintedLazarusPlayers.lua +2 -2
  36. package/featuresInitialized.lua +1 -1
  37. package/functions/minimap.d.ts +32 -0
  38. package/functions/minimap.lua +65 -0
  39. package/functions/nextStage.d.ts +1 -1
  40. package/functions/nextStage.lua +1 -1
  41. package/functions/rooms.d.ts +13 -3
  42. package/functions/rooms.lua +22 -5
  43. package/functions/run.d.ts +5 -2
  44. package/functions/run.lua +5 -2
  45. package/functions/saveFile.lua +3 -0
  46. package/functions/stage.d.ts +10 -0
  47. package/functions/stage.lua +20 -0
  48. package/functions/utils.d.ts +5 -0
  49. package/functions/utils.lua +7 -0
  50. package/index.d.ts +5 -3
  51. package/index.lua +30 -16
  52. package/initFeatures.lua +3 -3
  53. package/lualib_bundle.lua +6 -3
  54. package/objects/stageTypeSuffixes.d.ts +4 -0
  55. package/objects/stageTypeSuffixes.lua +12 -0
  56. package/package.json +1 -1
  57. package/sets/consoleCommandsSet.d.ts +5 -0
  58. package/sets/consoleCommandsSet.lua +61 -0
@@ -147,6 +147,7 @@ end
147
147
  -- This can make debugging easier, as you can access the variables from the game's debug console.
148
148
  -- e.g. `l print(g.feature1.foo)`
149
149
  function ____exports.saveDataManagerSetGlobal(self)
150
+ errorIfFeaturesNotInitialized(nil, SAVE_DATA_MANAGER_FEATURE_NAME)
150
151
  g = saveDataMap
151
152
  gd = saveDataDefaultsMap
152
153
  end
@@ -48,12 +48,12 @@ function getSirenHelper(self, familiar)
48
48
  function(____, sirenHelper) return sirenHelper.Target ~= nil and GetPtrHash(sirenHelper.Target) == familiarPtrHash end
49
49
  )
50
50
  end
51
- local FEATURE_NAME = "siren helpers"
51
+ local FEATURE_NAME = "sirenHelpers"
52
52
  v = {run = {familiarBlacklist = {}}}
53
53
  ---
54
54
  -- @internal
55
55
  function ____exports.sirenHelpersInit(self, mod)
56
- saveDataManager(nil, "sirenHelpers", v)
56
+ saveDataManager(nil, FEATURE_NAME, v)
57
57
  mod:AddCallback(ModCallback.POST_NPC_INIT, postNPCInitSirenHelper, EntityType.SIREN_HELPER)
58
58
  end
59
59
  --- Blacklists a familiar from being stolen by The Siren boss. This should be called once at the
@@ -17,12 +17,12 @@ function postNewLevelReordered(self)
17
17
  local ____v_run_stageHistory_0 = v.run.stageHistory
18
18
  ____v_run_stageHistory_0[#____v_run_stageHistory_0 + 1] = {stage, stageType}
19
19
  end
20
- local FEATURE_NAME = "stage history"
20
+ local FEATURE_NAME = "stageHistory"
21
21
  v = {run = {stageHistory = {}}}
22
22
  ---
23
23
  -- @internal
24
24
  function ____exports.stageHistoryInit(self, mod)
25
- saveDataManager(nil, "stageHistory", v)
25
+ saveDataManager(nil, FEATURE_NAME, v)
26
26
  mod:AddCallbackCustom(ModCallbackCustom.POST_NEW_LEVEL_REORDERED, postNewLevelReordered)
27
27
  end
28
28
  --- Helper function to get all of the stages that a player has visited thus far on this run.
@@ -43,7 +43,7 @@ function checkDequeue(self)
43
43
  v.run.subPlayerMap:set(taintedLazarusPtrHash, deadTaintedLazarusPtr)
44
44
  v.run.subPlayerMap:set(deadTaintedLazarusPtrHash, taintedLazarusPtr)
45
45
  end
46
- local FEATURE_NAME = "Tainted Lazarus entity finder"
46
+ local FEATURE_NAME = "taintedLazarusPlayers"
47
47
  v = {run = {
48
48
  queuedTaintedLazarus = {},
49
49
  queuedDeadTaintedLazarus = {},
@@ -54,7 +54,7 @@ v = {run = {
54
54
  function ____exports.taintedLazarusPlayersInit(self, mod)
55
55
  saveDataManager(
56
56
  nil,
57
- "taintedLazarusPlayers",
57
+ FEATURE_NAME,
58
58
  v,
59
59
  function() return false end
60
60
  )
@@ -9,7 +9,7 @@ end
9
9
  -- @internal
10
10
  function ____exports.errorIfFeaturesNotInitialized(self, featureName)
11
11
  if not ____exports.areFeaturesInitialized(nil) then
12
- error(("The " .. featureName) .. " is not initialized. You must first upgrade your mod object by calling the \"upgradeMod\" function.")
12
+ error(("The \"" .. featureName) .. "\" feature is not initialized. You must first upgrade your mod object by calling the \"upgradeMod\" function.")
13
13
  end
14
14
  end
15
15
  ---
@@ -0,0 +1,32 @@
1
+ import { DisplayFlag } from "isaac-typescript-definitions";
2
+ /**
3
+ * Helper function to get the minimap `DisplayFlag` value for every room on the floor. Returns a map
4
+ * that is indexed by the room's safe grid index.
5
+ */
6
+ export declare function getFloorDisplayFlags(): Map<int, BitFlags<DisplayFlag>>;
7
+ /**
8
+ * Helper function to get a particular room's minimap display flags (e.g. whether or not it is
9
+ * visible and so on).
10
+ *
11
+ * @param roomGridIndex Optional. Default is the current room index.
12
+ */
13
+ export declare function getRoomDisplayFlags(roomGridIndex?: int): BitFlags<DisplayFlag>;
14
+ /**
15
+ * Helper function to set the minimap `DisplayFlag` value for multiple rooms at once.
16
+ *
17
+ * This function automatically calls the `Level.UpdateVisibility` after setting the flags so that
18
+ * the changes will be immediately visible.
19
+ *
20
+ * @param displayFlagsMap A map of the display flags that is indexed by the room's safe grid index.
21
+ */
22
+ export declare function setDisplayFlags(displayFlagsMap: Map<int, BitFlags<DisplayFlag>>): void;
23
+ /** Alias for the `setDisplayFlags` function. */
24
+ export declare function setFloorDisplayFlags(displayFlagsMap: Map<int, BitFlags<DisplayFlag>>): void;
25
+ /**
26
+ * Helper function to set a particular room's minimap display flags (e.g. whether or not it is
27
+ * visible and so on).
28
+ *
29
+ * @param roomGridIndex Set to undefined to use the current room index.
30
+ * @param displayFlags The bit flags value to set. (See the `DisplayFlag` enum.)
31
+ */
32
+ export declare function setRoomDisplayFlags(roomGridIndex: int | undefined, displayFlags: BitFlags<DisplayFlag>): void;
@@ -0,0 +1,65 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local Map = ____lualib.Map
3
+ local __TS__New = ____lualib.__TS__New
4
+ local __TS__Iterator = ____lualib.__TS__Iterator
5
+ local ____exports = {}
6
+ local ____cachedClasses = require("cachedClasses")
7
+ local game = ____cachedClasses.game
8
+ local ____roomData = require("functions.roomData")
9
+ local getRoomDescriptor = ____roomData.getRoomDescriptor
10
+ local ____rooms = require("functions.rooms")
11
+ local getRoomsInGrid = ____rooms.getRoomsInGrid
12
+ --- Helper function to set a particular room's minimap display flags (e.g. whether or not it is
13
+ -- visible and so on).
14
+ --
15
+ -- @param roomGridIndex Set to undefined to use the current room index.
16
+ -- @param displayFlags The bit flags value to set. (See the `DisplayFlag` enum.)
17
+ function ____exports.setRoomDisplayFlags(self, roomGridIndex, displayFlags)
18
+ local roomDescriptor = getRoomDescriptor(nil, roomGridIndex)
19
+ roomDescriptor.DisplayFlags = displayFlags
20
+ end
21
+ --- Helper function to get the minimap `DisplayFlag` value for every room on the floor. Returns a map
22
+ -- that is indexed by the room's safe grid index.
23
+ function ____exports.getFloorDisplayFlags(self)
24
+ local displayFlagsMap = __TS__New(Map)
25
+ local roomsInGrid = getRoomsInGrid(nil)
26
+ for ____, roomDescriptor in ipairs(roomsInGrid) do
27
+ displayFlagsMap:set(roomDescriptor.SafeGridIndex, roomDescriptor.DisplayFlags)
28
+ end
29
+ return displayFlagsMap
30
+ end
31
+ --- Helper function to get a particular room's minimap display flags (e.g. whether or not it is
32
+ -- visible and so on).
33
+ --
34
+ -- @param roomGridIndex Optional. Default is the current room index.
35
+ function ____exports.getRoomDisplayFlags(self, roomGridIndex)
36
+ local roomDescriptor = getRoomDescriptor(nil, roomGridIndex)
37
+ return roomDescriptor.DisplayFlags
38
+ end
39
+ --- Helper function to set the minimap `DisplayFlag` value for multiple rooms at once.
40
+ --
41
+ -- This function automatically calls the `Level.UpdateVisibility` after setting the flags so that
42
+ -- the changes will be immediately visible.
43
+ --
44
+ -- @param displayFlagsMap A map of the display flags that is indexed by the room's safe grid index.
45
+ function ____exports.setDisplayFlags(self, displayFlagsMap)
46
+ local level = game:GetLevel()
47
+ for ____, ____value in __TS__Iterator(displayFlagsMap:entries()) do
48
+ local roomGridIndex = ____value[1]
49
+ local displayFlags = ____value[2]
50
+ if MinimapAPI == nil then
51
+ ____exports.setRoomDisplayFlags(nil, roomGridIndex, displayFlags)
52
+ else
53
+ local roomDescriptor = MinimapAPI:GetRoomByIdx(roomGridIndex)
54
+ if roomDescriptor ~= nil then
55
+ roomDescriptor.DisplayFlags = displayFlags
56
+ end
57
+ end
58
+ end
59
+ level:UpdateVisibility()
60
+ end
61
+ --- Alias for the `setDisplayFlags` function.
62
+ function ____exports.setFloorDisplayFlags(self, displayFlagsMap)
63
+ ____exports.setDisplayFlags(nil, displayFlagsMap)
64
+ end
65
+ return ____exports
@@ -13,6 +13,6 @@ export declare function getNextStage(): LevelStage;
13
13
  * based on the current stage, room, and game state flags.
14
14
  *
15
15
  * @param upwards Whether or not the player should go up to Cathedral in the case of being on Womb
16
- * 2. Defaults to false.
16
+ * 2. Default is false.
17
17
  */
18
18
  export declare function getNextStageType(upwards?: boolean): StageType;
@@ -200,7 +200,7 @@ end
200
200
  -- based on the current stage, room, and game state flags.
201
201
  --
202
202
  -- @param upwards Whether or not the player should go up to Cathedral in the case of being on Womb
203
- -- 2. Defaults to false.
203
+ -- 2. Default is false.
204
204
  function ____exports.getNextStageType(self, upwards)
205
205
  if upwards == nil then
206
206
  upwards = false
@@ -49,15 +49,25 @@ export declare function getRoomShapeNeighborGridIndexDeltas(roomShape: RoomShape
49
49
  */
50
50
  export declare function getRoomTypeName(roomType: RoomType): string;
51
51
  /**
52
- * Helper function to get the room descriptor for every room on the level. Uses the `Level.GetRooms`
53
- * method to accomplish this. Rooms without data are assumed to be non-existent and are not added to
54
- * the list.
52
+ * Helper function to get the room descriptor for every room on the level, including off-grid rooms.
53
+ * Uses the `Level.GetRooms` method to accomplish this. Rooms without data are assumed to be
54
+ * non-existent and are not added to the list.
55
55
  *
56
56
  * @param includeExtraDimensionalRooms Optional. On some floors (e.g. Downpour 2, Mines 2),
57
57
  * extra-dimensional rooms are automatically be generated and can be
58
58
  * seen when you iterate over the `RoomList`. Default is false.
59
59
  */
60
60
  export declare function getRooms(includeExtraDimensionalRooms?: boolean): RoomDescriptor[];
61
+ /**
62
+ * Helper function to get the room descriptor for every room on the level except for rooms that are
63
+ * not on the grid. Uses the `Level.GetRooms` method to accomplish this. Rooms without data are
64
+ * assumed to be non-existent and are not added to the list.
65
+ *
66
+ * @param includeExtraDimensionalRooms Optional. On some floors (e.g. Downpour 2, Mines 2),
67
+ * extra-dimensional rooms are automatically be generated and can be
68
+ * seen when you iterate over the `RoomList`. Default is false.
69
+ */
70
+ export declare function getRoomsInGrid(includeExtraDimensionalRooms?: boolean): RoomDescriptor[];
61
71
  /**
62
72
  * Helper function to get the room descriptor for every room on the level in a specific dimension.
63
73
  * Uses the `Level.GetRooms` method to accomplish this. Rooms without data are assumed to be
@@ -67,9 +67,9 @@ local irange = ____utils.irange
67
67
  function ____exports.getRoomShapeNeighborGridIndexDeltas(self, roomShape)
68
68
  return {__TS__Spread(ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA[roomShape]:values())}
69
69
  end
70
- --- Helper function to get the room descriptor for every room on the level. Uses the `Level.GetRooms`
71
- -- method to accomplish this. Rooms without data are assumed to be non-existent and are not added to
72
- -- the list.
70
+ --- Helper function to get the room descriptor for every room on the level, including off-grid rooms.
71
+ -- Uses the `Level.GetRooms` method to accomplish this. Rooms without data are assumed to be
72
+ -- non-existent and are not added to the list.
73
73
  --
74
74
  -- @param includeExtraDimensionalRooms Optional. On some floors (e.g. Downpour 2, Mines 2),
75
75
  -- extra-dimensional rooms are automatically be generated and can be
@@ -209,6 +209,23 @@ end
209
209
  function ____exports.getRoomTypeName(self, roomType)
210
210
  return ROOM_TYPE_NAMES[roomType]
211
211
  end
212
+ --- Helper function to get the room descriptor for every room on the level except for rooms that are
213
+ -- not on the grid. Uses the `Level.GetRooms` method to accomplish this. Rooms without data are
214
+ -- assumed to be non-existent and are not added to the list.
215
+ --
216
+ -- @param includeExtraDimensionalRooms Optional. On some floors (e.g. Downpour 2, Mines 2),
217
+ -- extra-dimensional rooms are automatically be generated and can be
218
+ -- seen when you iterate over the `RoomList`. Default is false.
219
+ function ____exports.getRoomsInGrid(self, includeExtraDimensionalRooms)
220
+ if includeExtraDimensionalRooms == nil then
221
+ includeExtraDimensionalRooms = false
222
+ end
223
+ local rooms = ____exports.getRooms(nil, includeExtraDimensionalRooms)
224
+ return __TS__ArrayFilter(
225
+ rooms,
226
+ function(____, roomDescriptor) return roomDescriptor.SafeGridIndex >= 0 end
227
+ )
228
+ end
212
229
  --- Helper function to get the room descriptor for every room on the level in a specific dimension.
213
230
  -- Uses the `Level.GetRooms` method to accomplish this. Rooms without data are assumed to be
214
231
  -- non-existent and are not added to the list.
@@ -430,12 +447,12 @@ function ____exports.setRoomCleared(self)
430
447
  for ____, door in ipairs(getDoors(nil)) do
431
448
  do
432
449
  if isHiddenSecretRoomDoor(nil, door) then
433
- goto __continue67
450
+ goto __continue69
434
451
  end
435
452
  openDoorFast(nil, door)
436
453
  door.ExtraVisible = false
437
454
  end
438
- ::__continue67::
455
+ ::__continue69::
439
456
  end
440
457
  sfxManager:Stop(SoundEffect.DOOR_HEAVY_OPEN)
441
458
  game:ShakeScreen(0)
@@ -6,7 +6,10 @@ import { PlayerType } from "isaac-typescript-definitions";
6
6
  */
7
7
  export declare function onSetSeed(): boolean;
8
8
  /**
9
- * Helper function to restart the game using the console command of "restart". You can optionally
10
- * specify a `PlayerType` to restart the game as that character.
9
+ * Helper function to restart the run using the console command of "restart". If the player is
10
+ * playing a seeded run, then it will restart the game to the beginning of the seed. Otherwise, it
11
+ * will put the player on a run with an entirely new seed.
12
+ *
13
+ * You can optionally specify a `PlayerType` to restart the game as that character.
11
14
  */
12
15
  export declare function restart(character?: PlayerType): void;
package/functions/run.lua CHANGED
@@ -16,8 +16,11 @@ function ____exports.onSetSeed(self)
16
16
  local challenge = Isaac.GetChallenge()
17
17
  return challenge == Challenge.NULL and customRun
18
18
  end
19
- --- Helper function to restart the game using the console command of "restart". You can optionally
20
- -- specify a `PlayerType` to restart the game as that character.
19
+ --- Helper function to restart the run using the console command of "restart". If the player is
20
+ -- playing a seeded run, then it will restart the game to the beginning of the seed. Otherwise, it
21
+ -- will put the player on a run with an entirely new seed.
22
+ --
23
+ -- You can optionally specify a `PlayerType` to restart the game as that character.
21
24
  function ____exports.restart(self, character)
22
25
  if character == nil then
23
26
  log("Restarting.")
@@ -100,6 +100,9 @@ function ____exports.isCollectibleUnlocked(self, collectibleTypeToCheckFor, item
100
100
  end
101
101
  end
102
102
  end
103
+ for ____, player in ipairs(taintedLosts) do
104
+ player:ChangePlayerType(PlayerType.THE_LOST_B)
105
+ end
103
106
  return collectibleUnlocked
104
107
  end
105
108
  return ____exports
@@ -36,6 +36,16 @@ export declare function onDarkRoom(): boolean;
36
36
  export declare function onFinalFloor(): boolean;
37
37
  export declare function onRepentanceStage(): boolean;
38
38
  export declare function onSheol(): boolean;
39
+ /**
40
+ * Helper function to warp to a new stage/level.
41
+ *
42
+ * @param stage The stage number to warp to.
43
+ * @param stageType The stage type to warp to.
44
+ * @param reseed Optional. Whether or not to reseed the floor upon arrival. Default is false. Set
45
+ * this to true if you are warping to the same stage but a different stage type (or
46
+ * else the floor layout will be identical to the old floor).
47
+ */
48
+ export declare function setStage(stage: LevelStage, stageType: StageType, reseed?: boolean): void;
39
49
  /**
40
50
  * Helper function to convert a numerical `StageType` into the letter suffix supplied to the "stage"
41
51
  * console command. For example, `StageType.REPENTANCE` is the stage type for Downpour, and the
@@ -4,6 +4,8 @@ local LevelStage = ____isaac_2Dtypescript_2Ddefinitions.LevelStage
4
4
  local StageType = ____isaac_2Dtypescript_2Ddefinitions.StageType
5
5
  local ____cachedClasses = require("cachedClasses")
6
6
  local game = ____cachedClasses.game
7
+ local ____stageTypeSuffixes = require("objects.stageTypeSuffixes")
8
+ local STAGE_TYPE_SUFFIXES = ____stageTypeSuffixes.STAGE_TYPE_SUFFIXES
7
9
  local ____stageTypeToLetter = require("objects.stageTypeToLetter")
8
10
  local STAGE_TYPE_TO_LETTER = ____stageTypeToLetter.STAGE_TYPE_TO_LETTER
9
11
  function ____exports.isRepentanceStage(self, stageType)
@@ -111,4 +113,22 @@ function ____exports.onSheol(self)
111
113
  local stageType = level:GetStageType()
112
114
  return stage == LevelStage.SHEOL_CATHEDRAL and stageType == StageType.ORIGINAL
113
115
  end
116
+ --- Helper function to warp to a new stage/level.
117
+ --
118
+ -- @param stage The stage number to warp to.
119
+ -- @param stageType The stage type to warp to.
120
+ -- @param reseed Optional. Whether or not to reseed the floor upon arrival. Default is false. Set
121
+ -- this to true if you are warping to the same stage but a different stage type (or
122
+ -- else the floor layout will be identical to the old floor).
123
+ function ____exports.setStage(self, stage, stageType, reseed)
124
+ if reseed == nil then
125
+ reseed = false
126
+ end
127
+ local stageTypeSuffix = STAGE_TYPE_SUFFIXES[stageType]
128
+ local command = ("stage " .. tostring(stage)) .. stageTypeSuffix
129
+ Isaac.ExecuteCommand(command)
130
+ if reseed then
131
+ Isaac.ExecuteCommand("reseed")
132
+ end
133
+ end
114
134
  return ____exports
@@ -34,6 +34,11 @@ export declare function irange(start: int, end?: int): int[];
34
34
  * be a non-zero value in reflections.
35
35
  */
36
36
  export declare function isReflectionRender(): boolean;
37
+ /**
38
+ * Helper function to see if a particular command is a vanilla console command. This is useful
39
+ * because the `EXECUTE_CMD` callback will not fire for any vanilla commands.
40
+ */
41
+ export declare function isVanillaConsoleCommand(commandName: string): boolean;
37
42
  /**
38
43
  * Helper function to print something to the in-game console. Use this instead of invoking the
39
44
  * `Isaac.ConsoleOutput` method directly because it will automatically insert a newline at the end
@@ -6,6 +6,8 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitio
6
6
  local RenderMode = ____isaac_2Dtypescript_2Ddefinitions.RenderMode
7
7
  local ____cachedClasses = require("cachedClasses")
8
8
  local game = ____cachedClasses.game
9
+ local ____consoleCommandsSet = require("sets.consoleCommandsSet")
10
+ local CONSOLE_COMMANDS_SET = ____consoleCommandsSet.CONSOLE_COMMANDS_SET
9
11
  local HEX_STRING_LENGTH = 6
10
12
  --- Helper function to return an array with the elements from start to end. It is inclusive at the
11
13
  -- start and exclusive at the end. (The "e" stands for exclusive.)
@@ -91,6 +93,11 @@ function ____exports.isReflectionRender(self)
91
93
  local renderMode = room:GetRenderMode()
92
94
  return renderMode == RenderMode.WATER_REFLECT
93
95
  end
96
+ --- Helper function to see if a particular command is a vanilla console command. This is useful
97
+ -- because the `EXECUTE_CMD` callback will not fire for any vanilla commands.
98
+ function ____exports.isVanillaConsoleCommand(self, commandName)
99
+ return CONSOLE_COMMANDS_SET:has(commandName)
100
+ end
94
101
  --- Helper function to print something to the in-game console. Use this instead of invoking the
95
102
  -- `Isaac.ConsoleOutput` method directly because it will automatically insert a newline at the end
96
103
  -- of the message (which `Isaac.ConsoleOutput` does not do by default).
package/index.d.ts CHANGED
@@ -15,16 +15,17 @@ export { getCollectibleItemPoolType } from "./features/collectibleItemPoolType";
15
15
  export * from "./features/customTrapdoor/exports";
16
16
  export * from "./features/debugDisplay/exports";
17
17
  export { deployJSONRoom, deployRandomJSONRoom, emptyRoom, } from "./features/deployJSONRoom";
18
+ export { disableAllSound, enableAllSound } from "./features/disableAllSound";
18
19
  export { disableAllInputs, disableAllInputsExceptFor, disableMovementInputs, disableShootingInputs, enableAllInputs, enableAllInputsExceptFor, } from "./features/disableInputs";
19
- export { disableAllSound, enableAllSound } from "./features/disableSound";
20
- export { addConsoleCommand, enableExtraConsoleCommands, removeConsoleCommand, } from "./features/extraConsoleCommands/init";
20
+ export * from "./features/extraConsoleCommands/exports";
21
21
  export { removeFadeIn, restoreFadeIn } from "./features/fadeInRemover";
22
22
  export { disableFastReset, enableFastReset } from "./features/fastReset";
23
23
  export { forgottenSwitch } from "./features/forgottenSwitch";
24
24
  export { removePersistentEntity, spawnPersistentEntity, } from "./features/persistentEntities";
25
25
  export { getPlayerInventory } from "./features/playerInventory";
26
- export { anyPlayerUsingPony, isPlayerUsingPony as isPonyActive, } from "./features/ponyDetection";
26
+ export { anyPlayerUsingPony, isPlayerUsingPony, } from "./features/ponyDetection";
27
27
  export { preventCollectibleRotation } from "./features/preventCollectibleRotation";
28
+ export { registerHotkey, unregisterHotkey } from "./features/registerHotkey";
28
29
  export { getRoomClearGameFrame, getRoomClearRoomFrame, } from "./features/roomClearFrame";
29
30
  export { runInNGameFrames, runInNRenderFrames, runNextGameFrame, runNextRenderFrame, } from "./features/runInNFrames";
30
31
  export * from "./features/saveDataManager/exports";
@@ -77,6 +78,7 @@ export * from "./functions/log";
77
78
  export * from "./functions/map";
78
79
  export * from "./functions/math";
79
80
  export * from "./functions/mergeTests";
81
+ export * from "./functions/minimap";
80
82
  export * from "./functions/nextStage";
81
83
  export * from "./functions/npc";
82
84
  export * from "./functions/pickups";
package/index.lua CHANGED
@@ -125,6 +125,13 @@ do
125
125
  ____exports.deployRandomJSONRoom = deployRandomJSONRoom
126
126
  ____exports.emptyRoom = emptyRoom
127
127
  end
128
+ do
129
+ local ____disableAllSound = require("features.disableAllSound")
130
+ local disableAllSound = ____disableAllSound.disableAllSound
131
+ local enableAllSound = ____disableAllSound.enableAllSound
132
+ ____exports.disableAllSound = disableAllSound
133
+ ____exports.enableAllSound = enableAllSound
134
+ end
128
135
  do
129
136
  local ____disableInputs = require("features.disableInputs")
130
137
  local disableAllInputs = ____disableInputs.disableAllInputs
@@ -141,20 +148,12 @@ do
141
148
  ____exports.enableAllInputsExceptFor = enableAllInputsExceptFor
142
149
  end
143
150
  do
144
- local ____disableSound = require("features.disableSound")
145
- local disableAllSound = ____disableSound.disableAllSound
146
- local enableAllSound = ____disableSound.enableAllSound
147
- ____exports.disableAllSound = disableAllSound
148
- ____exports.enableAllSound = enableAllSound
149
- end
150
- do
151
- local ____init = require("features.extraConsoleCommands.init")
152
- local addConsoleCommand = ____init.addConsoleCommand
153
- local enableExtraConsoleCommands = ____init.enableExtraConsoleCommands
154
- local removeConsoleCommand = ____init.removeConsoleCommand
155
- ____exports.addConsoleCommand = addConsoleCommand
156
- ____exports.enableExtraConsoleCommands = enableExtraConsoleCommands
157
- ____exports.removeConsoleCommand = removeConsoleCommand
151
+ local ____export = require("features.extraConsoleCommands.exports")
152
+ for ____exportKey, ____exportValue in pairs(____export) do
153
+ if ____exportKey ~= "default" then
154
+ ____exports[____exportKey] = ____exportValue
155
+ end
156
+ end
158
157
  end
159
158
  do
160
159
  local ____fadeInRemover = require("features.fadeInRemover")
@@ -190,15 +189,22 @@ end
190
189
  do
191
190
  local ____ponyDetection = require("features.ponyDetection")
192
191
  local anyPlayerUsingPony = ____ponyDetection.anyPlayerUsingPony
193
- local isPonyActive = ____ponyDetection.isPlayerUsingPony
192
+ local isPlayerUsingPony = ____ponyDetection.isPlayerUsingPony
194
193
  ____exports.anyPlayerUsingPony = anyPlayerUsingPony
195
- ____exports.isPonyActive = isPonyActive
194
+ ____exports.isPlayerUsingPony = isPlayerUsingPony
196
195
  end
197
196
  do
198
197
  local ____preventCollectibleRotation = require("features.preventCollectibleRotation")
199
198
  local preventCollectibleRotation = ____preventCollectibleRotation.preventCollectibleRotation
200
199
  ____exports.preventCollectibleRotation = preventCollectibleRotation
201
200
  end
201
+ do
202
+ local ____registerHotkey = require("features.registerHotkey")
203
+ local registerHotkey = ____registerHotkey.registerHotkey
204
+ local unregisterHotkey = ____registerHotkey.unregisterHotkey
205
+ ____exports.registerHotkey = registerHotkey
206
+ ____exports.unregisterHotkey = unregisterHotkey
207
+ end
202
208
  do
203
209
  local ____roomClearFrame = require("features.roomClearFrame")
204
210
  local getRoomClearGameFrame = ____roomClearFrame.getRoomClearGameFrame
@@ -612,6 +618,14 @@ do
612
618
  end
613
619
  end
614
620
  end
621
+ do
622
+ local ____export = require("functions.minimap")
623
+ for ____exportKey, ____exportValue in pairs(____export) do
624
+ if ____exportKey ~= "default" then
625
+ ____exports[____exportKey] = ____exportValue
626
+ end
627
+ end
628
+ end
615
629
  do
616
630
  local ____export = require("functions.nextStage")
617
631
  for ____exportKey, ____exportValue in pairs(____export) do
package/initFeatures.lua CHANGED
@@ -9,10 +9,10 @@ local ____init = require("features.customTrapdoor.init")
9
9
  local stageTravelInit = ____init.stageTravelInit
10
10
  local ____deployJSONRoom = require("features.deployJSONRoom")
11
11
  local deployJSONRoomInit = ____deployJSONRoom.deployJSONRoomInit
12
+ local ____disableAllSound = require("features.disableAllSound")
13
+ local disableAllSoundInit = ____disableAllSound.disableAllSoundInit
12
14
  local ____disableInputs = require("features.disableInputs")
13
15
  local disableInputsInit = ____disableInputs.disableInputsInit
14
- local ____disableSound = require("features.disableSound")
15
- local disableSoundsInit = ____disableSound.disableSoundsInit
16
16
  local ____fadeInRemover = require("features.fadeInRemover")
17
17
  local fadeInRemoverInit = ____fadeInRemover.fadeInRemoverInit
18
18
  local ____fastReset = require("features.fastReset")
@@ -44,8 +44,8 @@ function ____exports.initFeaturesMajor(self, mod)
44
44
  characterHealthConversionInit(nil, mod)
45
45
  end
46
46
  function ____exports.initFeaturesMinor(self, mod)
47
+ disableAllSoundInit(nil, mod)
47
48
  disableInputsInit(nil, mod)
48
- disableSoundsInit(nil, mod)
49
49
  fadeInRemoverInit(nil, mod)
50
50
  fastResetInit(nil, mod)
51
51
  forgottenSwitchInit(nil, mod)
package/lualib_bundle.lua CHANGED
@@ -651,7 +651,7 @@ do
651
651
  end
652
652
  else
653
653
  local ____self_fulfilledCallbacks_2 = self.fulfilledCallbacks
654
- ____self_fulfilledCallbacks_2[#____self_fulfilledCallbacks_2 + 1] = function() return resolve(nil, nil) end
654
+ ____self_fulfilledCallbacks_2[#____self_fulfilledCallbacks_2 + 1] = function(____, v) return resolve(nil, v) end
655
655
  end
656
656
  if onRejected then
657
657
  local internalCallback = self:createPromiseResolvingCallback(onRejected, resolve, reject)
@@ -660,6 +660,9 @@ do
660
660
  if isRejected then
661
661
  internalCallback(nil, self.rejectionReason)
662
662
  end
663
+ else
664
+ local ____self_rejectedCallbacks_4 = self.rejectedCallbacks
665
+ ____self_rejectedCallbacks_4[#____self_rejectedCallbacks_4 + 1] = function(____, err) return reject(nil, err) end
663
666
  end
664
667
  if isFulfilled then
665
668
  resolve(nil, self.value)
@@ -674,8 +677,8 @@ do
674
677
  end
675
678
  function __TS__Promise.prototype.finally(self, onFinally)
676
679
  if onFinally then
677
- local ____self_finallyCallbacks_4 = self.finallyCallbacks
678
- ____self_finallyCallbacks_4[#____self_finallyCallbacks_4 + 1] = onFinally
680
+ local ____self_finallyCallbacks_5 = self.finallyCallbacks
681
+ ____self_finallyCallbacks_5[#____self_finallyCallbacks_5 + 1] = onFinally
679
682
  if self.state ~= 0 then
680
683
  onFinally(nil)
681
684
  end
@@ -0,0 +1,4 @@
1
+ import { StageType } from "isaac-typescript-definitions";
2
+ export declare const STAGE_TYPE_SUFFIXES: {
3
+ readonly [key in StageType]: string;
4
+ };
@@ -0,0 +1,12 @@
1
+ local ____exports = {}
2
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
3
+ local StageType = ____isaac_2Dtypescript_2Ddefinitions.StageType
4
+ ____exports.STAGE_TYPE_SUFFIXES = {
5
+ [StageType.ORIGINAL] = "",
6
+ [StageType.WRATH_OF_THE_LAMB] = "a",
7
+ [StageType.AFTERBIRTH] = "b",
8
+ [StageType.GREED_MODE] = "",
9
+ [StageType.REPENTANCE] = "c",
10
+ [StageType.REPENTANCE_B] = "d"
11
+ }
12
+ return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "4.3.3",
3
+ "version": "4.5.1",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -0,0 +1,5 @@
1
+ /**
2
+ * The set of vanilla console commands, as documented here:
3
+ * https://bindingofisaacrebirth.fandom.com/wiki/Debug_Console
4
+ */
5
+ export declare const CONSOLE_COMMANDS_SET: ReadonlySet<string>;