isaacscript-common 4.5.0 → 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 (48) 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/run.d.ts +5 -2
  38. package/functions/run.lua +5 -2
  39. package/functions/saveFile.lua +3 -0
  40. package/functions/utils.d.ts +5 -0
  41. package/functions/utils.lua +7 -0
  42. package/index.d.ts +4 -3
  43. package/index.lua +22 -16
  44. package/initFeatures.lua +3 -3
  45. package/lualib_bundle.lua +6 -3
  46. package/package.json +1 -1
  47. package/sets/consoleCommandsSet.d.ts +5 -0
  48. 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
  ---
@@ -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
@@ -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";
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
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "4.5.0",
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>;
@@ -0,0 +1,61 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local Set = ____lualib.Set
3
+ local __TS__New = ____lualib.__TS__New
4
+ local ____exports = {}
5
+ --- The set of vanilla console commands, as documented here:
6
+ -- https://bindingofisaacrebirth.fandom.com/wiki/Debug_Console
7
+ ____exports.CONSOLE_COMMANDS_SET = __TS__New(Set, {
8
+ "achievement",
9
+ "challenge",
10
+ "clear",
11
+ "clearcache",
12
+ "clearseeds",
13
+ "combo",
14
+ "copy",
15
+ "costumetest",
16
+ "curse",
17
+ "cutscene",
18
+ "debug",
19
+ "delirious",
20
+ "eggs",
21
+ "giveitem",
22
+ "g",
23
+ "goto",
24
+ "gridspawn",
25
+ "listcollectibles",
26
+ "lua",
27
+ "l",
28
+ "luamem",
29
+ "luamod",
30
+ "luarun",
31
+ "macro",
32
+ "m",
33
+ "metro",
34
+ "playsfx",
35
+ "prof",
36
+ "profstop",
37
+ "remove",
38
+ "r",
39
+ "reloadfx",
40
+ "reloadshaders",
41
+ "repeat",
42
+ "reseed",
43
+ "restart",
44
+ "seed",
45
+ "spawn",
46
+ "stage",
47
+ "time",
48
+ "addplayer",
49
+ "forceroom",
50
+ "giveitem2",
51
+ "g2",
52
+ "netdelay",
53
+ "netstart",
54
+ "remove2",
55
+ "r2",
56
+ "reloadwisps",
57
+ "restock",
58
+ "rewind",
59
+ "testbosspool"
60
+ })
61
+ return ____exports