isaacscript-common 9.19.2 → 10.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/index.d.ts +49 -6
  2. package/dist/isaacscript-common.lua +173 -47
  3. package/dist/lualib_bundle.lua +53 -37
  4. package/dist/package.lua +2 -2
  5. package/dist/src/callbacks/preGetPedestal.d.ts +3 -0
  6. package/dist/src/callbacks/preGetPedestal.d.ts.map +1 -0
  7. package/dist/src/callbacks/preGetPedestal.lua +40 -0
  8. package/dist/src/callbacks/subscriptions/preGetPedestal.d.ts +10 -0
  9. package/dist/src/callbacks/subscriptions/preGetPedestal.d.ts.map +1 -0
  10. package/dist/src/callbacks/subscriptions/preGetPedestal.lua +32 -0
  11. package/dist/src/enums/ModCallbackCustom.d.ts +21 -2
  12. package/dist/src/enums/ModCallbackCustom.d.ts.map +1 -1
  13. package/dist/src/enums/ModCallbackCustom.lua +4 -2
  14. package/dist/src/features/saveDataManager/load.d.ts +1 -1
  15. package/dist/src/features/saveDataManager/maps.d.ts +1 -1
  16. package/dist/src/features/saveDataManager/merge.d.ts +1 -1
  17. package/dist/src/features/saveDataManager/save.d.ts +1 -1
  18. package/dist/src/functions/arrayLua.d.ts +13 -0
  19. package/dist/src/functions/arrayLua.d.ts.map +1 -1
  20. package/dist/src/functions/arrayLua.lua +15 -0
  21. package/dist/src/functions/bitSet128.d.ts +1 -1
  22. package/dist/src/functions/color.d.ts +1 -1
  23. package/dist/src/functions/entities.d.ts +1 -1
  24. package/dist/src/functions/globals.d.ts +1 -1
  25. package/dist/src/functions/jsonHelpers.d.ts +1 -1
  26. package/dist/src/functions/kColor.d.ts +1 -1
  27. package/dist/src/functions/log.d.ts +2 -2
  28. package/dist/src/functions/log.d.ts.map +1 -1
  29. package/dist/src/functions/positionVelocity.d.ts +3 -1
  30. package/dist/src/functions/positionVelocity.d.ts.map +1 -1
  31. package/dist/src/functions/positionVelocity.lua +9 -1
  32. package/dist/src/functions/rng.d.ts +1 -1
  33. package/dist/src/functions/table.d.ts +2 -2
  34. package/dist/src/functions/table.d.ts.map +1 -1
  35. package/dist/src/functions/table.lua +5 -2
  36. package/dist/src/functions/tstlClass.d.ts +1 -1
  37. package/dist/src/functions/types.d.ts +1 -1
  38. package/dist/src/functions/vector.d.ts +1 -1
  39. package/dist/src/initCustomCallbacks.d.ts.map +1 -1
  40. package/dist/src/initCustomCallbacks.lua +3 -0
  41. package/dist/src/interfaces/private/AddCallbackParameterCustom.d.ts +2 -0
  42. package/dist/src/interfaces/private/AddCallbackParameterCustom.d.ts.map +1 -1
  43. package/dist/src/interfaces/private/TSTLClassMetatable.d.ts +1 -1
  44. package/dist/src/objects/callbackRegisterFunctions.d.ts.map +1 -1
  45. package/dist/src/objects/callbackRegisterFunctions.lua +3 -0
  46. package/dist/src/types/SerializedIsaacAPIClass.d.ts +1 -1
  47. package/dist/src/types/TSTLClass.d.ts +1 -1
  48. package/package.json +2 -2
  49. package/src/callbacks/preGetPedestal.ts +60 -0
  50. package/src/callbacks/subscriptions/preGetPedestal.ts +55 -0
  51. package/src/enums/ModCallbackCustom.ts +20 -0
  52. package/src/functions/arrayLua.ts +25 -0
  53. package/src/functions/log.ts +8 -6
  54. package/src/functions/positionVelocity.ts +10 -0
  55. package/src/functions/table.ts +10 -4
  56. package/src/initCustomCallbacks.ts +2 -0
  57. package/src/interfaces/private/AddCallbackParameterCustom.ts +2 -0
  58. package/src/objects/callbackRegisterFunctions.ts +2 -0
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
+ /// <reference types="@typescript-to-lua/language-extensions" />
1
2
  /// <reference types="isaac-typescript-definitions" />
2
3
  /// <reference types="lua-types/5.3" />
3
- /// <reference types="typescript-to-lua/language-extensions" />
4
4
 
5
5
  import { ActiveSlot } from 'isaac-typescript-definitions';
6
6
  import { BackdropType } from 'isaac-typescript-definitions';
@@ -170,6 +170,7 @@ declare interface AddCallbackParameterCustom {
170
170
  [ModCallbackCustom.POST_TRINKET_BREAK]: PostTrinketBreakRegisterParameters;
171
171
  [ModCallbackCustom.PRE_BERSERK_DEATH]: PreBerserkDeathRegisterParameters;
172
172
  [ModCallbackCustom.PRE_CUSTOM_REVIVE]: PreCustomReviveRegisterParameters;
173
+ [ModCallbackCustom.PRE_GET_PEDESTAL]: PreGetPedestalRegisterParameters;
173
174
  [ModCallbackCustom.PRE_ITEM_PICKUP]: PreItemPickupRegisterParameters;
174
175
  [ModCallbackCustom.PRE_NEW_LEVEL]: PreNewLevelRegisterParameters;
175
176
  }
@@ -2156,8 +2157,10 @@ export declare function find<T>(array: T[], func: (value: T, index: number, arra
2156
2157
  * @param startingPosition The position to start searching from. If this position is not overlapping
2157
2158
  * with anything, then it will be returned.
2158
2159
  * @param avoidActiveEntities Optional. Default is false.
2160
+ * @param minimumDistance Optional. If specified, will ensure that the randomly generated position
2161
+ * is equal to or greater than the distance provided.
2159
2162
  */
2160
- export declare function findFreePosition(startingPosition: Vector, avoidActiveEntities?: boolean): Vector;
2163
+ export declare function findFreePosition(startingPosition: Vector, avoidActiveEntities?: boolean, minimumDistance?: float): Vector;
2161
2164
 
2162
2165
  /**
2163
2166
  * Helper function to make an NPC fire one or more projectiles. Returns the fired projectile(s).
@@ -2261,6 +2264,13 @@ export declare function forceNewLevelCallback(): void;
2261
2264
  */
2262
2265
  export declare function forceNewRoomCallback(): void;
2263
2266
 
2267
+ /**
2268
+ * Helper function for non-TypeScript users to iterate over an array.
2269
+ *
2270
+ * Internally, this just calls `array.forEach`.
2271
+ */
2272
+ export declare function forEach<T>(array: T[], func: (value: T, index: number, array: T[]) => void): void;
2273
+
2264
2274
  /**
2265
2275
  * When used on The Forgotten, switches to The Soul. When used on The Soul, switches to The
2266
2276
  * Forgotten. This takes 1 game frame to take effect.
@@ -6467,7 +6477,7 @@ export declare const itemConfig: ItemConfig;
6467
6477
  * false in situations where iterating randomly would not matter and you need the
6468
6478
  * extra performance.
6469
6479
  */
6470
- export declare function iterateTableInOrder<K, V>(luaMap: LuaMap<K, V>, func: (key: K, value: V) => void, inOrder?: boolean): void;
6480
+ export declare function iterateTableInOrder<K extends AnyNotNil, V>(luaMap: LuaMap<K, V>, func: (key: K, value: V) => void, inOrder?: boolean): void;
6471
6481
 
6472
6482
  /**
6473
6483
  * Helper function for non-TypeScript users to convert an array to a string with the specified
@@ -6816,7 +6826,7 @@ export declare function logTable(luaTable: unknown, parentTables?: number): void
6816
6826
  * Helper function to print out the differences between the entries of two tables. Note that this
6817
6827
  * will only do a shallow comparison.
6818
6828
  */
6819
- export declare function logTableDifferences<K, V>(table1: LuaMap<K, V>, table2: LuaMap<K, V>): void;
6829
+ export declare function logTableDifferences<K extends AnyNotNil, V>(table1: LuaMap<K, V>, table2: LuaMap<K, V>): void;
6820
6830
 
6821
6831
  /** Helper function for printing out every tear flag that is turned on. Useful when debugging. */
6822
6832
  export declare function logTearFlags(flags: TearFlag | BitFlags<TearFlag>): void;
@@ -8331,6 +8341,25 @@ export declare enum ModCallbackCustom {
8331
8341
  * ```
8332
8342
  */
8333
8343
  PRE_CUSTOM_REVIVE = 90,
8344
+ /**
8345
+ * Fires from the `PRE_PICKUP_COLLISION` callback when a player touches a collectible pedestal and
8346
+ * meets all of the conditions to pick it up.
8347
+ *
8348
+ * The return values of this callback are the same as the `PRE_PICKUP_COLLISION` callback. For
8349
+ * example, you can prevent a player from picking up the collectible by returning false. (However,
8350
+ * note that this callback will continue to fire for every frame that the player touches the
8351
+ * pedestal, so you would need to continue returning false.)
8352
+ *
8353
+ * - When registering the callback, takes an optional second argument that will make the callback
8354
+ * only fire if the player matches the `PlayerVariant` provided.
8355
+ * - When registering the callback, takes an optional third argument that will make the callback
8356
+ * only fire if the player matches the `PlayerType` provided.
8357
+ *
8358
+ * ```ts
8359
+ * function preGetPedestal(player: EntityPlayer, collectible: EntityPickupCollectible): void {}
8360
+ * ```
8361
+ */
8362
+ PRE_GET_PEDESTAL = 91,
8334
8363
  /**
8335
8364
  * Fires from the `POST_PEFFECT_UPDATE` callback when an item becomes queued (i.e. when the player
8336
8365
  * begins to hold the item above their head).
@@ -8349,7 +8378,7 @@ export declare enum ModCallbackCustom {
8349
8378
  * ): void {}
8350
8379
  * ```
8351
8380
  */
8352
- PRE_ITEM_PICKUP = 91,
8381
+ PRE_ITEM_PICKUP = 92,
8353
8382
  /**
8354
8383
  * Fires on the `POST_RENDER` frame before the player is taken to a new floor. Only fires when a
8355
8384
  * player jumps into a trapdoor or enters a heaven door (beam of light). Does not fire on the
@@ -8363,7 +8392,7 @@ export declare enum ModCallbackCustom {
8363
8392
  * function preNewLevel(player: EntityPlayer): void {}
8364
8393
  * ```
8365
8394
  */
8366
- PRE_NEW_LEVEL = 92
8395
+ PRE_NEW_LEVEL = 93
8367
8396
  }
8368
8397
 
8369
8398
  /**
@@ -9203,6 +9232,12 @@ playerVariant?: PlayerVariant,
9203
9232
  character?: PlayerType
9204
9233
  ];
9205
9234
 
9235
+ declare type PreGetPedestalRegisterParameters = [
9236
+ callback: (player: EntityPlayer, collectible: EntityPickupCollectible) => boolean | undefined,
9237
+ playerVariant?: PlayerVariant,
9238
+ character?: PlayerType
9239
+ ];
9240
+
9206
9241
  declare type PreItemPickupRegisterParameters = [callback: (player: EntityPlayer, pickingUpItem: PickingUpItem) => void] | [
9207
9242
  callback: (player: EntityPlayer, pickingUpItem: PickingUpItemCollectible) => void,
9208
9243
  itemType: ItemType.PASSIVE | ItemType.ACTIVE | ItemType.FAMILIAR,
@@ -11024,6 +11059,14 @@ export declare function smeltTrinket(player: EntityPlayer, trinketType: TrinketT
11024
11059
  */
11025
11060
  export declare function smeltTrinkets(player: EntityPlayer, ...trinketTypes: TrinketType[]): void;
11026
11061
 
11062
+ /**
11063
+ * Helper function for non-TypeScript users to check if one or more elements in the array is equal
11064
+ * to a condition.
11065
+ *
11066
+ * Internally, this just calls `array.some`.
11067
+ */
11068
+ export declare function some<T>(array: T[], func: (value: T, index: number, array: T[]) => boolean): boolean;
11069
+
11027
11070
  export declare type SoulHeartType = HeartSubType.SOUL | HeartSubType.BLACK | HeartSubType.BONE;
11028
11071
 
11029
11072
  /**
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 9.19.2
3
+ isaacscript-common 10.0.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -304,11 +304,15 @@ local function __TS__ArrayPushArray(self, items)
304
304
  return len
305
305
  end
306
306
 
307
+ local function __TS__CountVarargs(...)
308
+ return select("#", ...)
309
+ end
310
+
307
311
  local function __TS__ArrayReduce(self, callbackFn, ...)
308
312
  local len = #self
309
313
  local k = 0
310
314
  local accumulator = nil
311
- if select("#", ...) ~= 0 then
315
+ if __TS__CountVarargs(...) ~= 0 then
312
316
  accumulator = ...
313
317
  elseif len > 0 then
314
318
  accumulator = self[1]
@@ -332,7 +336,7 @@ local function __TS__ArrayReduceRight(self, callbackFn, ...)
332
336
  local len = #self
333
337
  local k = len - 1
334
338
  local accumulator = nil
335
- if select("#", ...) ~= 0 then
339
+ if __TS__CountVarargs(...) ~= 0 then
336
340
  accumulator = ...
337
341
  elseif len > 0 then
338
342
  accumulator = self[k + 1]
@@ -448,7 +452,7 @@ end
448
452
  local function __TS__ArraySplice(self, ...)
449
453
  local args = {...}
450
454
  local len = #self
451
- local actualArgumentCount = select("#", ...)
455
+ local actualArgumentCount = __TS__CountVarargs(...)
452
456
  local start = args[1]
453
457
  local deleteCount = args[2]
454
458
  if start < 0 then
@@ -1065,6 +1069,16 @@ local function __TS__DecorateParam(paramIndex, decorator)
1065
1069
  return function(____, target, key) return decorator(nil, target, key, paramIndex) end
1066
1070
  end
1067
1071
 
1072
+ local function __TS__StringIncludes(self, searchString, position)
1073
+ if not position then
1074
+ position = 1
1075
+ else
1076
+ position = position + 1
1077
+ end
1078
+ local index = string.find(self, searchString, position, true)
1079
+ return index ~= nil
1080
+ end
1081
+
1068
1082
  local Error, RangeError, ReferenceError, SyntaxError, TypeError, URIError
1069
1083
  do
1070
1084
  local function getErrorStack(self, constructor)
@@ -1079,13 +1093,18 @@ do
1079
1093
  break
1080
1094
  end
1081
1095
  end
1082
- return debug.traceback(nil, level)
1096
+ if __TS__StringIncludes(_VERSION, "Lua 5.0") then
1097
+ return debug.traceback(("[Level " .. tostring(level)) .. "]")
1098
+ else
1099
+ return debug.traceback(nil, level)
1100
+ end
1083
1101
  end
1084
1102
  local function wrapErrorToString(self, getDescription)
1085
1103
  return function(self)
1086
1104
  local description = getDescription(self)
1087
1105
  local caller = debug.getinfo(3, "f")
1088
- if _VERSION == "Lua 5.1" or caller and caller.func ~= error then
1106
+ local isClassicLua = __TS__StringIncludes(_VERSION, "Lua 5.0") or _VERSION == "Lua 5.1"
1107
+ if isClassicLua or caller and caller.func ~= error then
1089
1108
  return description
1090
1109
  else
1091
1110
  return (tostring(description) .. "\n") .. self.stack
@@ -1234,16 +1253,9 @@ do
1234
1253
  function __TS__Generator(fn)
1235
1254
  return function(...)
1236
1255
  local args = {...}
1237
- local argsLength = select("#", ...)
1256
+ local argsLength = __TS__CountVarargs(...)
1238
1257
  return {
1239
- ____coroutine = coroutine.create(function()
1240
- local ____fn_1 = fn
1241
- local ____unpack_0 = unpack
1242
- if ____unpack_0 == nil then
1243
- ____unpack_0 = table.unpack
1244
- end
1245
- return ____fn_1(____unpack_0(args, 1, argsLength))
1246
- end),
1258
+ ____coroutine = coroutine.create(function() return fn(__TS__Unpack(args, 1, argsLength)) end),
1247
1259
  [Symbol.iterator] = generatorIterator,
1248
1260
  next = generatorNext
1249
1261
  }
@@ -1407,8 +1419,12 @@ do
1407
1419
  Map[Symbol.species] = Map
1408
1420
  end
1409
1421
 
1422
+ local __TS__Match = string.match
1423
+
1410
1424
  local __TS__MathAtan2 = math.atan2 or math.atan
1411
1425
 
1426
+ local __TS__MathModf = math.modf
1427
+
1412
1428
  local function __TS__MathSign(val)
1413
1429
  if val > 0 then
1414
1430
  return 1
@@ -1418,6 +1434,10 @@ local function __TS__MathSign(val)
1418
1434
  return 0
1419
1435
  end
1420
1436
 
1437
+ local function __TS__Modulo50(a, b)
1438
+ return a - math.floor(a / b) * b
1439
+ end
1440
+
1421
1441
  local function __TS__Number(value)
1422
1442
  local valueType = type(value)
1423
1443
  if valueType == "number" then
@@ -1464,7 +1484,7 @@ do
1464
1484
  if radix < 2 or radix > 36 then
1465
1485
  error("toString() radix argument must be between 2 and 36", 0)
1466
1486
  end
1467
- local integer, fraction = math.modf(math.abs(self))
1487
+ local integer, fraction = __TS__MathModf(math.abs(self))
1468
1488
  local result = ""
1469
1489
  if radix == 8 then
1470
1490
  result = string.format("%o", integer)
@@ -1620,7 +1640,7 @@ local function __TS__ObjectValues(obj)
1620
1640
  end
1621
1641
 
1622
1642
  local function __TS__ParseFloat(numberString)
1623
- local infinityMatch = string.match(numberString, "^%s*(-?Infinity)")
1643
+ local infinityMatch = __TS__Match(numberString, "^%s*(-?Infinity)")
1624
1644
  if infinityMatch then
1625
1645
  local ____temp_0
1626
1646
  if __TS__StringAccess(infinityMatch, 0) == "-" then
@@ -1630,7 +1650,7 @@ local function __TS__ParseFloat(numberString)
1630
1650
  end
1631
1651
  return ____temp_0
1632
1652
  end
1633
- local number = tonumber(string.match(numberString, "^%s*(-?%d+%.?%d*)"))
1653
+ local number = tonumber(__TS__Match(numberString, "^%s*(-?%d+%.?%d*)"))
1634
1654
  local ____number_1 = number
1635
1655
  if ____number_1 == nil then
1636
1656
  ____number_1 = 0 / 0
@@ -1678,16 +1698,16 @@ do
1678
1698
  function __TS__ParseInt(numberString, base)
1679
1699
  if base == nil then
1680
1700
  base = 10
1681
- local hexMatch = string.match(numberString, "^%s*-?0[xX]")
1701
+ local hexMatch = __TS__Match(numberString, "^%s*-?0[xX]")
1682
1702
  if hexMatch then
1683
1703
  base = 16
1684
- local ____string_match_result__0_0
1685
- if string.match(hexMatch, "-") then
1686
- ____string_match_result__0_0 = "-" .. __TS__StringSubstr(numberString, #hexMatch)
1704
+ local ____TS__Match_result__0_0
1705
+ if __TS__Match(hexMatch, "-") then
1706
+ ____TS__Match_result__0_0 = "-" .. __TS__StringSubstr(numberString, #hexMatch)
1687
1707
  else
1688
- ____string_match_result__0_0 = __TS__StringSubstr(numberString, #hexMatch)
1708
+ ____TS__Match_result__0_0 = __TS__StringSubstr(numberString, #hexMatch)
1689
1709
  end
1690
- numberString = ____string_match_result__0_0
1710
+ numberString = ____TS__Match_result__0_0
1691
1711
  end
1692
1712
  end
1693
1713
  if base < 2 or base > 36 then
@@ -1702,7 +1722,7 @@ do
1702
1722
  local allowedDigits = ____temp_1
1703
1723
  local pattern = ("^%s*(-?[" .. allowedDigits) .. "]*)"
1704
1724
  local number = tonumber(
1705
- string.match(numberString, pattern),
1725
+ __TS__Match(numberString, pattern),
1706
1726
  base
1707
1727
  )
1708
1728
  if number == nil then
@@ -2014,13 +2034,13 @@ end
2014
2034
 
2015
2035
  local function __TS__SparseArrayNew(...)
2016
2036
  local sparseArray = {...}
2017
- sparseArray.sparseLength = select("#", ...)
2037
+ sparseArray.sparseLength = __TS__CountVarargs(...)
2018
2038
  return sparseArray
2019
2039
  end
2020
2040
 
2021
2041
  local function __TS__SparseArrayPush(sparseArray, ...)
2022
2042
  local args = {...}
2023
- local argsLen = select("#", ...)
2043
+ local argsLen = __TS__CountVarargs(...)
2024
2044
  local listLen = sparseArray.sparseLength
2025
2045
  for i = 1, argsLen do
2026
2046
  sparseArray[listLen + i] = args[i]
@@ -2135,6 +2155,8 @@ local function __TS__SourceMapTraceBack(fileName, sourceMap)
2135
2155
  local trace
2136
2156
  if thread == nil and message == nil and level == nil then
2137
2157
  trace = originalTraceback()
2158
+ elseif __TS__StringIncludes(_VERSION, "Lua 5.0") then
2159
+ trace = originalTraceback((("[Level " .. tostring(level)) .. "] ") .. message)
2138
2160
  else
2139
2161
  trace = originalTraceback(thread, message, level)
2140
2162
  end
@@ -2160,7 +2182,7 @@ local function __TS__SourceMapTraceBack(fileName, sourceMap)
2160
2182
  local function stringReplacer(____, file, line)
2161
2183
  local fileSourceMap = _G.__TS__sourcemap[file]
2162
2184
  if fileSourceMap and fileSourceMap[line] then
2163
- local chunkName = string.match(file, "%[string \"([^\"]+)\"%]")
2185
+ local chunkName = __TS__Match(file, "%[string \"([^\"]+)\"%]")
2164
2186
  local sourceName = string.gsub(chunkName, ".lua$", ".ts")
2165
2187
  local data = fileSourceMap[line]
2166
2188
  if type(data) == "number" then
@@ -2227,16 +2249,6 @@ local function __TS__StringEndsWith(self, searchString, endPosition)
2227
2249
  return string.sub(self, endPosition - #searchString + 1, endPosition) == searchString
2228
2250
  end
2229
2251
 
2230
- local function __TS__StringIncludes(self, searchString, position)
2231
- if not position then
2232
- position = 1
2233
- else
2234
- position = position + 1
2235
- end
2236
- local index = string.find(self, searchString, position, true)
2237
- return index ~= nil
2238
- end
2239
-
2240
2252
  local function __TS__StringPadEnd(self, maxLength, fillString)
2241
2253
  if fillString == nil then
2242
2254
  fillString = " "
@@ -2492,6 +2504,7 @@ return {
2492
2504
  __TS__Class = __TS__Class,
2493
2505
  __TS__ClassExtends = __TS__ClassExtends,
2494
2506
  __TS__CloneDescriptor = __TS__CloneDescriptor,
2507
+ __TS__CountVarargs = __TS__CountVarargs,
2495
2508
  __TS__Decorate = __TS__Decorate,
2496
2509
  __TS__DecorateParam = __TS__DecorateParam,
2497
2510
  __TS__Delete = __TS__Delete,
@@ -2509,8 +2522,11 @@ return {
2509
2522
  __TS__Iterator = __TS__Iterator,
2510
2523
  __TS__LuaIteratorSpread = __TS__LuaIteratorSpread,
2511
2524
  Map = Map,
2525
+ __TS__Match = __TS__Match,
2512
2526
  __TS__MathAtan2 = __TS__MathAtan2,
2527
+ __TS__MathModf = __TS__MathModf,
2513
2528
  __TS__MathSign = __TS__MathSign,
2529
+ __TS__Modulo50 = __TS__Modulo50,
2514
2530
  __TS__New = __TS__New,
2515
2531
  __TS__Number = __TS__Number,
2516
2532
  __TS__NumberIsFinite = __TS__NumberIsFinite,
@@ -3044,9 +3060,11 @@ ____exports.ModCallbackCustom.PRE_BERSERK_DEATH = 89
3044
3060
  ____exports.ModCallbackCustom[____exports.ModCallbackCustom.PRE_BERSERK_DEATH] = "PRE_BERSERK_DEATH"
3045
3061
  ____exports.ModCallbackCustom.PRE_CUSTOM_REVIVE = 90
3046
3062
  ____exports.ModCallbackCustom[____exports.ModCallbackCustom.PRE_CUSTOM_REVIVE] = "PRE_CUSTOM_REVIVE"
3047
- ____exports.ModCallbackCustom.PRE_ITEM_PICKUP = 91
3063
+ ____exports.ModCallbackCustom.PRE_GET_PEDESTAL = 91
3064
+ ____exports.ModCallbackCustom[____exports.ModCallbackCustom.PRE_GET_PEDESTAL] = "PRE_GET_PEDESTAL"
3065
+ ____exports.ModCallbackCustom.PRE_ITEM_PICKUP = 92
3048
3066
  ____exports.ModCallbackCustom[____exports.ModCallbackCustom.PRE_ITEM_PICKUP] = "PRE_ITEM_PICKUP"
3049
- ____exports.ModCallbackCustom.PRE_NEW_LEVEL = 92
3067
+ ____exports.ModCallbackCustom.PRE_NEW_LEVEL = 93
3050
3068
  ____exports.ModCallbackCustom[____exports.ModCallbackCustom.PRE_NEW_LEVEL] = "PRE_NEW_LEVEL"
3051
3069
  return ____exports
3052
3070
  end,
@@ -4835,7 +4853,7 @@ return ____exports
4835
4853
  ["lua_modules.isaac-typescript-definitions.dist.package"] = function(...)
4836
4854
  return {
4837
4855
  name = "isaac-typescript-definitions",
4838
- version = "5.0.5",
4856
+ version = "7.0.0",
4839
4857
  description = "TypeScript definitions for The Binding of Isaac: Repentance.",
4840
4858
  keywords = {"isaac", "rebirth", "afterbirth", "repentance"},
4841
4859
  homepage = "https://isaacscript.github.io/",
@@ -4846,7 +4864,7 @@ return {
4846
4864
  type = "commonjs",
4847
4865
  main = "dist/src/index",
4848
4866
  types = "dist/src/index.d.ts",
4849
- dependencies = {["lua-types"] = "^2.12.2"}
4867
+ dependencies = {["lua-types"] = "^2.13.0"}
4850
4868
  }
4851
4869
  end,
4852
4870
  ["lua_modules.isaac-typescript-definitions.dist.src.enums.ActiveSlot"] = function(...)
@@ -17666,6 +17684,40 @@ function ____exports.preCustomReviveFire(self, player)
17666
17684
  end
17667
17685
  return nil
17668
17686
  end
17687
+ return ____exports
17688
+ end,
17689
+ ["src.callbacks.subscriptions.preGetPedestal"] = function(...)
17690
+ local ____exports = {}
17691
+ local subscriptions = {}
17692
+ function ____exports.preGetPedestalHasSubscriptions(self)
17693
+ return #subscriptions > 0
17694
+ end
17695
+ function ____exports.preGetPedestalRegister(self, ...)
17696
+ local args = {...}
17697
+ subscriptions[#subscriptions + 1] = args
17698
+ end
17699
+ function ____exports.preGetPedestalFire(self, player, collectible)
17700
+ local character = player:GetPlayerType()
17701
+ for ____, ____value in ipairs(subscriptions) do
17702
+ local callback = ____value[1]
17703
+ local callbackPlayerVariant = ____value[2]
17704
+ local callbackCharacter = ____value[3]
17705
+ do
17706
+ if callbackPlayerVariant ~= nil and callbackPlayerVariant ~= player.Variant then
17707
+ goto __continue5
17708
+ end
17709
+ if callbackCharacter ~= nil and callbackCharacter ~= character then
17710
+ goto __continue5
17711
+ end
17712
+ local returnValue = callback(nil, player, collectible)
17713
+ if returnValue ~= nil then
17714
+ return returnValue
17715
+ end
17716
+ end
17717
+ ::__continue5::
17718
+ end
17719
+ return nil
17720
+ end
17669
17721
  return ____exports
17670
17722
  end,
17671
17723
  ["src.callbacks.subscriptions.preItemPickup"] = function(...)
@@ -17905,6 +17957,8 @@ local ____preBerserkDeath = require("src.callbacks.subscriptions.preBerserkDeath
17905
17957
  local preBerserkDeathRegister = ____preBerserkDeath.preBerserkDeathRegister
17906
17958
  local ____preCustomRevive = require("src.callbacks.subscriptions.preCustomRevive")
17907
17959
  local preCustomReviveRegister = ____preCustomRevive.preCustomReviveRegister
17960
+ local ____preGetPedestal = require("src.callbacks.subscriptions.preGetPedestal")
17961
+ local preGetPedestalRegister = ____preGetPedestal.preGetPedestalRegister
17908
17962
  local ____preItemPickup = require("src.callbacks.subscriptions.preItemPickup")
17909
17963
  local preItemPickupRegister = ____preItemPickup.preItemPickupRegister
17910
17964
  local ____preNewLevel = require("src.callbacks.subscriptions.preNewLevel")
@@ -18003,6 +18057,7 @@ ____exports.CALLBACK_REGISTER_FUNCTIONS = {
18003
18057
  [ModCallbackCustom.POST_TRINKET_BREAK] = postTrinketBreakRegister,
18004
18058
  [ModCallbackCustom.PRE_BERSERK_DEATH] = preBerserkDeathRegister,
18005
18059
  [ModCallbackCustom.PRE_CUSTOM_REVIVE] = preCustomReviveRegister,
18060
+ [ModCallbackCustom.PRE_GET_PEDESTAL] = preGetPedestalRegister,
18006
18061
  [ModCallbackCustom.PRE_ITEM_PICKUP] = preItemPickupRegister,
18007
18062
  [ModCallbackCustom.PRE_NEW_LEVEL] = preNewLevelRegister
18008
18063
  }
@@ -18352,6 +18407,7 @@ local ____types = require("src.functions.types")
18352
18407
  local isBoolean = ____types.isBoolean
18353
18408
  local isNumber = ____types.isNumber
18354
18409
  local isString = ____types.isString
18410
+ local isTable = ____types.isTable
18355
18411
  --- In a `Map`, you can use the `clear` method to delete every element. However, in a `LuaMap`, the
18356
18412
  -- `clear` method does not exist. Use this helper function as a drop-in replacement for this.
18357
18413
  function ____exports.clearTable(self, luaMap)
@@ -18361,9 +18417,11 @@ function ____exports.clearTable(self, luaMap)
18361
18417
  end
18362
18418
  --- Helper function to copy specific values from a object to a table.
18363
18419
  function ____exports.copyValuesToTable(self, object, keys, luaMap)
18364
- local otherTable = object
18420
+ if not isTable(nil, object) then
18421
+ error("Failed to copy an object values to a table, since the object was of type: " .. type(object))
18422
+ end
18365
18423
  for ____, key in ipairs(keys) do
18366
- local value = otherTable[key]
18424
+ local value = object[key]
18367
18425
  luaMap[key] = value
18368
18426
  end
18369
18427
  end
@@ -26689,7 +26747,9 @@ end
26689
26747
  -- @param startingPosition The position to start searching from. If this position is not overlapping
26690
26748
  -- with anything, then it will be returned.
26691
26749
  -- @param avoidActiveEntities Optional. Default is false.
26692
- function ____exports.findFreePosition(self, startingPosition, avoidActiveEntities)
26750
+ -- @param minimumDistance Optional. If specified, will ensure that the randomly generated position
26751
+ -- is equal to or greater than the distance provided.
26752
+ function ____exports.findFreePosition(self, startingPosition, avoidActiveEntities, minimumDistance)
26693
26753
  if avoidActiveEntities == nil then
26694
26754
  avoidActiveEntities = false
26695
26755
  end
@@ -26708,6 +26768,12 @@ function ____exports.findFreePosition(self, startingPosition, avoidActiveEntitie
26708
26768
  if isCloseHeavenDoor then
26709
26769
  goto __continue7
26710
26770
  end
26771
+ if minimumDistance ~= nil then
26772
+ local distance = startingPosition:Distance(position)
26773
+ if distance < minimumDistance then
26774
+ goto __continue7
26775
+ end
26776
+ end
26711
26777
  return position
26712
26778
  end
26713
26779
  ::__continue7::
@@ -37935,6 +38001,48 @@ end
37935
38001
  function ____exports.preBerserkDeathInit(self, mod)
37936
38002
  mod:AddCallbackCustom(ModCallbackCustom.POST_PEFFECT_UPDATE_REORDERED, postPEffectUpdateReordered)
37937
38003
  end
38004
+ return ____exports
38005
+ end,
38006
+ ["src.callbacks.preGetPedestal"] = function(...)
38007
+ local ____exports = {}
38008
+ local hasSubscriptions, prePickupCollision
38009
+ local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
38010
+ local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
38011
+ local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
38012
+ local PickupVariant = ____isaac_2Dtypescript_2Ddefinitions.PickupVariant
38013
+ local ____preGetPedestal = require("src.callbacks.subscriptions.preGetPedestal")
38014
+ local preGetPedestalFire = ____preGetPedestal.preGetPedestalFire
38015
+ local preGetPedestalHasSubscriptions = ____preGetPedestal.preGetPedestalHasSubscriptions
38016
+ function hasSubscriptions(self)
38017
+ return preGetPedestalHasSubscriptions(nil)
38018
+ end
38019
+ function prePickupCollision(self, pickup, collider, _low)
38020
+ if not hasSubscriptions(nil) then
38021
+ return nil
38022
+ end
38023
+ local collectible = pickup
38024
+ if collectible.SubType == CollectibleType.NULL then
38025
+ return nil
38026
+ end
38027
+ local player = collider:ToPlayer()
38028
+ if player == nil then
38029
+ return nil
38030
+ end
38031
+ local numCoins = player:GetNumCoins()
38032
+ if collectible.Price > numCoins then
38033
+ return nil
38034
+ end
38035
+ if collectible.Wait > 0 or player.ItemHoldCooldown > 0 then
38036
+ return nil
38037
+ end
38038
+ if player:IsHoldingItem() then
38039
+ return nil
38040
+ end
38041
+ return preGetPedestalFire(nil, player, collectible)
38042
+ end
38043
+ function ____exports.preGetPedestalInit(self, mod)
38044
+ mod:AddCallback(ModCallback.PRE_PICKUP_COLLISION, prePickupCollision, PickupVariant.COLLECTIBLE)
38045
+ end
37938
38046
  return ____exports
37939
38047
  end,
37940
38048
  ["src.callbacks.preNewLevel"] = function(...)
@@ -38225,6 +38333,8 @@ local ____postTrinketBreak = require("src.callbacks.postTrinketBreak")
38225
38333
  local postTrinketBreakInit = ____postTrinketBreak.postTrinketBreakInit
38226
38334
  local ____preBerserkDeath = require("src.callbacks.preBerserkDeath")
38227
38335
  local preBerserkDeathInit = ____preBerserkDeath.preBerserkDeathInit
38336
+ local ____preGetPedestal = require("src.callbacks.preGetPedestal")
38337
+ local preGetPedestalInit = ____preGetPedestal.preGetPedestalInit
38228
38338
  local ____preNewLevel = require("src.callbacks.preNewLevel")
38229
38339
  local preNewLevelInit = ____preNewLevel.preNewLevelInit
38230
38340
  local ____reorderedCallbacks = require("src.callbacks.reorderedCallbacks")
@@ -38299,6 +38409,7 @@ function ____exports.initCustomCallbacks(self, mod)
38299
38409
  postTransformationInit(nil, mod)
38300
38410
  postTrinketBreakInit(nil, mod)
38301
38411
  preBerserkDeathInit(nil, mod)
38412
+ preGetPedestalInit(nil, mod)
38302
38413
  preNewLevelInit(nil, mod)
38303
38414
  reorderedCallbacksInit(nil, mod)
38304
38415
  end
@@ -46734,7 +46845,7 @@ return ____exports
46734
46845
  ["package"] = function(...)
46735
46846
  return {
46736
46847
  name = "isaacscript-common",
46737
- version = "9.19.2",
46848
+ version = "10.0.0",
46738
46849
  description = "Helper functions and features for IsaacScript mods.",
46739
46850
  keywords = {"isaac", "rebirth", "afterbirth", "repentance"},
46740
46851
  homepage = "https://isaacscript.github.io/",
@@ -46745,7 +46856,7 @@ return {
46745
46856
  type = "commonjs",
46746
46857
  main = "dist/src/index",
46747
46858
  types = "dist/src/index.d.ts",
46748
- dependencies = {["isaac-typescript-definitions"] = "^5.0.5"}
46859
+ dependencies = {["isaac-typescript-definitions"] = "^7.0.0"}
46749
46860
  }
46750
46861
  end,
46751
46862
  ["src.functions.map"] = function(...)
@@ -52406,9 +52517,11 @@ local ____lualib = require("lualib_bundle")
52406
52517
  local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
52407
52518
  local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
52408
52519
  local __TS__ArrayFind = ____lualib.__TS__ArrayFind
52520
+ local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
52409
52521
  local __TS__ArrayIncludes = ____lualib.__TS__ArrayIncludes
52410
52522
  local __TS__ArrayJoin = ____lualib.__TS__ArrayJoin
52411
52523
  local __TS__ArrayMap = ____lualib.__TS__ArrayMap
52524
+ local __TS__ArraySome = ____lualib.__TS__ArraySome
52412
52525
  local ____exports = {}
52413
52526
  --- Helper function for non-TypeScript users to check if every element in the array is equal to a
52414
52527
  -- condition.
@@ -52430,6 +52543,12 @@ end
52430
52543
  function ____exports.find(self, array, func)
52431
52544
  return __TS__ArrayFind(array, func)
52432
52545
  end
52546
+ --- Helper function for non-TypeScript users to iterate over an array.
52547
+ --
52548
+ -- Internally, this just calls `array.forEach`.
52549
+ function ____exports.forEach(self, array, func)
52550
+ __TS__ArrayForEach(array, func)
52551
+ end
52433
52552
  --- Helper function for non-TypeScript users to check if an element is in an array.
52434
52553
  --
52435
52554
  -- Since this takes O(N) time, using this function is usually a mistake, since you can use a `Map`
@@ -52453,6 +52572,13 @@ end
52453
52572
  function ____exports.map(self, array, func)
52454
52573
  return __TS__ArrayMap(array, func)
52455
52574
  end
52575
+ --- Helper function for non-TypeScript users to check if one or more elements in the array is equal
52576
+ -- to a condition.
52577
+ --
52578
+ -- Internally, this just calls `array.some`.
52579
+ function ____exports.some(self, array, func)
52580
+ return __TS__ArraySome(array, func)
52581
+ end
52456
52582
  return ____exports
52457
52583
  end,
52458
52584
  ["src.functions.benchmark"] = function(...)