isaacscript-common 1.2.159 → 1.2.162

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 (85) 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 +2 -1
  4. package/dist/callbacks/postCustomDoorEnter.lua +34 -17
  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/roomClearChange.d.ts +1 -0
  14. package/dist/callbacks/roomClearChange.lua +39 -0
  15. package/dist/callbacks/subscriptions/postPlayerChangeHealth.d.ts +1 -1
  16. package/dist/callbacks/subscriptions/roomClearChange.d.ts +1 -0
  17. package/dist/callbacks/subscriptions/roomClearChange.lua +18 -0
  18. package/dist/classes/DefaultMap.d.ts +74 -0
  19. package/dist/classes/DefaultMap.lua +85 -0
  20. package/dist/classes/ModUpgraded.d.ts +19 -0
  21. package/dist/classes/ModUpgraded.lua +73 -0
  22. package/dist/enums/CardType.d.ts +40 -0
  23. package/dist/enums/CardType.lua +20 -0
  24. package/dist/enums/CollectiblePedestalType.d.ts +38 -0
  25. package/dist/enums/CollectiblePedestalType.lua +36 -0
  26. package/dist/enums/HealthType.d.ts +16 -0
  27. package/dist/enums/HealthType.lua +22 -0
  28. package/dist/enums/ModCallbacksCustom.d.ts +61 -0
  29. package/dist/enums/ModCallbacksCustom.lua +108 -0
  30. package/dist/enums/PillEffectClass.d.ts +17 -0
  31. package/dist/enums/PillEffectClass.lua +16 -0
  32. package/dist/enums/PillEffectType.d.ts +16 -0
  33. package/dist/enums/PillEffectType.lua +14 -0
  34. package/dist/enums/PocketItemType.d.ts +8 -0
  35. package/dist/enums/PocketItemType.lua +16 -0
  36. package/dist/enums/private/SaveDataKeys.d.ts +6 -0
  37. package/dist/enums/private/SaveDataKeys.lua +8 -0
  38. package/dist/enums/private/SerializationBrand.d.ts +15 -0
  39. package/dist/enums/private/SerializationBrand.lua +24 -0
  40. package/dist/features/deployJSONRoom.lua +2 -2
  41. package/dist/features/extraConsoleCommands/commands.lua +2 -2
  42. package/dist/features/isPonyActive.lua +2 -2
  43. package/dist/features/playerInventory.lua +4 -4
  44. package/dist/features/saveDataManager/exports.d.ts +6 -2
  45. package/dist/features/saveDataManager/exports.lua +4 -4
  46. package/dist/features/saveDataManager/main.lua +4 -4
  47. package/dist/features/saveDataManager/merge.lua +3 -3
  48. package/dist/functions/cards.d.ts +1 -1
  49. package/dist/functions/cards.lua +2 -2
  50. package/dist/functions/collectibles.d.ts +1 -1
  51. package/dist/functions/deepCopy.lua +4 -4
  52. package/dist/functions/deepCopyTests.lua +2 -2
  53. package/dist/functions/map.d.ts +1 -1
  54. package/dist/functions/pills.d.ts +2 -2
  55. package/dist/functions/player.d.ts +1 -1
  56. package/dist/functions/player.lua +2 -2
  57. package/dist/functions/playerDataStructures.d.ts +1 -1
  58. package/dist/functions/playerHealth.d.ts +1 -1
  59. package/dist/functions/playerHealth.lua +1 -1
  60. package/dist/functions/pocketItems.lua +1 -1
  61. package/dist/functions/transformations.lua +2 -2
  62. package/dist/functions/trinkets.d.ts +12 -0
  63. package/dist/functions/trinkets.lua +15 -0
  64. package/dist/index.d.ts +10 -8
  65. package/dist/index.lua +73 -57
  66. package/dist/objects/callbackRegisterFunctions.d.ts +1 -1
  67. package/dist/objects/callbackRegisterFunctions.lua +10 -1
  68. package/dist/objects/cardTypes.d.ts +1 -1
  69. package/dist/objects/cardTypes.lua +1 -1
  70. package/dist/objects/directionNames.d.ts +4 -0
  71. package/dist/objects/directionNames.lua +10 -0
  72. package/dist/objects/pillEffectClasses.d.ts +1 -1
  73. package/dist/objects/pillEffectClasses.lua +1 -1
  74. package/dist/objects/pillEffectTypes.d.ts +1 -1
  75. package/dist/objects/pillEffectTypes.lua +1 -1
  76. package/dist/types/AddCallbackParametersCustom.d.ts +11 -1
  77. package/dist/types/AddCallbackParametersCustom.lua +1 -1
  78. package/dist/types/ModCallbacksCustom.d.ts +43 -40
  79. package/dist/types/ModCallbacksCustom.lua +46 -40
  80. package/dist/types/PocketItemDescription.d.ts +1 -1
  81. package/dist/types/private/SaveData.d.ts +0 -6
  82. package/dist/types/private/SaveData.lua +0 -5
  83. package/dist/upgradeMod.d.ts +1 -1
  84. package/dist/upgradeMod.lua +8 -2
  85. 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,4 +1,5 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
+ import { ModUpgraded } from "../classes/ModUpgraded";
2
3
  /**
3
4
  * `isaacscript-common` provides custom doors that can be spawned where any wall segment is. If you
4
5
  * use this feature, you must first call this initialization function at the beginning of your mod.
@@ -22,7 +23,7 @@
22
23
  * initCustomDoor(mod, fooEffectVariant);
23
24
  * ```
24
25
  */
25
- export declare function initCustomDoor(mod: Mod, effectVariant: int): void;
26
+ export declare function initCustomDoor(mod: ModUpgraded, effectVariant: int): void;
26
27
  /**
27
28
  * Helper function to spawn a custom door. This is intended to be called from the `MC_POST_NEW_ROOM`
28
29
  * callback when the player enters a room that should have a custom door. (You could also call it
@@ -4,13 +4,17 @@ local Set = ____lualib.Set
4
4
  local __TS__New = ____lualib.__TS__New
5
5
  local Map = ____lualib.Map
6
6
  local ____exports = {}
7
- local hasSubscriptions, postEffectUpdaterCustomEntity, doorChangedState, getAnimationForCustomDoor, postEffectRenderCustomEntity, isPlayerPastDoorThreshold, getPositionOffset, POSITION_OFFSET_MULTIPLIER, v
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")
13
15
  local doorSlotToDirection = ____doors.doorSlotToDirection
16
+ local ____entitySpecific = require("functions.entitySpecific")
17
+ local getEffects = ____entitySpecific.getEffects
14
18
  local ____player = require("functions.player")
15
19
  local getClosestPlayer = ____player.getClosestPlayer
16
20
  local ____utils = require("functions.utils")
@@ -49,15 +53,15 @@ end
49
53
  function getAnimationForCustomDoor(self, effect)
50
54
  local freshlySpawned = effect.FrameCount == 0
51
55
  repeat
52
- local ____switch11 = effect.State
53
- local ____cond11 = ____switch11 == DoorState.STATE_OPEN
54
- if ____cond11 then
56
+ local ____switch12 = effect.State
57
+ local ____cond12 = ____switch12 == DoorState.STATE_OPEN
58
+ if ____cond12 then
55
59
  do
56
60
  return freshlySpawned and "Opened" or "Open"
57
61
  end
58
62
  end
59
- ____cond11 = ____cond11 or ____switch11 == DoorState.STATE_CLOSED
60
- if ____cond11 then
63
+ ____cond12 = ____cond12 or ____switch12 == DoorState.STATE_CLOSED
64
+ if ____cond12 then
61
65
  do
62
66
  return freshlySpawned and "Closed" or "Close"
63
67
  end
@@ -89,33 +93,33 @@ function postEffectRenderCustomEntity(self, effect)
89
93
  end
90
94
  function isPlayerPastDoorThreshold(self, effect, player, direction)
91
95
  repeat
92
- local ____switch19 = direction
93
- local ____cond19 = ____switch19 == Direction.NO_DIRECTION
94
- if ____cond19 then
96
+ local ____switch20 = direction
97
+ local ____cond20 = ____switch20 == Direction.NO_DIRECTION
98
+ if ____cond20 then
95
99
  do
96
100
  return false
97
101
  end
98
102
  end
99
- ____cond19 = ____cond19 or ____switch19 == Direction.UP
100
- if ____cond19 then
103
+ ____cond20 = ____cond20 or ____switch20 == Direction.UP
104
+ if ____cond20 then
101
105
  do
102
106
  return player.Position.Y <= effect.Position.Y
103
107
  end
104
108
  end
105
- ____cond19 = ____cond19 or ____switch19 == Direction.RIGHT
106
- if ____cond19 then
109
+ ____cond20 = ____cond20 or ____switch20 == Direction.RIGHT
110
+ if ____cond20 then
107
111
  do
108
112
  return player.Position.X >= effect.Position.X
109
113
  end
110
114
  end
111
- ____cond19 = ____cond19 or ____switch19 == Direction.DOWN
112
- if ____cond19 then
115
+ ____cond20 = ____cond20 or ____switch20 == Direction.DOWN
116
+ if ____cond20 then
113
117
  do
114
118
  return player.Position.Y >= effect.Position.Y
115
119
  end
116
120
  end
117
- ____cond19 = ____cond19 or ____switch19 == Direction.LEFT
118
- if ____cond19 then
121
+ ____cond20 = ____cond20 or ____switch20 == Direction.LEFT
122
+ if ____cond20 then
119
123
  do
120
124
  return player.Position.X <= effect.Position.X
121
125
  end
@@ -127,6 +131,13 @@ function isPlayerPastDoorThreshold(self, effect, player, direction)
127
131
  end
128
132
  until true
129
133
  end
134
+ function roomClearChange(self, roomClear, effectVariant)
135
+ local state = roomClear and DoorState.STATE_OPEN or DoorState.STATE_CLOSED
136
+ local customDoors = getEffects(nil, effectVariant)
137
+ for ____, customDoor in ipairs(customDoors) do
138
+ customDoor.State = state
139
+ end
140
+ end
130
141
  function getPositionOffset(self, doorSlot)
131
142
  local direction = doorSlotToDirection(nil, doorSlot)
132
143
  local vector = directionToVector(nil, direction)
@@ -145,6 +156,12 @@ function ____exports.initCustomDoor(self, mod, effectVariant)
145
156
  initializedEffectVariants:add(effectVariant)
146
157
  mod:AddCallback(ModCallbacks.MC_POST_EFFECT_UPDATE, postEffectUpdaterCustomEntity, effectVariant)
147
158
  mod:AddCallback(ModCallbacks.MC_POST_EFFECT_RENDER, postEffectRenderCustomEntity, effectVariant)
159
+ mod:AddCallbackCustom(
160
+ ModCallbacksCustom.MC_ROOM_CLEAR_CHANGE,
161
+ function(____, roomClear)
162
+ roomClearChange(nil, roomClear, effectVariant)
163
+ end
164
+ )
148
165
  end
149
166
  function ____exports.spawnCustomDoor(self, effectVariant, doorSlot)
150
167
  if not initializedEffectVariants:has(effectVariant) then
@@ -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
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,39 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____exports = {}
3
+ local hasSubscriptions, postUpdate, postNewRoom, v
4
+ local ____cachedClasses = require("cachedClasses")
5
+ local game = ____cachedClasses.game
6
+ local ____exports = require("features.saveDataManager.exports")
7
+ local saveDataManager = ____exports.saveDataManager
8
+ local ____roomClearChange = require("callbacks.subscriptions.roomClearChange")
9
+ local roomClearChangedFire = ____roomClearChange.roomClearChangedFire
10
+ local roomClearChangedHasSubscriptions = ____roomClearChange.roomClearChangedHasSubscriptions
11
+ function hasSubscriptions(self)
12
+ return roomClearChangedHasSubscriptions(nil)
13
+ end
14
+ function postUpdate(self)
15
+ if not hasSubscriptions(nil) then
16
+ return
17
+ end
18
+ local room = game:GetRoom()
19
+ local roomClear = room:IsClear()
20
+ if roomClear ~= v.room.cleared then
21
+ v.room.cleared = roomClear
22
+ roomClearChangedFire(nil, roomClear)
23
+ end
24
+ end
25
+ function postNewRoom(self)
26
+ if not hasSubscriptions(nil) then
27
+ return
28
+ end
29
+ local room = game:GetRoom()
30
+ local roomClear = room:IsClear()
31
+ v.room.cleared = roomClear
32
+ end
33
+ v = {room = {cleared = false}}
34
+ function ____exports.roomClearChangeCallbackInit(self, mod)
35
+ saveDataManager(nil, "roomClearChange", v, hasSubscriptions)
36
+ mod:AddCallback(ModCallbacks.MC_POST_UPDATE, postUpdate)
37
+ mod:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, postNewRoom)
38
+ end
39
+ return ____exports
@@ -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 @@
1
+ export declare type RoomClearChangeCallbackType = (roomClear: boolean) => void;
@@ -0,0 +1,18 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____lualib = require("lualib_bundle")
3
+ local __TS__ArrayPush = ____lualib.__TS__ArrayPush
4
+ local ____exports = {}
5
+ local subscriptions = {}
6
+ function ____exports.roomClearChangedHasSubscriptions(self)
7
+ return #subscriptions > 0
8
+ end
9
+ function ____exports.roomClearChangedRegister(self, callback)
10
+ __TS__ArrayPush(subscriptions, {callback})
11
+ end
12
+ function ____exports.roomClearChangedFire(self, roomClear)
13
+ for ____, ____value in ipairs(subscriptions) do
14
+ local callback = ____value[1]
15
+ callback(nil, roomClear)
16
+ end
17
+ end
18
+ return ____exports
@@ -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