isaacscript-common 1.2.161 → 1.2.164

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 (79) hide show
  1. package/dist/callbacks/customRevive.lua +2 -2
  2. package/dist/callbacks/itemPickup.lua +4 -4
  3. package/dist/callbacks/postCustomDoorEnter.d.ts +1 -1
  4. package/dist/callbacks/postCustomDoorEnter.lua +2 -2
  5. package/dist/callbacks/postGridEntityCollision.lua +2 -2
  6. package/dist/callbacks/postPlayerChangeHealth.lua +6 -6
  7. package/dist/callbacks/postPlayerChangeType.lua +4 -4
  8. package/dist/callbacks/postPurchase.lua +4 -4
  9. package/dist/callbacks/postSlotRender.lua +2 -2
  10. package/dist/callbacks/postTransformation.lua +4 -4
  11. package/dist/callbacks/postTrinketBreak.lua +4 -4
  12. package/dist/callbacks/preBerserkDeath.lua +2 -2
  13. package/dist/callbacks/subscriptions/postPlayerChangeHealth.d.ts +1 -1
  14. package/dist/classes/DefaultMap.d.ts +74 -0
  15. package/dist/classes/DefaultMap.lua +85 -0
  16. package/dist/classes/ModUpgraded.d.ts +19 -0
  17. package/dist/classes/ModUpgraded.lua +73 -0
  18. package/dist/enums/CardType.d.ts +40 -0
  19. package/dist/enums/CardType.lua +20 -0
  20. package/dist/enums/CollectiblePedestalType.d.ts +38 -0
  21. package/dist/enums/CollectiblePedestalType.lua +36 -0
  22. package/dist/enums/HealthType.d.ts +16 -0
  23. package/dist/enums/HealthType.lua +22 -0
  24. package/dist/enums/ModCallbacksCustom.d.ts +61 -0
  25. package/dist/enums/ModCallbacksCustom.lua +108 -0
  26. package/dist/enums/PillEffectClass.d.ts +17 -0
  27. package/dist/enums/PillEffectClass.lua +16 -0
  28. package/dist/enums/PillEffectType.d.ts +16 -0
  29. package/dist/enums/PillEffectType.lua +14 -0
  30. package/dist/enums/PocketItemType.d.ts +8 -0
  31. package/dist/enums/PocketItemType.lua +16 -0
  32. package/dist/enums/private/SaveDataKeys.d.ts +6 -0
  33. package/dist/enums/private/SaveDataKeys.lua +8 -0
  34. package/dist/enums/private/SerializationBrand.d.ts +15 -0
  35. package/dist/enums/private/SerializationBrand.lua +24 -0
  36. package/dist/features/deployJSONRoom.lua +2 -2
  37. package/dist/features/extraConsoleCommands/commands.lua +2 -2
  38. package/dist/features/isPonyActive.lua +2 -2
  39. package/dist/features/playerInventory.lua +4 -4
  40. package/dist/features/preventCollectibleRotate.lua +4 -2
  41. package/dist/features/saveDataManager/main.lua +4 -4
  42. package/dist/features/saveDataManager/merge.lua +3 -3
  43. package/dist/functions/cards.d.ts +1 -1
  44. package/dist/functions/cards.lua +2 -2
  45. package/dist/functions/collectibles.d.ts +1 -1
  46. package/dist/functions/deepCopy.lua +4 -4
  47. package/dist/functions/deepCopyTests.lua +2 -2
  48. package/dist/functions/gridEntity.lua +1 -4
  49. package/dist/functions/map.d.ts +1 -1
  50. package/dist/functions/pills.d.ts +2 -2
  51. package/dist/functions/player.d.ts +1 -1
  52. package/dist/functions/player.lua +2 -2
  53. package/dist/functions/playerDataStructures.d.ts +1 -1
  54. package/dist/functions/playerHealth.d.ts +1 -1
  55. package/dist/functions/playerHealth.lua +1 -1
  56. package/dist/functions/pocketItems.lua +1 -1
  57. package/dist/functions/string.d.ts +1 -0
  58. package/dist/functions/string.lua +6 -0
  59. package/dist/functions/transformations.lua +2 -2
  60. package/dist/index.d.ts +10 -8
  61. package/dist/index.lua +73 -57
  62. package/dist/objects/callbackRegisterFunctions.d.ts +1 -1
  63. package/dist/objects/callbackRegisterFunctions.lua +1 -1
  64. package/dist/objects/cardTypes.d.ts +1 -1
  65. package/dist/objects/cardTypes.lua +1 -1
  66. package/dist/objects/directionNames.d.ts +4 -0
  67. package/dist/objects/directionNames.lua +10 -0
  68. package/dist/objects/pillEffectClasses.d.ts +1 -1
  69. package/dist/objects/pillEffectClasses.lua +1 -1
  70. package/dist/objects/pillEffectTypes.d.ts +1 -1
  71. package/dist/objects/pillEffectTypes.lua +1 -1
  72. package/dist/types/AddCallbackParametersCustom.d.ts +1 -1
  73. package/dist/types/AddCallbackParametersCustom.lua +1 -1
  74. package/dist/types/PocketItemDescription.d.ts +1 -1
  75. package/dist/types/private/SaveData.d.ts +0 -6
  76. package/dist/types/private/SaveData.lua +0 -5
  77. package/dist/upgradeMod.d.ts +1 -1
  78. package/dist/upgradeMod.lua +2 -2
  79. package/package.json +1 -1
@@ -3,6 +3,8 @@ local ____exports = {}
3
3
  local hasSubscriptions, postRender, postNewRoom, postPEffectUpdateReordered, checkWaitingForItemAnimation, postPlayerFatalDamage, preBerserkDeath, playerIsAboutToDie, logStateChanged, DEBUG, CustomReviveState, v
4
4
  local ____cachedClasses = require("cachedClasses")
5
5
  local sfxManager = ____cachedClasses.sfxManager
6
+ local ____ModCallbacksCustom = require("enums.ModCallbacksCustom")
7
+ local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
6
8
  local ____runInNFrames = require("features.runInNFrames")
7
9
  local runNextGameFrame = ____runInNFrames.runNextGameFrame
8
10
  local ____exports = require("features.saveDataManager.exports")
@@ -16,8 +18,6 @@ local log = ____log.log
16
18
  local ____player = require("functions.player")
17
19
  local getPlayerFromIndex = ____player.getPlayerFromIndex
18
20
  local getPlayerIndex = ____player.getPlayerIndex
19
- local ____ModCallbacksCustom = require("types.ModCallbacksCustom")
20
- local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
21
21
  local ____postCustomRevive = require("callbacks.subscriptions.postCustomRevive")
22
22
  local postCustomReviveFire = ____postCustomRevive.postCustomReviveFire
23
23
  local postCustomReviveHasSubscriptions = ____postCustomRevive.postCustomReviveHasSubscriptions
@@ -3,14 +3,14 @@ local ____lualib = require("lualib_bundle")
3
3
  local __TS__New = ____lualib.__TS__New
4
4
  local ____exports = {}
5
5
  local hasSubscriptions, postPEffectUpdateReordered, queueEmpty, queueNotEmpty, v
6
+ local ____DefaultMap = require("classes.DefaultMap")
7
+ local DefaultMap = ____DefaultMap.DefaultMap
8
+ local ____ModCallbacksCustom = require("enums.ModCallbacksCustom")
9
+ local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
6
10
  local ____exports = require("features.saveDataManager.exports")
7
11
  local saveDataManager = ____exports.saveDataManager
8
12
  local ____playerDataStructures = require("functions.playerDataStructures")
9
13
  local defaultMapGetPlayer = ____playerDataStructures.defaultMapGetPlayer
10
- local ____DefaultMap = require("types.DefaultMap")
11
- local DefaultMap = ____DefaultMap.DefaultMap
12
- local ____ModCallbacksCustom = require("types.ModCallbacksCustom")
13
- local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
14
14
  local ____PickingUpItem = require("types.PickingUpItem")
15
15
  local newPickingUpItem = ____PickingUpItem.newPickingUpItem
16
16
  local resetPickingUpItem = ____PickingUpItem.resetPickingUpItem
@@ -1,5 +1,5 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
- import { ModUpgraded } from "../types/ModUpgraded";
2
+ import { ModUpgraded } from "../classes/ModUpgraded";
3
3
  /**
4
4
  * `isaacscript-common` provides custom doors that can be spawned where any wall segment is. If you
5
5
  * use this feature, you must first call this initialization function at the beginning of your mod.
@@ -7,6 +7,8 @@ local ____exports = {}
7
7
  local hasSubscriptions, postEffectUpdaterCustomEntity, doorChangedState, getAnimationForCustomDoor, postEffectRenderCustomEntity, isPlayerPastDoorThreshold, roomClearChange, getPositionOffset, POSITION_OFFSET_MULTIPLIER, v
8
8
  local ____cachedClasses = require("cachedClasses")
9
9
  local game = ____cachedClasses.game
10
+ local ____ModCallbacksCustom = require("enums.ModCallbacksCustom")
11
+ local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
10
12
  local ____exports = require("features.saveDataManager.exports")
11
13
  local saveDataManager = ____exports.saveDataManager
12
14
  local ____doors = require("functions.doors")
@@ -19,8 +21,6 @@ local ____utils = require("functions.utils")
19
21
  local ensureAllCases = ____utils.ensureAllCases
20
22
  local ____vector = require("functions.vector")
21
23
  local directionToVector = ____vector.directionToVector
22
- local ____ModCallbacksCustom = require("types.ModCallbacksCustom")
23
- local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
24
24
  local ____postCustomDoorEnter = require("callbacks.subscriptions.postCustomDoorEnter")
25
25
  local postCustomDoorEnterFire = ____postCustomDoorEnter.postCustomDoorEnterFire
26
26
  local postCustomDoorEnterHasSubscriptions = ____postCustomDoorEnter.postCustomDoorEnterHasSubscriptions
@@ -7,13 +7,13 @@ local __TS__ArrayMap = ____lualib.__TS__ArrayMap
7
7
  local __TS__Iterator = ____lualib.__TS__Iterator
8
8
  local ____exports = {}
9
9
  local hasSubscriptions, postUpdate, v
10
+ local ____DefaultMap = require("classes.DefaultMap")
11
+ local DefaultMap = ____DefaultMap.DefaultMap
10
12
  local ____exports = require("features.saveDataManager.exports")
11
13
  local saveDataManager = ____exports.saveDataManager
12
14
  local ____gridEntity = require("functions.gridEntity")
13
15
  local getCollidingEntitiesWithGridEntity = ____gridEntity.getCollidingEntitiesWithGridEntity
14
16
  local getGridEntities = ____gridEntity.getGridEntities
15
- local ____DefaultMap = require("types.DefaultMap")
16
- local DefaultMap = ____DefaultMap.DefaultMap
17
17
  local ____postGridEntityCollision = require("callbacks.subscriptions.postGridEntityCollision")
18
18
  local postGridEntityCollisionFire = ____postGridEntityCollision.postGridEntityCollisionFire
19
19
  local postGridEntityCollisionHasSubscriptions = ____postGridEntityCollision.postGridEntityCollisionHasSubscriptions
@@ -4,6 +4,12 @@ local Map = ____lualib.Map
4
4
  local __TS__New = ____lualib.__TS__New
5
5
  local ____exports = {}
6
6
  local hasSubscriptions, postPEffectUpdateReordered, v
7
+ local ____DefaultMap = require("classes.DefaultMap")
8
+ local DefaultMap = ____DefaultMap.DefaultMap
9
+ local ____HealthType = require("enums.HealthType")
10
+ local HealthType = ____HealthType.HealthType
11
+ local ____ModCallbacksCustom = require("enums.ModCallbacksCustom")
12
+ local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
7
13
  local ____exports = require("features.saveDataManager.exports")
8
14
  local saveDataManager = ____exports.saveDataManager
9
15
  local ____player = require("functions.player")
@@ -12,12 +18,6 @@ local ____playerHealth = require("functions.playerHealth")
12
18
  local getPlayerHealthType = ____playerHealth.getPlayerHealthType
13
19
  local ____utils = require("functions.utils")
14
20
  local getEnumValues = ____utils.getEnumValues
15
- local ____DefaultMap = require("types.DefaultMap")
16
- local DefaultMap = ____DefaultMap.DefaultMap
17
- local ____HealthType = require("types.HealthType")
18
- local HealthType = ____HealthType.HealthType
19
- local ____ModCallbacksCustom = require("types.ModCallbacksCustom")
20
- local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
21
21
  local ____postPlayerChangeHealth = require("callbacks.subscriptions.postPlayerChangeHealth")
22
22
  local postPlayerChangeHealthFire = ____postPlayerChangeHealth.postPlayerChangeHealthFire
23
23
  local postPlayerChangeHealthHasSubscriptions = ____postPlayerChangeHealth.postPlayerChangeHealthHasSubscriptions
@@ -3,15 +3,15 @@ local ____lualib = require("lualib_bundle")
3
3
  local __TS__New = ____lualib.__TS__New
4
4
  local ____exports = {}
5
5
  local hasSubscriptions, postPEffectUpdateReordered, v
6
+ local ____DefaultMap = require("classes.DefaultMap")
7
+ local DefaultMap = ____DefaultMap.DefaultMap
8
+ local ____ModCallbacksCustom = require("enums.ModCallbacksCustom")
9
+ local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
6
10
  local ____exports = require("features.saveDataManager.exports")
7
11
  local saveDataManager = ____exports.saveDataManager
8
12
  local ____playerDataStructures = require("functions.playerDataStructures")
9
13
  local defaultMapGetPlayer = ____playerDataStructures.defaultMapGetPlayer
10
14
  local mapSetPlayer = ____playerDataStructures.mapSetPlayer
11
- local ____DefaultMap = require("types.DefaultMap")
12
- local DefaultMap = ____DefaultMap.DefaultMap
13
- local ____ModCallbacksCustom = require("types.ModCallbacksCustom")
14
- local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
15
15
  local ____postPlayerChangeType = require("callbacks.subscriptions.postPlayerChangeType")
16
16
  local postPlayerChangeTypeFire = ____postPlayerChangeType.postPlayerChangeTypeFire
17
17
  local postPlayerChangeTypeHasSubscriptions = ____postPlayerChangeType.postPlayerChangeTypeHasSubscriptions
@@ -4,6 +4,10 @@ local __TS__New = ____lualib.__TS__New
4
4
  local __TS__ArrayFind = ____lualib.__TS__ArrayFind
5
5
  local ____exports = {}
6
6
  local hasSubscriptions, postPEffectUpdateReordered, playerPickedUpNewItem, v
7
+ local ____DefaultMap = require("classes.DefaultMap")
8
+ local DefaultMap = ____DefaultMap.DefaultMap
9
+ local ____ModCallbacksCustom = require("enums.ModCallbacksCustom")
10
+ local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
7
11
  local ____exports = require("features.saveDataManager.exports")
8
12
  local saveDataManager = ____exports.saveDataManager
9
13
  local ____pickups = require("functions.pickups")
@@ -11,10 +15,6 @@ local getPickups = ____pickups.getPickups
11
15
  local ____playerDataStructures = require("functions.playerDataStructures")
12
16
  local defaultMapGetPlayer = ____playerDataStructures.defaultMapGetPlayer
13
17
  local mapSetPlayer = ____playerDataStructures.mapSetPlayer
14
- local ____DefaultMap = require("types.DefaultMap")
15
- local DefaultMap = ____DefaultMap.DefaultMap
16
- local ____ModCallbacksCustom = require("types.ModCallbacksCustom")
17
- local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
18
18
  local ____postPurchase = require("callbacks.subscriptions.postPurchase")
19
19
  local postPurchaseFire = ____postPurchase.postPurchaseFire
20
20
  local postPurchaseHasSubscriptions = ____postPurchase.postPurchaseHasSubscriptions
@@ -4,12 +4,12 @@ local Set = ____lualib.Set
4
4
  local __TS__New = ____lualib.__TS__New
5
5
  local ____exports = {}
6
6
  local hasSubscriptions, postRender, checkSlotAnimationChanged, checkSlotBroken, BROKEN_ANIMATIONS, v
7
+ local ____DefaultMap = require("classes.DefaultMap")
8
+ local DefaultMap = ____DefaultMap.DefaultMap
7
9
  local ____exports = require("features.saveDataManager.exports")
8
10
  local saveDataManager = ____exports.saveDataManager
9
11
  local ____entitySpecific = require("functions.entitySpecific")
10
12
  local getSlots = ____entitySpecific.getSlots
11
- local ____DefaultMap = require("types.DefaultMap")
12
- local DefaultMap = ____DefaultMap.DefaultMap
13
13
  local ____postSlotAnimationChanged = require("callbacks.subscriptions.postSlotAnimationChanged")
14
14
  local postSlotAnimationChangedFire = ____postSlotAnimationChanged.postSlotAnimationChangedFire
15
15
  local postSlotAnimationChangedHasSubscriptions = ____postSlotAnimationChanged.postSlotAnimationChangedHasSubscriptions
@@ -5,16 +5,16 @@ local __TS__New = ____lualib.__TS__New
5
5
  local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
6
6
  local ____exports = {}
7
7
  local hasSubscriptions, postPEffectUpdateReordered, VALID_TRANSFORMATIONS, v
8
+ local ____DefaultMap = require("classes.DefaultMap")
9
+ local DefaultMap = ____DefaultMap.DefaultMap
10
+ local ____ModCallbacksCustom = require("enums.ModCallbacksCustom")
11
+ local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
8
12
  local ____exports = require("features.saveDataManager.exports")
9
13
  local saveDataManager = ____exports.saveDataManager
10
14
  local ____math = require("functions.math")
11
15
  local range = ____math.range
12
16
  local ____playerDataStructures = require("functions.playerDataStructures")
13
17
  local defaultMapGetPlayer = ____playerDataStructures.defaultMapGetPlayer
14
- local ____DefaultMap = require("types.DefaultMap")
15
- local DefaultMap = ____DefaultMap.DefaultMap
16
- local ____ModCallbacksCustom = require("types.ModCallbacksCustom")
17
- local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
18
18
  local ____postTransformation = require("callbacks.subscriptions.postTransformation")
19
19
  local postTransformationFire = ____postTransformation.postTransformationFire
20
20
  local postTransformationHasSubscriptions = ____postTransformation.postTransformationHasSubscriptions
@@ -3,14 +3,14 @@ local ____lualib = require("lualib_bundle")
3
3
  local __TS__New = ____lualib.__TS__New
4
4
  local ____exports = {}
5
5
  local hasSubscriptions, entityTakeDmgPlayer, postPEffectUpdateReordered, TRINKETS_THAT_CAN_BREAK, v
6
+ local ____DefaultMap = require("classes.DefaultMap")
7
+ local DefaultMap = ____DefaultMap.DefaultMap
8
+ local ____ModCallbacksCustom = require("enums.ModCallbacksCustom")
9
+ local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
6
10
  local ____exports = require("features.saveDataManager.exports")
7
11
  local saveDataManager = ____exports.saveDataManager
8
12
  local ____playerDataStructures = require("functions.playerDataStructures")
9
13
  local defaultMapGetPlayer = ____playerDataStructures.defaultMapGetPlayer
10
- local ____DefaultMap = require("types.DefaultMap")
11
- local DefaultMap = ____DefaultMap.DefaultMap
12
- local ____ModCallbacksCustom = require("types.ModCallbacksCustom")
13
- local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
14
14
  local ____postTrinketBreak = require("callbacks.subscriptions.postTrinketBreak")
15
15
  local postTrinketBreakFire = ____postTrinketBreak.postTrinketBreakFire
16
16
  local postTrinketBreakHasSubscriptions = ____postTrinketBreak.postTrinketBreakHasSubscriptions
@@ -1,13 +1,13 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  local ____exports = {}
3
3
  local hasSubscriptions, postPEffectUpdateReordered
4
+ local ____ModCallbacksCustom = require("enums.ModCallbacksCustom")
5
+ local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
4
6
  local ____player = require("functions.player")
5
7
  local getPlayerNumHitsRemaining = ____player.getPlayerNumHitsRemaining
6
8
  local isChildPlayer = ____player.isChildPlayer
7
9
  local ____revive = require("functions.revive")
8
10
  local willPlayerRevive = ____revive.willPlayerRevive
9
- local ____ModCallbacksCustom = require("types.ModCallbacksCustom")
10
- local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
11
11
  local ____preBerserkDeath = require("callbacks.subscriptions.preBerserkDeath")
12
12
  local preBerserkDeathFire = ____preBerserkDeath.preBerserkDeathFire
13
13
  local preBerserkDeathHasSubscriptions = ____preBerserkDeath.preBerserkDeathHasSubscriptions
@@ -1,3 +1,3 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
- import { HealthType } from "../../types/HealthType";
2
+ import { HealthType } from "../../enums/HealthType";
3
3
  export declare type PostPlayerChangeHealthCallbackType = (player: EntityPlayer, healthType: HealthType, amount: int) => void;
@@ -0,0 +1,74 @@
1
+ declare type FactoryFunction<K, V, A extends unknown[]> = (k: K, ...extraArgs: A) => V;
2
+ declare type FirstArg<K, V, A extends unknown[]> = Iterable<[K, V]> | V | FactoryFunction<K, V, A>;
3
+ declare type SecondArg<K, V, A extends unknown[]> = V | FactoryFunction<K, V, A>;
4
+ /**
5
+ * An extended Map with some new methods:
6
+ *
7
+ * - `getAndSetDefault` - If the key exists, this will return the same thing as the `get` method.
8
+ * Otherwise, it will set a default value to the key, and then return the default value.
9
+ * - `getDefaultValue` - Returns the default value to be used for a new key. (If a factory function
10
+ * was provided during instantiation, this will execute the factory function.)
11
+ * - `getConstructorArg` - Helper method for cloning the map. Returns either the default value or
12
+ * the reference to the factory function.
13
+ *
14
+ * When instantiating a new DefaultMap, you must specify either a default value or a function that
15
+ * returns a default value.
16
+ *
17
+ * Example:
18
+ * ```ts
19
+ * // Initializes a new empty DefaultMap with a default value of "foo"
20
+ * const defaultMapWithPrimitive = new DefaultMap<string, string>("foo");
21
+ *
22
+ * // Initializes a new empty DefaultMap with a default value of a new Map
23
+ * const defaultMapWithFactory = new DefaultMap<string, Map<string, string>>(() => {
24
+ * return new Map();
25
+ * })
26
+ *
27
+ * // Initializes a DefaultMap with some initial values and a default value of "bar"
28
+ * const defaultMapWithInitialValues = new DefaultMap<string, string>([
29
+ * ["a1", "a2"],
30
+ * ["b1", "b2"],
31
+ * ], "bar");
32
+ * ```
33
+ *
34
+ * If specified, the first argument of a factory function must always be equal to the key:
35
+ *
36
+ * ```ts
37
+ * const defaultMapWithConditionalDefaultValue = new DefaultMap<number, number>((key: number) => {
38
+ * return isOdd(key) ? 0 : 1;
39
+ * });
40
+ * ```
41
+ *
42
+ * You can also specify a factory function that takes a generic amount of arguments beyond the
43
+ * first:
44
+ *
45
+ * ```ts
46
+ * const factoryFunction = (_key: string, arg2: boolean) => arg2 ? 0 : 1;
47
+ * const defaultMapWithExtraArgs = new DefaultMap<string, string, [arg2: boolean]>(factoryFunction);
48
+ * ```
49
+ */
50
+ export declare class DefaultMap<K, V, A extends unknown[] = []> extends Map<K, V> {
51
+ private defaultValue;
52
+ private defaultValueFactory;
53
+ /**
54
+ * See the DefaultMap documentation:
55
+ * https://isaacscript.github.io/isaacscript-common/classes/types_DefaultMap.DefaultMap.html
56
+ */
57
+ constructor(iterableOrDefaultValueOrDefaultValueFactory: FirstArg<K, V, A>, defaultValueOrDefaultValueFactory?: SecondArg<K, V, A>);
58
+ /**
59
+ * If the key exists, this will return the same thing as the `get` method. Otherwise, it will set
60
+ * a default value to the key, and then return the default value.
61
+ */
62
+ getAndSetDefault(key: K, ...extraArgs: A): V;
63
+ /**
64
+ * Returns the default value to be used for a new key. (If a factory function was provided during
65
+ * instantiation, this will execute the factory function.)
66
+ */
67
+ getDefaultValue(key: K, ...extraArgs: A): V;
68
+ /**
69
+ * Helper method for cloning the map. Returns either the default value or a reference to the
70
+ * factory function.
71
+ */
72
+ getConstructorArg(): V | FactoryFunction<K, V, A>;
73
+ }
74
+ export {};
@@ -0,0 +1,85 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____lualib = require("lualib_bundle")
3
+ local __TS__Class = ____lualib.__TS__Class
4
+ local Map = ____lualib.Map
5
+ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
6
+ local __TS__TypeOf = ____lualib.__TS__TypeOf
7
+ local ____exports = {}
8
+ local parseArguments, parseArgumentsOne, parseArgumentsTwo, parseDefaultValueOrDefaultValueFactory
9
+ function parseArguments(self, firstArg, secondArg)
10
+ return secondArg == nil and parseArgumentsOne(nil, firstArg) or parseArgumentsTwo(nil, firstArg, secondArg)
11
+ end
12
+ function parseArgumentsOne(self, firstArg)
13
+ local arg = firstArg
14
+ local ____parseDefaultValueOrDefaultValueFactory_result_1 = parseDefaultValueOrDefaultValueFactory(nil, arg)
15
+ local defaultValue = ____parseDefaultValueOrDefaultValueFactory_result_1.defaultValue
16
+ local defaultValueFactory = ____parseDefaultValueOrDefaultValueFactory_result_1.defaultValueFactory
17
+ return {iterable = nil, defaultValue = defaultValue, defaultValueFactory = defaultValueFactory}
18
+ end
19
+ function parseArgumentsTwo(self, firstArg, secondArg)
20
+ local firstArgType = type(firstArg)
21
+ if firstArgType ~= "table" then
22
+ error("A DefaultMap constructor with two arguments must have the first argument be the initializer list.")
23
+ end
24
+ local ____parseDefaultValueOrDefaultValueFactory_result_2 = parseDefaultValueOrDefaultValueFactory(nil, secondArg)
25
+ local defaultValue = ____parseDefaultValueOrDefaultValueFactory_result_2.defaultValue
26
+ local defaultValueFactory = ____parseDefaultValueOrDefaultValueFactory_result_2.defaultValueFactory
27
+ return {iterable = firstArg, defaultValue = defaultValue, defaultValueFactory = defaultValueFactory}
28
+ end
29
+ function parseDefaultValueOrDefaultValueFactory(self, arg)
30
+ if type(arg) == "function" then
31
+ return {defaultValue = nil, defaultValueFactory = arg}
32
+ end
33
+ if type(arg) == "boolean" or type(arg) == "number" or type(arg) == "string" then
34
+ return {defaultValue = arg, defaultValueFactory = nil}
35
+ end
36
+ return error("A DefaultMap was instantiated with an unknown type of: " .. __TS__TypeOf(arg))
37
+ end
38
+ ____exports.DefaultMap = __TS__Class()
39
+ local DefaultMap = ____exports.DefaultMap
40
+ DefaultMap.name = "DefaultMap"
41
+ __TS__ClassExtends(DefaultMap, Map)
42
+ function DefaultMap.prototype.____constructor(self, iterableOrDefaultValueOrDefaultValueFactory, defaultValueOrDefaultValueFactory)
43
+ local ____parseArguments_result_0 = parseArguments(nil, iterableOrDefaultValueOrDefaultValueFactory, defaultValueOrDefaultValueFactory)
44
+ local iterable = ____parseArguments_result_0.iterable
45
+ local defaultValue = ____parseArguments_result_0.defaultValue
46
+ local defaultValueFactory = ____parseArguments_result_0.defaultValueFactory
47
+ if defaultValue == nil and defaultValueFactory == nil then
48
+ error("A DefaultMap must be instantiated with either a default value or a function that returns a default value.")
49
+ end
50
+ if iterable == nil then
51
+ Map.prototype.____constructor(self)
52
+ else
53
+ Map.prototype.____constructor(self, iterable)
54
+ end
55
+ self.defaultValue = defaultValue
56
+ self.defaultValueFactory = defaultValueFactory
57
+ end
58
+ function DefaultMap.prototype.getAndSetDefault(self, key, ...)
59
+ local value = self:get(key)
60
+ if value ~= nil then
61
+ return value
62
+ end
63
+ local defaultValue = self:getDefaultValue(key, ...)
64
+ self:set(key, defaultValue)
65
+ return defaultValue
66
+ end
67
+ function DefaultMap.prototype.getDefaultValue(self, key, ...)
68
+ if self.defaultValue ~= nil then
69
+ return self.defaultValue
70
+ end
71
+ if self.defaultValueFactory ~= nil then
72
+ return self:defaultValueFactory(key, ...)
73
+ end
74
+ return error("A DefaultMap was incorrectly instantiated.")
75
+ end
76
+ function DefaultMap.prototype.getConstructorArg(self)
77
+ if self.defaultValue ~= nil then
78
+ return self.defaultValue
79
+ end
80
+ if self.defaultValueFactory ~= nil then
81
+ return self.defaultValueFactory
82
+ end
83
+ return error("A DefaultMap was incorrectly instantiated.")
84
+ end
85
+ return ____exports
@@ -0,0 +1,19 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ import { ModCallbacksCustom } from "../enums/ModCallbacksCustom";
3
+ import { AddCallbackParametersCustom } from "../types/AddCallbackParametersCustom";
4
+ /** `isaacscript-common` allows for custom callbacks, so it provides an upgraded Mod object. */
5
+ export declare class ModUpgraded implements Mod {
6
+ Name: string;
7
+ /** We store a copy of the original mod object so that we can re-implement its functions. */
8
+ Mod: Mod;
9
+ /** End-users can optionally enable verbose-mode, which helps troubleshoot crashes. */
10
+ Verbose: boolean;
11
+ constructor(mod: Mod, verbose: boolean);
12
+ AddCallback<T extends ModCallbacks>(modCallbacks: T, ...args: AddCallbackParameters[T]): void;
13
+ HasData(): boolean;
14
+ LoadData(): string;
15
+ RemoveCallback(callbackID: ModCallbacks, callback: () => void): void;
16
+ RemoveData(): void;
17
+ SaveData(data: string): void;
18
+ AddCallbackCustom<T extends ModCallbacksCustom>(modCallbacksCustom: T, ...args: AddCallbackParametersCustom[T]): void;
19
+ }
@@ -0,0 +1,73 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____lualib = require("lualib_bundle")
3
+ local __TS__Class = ____lualib.__TS__Class
4
+ local __TS__Spread = ____lualib.__TS__Spread
5
+ local __TS__ObjectEntries = ____lualib.__TS__ObjectEntries
6
+ local ____exports = {}
7
+ local getCallbackName
8
+ local ____log = require("functions.log")
9
+ local getDebugPrependString = ____log.getDebugPrependString
10
+ local ____callbackRegisterFunctions = require("objects.callbackRegisterFunctions")
11
+ local CALLBACK_REGISTER_FUNCTIONS = ____callbackRegisterFunctions.CALLBACK_REGISTER_FUNCTIONS
12
+ function getCallbackName(self, callbackID)
13
+ for ____, ____value in ipairs(__TS__ObjectEntries(ModCallbacks)) do
14
+ local key = ____value[1]
15
+ local value = ____value[2]
16
+ if value == callbackID then
17
+ return key
18
+ end
19
+ end
20
+ return "MC_UNKNOWN"
21
+ end
22
+ ____exports.ModUpgraded = __TS__Class()
23
+ local ModUpgraded = ____exports.ModUpgraded
24
+ ModUpgraded.name = "ModUpgraded"
25
+ function ModUpgraded.prototype.____constructor(self, mod, verbose)
26
+ self.Name = mod.Name
27
+ self.Mod = mod
28
+ self.Verbose = verbose
29
+ end
30
+ function ModUpgraded.prototype.AddCallback(self, modCallbacks, ...)
31
+ local args = {...}
32
+ if self.Verbose then
33
+ local callback = args[1]
34
+ local optionalArg = args[2]
35
+ local callbackName = getCallbackName(nil, modCallbacks)
36
+ local debugMsg = getDebugPrependString(nil, callbackName)
37
+ local function callbackWithLogger(____, ...)
38
+ Isaac.DebugString(debugMsg .. " - START")
39
+ local value = callback(nil, ...)
40
+ Isaac.DebugString((debugMsg .. " - END - ") .. tostring(value))
41
+ return value
42
+ end
43
+ self.Mod:AddCallback(modCallbacks, callbackWithLogger, optionalArg)
44
+ else
45
+ self.Mod:AddCallback(
46
+ modCallbacks,
47
+ __TS__Spread(args)
48
+ )
49
+ end
50
+ end
51
+ function ModUpgraded.prototype.HasData(self)
52
+ return self.Mod:HasData()
53
+ end
54
+ function ModUpgraded.prototype.LoadData(self)
55
+ return self.Mod:LoadData()
56
+ end
57
+ function ModUpgraded.prototype.RemoveCallback(self, callbackID, callback)
58
+ self.Mod:RemoveCallback(callbackID, callback)
59
+ end
60
+ function ModUpgraded.prototype.RemoveData(self)
61
+ self.Mod:RemoveData()
62
+ end
63
+ function ModUpgraded.prototype.SaveData(self, data)
64
+ self.Mod:SaveData(data)
65
+ end
66
+ function ModUpgraded.prototype.AddCallbackCustom(self, modCallbacksCustom, ...)
67
+ local callbackRegisterFunction = CALLBACK_REGISTER_FUNCTIONS[modCallbacksCustom]
68
+ if callbackRegisterFunction == nil then
69
+ error("Failed to find a callback registration function for custom callback: " .. tostring(modCallbacksCustom))
70
+ end
71
+ callbackRegisterFunction(nil, ...)
72
+ end
73
+ return ____exports
@@ -0,0 +1,40 @@
1
+ /** Matches the "type" attribute in the "pocketitems.xml" file. */
2
+ export declare enum CardType {
3
+ /** No valid card will have this type. */
4
+ NULL = 0,
5
+ /** A normal card with a brown back, like "0 - The Fool". */
6
+ TAROT = 1,
7
+ /** A playing card with a red back, like 2 of Clubs. This includes the Queen of Hearts. */
8
+ SUIT = 2,
9
+ /**
10
+ * A left-facing rune like Hagalaz, a right-facing rune like Ansuz, a Black Rune, a Blank Rune, a
11
+ * a Rune Shard, or a "soul" rune like Soul of Isaac.
12
+ */
13
+ RUNE = 3,
14
+ /**
15
+ * A card that does not fall into any of the other categories, like a Chaos Card (42).
16
+ *
17
+ * Most of these have unique backs.
18
+ *
19
+ * 4 cards share the Magic the Gathering back:
20
+ * - Chaos Card (42)
21
+ * - Huge Growth (52)
22
+ * - Ancient Recall (53)
23
+ * - Era Walk (54)
24
+ *
25
+ * 3 cards have a red playing card back:
26
+ * - Rules Card (44)
27
+ * - Suicide King (46)
28
+ * - ? Card (48)
29
+ */
30
+ SPECIAL = 4,
31
+ /** A Dice Shard, an Emergency Contact, or a Cracked Key. */
32
+ OBJECT = 5,
33
+ /** A reverse tarot card with a reddish-brown back, like "0 - The Fool?". */
34
+ TAROT_REVERSE = 6,
35
+ /**
36
+ * This is not a real `CardType`. Due to limitations in the API, getting the real type of modded
37
+ * cards is not possible, so this value is returned instead.
38
+ */
39
+ MODDED = 7
40
+ }
@@ -0,0 +1,20 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____exports = {}
3
+ ____exports.CardType = CardType or ({})
4
+ ____exports.CardType.NULL = 0
5
+ ____exports.CardType[____exports.CardType.NULL] = "NULL"
6
+ ____exports.CardType.TAROT = 1
7
+ ____exports.CardType[____exports.CardType.TAROT] = "TAROT"
8
+ ____exports.CardType.SUIT = 2
9
+ ____exports.CardType[____exports.CardType.SUIT] = "SUIT"
10
+ ____exports.CardType.RUNE = 3
11
+ ____exports.CardType[____exports.CardType.RUNE] = "RUNE"
12
+ ____exports.CardType.SPECIAL = 4
13
+ ____exports.CardType[____exports.CardType.SPECIAL] = "SPECIAL"
14
+ ____exports.CardType.OBJECT = 5
15
+ ____exports.CardType[____exports.CardType.OBJECT] = "OBJECT"
16
+ ____exports.CardType.TAROT_REVERSE = 6
17
+ ____exports.CardType[____exports.CardType.TAROT_REVERSE] = "TAROT_REVERSE"
18
+ ____exports.CardType.MODDED = 7
19
+ ____exports.CardType[____exports.CardType.MODDED] = "MODDED"
20
+ return ____exports
@@ -0,0 +1,38 @@
1
+ /** Corresponds to the overlay frame number in "005.100_collectible.anm2". */
2
+ export declare enum CollectiblePedestalType {
3
+ /**
4
+ * Used for e.g. shop collectibles. In the "005.100_collectible.anm2" file, this is represented by
5
+ * the final frame.
6
+ */
7
+ NONE = -1,
8
+ /** The normal grey pedestal. */
9
+ NORMAL = 0,
10
+ /** From SlotVariant.FORTUNE_TELLING_MACHINE (3) */
11
+ FORTUNE_TELLING_MACHINE = 1,
12
+ /** From SlotVariant.BLOOD_DONATION_MACHINE (2) */
13
+ BLOOD_DONATION_MACHINE = 2,
14
+ /** From SlotVariant.SLOT_MACHINE (1) */
15
+ SLOT_MACHINE = 3,
16
+ /** From PickupVariant.LOCKEDCHEST (60) */
17
+ LOCKEDCHEST = 4,
18
+ /** From PickupVariant.PICKUP_REDCHEST (360) */
19
+ REDCHEST = 5,
20
+ /** From PickupVariant.PICKUP_BOMBCHEST (51) */
21
+ BOMBCHEST = 6,
22
+ /** From PickupVariant.PICKUP_SPIKEDCHEST (52) */
23
+ SPIKEDCHEST = 7,
24
+ /** From PickupVariant.PICKUP_ETERNALCHEST (53) */
25
+ ETERNALCHEST = 8,
26
+ /** From SlotVariant.MOMS_DRESSING_TABLE (12) */
27
+ MOMS_DRESSING_TABLE = 9,
28
+ /** From PickupVariant.PICKUP_CHEST (50) */
29
+ CHEST = 10,
30
+ /** From PickupVariant.PICKUP_MOMSCHEST (390) */
31
+ MOMSCHEST = 11,
32
+ /** From PickupVariant.PICKUP_OLDCHEST (55) */
33
+ OLDCHEST = 12,
34
+ /** From PickupVariant.PICKUP_WOODENCHEST (56) */
35
+ WOODENCHEST = 13,
36
+ /** From PickupVariant.PICKUP_MEGACHEST (57) */
37
+ MEGACHEST = 14
38
+ }
@@ -0,0 +1,36 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____exports = {}
3
+ ____exports.CollectiblePedestalType = CollectiblePedestalType or ({})
4
+ ____exports.CollectiblePedestalType.NONE = -1
5
+ ____exports.CollectiblePedestalType[____exports.CollectiblePedestalType.NONE] = "NONE"
6
+ ____exports.CollectiblePedestalType.NORMAL = 0
7
+ ____exports.CollectiblePedestalType[____exports.CollectiblePedestalType.NORMAL] = "NORMAL"
8
+ ____exports.CollectiblePedestalType.FORTUNE_TELLING_MACHINE = 1
9
+ ____exports.CollectiblePedestalType[____exports.CollectiblePedestalType.FORTUNE_TELLING_MACHINE] = "FORTUNE_TELLING_MACHINE"
10
+ ____exports.CollectiblePedestalType.BLOOD_DONATION_MACHINE = 2
11
+ ____exports.CollectiblePedestalType[____exports.CollectiblePedestalType.BLOOD_DONATION_MACHINE] = "BLOOD_DONATION_MACHINE"
12
+ ____exports.CollectiblePedestalType.SLOT_MACHINE = 3
13
+ ____exports.CollectiblePedestalType[____exports.CollectiblePedestalType.SLOT_MACHINE] = "SLOT_MACHINE"
14
+ ____exports.CollectiblePedestalType.LOCKEDCHEST = 4
15
+ ____exports.CollectiblePedestalType[____exports.CollectiblePedestalType.LOCKEDCHEST] = "LOCKEDCHEST"
16
+ ____exports.CollectiblePedestalType.REDCHEST = 5
17
+ ____exports.CollectiblePedestalType[____exports.CollectiblePedestalType.REDCHEST] = "REDCHEST"
18
+ ____exports.CollectiblePedestalType.BOMBCHEST = 6
19
+ ____exports.CollectiblePedestalType[____exports.CollectiblePedestalType.BOMBCHEST] = "BOMBCHEST"
20
+ ____exports.CollectiblePedestalType.SPIKEDCHEST = 7
21
+ ____exports.CollectiblePedestalType[____exports.CollectiblePedestalType.SPIKEDCHEST] = "SPIKEDCHEST"
22
+ ____exports.CollectiblePedestalType.ETERNALCHEST = 8
23
+ ____exports.CollectiblePedestalType[____exports.CollectiblePedestalType.ETERNALCHEST] = "ETERNALCHEST"
24
+ ____exports.CollectiblePedestalType.MOMS_DRESSING_TABLE = 9
25
+ ____exports.CollectiblePedestalType[____exports.CollectiblePedestalType.MOMS_DRESSING_TABLE] = "MOMS_DRESSING_TABLE"
26
+ ____exports.CollectiblePedestalType.CHEST = 10
27
+ ____exports.CollectiblePedestalType[____exports.CollectiblePedestalType.CHEST] = "CHEST"
28
+ ____exports.CollectiblePedestalType.MOMSCHEST = 11
29
+ ____exports.CollectiblePedestalType[____exports.CollectiblePedestalType.MOMSCHEST] = "MOMSCHEST"
30
+ ____exports.CollectiblePedestalType.OLDCHEST = 12
31
+ ____exports.CollectiblePedestalType[____exports.CollectiblePedestalType.OLDCHEST] = "OLDCHEST"
32
+ ____exports.CollectiblePedestalType.WOODENCHEST = 13
33
+ ____exports.CollectiblePedestalType[____exports.CollectiblePedestalType.WOODENCHEST] = "WOODENCHEST"
34
+ ____exports.CollectiblePedestalType.MEGACHEST = 14
35
+ ____exports.CollectiblePedestalType[____exports.CollectiblePedestalType.MEGACHEST] = "MEGACHEST"
36
+ return ____exports
@@ -0,0 +1,16 @@
1
+ /**
2
+ * This represents the type of health that is either given or taken away from a player. Note that
3
+ * we cannot use the HeartSubType enum for this purpose this since it has no value for broken hearts
4
+ * or max hearts.
5
+ */
6
+ export declare enum HealthType {
7
+ RED = 0,
8
+ SOUL = 1,
9
+ ETERNAL = 2,
10
+ BLACK = 3,
11
+ GOLDEN = 4,
12
+ BONE = 5,
13
+ ROTTEN = 6,
14
+ BROKEN = 7,
15
+ MAX_HEARTS = 8
16
+ }