isaacscript-common 1.0.575 → 1.0.579

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 (137) hide show
  1. package/dist/callbacks/itemPickup.lua +2 -6
  2. package/dist/callbacks/postBombInitLate.lua +1 -5
  3. package/dist/callbacks/postCursedTeleport.lua +8 -10
  4. package/dist/callbacks/postEffectInitLate.lua +1 -5
  5. package/dist/callbacks/postEsauJr.lua +2 -4
  6. package/dist/callbacks/postFamiliarInitLate.lua +1 -5
  7. package/dist/callbacks/postFlip.lua +2 -4
  8. package/dist/callbacks/postGridEntity.lua +8 -20
  9. package/dist/callbacks/postKnifeInitLate.lua +1 -5
  10. package/dist/callbacks/postLaserInitLate.lua +1 -5
  11. package/dist/callbacks/postNPCInitLate.lua +1 -5
  12. package/dist/callbacks/postPickupCollect.lua +1 -5
  13. package/dist/callbacks/postPickupInitLate.lua +1 -5
  14. package/dist/callbacks/postPlayerChangeHealth.lua +19 -23
  15. package/dist/callbacks/postPlayerChangeType.lua +1 -5
  16. package/dist/callbacks/postPlayerFatalDamage.lua +5 -9
  17. package/dist/callbacks/postPlayerInitLate.lua +1 -5
  18. package/dist/callbacks/postPlayerReordered.lua +8 -2
  19. package/dist/callbacks/postProjectileInitLate.lua +1 -5
  20. package/dist/callbacks/postPurchase.lua +19 -19
  21. package/dist/callbacks/postSacrifice.lua +3 -3
  22. package/dist/callbacks/postSlotInitUpdate.lua +3 -11
  23. package/dist/callbacks/postSlotRenderBroken.lua +2 -8
  24. package/dist/callbacks/postTearInitLate.lua +1 -5
  25. package/dist/callbacks/postTearInitVeryLate.lua +1 -5
  26. package/dist/callbacks/postTransformation.lua +1 -5
  27. package/dist/callbacks/postTrinketBreak.lua +5 -9
  28. package/dist/callbacks/preNewLevel.lua +1 -1
  29. package/dist/callbacks/reorderedCallbacks.lua +4 -4
  30. package/dist/callbacks/subscriptions/PreNewLevel.lua +1 -2
  31. package/dist/callbacks/subscriptions/postBombInitLate.lua +3 -5
  32. package/dist/callbacks/subscriptions/postCursedTeleport.lua +1 -2
  33. package/dist/callbacks/subscriptions/postCustomRevive.lua +3 -5
  34. package/dist/callbacks/subscriptions/postEffectInitLate.lua +3 -5
  35. package/dist/callbacks/subscriptions/postEsauJr.lua +1 -2
  36. package/dist/callbacks/subscriptions/postFamiliarInitLate.lua +3 -5
  37. package/dist/callbacks/subscriptions/postFirstEsauJr.lua +1 -2
  38. package/dist/callbacks/subscriptions/postFirstFlip.lua +1 -2
  39. package/dist/callbacks/subscriptions/postFlip.lua +1 -2
  40. package/dist/callbacks/subscriptions/postGameStartedReordered.lua +1 -2
  41. package/dist/callbacks/subscriptions/postGridEntityInit.lua +3 -5
  42. package/dist/callbacks/subscriptions/postGridEntityRemove.lua +3 -5
  43. package/dist/callbacks/subscriptions/postGridEntityUpdate.lua +3 -5
  44. package/dist/callbacks/subscriptions/postItemPickup.lua +5 -8
  45. package/dist/callbacks/subscriptions/postKnifeInitLate.lua +3 -5
  46. package/dist/callbacks/subscriptions/postLaserInitLate.lua +3 -5
  47. package/dist/callbacks/subscriptions/postNPCInitLate.lua +3 -5
  48. package/dist/callbacks/subscriptions/postNewLevelReordered.lua +1 -2
  49. package/dist/callbacks/subscriptions/postNewRoomEarly.lua +1 -2
  50. package/dist/callbacks/subscriptions/postNewRoomReordered.lua +1 -2
  51. package/dist/callbacks/subscriptions/postPEffectUpdateReordered.lua +3 -5
  52. package/dist/callbacks/subscriptions/postPickupCollect.lua +3 -5
  53. package/dist/callbacks/subscriptions/postPickupInitLate.lua +3 -5
  54. package/dist/callbacks/subscriptions/postPlayerChangeHealth.lua +3 -5
  55. package/dist/callbacks/subscriptions/postPlayerChangeType.lua +1 -2
  56. package/dist/callbacks/subscriptions/postPlayerFatalDamage.lua +3 -5
  57. package/dist/callbacks/subscriptions/postPlayerInitLate.lua +3 -5
  58. package/dist/callbacks/subscriptions/postPlayerInitReordered.lua +3 -5
  59. package/dist/callbacks/subscriptions/postPlayerRenderReordered.lua +3 -5
  60. package/dist/callbacks/subscriptions/postPlayerUpdateReordered.lua +3 -5
  61. package/dist/callbacks/subscriptions/postProjectileInitLate.lua +3 -5
  62. package/dist/callbacks/subscriptions/postPurchase.lua +8 -3
  63. package/dist/callbacks/subscriptions/postSacrifice.lua +1 -2
  64. package/dist/callbacks/subscriptions/postSlotDestroyed.lua +3 -5
  65. package/dist/callbacks/subscriptions/postSlotInit.lua +3 -5
  66. package/dist/callbacks/subscriptions/postSlotRender.lua +3 -5
  67. package/dist/callbacks/subscriptions/postSlotUpdate.lua +3 -5
  68. package/dist/callbacks/subscriptions/postTearInitLate.lua +3 -5
  69. package/dist/callbacks/subscriptions/postTearInitVeryLate.lua +3 -5
  70. package/dist/callbacks/subscriptions/postTransformation.lua +3 -5
  71. package/dist/callbacks/subscriptions/postTrinketBreak.lua +3 -5
  72. package/dist/callbacks/subscriptions/preCustomRevive.lua +1 -2
  73. package/dist/callbacks/subscriptions/preItemPickup.lua +5 -8
  74. package/dist/constants.lua +57 -6
  75. package/dist/features/deployJSONRoom.lua +95 -68
  76. package/dist/features/disableInputs.lua +9 -3
  77. package/dist/features/forgottenSwitch.lua +1 -1
  78. package/dist/features/getCollectibleItemPoolType.lua +4 -10
  79. package/dist/features/preventCollectibleRotate.lua +3 -9
  80. package/dist/features/saveDataManager/load.lua +2 -6
  81. package/dist/features/saveDataManager/main.lua +1 -1
  82. package/dist/features/saveDataManager/merge.lua +2 -4
  83. package/dist/features/sirenHelpers.lua +5 -7
  84. package/dist/functions/array.lua +6 -10
  85. package/dist/functions/bitwise.lua +1 -1
  86. package/dist/functions/challenges.lua +1 -1
  87. package/dist/functions/charge.lua +10 -12
  88. package/dist/functions/collectibles.lua +18 -23
  89. package/dist/functions/color.lua +9 -1
  90. package/dist/functions/deepCopy.lua +46 -28
  91. package/dist/functions/deepCopyTests.lua +12 -20
  92. package/dist/functions/doors.lua +9 -21
  93. package/dist/functions/entity.lua +8 -2
  94. package/dist/functions/flag.lua +1 -1
  95. package/dist/functions/gridEntity.lua +14 -9
  96. package/dist/functions/input.lua +17 -27
  97. package/dist/functions/jsonRoom.lua +3 -9
  98. package/dist/functions/language.lua +9 -1
  99. package/dist/functions/log.lua +33 -85
  100. package/dist/functions/math.lua +15 -17
  101. package/dist/functions/npc.lua +15 -17
  102. package/dist/functions/pickups.lua +14 -1
  103. package/dist/functions/player.lua +38 -60
  104. package/dist/functions/playerHealth.lua +19 -9
  105. package/dist/functions/pocketItems.lua +4 -4
  106. package/dist/functions/random.lua +2 -2
  107. package/dist/functions/revive.lua +4 -4
  108. package/dist/functions/rooms.d.ts +14 -2
  109. package/dist/functions/rooms.lua +56 -40
  110. package/dist/functions/spawnCollectible.lua +10 -2
  111. package/dist/functions/sprite.lua +2 -2
  112. package/dist/functions/stage.lua +11 -11
  113. package/dist/functions/tears.lua +1 -1
  114. package/dist/functions/transformations.lua +4 -10
  115. package/dist/functions/trinketGive.lua +3 -3
  116. package/dist/functions/trinkets.lua +10 -6
  117. package/dist/functions/ui.lua +3 -3
  118. package/dist/functions/util.d.ts +0 -11
  119. package/dist/functions/util.lua +6 -26
  120. package/dist/functions/vector.lua +8 -8
  121. package/dist/lualib_bundle.lua +795 -735
  122. package/dist/maps/cardDescriptionMap.lua +99 -1
  123. package/dist/maps/cardNameMap.lua +99 -1
  124. package/dist/maps/challengeNameMap.lua +47 -1
  125. package/dist/maps/collectibleDescriptionMap.lua +722 -1
  126. package/dist/maps/collectibleNameMap.lua +722 -1
  127. package/dist/maps/gridEntityXMLMap.lua +36 -1
  128. package/dist/maps/pillEffectNameMap.lua +52 -1
  129. package/dist/maps/roomShapeToTopLeftWallGridIndexMap.lua +7 -1
  130. package/dist/maps/transformationMaps.lua +21 -16
  131. package/dist/maps/transformationNameMap.lua +17 -1
  132. package/dist/maps/trinketDescriptionMap.lua +190 -1
  133. package/dist/maps/trinketNameMap.lua +190 -1
  134. package/dist/patchErrorFunctions.lua +2 -1
  135. package/dist/sets/cards.lua +98 -2
  136. package/dist/types/ModUpgraded.lua +95 -105
  137. package/package.json +5 -5
@@ -38,11 +38,11 @@ function ____exports.getRoomDescriptor(self, roomGridIndex)
38
38
  end
39
39
  function ____exports.getRoomStageID(self, roomGridIndex)
40
40
  local roomData = ____exports.getRoomData(nil, roomGridIndex)
41
- return ((roomData == nil) and -1) or roomData.StageID
41
+ return roomData == nil and -1 or roomData.StageID
42
42
  end
43
43
  function ____exports.getRoomSubType(self, roomGridIndex)
44
44
  local roomData = ____exports.getRoomData(nil, roomGridIndex)
45
- return ((roomData == nil) and -1) or roomData.Subtype
45
+ return roomData == nil and -1 or roomData.Subtype
46
46
  end
47
47
  function ____exports.getRooms(self, includeExtraDimensionalRooms)
48
48
  if includeExtraDimensionalRooms == nil then
@@ -80,19 +80,21 @@ end
80
80
  function ____exports.inDeathCertificateArea(self)
81
81
  local roomStageID = ____exports.getRoomStageID(nil)
82
82
  local roomSubType = ____exports.getRoomSubType(nil)
83
- return (roomStageID == 35) and ((roomSubType == 33) or (roomSubType == 33))
83
+ return roomStageID == 35 and (roomSubType == 33 or roomSubType == 33)
84
84
  end
85
85
  function ____exports.changeRoom(self, roomGridIndex)
86
86
  local game = Game()
87
87
  local level = game:GetLevel()
88
+ local roomData = ____exports.getRoomData(nil, roomGridIndex)
89
+ if roomData == nil then
90
+ error(("Failed to change the room to to grid index " .. tostring(roomGridIndex)) .. " because that room does not exist.")
91
+ end
88
92
  level.LeaveDoor = -1
89
93
  game:ChangeRoom(roomGridIndex)
90
94
  end
91
95
  function ____exports.getAllRoomGridIndexes(self)
92
96
  local allRoomGridIndexes = {}
93
- for ____, roomDescriptor in ipairs(
94
- ____exports.getRooms(nil)
95
- ) do
97
+ for ____, roomDescriptor in ipairs(____exports.getRooms(nil)) do
96
98
  __TS__ArrayPush(allRoomGridIndexes, roomDescriptor.SafeGridIndex)
97
99
  end
98
100
  return allRoomGridIndexes
@@ -117,21 +119,17 @@ function ____exports.getCurrentDimension(self)
117
119
  dimension = dimension + 1
118
120
  end
119
121
  end
120
- error(
121
- "Failed to get the current dimension using the starting room index of: " .. tostring(startingRoomGridIndex)
122
- )
122
+ error("Failed to get the current dimension using the starting room index of: " .. tostring(startingRoomGridIndex))
123
123
  return 0
124
124
  end
125
125
  function ____exports.getRoomDataType(self, roomGridIndex)
126
126
  local roomData = ____exports.getRoomData(nil, roomGridIndex)
127
- return ((roomData == nil) and -1) or roomData.Type
127
+ return roomData == nil and -1 or roomData.Type
128
128
  end
129
129
  function ____exports.getRoomGridIndexesForType(self, roomType)
130
130
  local roomGridIndexes = {}
131
- for ____, roomDescriptor in ipairs(
132
- ____exports.getRooms(nil)
133
- ) do
134
- if (roomDescriptor.Data ~= nil) and (roomDescriptor.Data.Type == roomType) then
131
+ for ____, roomDescriptor in ipairs(____exports.getRooms(nil)) do
132
+ if roomDescriptor.Data ~= nil and roomDescriptor.Data.Type == roomType then
135
133
  __TS__ArrayPush(roomGridIndexes, roomDescriptor.SafeGridIndex)
136
134
  end
137
135
  end
@@ -151,15 +149,15 @@ function ____exports.getRoomListIndex(self, roomGridIndex)
151
149
  end
152
150
  function ____exports.getRoomName(self, roomGridIndex)
153
151
  local roomData = ____exports.getRoomData(nil, roomGridIndex)
154
- return ((roomData == nil) and "Unknown") or roomData.Name
152
+ return roomData == nil and "Unknown" or roomData.Name
155
153
  end
156
154
  function ____exports.getRoomSafeGridIndex(self, roomGridIndex)
157
- local roomDescriptor = ((roomGridIndex == nil) and ____exports.getCurrentRoomDescriptorReadOnly(nil)) or ____exports.getRoomDescriptor(nil, roomGridIndex)
155
+ local roomDescriptor = roomGridIndex == nil and ____exports.getCurrentRoomDescriptorReadOnly(nil) or ____exports.getRoomDescriptor(nil, roomGridIndex)
158
156
  return roomDescriptor.SafeGridIndex
159
157
  end
160
158
  function ____exports.getRoomVariant(self, roomGridIndex)
161
159
  local roomData = ____exports.getRoomData(nil, roomGridIndex)
162
- return ((roomData == nil) and -1) or roomData.Variant
160
+ return roomData == nil and -1 or roomData.Variant
163
161
  end
164
162
  function ____exports.getRoomVisitedCount(self, roomGridIndex)
165
163
  local roomDescriptor = ____exports.getRoomDescriptor(nil, roomGridIndex)
@@ -170,26 +168,26 @@ function ____exports.gridToPos(self, x, y)
170
168
  local room = game:GetRoom()
171
169
  x = x + 1
172
170
  y = y + 1
173
- local gridIndex = (y * room:GetGridWidth()) + x
171
+ local gridIndex = y * room:GetGridWidth() + x
174
172
  return room:GetGridPosition(gridIndex)
175
173
  end
176
174
  function ____exports.in2x1Room(self)
177
175
  local game = Game()
178
176
  local room = game:GetRoom()
179
177
  local roomShape = room:GetRoomShape()
180
- return (roomShape == RoomShape.ROOMSHAPE_1x2) or (roomShape == RoomShape.ROOMSHAPE_2x1)
178
+ return roomShape == RoomShape.ROOMSHAPE_1x2 or roomShape == RoomShape.ROOMSHAPE_2x1
181
179
  end
182
180
  function ____exports.inAngelShop(self)
183
181
  local game = Game()
184
182
  local room = game:GetRoom()
185
183
  local roomType = room:GetType()
186
184
  local roomSubType = ____exports.getRoomSubType(nil)
187
- return (roomType == RoomType.ROOM_ANGEL) and (roomSubType == 1)
185
+ return roomType == RoomType.ROOM_ANGEL and roomSubType == 1
188
186
  end
189
187
  function ____exports.inBeastRoom(self)
190
188
  local roomSafeGridIndex = ____exports.getRoomSafeGridIndex(nil)
191
189
  local roomSubType = ____exports.getRoomSubType(nil)
192
- return (roomSafeGridIndex == GridRooms.ROOM_DUNGEON_IDX) and (roomSubType == 4)
190
+ return roomSafeGridIndex == GridRooms.ROOM_DUNGEON_IDX and roomSubType == 4
193
191
  end
194
192
  function ____exports.inBossRoomOf(self, bossID)
195
193
  local game = Game()
@@ -197,12 +195,12 @@ function ____exports.inBossRoomOf(self, bossID)
197
195
  local roomType = room:GetType()
198
196
  local roomStageID = ____exports.getRoomStageID(nil)
199
197
  local roomSubType = ____exports.getRoomSubType(nil)
200
- return ((roomType == RoomType.ROOM_BOSS) and (roomStageID == 0)) and (roomSubType == bossID)
198
+ return roomType == RoomType.ROOM_BOSS and roomStageID == 0 and roomSubType == bossID
201
199
  end
202
200
  function ____exports.inCrawlspace(self)
203
201
  local roomSafeGridIndex = ____exports.getRoomSafeGridIndex(nil)
204
202
  local roomSubType = ____exports.getRoomSubType(nil)
205
- return (roomSafeGridIndex == GridRooms.ROOM_DUNGEON_IDX) and (roomSubType ~= 4)
203
+ return roomSafeGridIndex == GridRooms.ROOM_DUNGEON_IDX and roomSubType ~= 4
206
204
  end
207
205
  function ____exports.inDevilsCrownTreasureRoom(self)
208
206
  local roomDescriptor = ____exports.getCurrentRoomDescriptorReadOnly(nil)
@@ -215,7 +213,7 @@ function ____exports.inLRoom(self)
215
213
  local game = Game()
216
214
  local room = game:GetRoom()
217
215
  local roomShape = room:GetRoomShape()
218
- return (((roomShape == RoomShape.ROOMSHAPE_LTL) or (roomShape == RoomShape.ROOMSHAPE_LTR)) or (roomShape == RoomShape.ROOMSHAPE_LBL)) or (roomShape == RoomShape.ROOMSHAPE_LBR)
216
+ return roomShape == RoomShape.ROOMSHAPE_LTL or roomShape == RoomShape.ROOMSHAPE_LTR or roomShape == RoomShape.ROOMSHAPE_LBL or roomShape == RoomShape.ROOMSHAPE_LBR
219
217
  end
220
218
  function ____exports.inGenesisRoom(self)
221
219
  local game = Game()
@@ -223,7 +221,7 @@ function ____exports.inGenesisRoom(self)
223
221
  local roomType = room:GetType()
224
222
  local roomVariant = ____exports.getRoomVariant(nil)
225
223
  local roomSubType = ____exports.getRoomSubType(nil)
226
- return ((roomType == RoomType.ROOM_ISAACS) and (roomVariant == GENESIS_ROOM_VARIANT)) and (roomSubType == GENESIS_ROOM_SUBTYPE)
224
+ return roomType == RoomType.ROOM_ISAACS and roomVariant == GENESIS_ROOM_VARIANT and roomSubType == GENESIS_ROOM_SUBTYPE
227
225
  end
228
226
  function ____exports.inMinibossRoomOf(self, minibossID)
229
227
  local game = Game()
@@ -231,34 +229,38 @@ function ____exports.inMinibossRoomOf(self, minibossID)
231
229
  local roomType = room:GetType()
232
230
  local roomStageID = ____exports.getRoomStageID(nil)
233
231
  local roomSubType = ____exports.getRoomSubType(nil)
234
- return ((roomType == RoomType.ROOM_MINIBOSS) and (roomStageID == 0)) and (roomSubType == minibossID)
232
+ return roomType == RoomType.ROOM_MINIBOSS and roomStageID == 0 and roomSubType == minibossID
235
233
  end
236
234
  function ____exports.inStartingRoom(self)
237
235
  local game = Game()
238
236
  local level = game:GetLevel()
239
237
  local startingRoomGridIndex = level:GetStartingRoomIndex()
240
238
  local roomSafeGridIndex = ____exports.getRoomSafeGridIndex(nil)
241
- return (roomSafeGridIndex == startingRoomGridIndex) and ____exports.inDimension(nil, 0)
239
+ return roomSafeGridIndex == startingRoomGridIndex and ____exports.inDimension(nil, 0)
242
240
  end
243
241
  function ____exports.isAllRoomsClear(self, onlyCheckRoomTypes)
244
- local roomTypeWhitelist = (((onlyCheckRoomTypes == nil) and (function() return nil end)) or (function() return __TS__New(Set, onlyCheckRoomTypes) end))()
245
- for ____, roomDescriptor in ipairs(
246
- ____exports.getRooms(nil)
247
- ) do
242
+ local ____temp_0
243
+ if onlyCheckRoomTypes == nil then
244
+ ____temp_0 = nil
245
+ else
246
+ ____temp_0 = __TS__New(Set, onlyCheckRoomTypes)
247
+ end
248
+ local roomTypeWhitelist = ____temp_0
249
+ for ____, roomDescriptor in ipairs(____exports.getRooms(nil)) do
248
250
  do
249
251
  local roomData = roomDescriptor.Data
250
252
  if roomData == nil then
251
- goto __continue46
253
+ goto __continue49
252
254
  end
253
255
  local roomType = roomData.Type
254
- if (roomTypeWhitelist ~= nil) and (not roomTypeWhitelist:has(roomType)) then
255
- goto __continue46
256
+ if roomTypeWhitelist ~= nil and not roomTypeWhitelist:has(roomType) then
257
+ goto __continue49
256
258
  end
257
259
  if not roomDescriptor.Clear then
258
260
  return false
259
261
  end
260
262
  end
261
- ::__continue46::
263
+ ::__continue49::
262
264
  end
263
265
  return true
264
266
  end
@@ -291,17 +293,15 @@ function ____exports.setRoomCleared(self)
291
293
  return
292
294
  end
293
295
  room:SetClear(true)
294
- for ____, door in ipairs(
295
- getDoors(nil)
296
- ) do
296
+ for ____, door in ipairs(getDoors(nil)) do
297
297
  do
298
298
  if isHiddenSecretRoomDoor(nil, door) then
299
- goto __continue56
299
+ goto __continue60
300
300
  end
301
301
  openDoorFast(nil, door)
302
302
  door.ExtraVisible = false
303
303
  end
304
- ::__continue56::
304
+ ::__continue60::
305
305
  end
306
306
  sfx:Stop(SoundEffect.SOUND_DOOR_HEAVY_OPEN)
307
307
  game:ShakeScreen(0)
@@ -312,4 +312,20 @@ function ____exports.setRoomUncleared(self)
312
312
  room:SetClear(false)
313
313
  closeAllDoors(nil)
314
314
  end
315
+ function ____exports.teleport(self, roomGridIndex, direction, roomTransitionAnim)
316
+ if direction == nil then
317
+ direction = Direction.NO_DIRECTION
318
+ end
319
+ if roomTransitionAnim == nil then
320
+ roomTransitionAnim = RoomTransitionAnim.TELEPORT
321
+ end
322
+ local game = Game()
323
+ local level = game:GetLevel()
324
+ local roomData = ____exports.getRoomData(nil, roomGridIndex)
325
+ if roomData == nil then
326
+ error(("Failed to change the room to to grid index " .. tostring(roomGridIndex)) .. " because that room does not exist.")
327
+ end
328
+ level.LeaveDoor = -1
329
+ game:StartRoomTransition(roomGridIndex, direction, roomTransitionAnim)
330
+ end
315
331
  return ____exports
@@ -22,14 +22,22 @@ function ____exports.spawnCollectible(self, collectibleType, position, seed, opt
22
22
  error("Failed to spawn a collectible since the provided seed was 0, which is not allowed. (It will cause the game to crash.)")
23
23
  end
24
24
  local game = Game()
25
- local collectible = game:Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, position, Vector.Zero, nil, collectibleType, seed):ToPickup()
25
+ local collectible = game:Spawn(
26
+ EntityType.ENTITY_PICKUP,
27
+ PickupVariant.PICKUP_COLLECTIBLE,
28
+ position,
29
+ Vector.Zero,
30
+ nil,
31
+ collectibleType,
32
+ seed
33
+ ):ToPickup()
26
34
  if collectible == nil then
27
35
  error("Failed to spawn a collectible.")
28
36
  end
29
37
  if options then
30
38
  collectible.OptionsPickupIndex = 1
31
39
  end
32
- if (anyPlayerIs(nil, PlayerType.PLAYER_KEEPER_B) and (not isQuestCollectible(nil, collectibleType))) and (not forceFreeItem) then
40
+ if anyPlayerIs(nil, PlayerType.PLAYER_KEEPER_B) and not isQuestCollectible(nil, collectibleType) and not forceFreeItem then
33
41
  collectible.ShopItemId = -1
34
42
  collectible.Price = 15
35
43
  end
@@ -24,12 +24,12 @@ end
24
24
  function ____exports.getFinalFrameOfAnimation(self, sprite, animation)
25
25
  local currentAnimation = sprite:GetAnimation()
26
26
  local currentFrame = sprite:GetFrame()
27
- if (animation ~= nil) and (animation ~= currentAnimation) then
27
+ if animation ~= nil and animation ~= currentAnimation then
28
28
  sprite:SetAnimation(animation)
29
29
  end
30
30
  sprite:SetLastFrame()
31
31
  local finalFrame = sprite:GetFrame()
32
- if (animation ~= nil) and (animation ~= currentAnimation) then
32
+ if animation ~= nil and animation ~= currentAnimation then
33
33
  sprite:Play(currentAnimation, true)
34
34
  end
35
35
  sprite:SetFrame(currentFrame)
@@ -6,7 +6,7 @@ function ____exports.onRepentanceStage(self)
6
6
  local game = Game()
7
7
  local level = game:GetLevel()
8
8
  local stageType = level:GetStageType()
9
- return (stageType == StageType.STAGETYPE_REPENTANCE) or (stageType == StageType.STAGETYPE_REPENTANCE_B)
9
+ return stageType == StageType.STAGETYPE_REPENTANCE or stageType == StageType.STAGETYPE_REPENTANCE_B
10
10
  end
11
11
  function ____exports.stageTypeToLetter(self, stageType)
12
12
  repeat
@@ -17,31 +17,31 @@ function ____exports.stageTypeToLetter(self, stageType)
17
17
  return ""
18
18
  end
19
19
  end
20
- ____cond14 = ____cond14 or (____switch14 == StageType.STAGETYPE_WOTL)
20
+ ____cond14 = ____cond14 or ____switch14 == StageType.STAGETYPE_WOTL
21
21
  if ____cond14 then
22
22
  do
23
23
  return "a"
24
24
  end
25
25
  end
26
- ____cond14 = ____cond14 or (____switch14 == StageType.STAGETYPE_AFTERBIRTH)
26
+ ____cond14 = ____cond14 or ____switch14 == StageType.STAGETYPE_AFTERBIRTH
27
27
  if ____cond14 then
28
28
  do
29
29
  return "b"
30
30
  end
31
31
  end
32
- ____cond14 = ____cond14 or (____switch14 == StageType.STAGETYPE_GREEDMODE)
32
+ ____cond14 = ____cond14 or ____switch14 == StageType.STAGETYPE_GREEDMODE
33
33
  if ____cond14 then
34
34
  do
35
35
  return ""
36
36
  end
37
37
  end
38
- ____cond14 = ____cond14 or (____switch14 == StageType.STAGETYPE_REPENTANCE)
38
+ ____cond14 = ____cond14 or ____switch14 == StageType.STAGETYPE_REPENTANCE
39
39
  if ____cond14 then
40
40
  do
41
41
  return "c"
42
42
  end
43
43
  end
44
- ____cond14 = ____cond14 or (____switch14 == StageType.STAGETYPE_REPENTANCE_B)
44
+ ____cond14 = ____cond14 or ____switch14 == StageType.STAGETYPE_REPENTANCE_B
45
45
  if ____cond14 then
46
46
  do
47
47
  return "d"
@@ -84,33 +84,33 @@ function ____exports.onCathedral(self)
84
84
  local level = game:GetLevel()
85
85
  local stage = level:GetStage()
86
86
  local stageType = level:GetStageType()
87
- return (stage == 10) and (stageType == 1)
87
+ return stage == 10 and stageType == 1
88
88
  end
89
89
  function ____exports.onChest(self)
90
90
  local game = Game()
91
91
  local level = game:GetLevel()
92
92
  local stage = level:GetStage()
93
93
  local stageType = level:GetStageType()
94
- return (stage == 11) and (stageType == 1)
94
+ return stage == 11 and stageType == 1
95
95
  end
96
96
  function ____exports.onDarkRoom(self)
97
97
  local game = Game()
98
98
  local level = game:GetLevel()
99
99
  local stage = level:GetStage()
100
100
  local stageType = level:GetStageType()
101
- return (stage == 11) and (stageType == 0)
101
+ return stage == 11 and stageType == 0
102
102
  end
103
103
  function ____exports.onFinalFloor(self)
104
104
  local game = Game()
105
105
  local level = game:GetLevel()
106
106
  local stage = level:GetStage()
107
- return (((stage == 11) or (stage == 12)) or (stage == 13)) or ((stage == 8) and ____exports.onRepentanceStage(nil))
107
+ return stage == 11 or stage == 12 or stage == 13 or stage == 8 and ____exports.onRepentanceStage(nil)
108
108
  end
109
109
  function ____exports.onSheol(self)
110
110
  local game = Game()
111
111
  local level = game:GetLevel()
112
112
  local stage = level:GetStage()
113
113
  local stageType = level:GetStageType()
114
- return (stage == 10) and (stageType == 0)
114
+ return stage == 10 and stageType == 0
115
115
  end
116
116
  return ____exports
@@ -1,7 +1,7 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  local ____exports = {}
3
3
  function ____exports.getFireDelay(self, tearsStat)
4
- return math.max((30 / tearsStat) - 1, -0.9999)
4
+ return math.max(30 / tearsStat - 1, -0.9999)
5
5
  end
6
6
  function ____exports.getTearsStat(self, fireDelay)
7
7
  return 30 / (fireDelay + 1)
@@ -8,15 +8,11 @@ local ____transformationNameMap = require("maps.transformationNameMap")
8
8
  local TRANSFORMATION_NAME_MAP = ____transformationNameMap.TRANSFORMATION_NAME_MAP
9
9
  function ____exports.getPlayerNumTransformationCollectibles(self, player, playerForm)
10
10
  if TRANSFORMATIONS_NOT_BASED_ON_ITEMS:has(playerForm) then
11
- error(
12
- ("The transformation of " .. tostring(playerForm)) .. " cannot be tracked by this function."
13
- )
11
+ error(("The transformation of " .. tostring(playerForm)) .. " cannot be tracked by this function.")
14
12
  end
15
13
  local itemsForTransformation = TRANSFORMATION_TO_ITEMS_MAP:get(playerForm)
16
14
  if itemsForTransformation == nil then
17
- error(
18
- ("The transformation of " .. tostring(playerForm)) .. " is not a valid value of the PlayerForm enum."
19
- )
15
+ error(("The transformation of " .. tostring(playerForm)) .. " is not a valid value of the PlayerForm enum.")
20
16
  end
21
17
  local numCollectibles = 0
22
18
  for ____, collectibleType in ipairs(itemsForTransformation) do
@@ -26,13 +22,11 @@ function ____exports.getPlayerNumTransformationCollectibles(self, player, player
26
22
  end
27
23
  function ____exports.getTransformationsForItem(self, collectibleType)
28
24
  local transformations = ITEM_TO_TRANSFORMATION_MAP:get(collectibleType)
29
- return ((transformations == nil) and ({})) or ({
30
- table.unpack(transformations)
31
- })
25
+ return transformations == nil and ({}) or ({table.unpack(transformations)})
32
26
  end
33
27
  function ____exports.getTransformationName(self, transformation)
34
28
  local defaultName = "Unknown"
35
29
  local transformationName = TRANSFORMATION_NAME_MAP:get(transformation)
36
- return ((transformationName == nil) and defaultName) or transformationName
30
+ return transformationName == nil and defaultName or transformationName
37
31
  end
38
32
  return ____exports
@@ -14,11 +14,11 @@ function ____exports.temporarilyRemoveTrinket(self, player, trinketType)
14
14
  numTrinkets = numTrinkets + 1
15
15
  end
16
16
  local numSmeltedTrinkets = numTrinkets
17
- local trinketWasInSlot1 = (trinket1 == trinketType) or ((trinket1 + GOLDEN_TRINKET_SHIFT) == trinketType)
17
+ local trinketWasInSlot1 = trinket1 == trinketType or trinket1 + GOLDEN_TRINKET_SHIFT == trinketType
18
18
  if trinketWasInSlot1 then
19
19
  numSmeltedTrinkets = numSmeltedTrinkets - 1
20
20
  end
21
- local trinketWasInSlot2 = (trinket2 == trinketType) or ((trinket2 + GOLDEN_TRINKET_SHIFT) == trinketType)
21
+ local trinketWasInSlot2 = trinket2 == trinketType or trinket2 + GOLDEN_TRINKET_SHIFT == trinketType
22
22
  if trinketWasInSlot2 then
23
23
  numSmeltedTrinkets = numSmeltedTrinkets - 1
24
24
  end
@@ -27,7 +27,7 @@ end
27
27
  function ____exports.temporarilyRemoveTrinkets(self, player)
28
28
  local trinket1 = player:GetTrinket(0)
29
29
  local trinket2 = player:GetTrinket(1)
30
- if (trinket1 == TrinketType.TRINKET_NULL) and (trinket2 == TrinketType.TRINKET_NULL) then
30
+ if trinket1 == TrinketType.TRINKET_NULL and trinket2 == TrinketType.TRINKET_NULL then
31
31
  return nil
32
32
  end
33
33
  if trinket1 ~= TrinketType.TRINKET_NULL then
@@ -19,17 +19,15 @@ function ____exports.getOpenTrinketSlot(self, player)
19
19
  local trinket0 = player:GetTrinket(0)
20
20
  local trinket1 = player:GetTrinket(1)
21
21
  if maxTrinkets == 1 then
22
- return ((trinket0 == TrinketType.TRINKET_NULL) and 0) or nil
22
+ return trinket0 == TrinketType.TRINKET_NULL and 0 or nil
23
23
  end
24
24
  if maxTrinkets == 2 then
25
25
  if trinket0 == TrinketType.TRINKET_NULL then
26
26
  return 0
27
27
  end
28
- return ((trinket1 == TrinketType.TRINKET_NULL) and 1) or nil
28
+ return trinket1 == TrinketType.TRINKET_NULL and 1 or nil
29
29
  end
30
- error(
31
- "The player has an unknown number of trinket slots: " .. tostring(maxTrinkets)
32
- )
30
+ error("The player has an unknown number of trinket slots: " .. tostring(maxTrinkets))
33
31
  return nil
34
32
  end
35
33
  function ____exports.getTrinkets(self, matchingSubType)
@@ -98,7 +96,13 @@ function ____exports.smeltTrinket(self, player, trinketType, numTrinkets)
98
96
  local i = 0
99
97
  while i < numTrinkets do
100
98
  player:AddTrinket(trinketType)
101
- player:UseActiveItem(CollectibleType.COLLECTIBLE_SMELTER, false, false, true, false)
99
+ player:UseActiveItem(
100
+ CollectibleType.COLLECTIBLE_SMELTER,
101
+ false,
102
+ false,
103
+ true,
104
+ false
105
+ )
102
106
  i = i + 1
103
107
  end
104
108
  end
@@ -16,14 +16,14 @@ function ____exports.getHeartsUIWidth(self)
16
16
  local soulHearts = player:GetSoulHearts()
17
17
  local boneHearts = player:GetBoneHearts()
18
18
  local extraLives = player:GetExtraLives()
19
- local combinedHearts = (maxHearts + soulHearts) + (boneHearts * 2)
19
+ local combinedHearts = maxHearts + soulHearts + boneHearts * 2
20
20
  if combinedHearts > 12 then
21
21
  combinedHearts = 12
22
22
  end
23
23
  if curses == LevelCurse.CURSE_OF_THE_UNKNOWN then
24
24
  combinedHearts = 2
25
25
  end
26
- local width = (combinedHearts / 2) * UI_HEART_WIDTH
26
+ local width = combinedHearts / 2 * UI_HEART_WIDTH
27
27
  if extraLives > 9 then
28
28
  width = width + 20
29
29
  if player:HasCollectible(CollectibleType.COLLECTIBLE_GUPPYS_COLLAR) then
@@ -40,7 +40,7 @@ end
40
40
  function ____exports.getHUDOffsetVector(self)
41
41
  local defaultVector = Vector.Zero
42
42
  local hudOffset = math.floor(Options.HUDOffset * 10)
43
- if (hudOffset < 1) or (hudOffset > 10) then
43
+ if hudOffset < 1 or hudOffset > 10 then
44
44
  return defaultVector
45
45
  end
46
46
  local x = hudOffset * 2
@@ -90,14 +90,3 @@ export declare function printConsole(msg: string): void;
90
90
  * `clear` method does not exist. Use this helper function as a drop-in replacement for this.
91
91
  */
92
92
  export declare function tableClear(table: LuaTable): void;
93
- /**
94
- * Helper function to change the current room. It can be used for both teleportation and "normal"
95
- * room transitions, depending on what is passed for the `direction` and `roomTransitionAnim`
96
- * arguments. Use this function instead of invoking `Game.StartRoomTransition()` directly so that
97
- * you don't forget to set `Level.LeaveDoor` property.
98
- *
99
- * @param roomGridIndex The room grid index of the destination room.
100
- * @param direction Optional. Default is `Direction.NO_DIRECTION`.
101
- * @param roomTransitionAnim Optional. Default is `RoomTransitionAnim.TELEPORT`.
102
- */
103
- export declare function teleport(roomGridIndex: int, direction?: Direction, roomTransitionAnim?: RoomTransitionAnim): void;
@@ -4,22 +4,16 @@ local ____exports = {}
4
4
  local HEX_STRING_LENGTH = 6
5
5
  function ____exports.copyMap(self, oldMap)
6
6
  local newMap = __TS__New(Map)
7
- for ____, ____value in __TS__Iterator(
8
- oldMap:entries()
9
- ) do
10
- local key
11
- key = ____value[1]
12
- local value
13
- value = ____value[2]
7
+ for ____, ____value in __TS__Iterator(oldMap:entries()) do
8
+ local key = ____value[1]
9
+ local value = ____value[2]
14
10
  newMap:set(key, value)
15
11
  end
16
12
  return newMap
17
13
  end
18
14
  function ____exports.copySet(self, oldSet)
19
15
  local newSet = __TS__New(Set)
20
- for ____, value in __TS__Iterator(
21
- oldSet:values()
22
- ) do
16
+ for ____, value in __TS__Iterator(oldSet:values()) do
23
17
  newSet:add(value)
24
18
  end
25
19
  return newSet
@@ -38,9 +32,7 @@ end
38
32
  function ____exports.hexToKColor(self, hexString, alpha)
39
33
  hexString = __TS__StringReplace(hexString, "#", "")
40
34
  if #hexString ~= HEX_STRING_LENGTH then
41
- error(
42
- ("Hex strings must be of length " .. tostring(HEX_STRING_LENGTH)) .. "."
43
- )
35
+ error(("Hex strings must be of length " .. tostring(HEX_STRING_LENGTH)) .. ".")
44
36
  end
45
37
  local rString = __TS__StringSubstr(hexString, 0, 2)
46
38
  local R = tonumber("0x" .. rString)
@@ -68,7 +60,7 @@ function ____exports.onSetSeed(self)
68
60
  local seeds = game:GetSeeds()
69
61
  local customRun = seeds:IsCustomRun()
70
62
  local challenge = Isaac.GetChallenge()
71
- return (challenge == Challenge.CHALLENGE_NULL) and customRun
63
+ return challenge == Challenge.CHALLENGE_NULL and customRun
72
64
  end
73
65
  function ____exports.printConsole(self, msg)
74
66
  Isaac.ConsoleOutput(msg .. "\n")
@@ -78,16 +70,4 @@ function ____exports.tableClear(self, ____table)
78
70
  ____table[key] = nil
79
71
  end
80
72
  end
81
- function ____exports.teleport(self, roomGridIndex, direction, roomTransitionAnim)
82
- if direction == nil then
83
- direction = Direction.NO_DIRECTION
84
- end
85
- if roomTransitionAnim == nil then
86
- roomTransitionAnim = RoomTransitionAnim.TELEPORT
87
- end
88
- local game = Game()
89
- local level = game:GetLevel()
90
- level.LeaveDoor = -1
91
- game:StartRoomTransition(roomGridIndex, direction, roomTransitionAnim)
92
- end
93
73
  return ____exports
@@ -14,25 +14,25 @@ function ____exports.directionToVector(self, direction)
14
14
  return Vector(0, 1)
15
15
  end
16
16
  end
17
- ____cond4 = ____cond4 or (____switch4 == Direction.LEFT)
17
+ ____cond4 = ____cond4 or ____switch4 == Direction.LEFT
18
18
  if ____cond4 then
19
19
  do
20
20
  return Vector(-1, 0)
21
21
  end
22
22
  end
23
- ____cond4 = ____cond4 or (____switch4 == Direction.RIGHT)
23
+ ____cond4 = ____cond4 or ____switch4 == Direction.RIGHT
24
24
  if ____cond4 then
25
25
  do
26
26
  return Vector(1, 0)
27
27
  end
28
28
  end
29
- ____cond4 = ____cond4 or (____switch4 == Direction.UP)
29
+ ____cond4 = ____cond4 or ____switch4 == Direction.UP
30
30
  if ____cond4 then
31
31
  do
32
32
  return Vector(0, -1)
33
33
  end
34
34
  end
35
- ____cond4 = ____cond4 or (____switch4 == Direction.NO_DIRECTION)
35
+ ____cond4 = ____cond4 or ____switch4 == Direction.NO_DIRECTION
36
36
  if ____cond4 then
37
37
  do
38
38
  return Vector.Zero
@@ -66,16 +66,16 @@ function ____exports.isVector(self, object)
66
66
  end
67
67
  function ____exports.vectorToDirection(self, vector)
68
68
  local degrees = vector:GetAngleDegrees()
69
- if (degrees > -45) and (degrees < 45) then
69
+ if degrees > -45 and degrees < 45 then
70
70
  return Direction.RIGHT
71
71
  end
72
- if (degrees >= 45) and (degrees <= 135) then
72
+ if degrees >= 45 and degrees <= 135 then
73
73
  return Direction.DOWN
74
74
  end
75
- if (degrees <= -45) and (degrees >= -135) then
75
+ if degrees <= -45 and degrees >= -135 then
76
76
  return Direction.UP
77
77
  end
78
- if (degrees > 135) or (degrees < -135) then
78
+ if degrees > 135 or degrees < -135 then
79
79
  return Direction.LEFT
80
80
  end
81
81
  return Direction.NO_DIRECTION