isaacscript-common 1.0.514 → 1.0.518

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.
@@ -0,0 +1,2 @@
1
+ import { ModUpgraded } from "../types/ModUpgraded";
2
+ export declare function preNewLevelCallbackInit(mod: ModUpgraded): void;
@@ -0,0 +1,38 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____exports = {}
3
+ local hasSubscriptions, postPlayerRender, firedOnStage
4
+ local ____sprite = require("functions.sprite")
5
+ local getFinalFrameOfAnimation = ____sprite.getFinalFrameOfAnimation
6
+ local ____stage = require("functions.stage")
7
+ local getEffectiveStage = ____stage.getEffectiveStage
8
+ local ____PreNewLevel = require("callbacks.subscriptions.PreNewLevel")
9
+ local preNewLevelFire = ____PreNewLevel.preNewLevelFire
10
+ local preNewLevelHasSubscriptions = ____PreNewLevel.preNewLevelHasSubscriptions
11
+ function hasSubscriptions(self)
12
+ return preNewLevelHasSubscriptions(nil)
13
+ end
14
+ function postPlayerRender(self, player)
15
+ if not hasSubscriptions(nil) then
16
+ return
17
+ end
18
+ local effectiveStage = getEffectiveStage(nil)
19
+ if effectiveStage == firedOnStage then
20
+ return
21
+ end
22
+ local sprite = player:GetSprite()
23
+ local animation = sprite:GetAnimation()
24
+ if (animation ~= "Trapdoor") and (animation ~= "LightTravel") then
25
+ return
26
+ end
27
+ local frame = sprite:GetFrame()
28
+ local finalFrame = getFinalFrameOfAnimation(nil, sprite)
29
+ if frame == finalFrame then
30
+ firedOnStage = effectiveStage
31
+ preNewLevelFire(nil)
32
+ end
33
+ end
34
+ firedOnStage = nil
35
+ function ____exports.preNewLevelCallbackInit(self, mod)
36
+ mod:AddCallback(ModCallbacks.MC_POST_PLAYER_RENDER, postPlayerRender)
37
+ end
38
+ return ____exports
@@ -0,0 +1,4 @@
1
+ export declare type PreNewLevelCallbackType = () => void;
2
+ export declare function preNewLevelHasSubscriptions(): boolean;
3
+ export declare function preNewLevelRegister(callback: PreNewLevelCallbackType): void;
4
+ export declare function preNewLevelFire(): void;
@@ -0,0 +1,18 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ require("lualib_bundle");
3
+ local ____exports = {}
4
+ local subscriptions = {}
5
+ function ____exports.preNewLevelHasSubscriptions(self)
6
+ return #subscriptions > 0
7
+ end
8
+ function ____exports.preNewLevelRegister(self, callback)
9
+ __TS__ArrayPush(subscriptions, {callback})
10
+ end
11
+ function ____exports.preNewLevelFire(self)
12
+ for ____, ____value in ipairs(subscriptions) do
13
+ local callback
14
+ callback = ____value[1]
15
+ callback(nil)
16
+ end
17
+ end
18
+ return ____exports
package/dist/debug.d.ts CHANGED
@@ -1 +1,2 @@
1
+ /** Set this to true to enable more verbosity in the save data manger. */
1
2
  export declare const DEBUG = false;
@@ -1,5 +1,15 @@
1
+ /**
2
+ * Helper function to get a stack trace.
3
+ *
4
+ * This will only work if the `--luadebug` launch option is enabled or the Racing+ sandbox is
5
+ * enabled.
6
+ */
7
+ export declare function getTraceback(): string;
1
8
  /**
2
9
  * Helper function to print a stack trace to the "log.txt" file, similar to JavaScript's
3
- * `console.trace()` function. This will only work if the `--luadebug` launch option is enabled.
10
+ * `console.trace()` function.
11
+ *
12
+ * This will only work if the `--luadebug` launch option is enabled or the Racing+ sandbox is
13
+ * enabled.
4
14
  */
5
15
  export declare function traceback(): void;
@@ -1,15 +1,16 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  local ____exports = {}
3
- function ____exports.traceback(self)
3
+ function ____exports.getTraceback(self)
4
4
  if debug ~= nil then
5
- local tracebackMsg = debug.traceback()
6
- Isaac.DebugString(tracebackMsg)
7
- return
5
+ return debug.traceback()
8
6
  end
9
- if sandboxTraceback ~= nil then
10
- sandboxTraceback()
11
- return
7
+ if sandboxGetTraceback ~= nil then
8
+ return sandboxGetTraceback()
12
9
  end
13
- Isaac.DebugString("Error: Cannot perform a traceback since --luadebug is not enabled.")
10
+ return "stack traceback:\n(the \"--luadebug\" flag is not enabled)"
11
+ end
12
+ function ____exports.traceback(self)
13
+ local tracebackOutput = ____exports.getTraceback(nil)
14
+ Isaac.DebugString(tracebackOutput)
14
15
  end
15
16
  return ____exports
@@ -1,14 +1,11 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  local ____exports = {}
3
3
  local RECOMMENDED_SHIFT_IDX
4
- local ____debug = require("functions.debug")
5
- local traceback = ____debug.traceback
6
4
  function ____exports.initRNG(self, seed)
7
5
  if seed == nil then
8
6
  seed = Random()
9
7
  end
10
8
  if seed == 0 then
11
- traceback(nil)
12
9
  error("You cannot initialize an RNG object with a seed of 0, or the game will crash.")
13
10
  end
14
11
  local rng = RNG()
@@ -133,6 +133,14 @@ export declare function inMinibossRoomOf(minibossID: MinibossID): boolean;
133
133
  * starting room of the mirror world does not count).
134
134
  */
135
135
  export declare function inStartingRoom(): boolean;
136
+ /**
137
+ * Helper function to loop through every room on the floor and see if it has been cleared.
138
+ *
139
+ * @param onlyCheckRoomTypes Optional. A whitelist of room types. If specified, room types not in
140
+ * the array will be ignored. If not specified, then all rooms will be checked. Undefined by
141
+ * default.
142
+ */
143
+ export declare function isAllRoomsClear(onlyCheckRoomTypes?: RoomType[]): boolean;
136
144
  /**
137
145
  * Helper function to determine whether or not the current room is part of the floor layout. For
138
146
  * example, Devil Rooms and the Mega Satan room are not considered to be inside the map.
@@ -231,6 +231,37 @@ function ____exports.inStartingRoom(self)
231
231
  local roomSafeGridIndex = ____exports.getRoomSafeGridIndex(nil)
232
232
  return (roomSafeGridIndex == startingRoomGridIndex) and ____exports.inDimension(nil, 0)
233
233
  end
234
+ function ____exports.isAllRoomsClear(self, onlyCheckRoomTypes)
235
+ local game = Game()
236
+ local level = game:GetLevel()
237
+ local rooms = level:GetRooms()
238
+ local roomTypeWhitelist = (((onlyCheckRoomTypes == nil) and (function() return nil end)) or (function() return __TS__New(Set, onlyCheckRoomTypes) end))()
239
+ do
240
+ local i = 0
241
+ while i < rooms.Size do
242
+ do
243
+ local roomDesc = rooms:Get(i)
244
+ if roomDesc == nil then
245
+ goto __continue42
246
+ end
247
+ local roomData = roomDesc.Data
248
+ if roomData == nil then
249
+ goto __continue42
250
+ end
251
+ local roomType = roomData.Type
252
+ if (roomTypeWhitelist ~= nil) and (not roomTypeWhitelist:has(roomType)) then
253
+ goto __continue42
254
+ end
255
+ if not roomDesc.Clear then
256
+ return false
257
+ end
258
+ end
259
+ ::__continue42::
260
+ i = i + 1
261
+ end
262
+ end
263
+ return true
264
+ end
234
265
  function ____exports.isRoomInsideMap(self)
235
266
  local roomSafeGridIndex = ____exports.getRoomSafeGridIndex(nil)
236
267
  return roomSafeGridIndex >= 0
@@ -259,14 +290,14 @@ function ____exports.setRoomCleared(self)
259
290
  ) do
260
291
  do
261
292
  if isHiddenSecretRoomDoor(nil, door) then
262
- goto __continue45
293
+ goto __continue51
263
294
  end
264
295
  door.State = DoorState.STATE_OPEN
265
296
  local sprite = door:GetSprite()
266
297
  sprite:Play("Opened", true)
267
298
  door.ExtraVisible = false
268
299
  end
269
- ::__continue45::
300
+ ::__continue51::
270
301
  end
271
302
  sfx:Stop(SoundEffect.SOUND_DOOR_HEAVY_OPEN)
272
303
  game:ShakeScreen(0)
@@ -57,6 +57,18 @@ export declare function getEnumValues(transpiledEnum: unknown): int[];
57
57
  */
58
58
  export declare function hexToKColor(hexString: string, alpha: float): KColor;
59
59
  export declare function isGreedMode(): boolean;
60
+ /**
61
+ * Players can boot the game with an launch option called "--luadebug", which will enable additional
62
+ * functionality that is considered to be unsafe. For more information about this flag, see the
63
+ * wiki: https://bindingofisaacrebirth.fandom.com/wiki/Launch_Options
64
+ *
65
+ * When this flag is enabled, the global environment will be slightly different. The differences are
66
+ * documented here: https://wofsauge.github.io/IsaacDocs/rep/Globals.html
67
+ *
68
+ * This function uses the `package` global variable as a proxy to determine if the "--luadebug" flag
69
+ * is enabled or not.
70
+ */
71
+ export declare function isLuaDebugEnabled(): boolean;
60
72
  /**
61
73
  * Whether or not the player is playing on a set seed (i.e. that they entered in a specific seed by
62
74
  * pressing tab on the character selection screen). When the player resets the game on a set seed,
@@ -51,6 +51,9 @@ function ____exports.isGreedMode(self)
51
51
  local game = Game()
52
52
  return (game.Difficulty == Difficulty.DIFFICULTY_GREED) or (game.Difficulty == Difficulty.DIFFICULTY_GREEDIER)
53
53
  end
54
+ function ____exports.isLuaDebugEnabled(self)
55
+ return package ~= nil
56
+ end
54
57
  function ____exports.onSetSeed(self)
55
58
  local game = Game()
56
59
  local seeds = game:GetSeeds()
@@ -0,0 +1,9 @@
1
+ /**
2
+ * In Lua, the `error` function will tell you the line number of the error, but not give you a full
3
+ * traceback of the parent functions, which is unlike how JavaScript works. This function monkey
4
+ * patches the `error` function to add this functionality.
5
+ *
6
+ * Traceback functionality can only be added if the "--luadebug" flag is turned on, so this function
7
+ * does nothing if the "--luadebug" flag is disabled.
8
+ */
9
+ export declare function patchErrorFunction(): void;
@@ -0,0 +1,44 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ require("lualib_bundle");
3
+ local ____exports = {}
4
+ local errorWithTraceback, slimTracebackOutput, vanillaError
5
+ local ____debug = require("functions.debug")
6
+ local getTraceback = ____debug.getTraceback
7
+ local ____util = require("functions.util")
8
+ local isLuaDebugEnabled = ____util.isLuaDebugEnabled
9
+ function errorWithTraceback(message, level)
10
+ if vanillaError == nil then
11
+ error(message, level)
12
+ end
13
+ if level == nil then
14
+ level = 1
15
+ end
16
+ local tracebackOutput = getTraceback(nil)
17
+ local slimmedTracebackOutput = slimTracebackOutput(nil, tracebackOutput)
18
+ Isaac.DebugString(slimmedTracebackOutput)
19
+ vanillaError(message, level + 1)
20
+ end
21
+ function slimTracebackOutput(self, tracebackOutput)
22
+ local lineSeparator = "\n"
23
+ local lines = __TS__StringSplit(tracebackOutput, lineSeparator)
24
+ if __TS__StringIncludes(lines[2], "in upvalue 'getTraceback'") then
25
+ __TS__ArraySplice(lines, 1, 1)
26
+ end
27
+ if __TS__StringIncludes(lines[2], "in function 'error'") then
28
+ __TS__ArraySplice(lines, 1, 1)
29
+ end
30
+ local slimmedTracebackOutput = table.concat(lines, lineSeparator or ",")
31
+ return slimmedTracebackOutput
32
+ end
33
+ function ____exports.patchErrorFunction(self)
34
+ if not isLuaDebugEnabled(nil) then
35
+ return
36
+ end
37
+ if __PATCHED_ERROR ~= nil then
38
+ return
39
+ end
40
+ __PATCHED_ERROR = true
41
+ vanillaError = error
42
+ error = errorWithTraceback
43
+ end
44
+ return ____exports
@@ -0,0 +1,8 @@
1
+ /**
2
+ * When the "--luadebug" flag is enabled, the `print` function will no longer print messages to the
3
+ * "log.txt" file or the in-game console. This function monkey patches the `print` function to
4
+ * restore this functionality.
5
+ *
6
+ * If the "--luadebug" flag is disabled, this function will do nothing.
7
+ */
8
+ export declare function patchPrintFunction(): void;
@@ -0,0 +1,45 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____exports = {}
3
+ local printForLuaDebug, getPrintMsg, getValueToPrint
4
+ local ____util = require("functions.util")
5
+ local isLuaDebugEnabled = ____util.isLuaDebugEnabled
6
+ local ____vector = require("functions.vector")
7
+ local isVector = ____vector.isVector
8
+ function printForLuaDebug(...)
9
+ local args = {...}
10
+ local msg = getPrintMsg(nil, args)
11
+ Isaac.DebugString(msg)
12
+ local msgWithNewline = msg .. "\n"
13
+ Isaac.ConsoleOutput(msgWithNewline)
14
+ end
15
+ function getPrintMsg(self, args)
16
+ if #args == 0 then
17
+ return tostring(nil)
18
+ end
19
+ local msg = ""
20
+ for ____, arg in ipairs(args) do
21
+ if msg ~= "" then
22
+ msg = msg .. " "
23
+ end
24
+ msg = msg .. getValueToPrint(nil, arg)
25
+ end
26
+ return msg
27
+ end
28
+ function getValueToPrint(self, arg)
29
+ if isVector(nil, arg) then
30
+ local vector = arg
31
+ return ((("Vector(" .. tostring(vector.X)) .. ", ") .. tostring(vector.Y)) .. ")"
32
+ end
33
+ return tostring(arg)
34
+ end
35
+ function ____exports.patchPrintFunction(self)
36
+ if not isLuaDebugEnabled(nil) then
37
+ return
38
+ end
39
+ if __PATCHED_PRINT ~= nil then
40
+ return
41
+ end
42
+ __PATCHED_PRINT = true
43
+ print = printForLuaDebug
44
+ end
45
+ return ____exports
@@ -39,6 +39,7 @@ import { PostTearInitLateCallbackType } from "../callbacks/subscriptions/postTea
39
39
  import { PostTransformationCallbackType } from "../callbacks/subscriptions/postTransformation";
40
40
  import { PreCustomReviveCallbackType } from "../callbacks/subscriptions/preCustomRevive";
41
41
  import { PreItemPickupCallbackType } from "../callbacks/subscriptions/preItemPickup";
42
+ import { PreNewLevelCallbackType } from "../callbacks/subscriptions/PreNewLevel";
42
43
  import { ModCallbacksCustom } from "./ModCallbacksCustom";
43
44
  export interface CallbackParametersCustom {
44
45
  [ModCallbacksCustom.MC_POST_GAME_STARTED_REORDERED]: [
@@ -65,6 +66,7 @@ export interface CallbackParametersCustom {
65
66
  [ModCallbacksCustom.MC_POST_NEW_ROOM_EARLY]: [
66
67
  callback: PostNewRoomEarlyCallbackType
67
68
  ];
69
+ [ModCallbacksCustom.MC_PRE_NEW_LEVEL]: [callback: PreNewLevelCallbackType];
68
70
  [ModCallbacksCustom.MC_POST_PLAYER_INIT_LATE]: [
69
71
  callback: PostPlayerInitLateCallbackType,
70
72
  playerVariant?: PlayerVariant
@@ -15,37 +15,38 @@ export declare enum ModCallbacksCustom {
15
15
  MC_POST_PLAYER_UPDATE_REORDERED = 4,
16
16
  MC_POST_PLAYER_RENDER_REORDERED = 5,
17
17
  MC_POST_NEW_ROOM_EARLY = 6,
18
- MC_POST_PLAYER_INIT_LATE = 7,
19
- MC_POST_TEAR_INIT_LATE = 8,
20
- MC_POST_FAMILIAR_INIT_LATE = 9,
21
- MC_POST_BOMB_INIT_LATE = 10,
22
- MC_POST_PICKUP_INIT_LATE = 11,
23
- MC_POST_LASER_INIT_LATE = 12,
24
- MC_POST_KNIFE_INIT_LATE = 13,
25
- MC_POST_PROJECTILE_INIT_LATE = 14,
26
- MC_POST_NPC_INIT_LATE = 15,
27
- MC_POST_EFFECT_INIT_LATE = 16,
28
- MC_POST_PICKUP_COLLECT = 17,
29
- MC_PRE_ITEM_PICKUP = 18,
30
- MC_POST_ITEM_PICKUP = 19,
31
- MC_POST_PLAYER_CHANGE_TYPE = 20,
32
- MC_POST_PLAYER_CHANGE_HEALTH = 21,
33
- MC_POST_PLAYER_FATAL_DAMAGE = 22,
34
- MC_PRE_CUSTOM_REVIVE = 23,
35
- MC_POST_CUSTOM_REVIVE = 24,
36
- MC_POST_FLIP = 25,
37
- MC_POST_FIRST_FLIP = 26,
38
- MC_POST_ESAU_JR = 27,
39
- MC_POST_FIRST_ESAU_JR = 28,
40
- MC_POST_TRANSFORMATION = 29,
41
- MC_POST_PURCHASE = 30,
42
- MC_POST_SACRIFICE = 31,
43
- MC_POST_CURSED_TELEPORT = 32,
44
- MC_POST_SLOT_INIT = 33,
45
- MC_POST_SLOT_UPDATE = 34,
46
- MC_POST_SLOT_RENDER = 35,
47
- MC_POST_SLOT_DESTROYED = 36,
48
- MC_POST_GRID_ENTITY_INIT = 37,
49
- MC_POST_GRID_ENTITY_UPDATE = 38,
50
- MC_POST_GRID_ENTITY_REMOVE = 39
18
+ MC_PRE_NEW_LEVEL = 7,
19
+ MC_POST_PLAYER_INIT_LATE = 8,
20
+ MC_POST_TEAR_INIT_LATE = 9,
21
+ MC_POST_FAMILIAR_INIT_LATE = 10,
22
+ MC_POST_BOMB_INIT_LATE = 11,
23
+ MC_POST_PICKUP_INIT_LATE = 12,
24
+ MC_POST_LASER_INIT_LATE = 13,
25
+ MC_POST_KNIFE_INIT_LATE = 14,
26
+ MC_POST_PROJECTILE_INIT_LATE = 15,
27
+ MC_POST_NPC_INIT_LATE = 16,
28
+ MC_POST_EFFECT_INIT_LATE = 17,
29
+ MC_POST_PICKUP_COLLECT = 18,
30
+ MC_PRE_ITEM_PICKUP = 19,
31
+ MC_POST_ITEM_PICKUP = 20,
32
+ MC_POST_PLAYER_CHANGE_TYPE = 21,
33
+ MC_POST_PLAYER_CHANGE_HEALTH = 22,
34
+ MC_POST_PLAYER_FATAL_DAMAGE = 23,
35
+ MC_PRE_CUSTOM_REVIVE = 24,
36
+ MC_POST_CUSTOM_REVIVE = 25,
37
+ MC_POST_FLIP = 26,
38
+ MC_POST_FIRST_FLIP = 27,
39
+ MC_POST_ESAU_JR = 28,
40
+ MC_POST_FIRST_ESAU_JR = 29,
41
+ MC_POST_TRANSFORMATION = 30,
42
+ MC_POST_PURCHASE = 31,
43
+ MC_POST_SACRIFICE = 32,
44
+ MC_POST_CURSED_TELEPORT = 33,
45
+ MC_POST_SLOT_INIT = 34,
46
+ MC_POST_SLOT_UPDATE = 35,
47
+ MC_POST_SLOT_RENDER = 36,
48
+ MC_POST_SLOT_DESTROYED = 37,
49
+ MC_POST_GRID_ENTITY_INIT = 38,
50
+ MC_POST_GRID_ENTITY_UPDATE = 39,
51
+ MC_POST_GRID_ENTITY_REMOVE = 40
51
52
  }
@@ -15,70 +15,72 @@ ____exports.ModCallbacksCustom.MC_POST_PLAYER_RENDER_REORDERED = 5
15
15
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_PLAYER_RENDER_REORDERED] = "MC_POST_PLAYER_RENDER_REORDERED"
16
16
  ____exports.ModCallbacksCustom.MC_POST_NEW_ROOM_EARLY = 6
17
17
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_NEW_ROOM_EARLY] = "MC_POST_NEW_ROOM_EARLY"
18
- ____exports.ModCallbacksCustom.MC_POST_PLAYER_INIT_LATE = 7
18
+ ____exports.ModCallbacksCustom.MC_PRE_NEW_LEVEL = 7
19
+ ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_PRE_NEW_LEVEL] = "MC_PRE_NEW_LEVEL"
20
+ ____exports.ModCallbacksCustom.MC_POST_PLAYER_INIT_LATE = 8
19
21
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_PLAYER_INIT_LATE] = "MC_POST_PLAYER_INIT_LATE"
20
- ____exports.ModCallbacksCustom.MC_POST_TEAR_INIT_LATE = 8
22
+ ____exports.ModCallbacksCustom.MC_POST_TEAR_INIT_LATE = 9
21
23
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_TEAR_INIT_LATE] = "MC_POST_TEAR_INIT_LATE"
22
- ____exports.ModCallbacksCustom.MC_POST_FAMILIAR_INIT_LATE = 9
24
+ ____exports.ModCallbacksCustom.MC_POST_FAMILIAR_INIT_LATE = 10
23
25
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_FAMILIAR_INIT_LATE] = "MC_POST_FAMILIAR_INIT_LATE"
24
- ____exports.ModCallbacksCustom.MC_POST_BOMB_INIT_LATE = 10
26
+ ____exports.ModCallbacksCustom.MC_POST_BOMB_INIT_LATE = 11
25
27
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_BOMB_INIT_LATE] = "MC_POST_BOMB_INIT_LATE"
26
- ____exports.ModCallbacksCustom.MC_POST_PICKUP_INIT_LATE = 11
28
+ ____exports.ModCallbacksCustom.MC_POST_PICKUP_INIT_LATE = 12
27
29
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_PICKUP_INIT_LATE] = "MC_POST_PICKUP_INIT_LATE"
28
- ____exports.ModCallbacksCustom.MC_POST_LASER_INIT_LATE = 12
30
+ ____exports.ModCallbacksCustom.MC_POST_LASER_INIT_LATE = 13
29
31
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_LASER_INIT_LATE] = "MC_POST_LASER_INIT_LATE"
30
- ____exports.ModCallbacksCustom.MC_POST_KNIFE_INIT_LATE = 13
32
+ ____exports.ModCallbacksCustom.MC_POST_KNIFE_INIT_LATE = 14
31
33
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_KNIFE_INIT_LATE] = "MC_POST_KNIFE_INIT_LATE"
32
- ____exports.ModCallbacksCustom.MC_POST_PROJECTILE_INIT_LATE = 14
34
+ ____exports.ModCallbacksCustom.MC_POST_PROJECTILE_INIT_LATE = 15
33
35
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_PROJECTILE_INIT_LATE] = "MC_POST_PROJECTILE_INIT_LATE"
34
- ____exports.ModCallbacksCustom.MC_POST_NPC_INIT_LATE = 15
36
+ ____exports.ModCallbacksCustom.MC_POST_NPC_INIT_LATE = 16
35
37
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_NPC_INIT_LATE] = "MC_POST_NPC_INIT_LATE"
36
- ____exports.ModCallbacksCustom.MC_POST_EFFECT_INIT_LATE = 16
38
+ ____exports.ModCallbacksCustom.MC_POST_EFFECT_INIT_LATE = 17
37
39
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_EFFECT_INIT_LATE] = "MC_POST_EFFECT_INIT_LATE"
38
- ____exports.ModCallbacksCustom.MC_POST_PICKUP_COLLECT = 17
40
+ ____exports.ModCallbacksCustom.MC_POST_PICKUP_COLLECT = 18
39
41
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_PICKUP_COLLECT] = "MC_POST_PICKUP_COLLECT"
40
- ____exports.ModCallbacksCustom.MC_PRE_ITEM_PICKUP = 18
42
+ ____exports.ModCallbacksCustom.MC_PRE_ITEM_PICKUP = 19
41
43
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_PRE_ITEM_PICKUP] = "MC_PRE_ITEM_PICKUP"
42
- ____exports.ModCallbacksCustom.MC_POST_ITEM_PICKUP = 19
44
+ ____exports.ModCallbacksCustom.MC_POST_ITEM_PICKUP = 20
43
45
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_ITEM_PICKUP] = "MC_POST_ITEM_PICKUP"
44
- ____exports.ModCallbacksCustom.MC_POST_PLAYER_CHANGE_TYPE = 20
46
+ ____exports.ModCallbacksCustom.MC_POST_PLAYER_CHANGE_TYPE = 21
45
47
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_PLAYER_CHANGE_TYPE] = "MC_POST_PLAYER_CHANGE_TYPE"
46
- ____exports.ModCallbacksCustom.MC_POST_PLAYER_CHANGE_HEALTH = 21
48
+ ____exports.ModCallbacksCustom.MC_POST_PLAYER_CHANGE_HEALTH = 22
47
49
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_PLAYER_CHANGE_HEALTH] = "MC_POST_PLAYER_CHANGE_HEALTH"
48
- ____exports.ModCallbacksCustom.MC_POST_PLAYER_FATAL_DAMAGE = 22
50
+ ____exports.ModCallbacksCustom.MC_POST_PLAYER_FATAL_DAMAGE = 23
49
51
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_PLAYER_FATAL_DAMAGE] = "MC_POST_PLAYER_FATAL_DAMAGE"
50
- ____exports.ModCallbacksCustom.MC_PRE_CUSTOM_REVIVE = 23
52
+ ____exports.ModCallbacksCustom.MC_PRE_CUSTOM_REVIVE = 24
51
53
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_PRE_CUSTOM_REVIVE] = "MC_PRE_CUSTOM_REVIVE"
52
- ____exports.ModCallbacksCustom.MC_POST_CUSTOM_REVIVE = 24
54
+ ____exports.ModCallbacksCustom.MC_POST_CUSTOM_REVIVE = 25
53
55
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_CUSTOM_REVIVE] = "MC_POST_CUSTOM_REVIVE"
54
- ____exports.ModCallbacksCustom.MC_POST_FLIP = 25
56
+ ____exports.ModCallbacksCustom.MC_POST_FLIP = 26
55
57
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_FLIP] = "MC_POST_FLIP"
56
- ____exports.ModCallbacksCustom.MC_POST_FIRST_FLIP = 26
58
+ ____exports.ModCallbacksCustom.MC_POST_FIRST_FLIP = 27
57
59
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_FIRST_FLIP] = "MC_POST_FIRST_FLIP"
58
- ____exports.ModCallbacksCustom.MC_POST_ESAU_JR = 27
60
+ ____exports.ModCallbacksCustom.MC_POST_ESAU_JR = 28
59
61
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_ESAU_JR] = "MC_POST_ESAU_JR"
60
- ____exports.ModCallbacksCustom.MC_POST_FIRST_ESAU_JR = 28
62
+ ____exports.ModCallbacksCustom.MC_POST_FIRST_ESAU_JR = 29
61
63
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_FIRST_ESAU_JR] = "MC_POST_FIRST_ESAU_JR"
62
- ____exports.ModCallbacksCustom.MC_POST_TRANSFORMATION = 29
64
+ ____exports.ModCallbacksCustom.MC_POST_TRANSFORMATION = 30
63
65
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_TRANSFORMATION] = "MC_POST_TRANSFORMATION"
64
- ____exports.ModCallbacksCustom.MC_POST_PURCHASE = 30
66
+ ____exports.ModCallbacksCustom.MC_POST_PURCHASE = 31
65
67
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_PURCHASE] = "MC_POST_PURCHASE"
66
- ____exports.ModCallbacksCustom.MC_POST_SACRIFICE = 31
68
+ ____exports.ModCallbacksCustom.MC_POST_SACRIFICE = 32
67
69
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_SACRIFICE] = "MC_POST_SACRIFICE"
68
- ____exports.ModCallbacksCustom.MC_POST_CURSED_TELEPORT = 32
70
+ ____exports.ModCallbacksCustom.MC_POST_CURSED_TELEPORT = 33
69
71
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_CURSED_TELEPORT] = "MC_POST_CURSED_TELEPORT"
70
- ____exports.ModCallbacksCustom.MC_POST_SLOT_INIT = 33
72
+ ____exports.ModCallbacksCustom.MC_POST_SLOT_INIT = 34
71
73
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_SLOT_INIT] = "MC_POST_SLOT_INIT"
72
- ____exports.ModCallbacksCustom.MC_POST_SLOT_UPDATE = 34
74
+ ____exports.ModCallbacksCustom.MC_POST_SLOT_UPDATE = 35
73
75
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_SLOT_UPDATE] = "MC_POST_SLOT_UPDATE"
74
- ____exports.ModCallbacksCustom.MC_POST_SLOT_RENDER = 35
76
+ ____exports.ModCallbacksCustom.MC_POST_SLOT_RENDER = 36
75
77
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_SLOT_RENDER] = "MC_POST_SLOT_RENDER"
76
- ____exports.ModCallbacksCustom.MC_POST_SLOT_DESTROYED = 36
78
+ ____exports.ModCallbacksCustom.MC_POST_SLOT_DESTROYED = 37
77
79
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_SLOT_DESTROYED] = "MC_POST_SLOT_DESTROYED"
78
- ____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_INIT = 37
80
+ ____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_INIT = 38
79
81
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_INIT] = "MC_POST_GRID_ENTITY_INIT"
80
- ____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_UPDATE = 38
82
+ ____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_UPDATE = 39
81
83
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_UPDATE] = "MC_POST_GRID_ENTITY_UPDATE"
82
- ____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_REMOVE = 39
84
+ ____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_REMOVE = 40
83
85
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_REMOVE] = "MC_POST_GRID_ENTITY_REMOVE"
84
86
  return ____exports
@@ -82,6 +82,8 @@ local ____preCustomRevive = require("callbacks.subscriptions.preCustomRevive")
82
82
  local preCustomReviveRegister = ____preCustomRevive.preCustomReviveRegister
83
83
  local ____preItemPickup = require("callbacks.subscriptions.preItemPickup")
84
84
  local preItemPickupRegister = ____preItemPickup.preItemPickupRegister
85
+ local ____PreNewLevel = require("callbacks.subscriptions.PreNewLevel")
86
+ local preNewLevelRegister = ____PreNewLevel.preNewLevelRegister
85
87
  local ____log = require("functions.log")
86
88
  local getDebugPrependString = ____log.getDebugPrependString
87
89
  local ____util = require("functions.util")
@@ -147,6 +149,12 @@ function getCallbackRegisterFunction(self, callbackID)
147
149
  return postNewRoomEarlyRegister
148
150
  end
149
151
  end
152
+ ____cond17 = ____cond17 or (____switch17 == ModCallbacksCustom.MC_PRE_NEW_LEVEL)
153
+ if ____cond17 then
154
+ do
155
+ return preNewLevelRegister
156
+ end
157
+ end
150
158
  ____cond17 = ____cond17 or (____switch17 == ModCallbacksCustom.MC_POST_PLAYER_INIT_LATE)
151
159
  if ____cond17 then
152
160
  do
@@ -56,6 +56,8 @@ local ____postTearInitLate = require("callbacks.postTearInitLate")
56
56
  local postTearInitLateCallbackInit = ____postTearInitLate.postTearInitLateCallbackInit
57
57
  local ____postTransformation = require("callbacks.postTransformation")
58
58
  local postTransformationCallbackInit = ____postTransformation.postTransformationCallbackInit
59
+ local ____preNewLevel = require("callbacks.preNewLevel")
60
+ local preNewLevelCallbackInit = ____preNewLevel.preNewLevelCallbackInit
59
61
  local ____reorderedCallbacks = require("callbacks.reorderedCallbacks")
60
62
  local reorderedCallbacksInit = ____reorderedCallbacks.reorderedCallbacksInit
61
63
  local ____deployJSONRoom = require("features.deployJSONRoom")
@@ -77,10 +79,15 @@ local sirenHelpersInit = ____sirenHelpers.sirenHelpersInit
77
79
  local ____initialized = require("initialized")
78
80
  local areFeaturesInitialized = ____initialized.areFeaturesInitialized
79
81
  local setFeaturesInitialized = ____initialized.setFeaturesInitialized
82
+ local ____patchErrorFunctions = require("patchErrorFunctions")
83
+ local patchErrorFunction = ____patchErrorFunctions.patchErrorFunction
84
+ local ____patchPrintFunction = require("patchPrintFunction")
85
+ local patchPrintFunction = ____patchPrintFunction.patchPrintFunction
80
86
  local ____ModUpgraded = require("types.ModUpgraded")
81
87
  local ModUpgraded = ____ModUpgraded.ModUpgraded
82
88
  function initCustomCallbacks(self, mod)
83
89
  reorderedCallbacksInit(nil, mod)
90
+ preNewLevelCallbackInit(nil, mod)
84
91
  postPlayerReorderedCallbacksInit(nil, mod)
85
92
  postPlayerInitLateCallbackInit(nil, mod)
86
93
  postTearInitLateCallbackInit(nil, mod)
@@ -121,6 +128,8 @@ function ____exports.upgradeMod(self, modVanilla, verbose)
121
128
  if verbose == nil then
122
129
  verbose = false
123
130
  end
131
+ patchErrorFunction(nil)
132
+ patchPrintFunction(nil)
124
133
  local mod = __TS__New(ModUpgraded, modVanilla, verbose)
125
134
  if not areFeaturesInitialized(nil) then
126
135
  setFeaturesInitialized(nil)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.0.514",
3
+ "version": "1.0.518",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",
@@ -25,7 +25,7 @@
25
25
  "dist/**/*.d.ts"
26
26
  ],
27
27
  "devDependencies": {
28
- "isaac-typescript-definitions": "^1.0.294",
28
+ "isaac-typescript-definitions": "^1.0.295",
29
29
  "isaacscript-lint": "^1.0.71",
30
30
  "typedoc": "^0.22.10",
31
31
  "typescript": "4.4.4",