isaacscript-common 1.0.573 → 1.0.577

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 (136) 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.d.ts +10 -0
  93. package/dist/functions/doors.lua +19 -21
  94. package/dist/functions/entity.lua +8 -2
  95. package/dist/functions/flag.lua +1 -1
  96. package/dist/functions/gridEntity.lua +14 -9
  97. package/dist/functions/input.lua +17 -27
  98. package/dist/functions/jsonRoom.lua +3 -9
  99. package/dist/functions/language.lua +9 -1
  100. package/dist/functions/log.lua +33 -85
  101. package/dist/functions/math.lua +15 -17
  102. package/dist/functions/npc.lua +15 -17
  103. package/dist/functions/pickups.lua +14 -1
  104. package/dist/functions/player.lua +38 -60
  105. package/dist/functions/playerHealth.lua +19 -9
  106. package/dist/functions/pocketItems.lua +4 -4
  107. package/dist/functions/random.lua +2 -2
  108. package/dist/functions/revive.lua +4 -4
  109. package/dist/functions/rooms.d.ts +1 -1
  110. package/dist/functions/rooms.lua +42 -41
  111. package/dist/functions/spawnCollectible.lua +10 -2
  112. package/dist/functions/sprite.lua +2 -2
  113. package/dist/functions/stage.lua +11 -11
  114. package/dist/functions/tears.lua +1 -1
  115. package/dist/functions/transformations.lua +4 -10
  116. package/dist/functions/trinketGive.lua +3 -3
  117. package/dist/functions/trinkets.lua +10 -6
  118. package/dist/functions/ui.lua +3 -3
  119. package/dist/functions/util.lua +6 -14
  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/sets/cards.lua +98 -2
  135. package/dist/types/ModUpgraded.lua +95 -105
  136. package/package.json +5 -5
@@ -58,7 +58,7 @@ function restoreDefaultsAll(self)
58
58
  restoreDefaults(nil, SaveDataKeys.Room)
59
59
  end
60
60
  function restoreDefaults(self, childTableName)
61
- if ((childTableName ~= SaveDataKeys.Run) and (childTableName ~= SaveDataKeys.Level)) and (childTableName ~= SaveDataKeys.Room) then
61
+ if childTableName ~= SaveDataKeys.Run and childTableName ~= SaveDataKeys.Level and childTableName ~= SaveDataKeys.Room then
62
62
  error("Unknown child table name of: " .. childTableName)
63
63
  end
64
64
  for subscriberName, saveData in pairs(saveDataMap) do
@@ -42,7 +42,7 @@ function ____exports.merge(self, oldObject, newTable, traversalDescription)
42
42
  end
43
43
  function mergeArray(self, oldObject, newTable)
44
44
  local oldArray = oldObject
45
- if (not isArray(nil, oldArray)) or (not isArray(nil, newTable)) then
45
+ if not isArray(nil, oldArray) or not isArray(nil, newTable) then
46
46
  return false
47
47
  end
48
48
  tableClear(nil, oldArray)
@@ -102,9 +102,7 @@ function mergeTable(self, oldTable, newTable, traversalDescription)
102
102
  end
103
103
  else
104
104
  if DEBUG then
105
- log(
106
- (("Merging key \"" .. tostring(key)) .. "\" with value: ") .. tostring(value)
107
- )
105
+ log((("Merging key \"" .. tostring(key)) .. "\" with value: ") .. tostring(value))
108
106
  end
109
107
  oldTable[key] = value
110
108
  end
@@ -24,14 +24,12 @@ function checkReturnFamiliarToPlayer(self, npc)
24
24
  end
25
25
  function blacklistEntryExists(self, incomingFamiliarVariant, incomingFamiliarSubType)
26
26
  for ____, ____value in ipairs(v.run.familiarBlacklist) do
27
- local familiarVariant
28
- familiarVariant = ____value[1]
29
- local familiarSubType
30
- familiarSubType = ____value[2]
31
- if (incomingFamiliarVariant == familiarVariant) and (familiarSubType == incomingFamiliarSubType) then
27
+ local familiarVariant = ____value[1]
28
+ local familiarSubType = ____value[2]
29
+ if incomingFamiliarVariant == familiarVariant and familiarSubType == incomingFamiliarSubType then
32
30
  return true
33
31
  end
34
- if (incomingFamiliarVariant == familiarVariant) and (familiarSubType == nil) then
32
+ if incomingFamiliarVariant == familiarVariant and familiarSubType == nil then
35
33
  return true
36
34
  end
37
35
  end
@@ -59,7 +57,7 @@ local function getSirenHelper(self, familiar)
59
57
  local familiarHash = GetPtrHash(familiar)
60
58
  local sirenHelpers = Isaac.FindByType(EntityType.ENTITY_SIREN_HELPER)
61
59
  for ____, sirenHelper in ipairs(sirenHelpers) do
62
- if (sirenHelper.Target ~= nil) and (GetPtrHash(sirenHelper.Target) == familiarHash) then
60
+ if sirenHelper.Target ~= nil and GetPtrHash(sirenHelper.Target) == familiarHash then
63
61
  return sirenHelper
64
62
  end
65
63
  end
@@ -14,7 +14,9 @@ function ____exports.arrayShuffleInPlace(self, array, seed)
14
14
  currentIndex = currentIndex - 1
15
15
  seed = nextSeed(nil, seed)
16
16
  randomIndex = ____exports.getRandomArrayIndex(nil, array, seed)
17
- array[currentIndex + 1], array[randomIndex + 1] = array[randomIndex + 1], array[currentIndex + 1]
17
+ local ____temp_0 = {array[randomIndex + 1], array[currentIndex + 1]}
18
+ array[currentIndex + 1] = ____temp_0[1]
19
+ array[randomIndex + 1] = ____temp_0[2]
18
20
  end
19
21
  end
20
22
  function ____exports.getRandomArrayIndex(self, array, seed)
@@ -38,9 +40,7 @@ function ____exports.arrayCombine(self, ...)
38
40
  return elements
39
41
  end
40
42
  function ____exports.arrayCopy(self, array)
41
- return {
42
- table.unpack(array)
43
- }
43
+ return {table.unpack(array)}
44
44
  end
45
45
  function ____exports.arrayEmpty(self, array)
46
46
  __TS__ArraySplice(array, 0, #array)
@@ -83,9 +83,7 @@ function ____exports.arrayShuffle(self, originalArray, seed)
83
83
  if seed == nil then
84
84
  seed = Random()
85
85
  end
86
- local array = {
87
- table.unpack(originalArray)
88
- }
86
+ local array = {table.unpack(originalArray)}
89
87
  ____exports.arrayShuffleInPlace(nil, array, seed)
90
88
  return array
91
89
  end
@@ -111,9 +109,7 @@ function ____exports.arrayToString(self, array)
111
109
  end
112
110
  function ____exports.arrayRemove(self, originalArray, ...)
113
111
  local elements = {...}
114
- local array = {
115
- table.unpack(originalArray)
116
- }
112
+ local array = {table.unpack(originalArray)}
117
113
  for ____, element in ipairs(elements) do
118
114
  local index = __TS__ArrayIndexOf(array, element)
119
115
  __TS__ArraySplice(array, index, 1)
@@ -1,7 +1,7 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  local ____exports = {}
3
3
  function ____exports.getKBitOfN(self, k, n)
4
- return (n >> k) & 1
4
+ return n >> k & 1
5
5
  end
6
6
  function ____exports.getNumBitsOfN(self, n)
7
7
  local numBits = 0
@@ -4,6 +4,6 @@ local ____challengeNameMap = require("maps.challengeNameMap")
4
4
  local CHALLENGE_NAME_MAP = ____challengeNameMap.CHALLENGE_NAME_MAP
5
5
  function ____exports.getChallengeName(self, challenge)
6
6
  local challengeName = CHALLENGE_NAME_MAP:get(challenge)
7
- return ((challengeName == nil) and "Unknown") or challengeName
7
+ return challengeName == nil and "Unknown" or challengeName
8
8
  end
9
9
  return ____exports
@@ -43,19 +43,19 @@ function getNumChargesToAdd(self, player, activeSlot, ignoreBigRoomDoubleCharge)
43
43
  local batteryCharge = player:GetBatteryCharge(activeSlot)
44
44
  local hasBattery = player:HasCollectible(CollectibleType.COLLECTIBLE_BATTERY)
45
45
  local maxCharges = getCollectibleMaxCharges(nil, activeItem)
46
- if (not hasBattery) and (activeCharge == maxCharges) then
46
+ if not hasBattery and activeCharge == maxCharges then
47
47
  return 0
48
48
  end
49
- if hasBattery and (batteryCharge == maxCharges) then
49
+ if hasBattery and batteryCharge == maxCharges then
50
50
  return 0
51
51
  end
52
- if (not hasBattery) and ((activeCharge + 1) == maxCharges) then
52
+ if not hasBattery and activeCharge + 1 == maxCharges then
53
53
  return 1
54
54
  end
55
- if hasBattery and ((batteryCharge + 1) == maxCharges) then
55
+ if hasBattery and batteryCharge + 1 == maxCharges then
56
56
  return 1
57
57
  end
58
- if (roomShape >= RoomShape.ROOMSHAPE_2x2) and (not ignoreBigRoomDoubleCharge) then
58
+ if roomShape >= RoomShape.ROOMSHAPE_2x2 and not ignoreBigRoomDoubleCharge then
59
59
  return 2
60
60
  end
61
61
  return 1
@@ -70,10 +70,10 @@ function getNumChargesWithAAAModifier(self, player, activeSlot, chargesToAdd)
70
70
  if not hasAAABattery then
71
71
  return chargesToAdd
72
72
  end
73
- if (not hasBattery) and ((activeCharge + chargesToAdd) == (maxCharges - 1)) then
73
+ if not hasBattery and activeCharge + chargesToAdd == maxCharges - 1 then
74
74
  return maxCharges + 1
75
75
  end
76
- if hasBattery and ((batteryCharge + chargesToAdd) == (maxCharges - 1)) then
76
+ if hasBattery and batteryCharge + chargesToAdd == maxCharges - 1 then
77
77
  return maxCharges + 1
78
78
  end
79
79
  return chargesToAdd
@@ -83,7 +83,7 @@ function ____exports.playChargeSoundEffect(self, player, activeSlot)
83
83
  for ____, soundEffect in ipairs({SoundEffect.SOUND_BATTERYCHARGE, SoundEffect.SOUND_BEEP}) do
84
84
  sfx:Stop(soundEffect)
85
85
  end
86
- local chargeSoundEffect = (shouldPlayFullRechargeSound(nil, player, activeSlot) and SoundEffect.SOUND_BATTERYCHARGE) or SoundEffect.SOUND_BEEP
86
+ local chargeSoundEffect = shouldPlayFullRechargeSound(nil, player, activeSlot) and SoundEffect.SOUND_BATTERYCHARGE or SoundEffect.SOUND_BEEP
87
87
  sfx:Play(chargeSoundEffect)
88
88
  end
89
89
  function shouldPlayFullRechargeSound(self, player, activeSlot)
@@ -95,15 +95,13 @@ function shouldPlayFullRechargeSound(self, player, activeSlot)
95
95
  if not hasBattery then
96
96
  return not player:NeedsCharge(activeSlot)
97
97
  end
98
- return (not player:NeedsCharge(activeSlot)) or ((activeCharge == maxCharges) and (batteryCharge == 0))
98
+ return not player:NeedsCharge(activeSlot) or activeCharge == maxCharges and batteryCharge == 0
99
99
  end
100
100
  function ____exports.addRoomClearCharges(self, ignoreBigRoomDoubleCharge)
101
101
  if ignoreBigRoomDoubleCharge == nil then
102
102
  ignoreBigRoomDoubleCharge = false
103
103
  end
104
- for ____, player in ipairs(
105
- getPlayers(nil)
106
- ) do
104
+ for ____, player in ipairs(getPlayers(nil)) do
107
105
  ____exports.addRoomClearCharge(nil, player, ignoreBigRoomDoubleCharge)
108
106
  end
109
107
  end
@@ -15,9 +15,7 @@ local ____sprite = require("functions.sprite")
15
15
  local clearSprite = ____sprite.clearSprite
16
16
  function ____exports.setCollectibleSprite(self, collectible, pngPath)
17
17
  if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
18
- error(
19
- "You cannot set a collectible sprite for pickups of variant: " .. tostring(collectible.Variant)
20
- )
18
+ error("You cannot set a collectible sprite for pickups of variant: " .. tostring(collectible.Variant))
21
19
  end
22
20
  local sprite = collectible:GetSprite()
23
21
  if pngPath == nil then
@@ -68,8 +66,8 @@ function ____exports.getCollectibleDevilHeartPrice(self, collectibleType, player
68
66
  if itemConfigItem == nil then
69
67
  return defaultPickupPrice
70
68
  end
71
- local twoHeartPrice = ((maxHearts == 2) and PickupPrice.PRICE_ONE_HEART_AND_TWO_SOULHEARTS) or PickupPrice.PRICE_TWO_HEARTS
72
- return ((itemConfigItem.DevilPrice == 2) and twoHeartPrice) or PickupPrice.PRICE_ONE_HEART
69
+ local twoHeartPrice = maxHearts == 2 and PickupPrice.PRICE_ONE_HEART_AND_TWO_SOULHEARTS or PickupPrice.PRICE_TWO_HEARTS
70
+ return itemConfigItem.DevilPrice == 2 and twoHeartPrice or PickupPrice.PRICE_ONE_HEART
73
71
  end
74
72
  function ____exports.getCollectibleGfxFilename(self, collectibleType)
75
73
  local itemConfig = Isaac.GetItemConfig()
@@ -138,11 +136,11 @@ function ____exports.getMaxCollectibleID(self)
138
136
  return itemConfig:GetCollectibles().Size - 1
139
137
  end
140
138
  function ____exports.isGlitchedCollectible(self, entity)
141
- return ((entity.Type == EntityType.ENTITY_PICKUP) and (entity.Variant == PickupVariant.PICKUP_COLLECTIBLE)) and (entity.SubType > GLITCHED_ITEM_THRESHOLD)
139
+ return entity.Type == EntityType.ENTITY_PICKUP and entity.Variant == PickupVariant.PICKUP_COLLECTIBLE and entity.SubType > GLITCHED_ITEM_THRESHOLD
142
140
  end
143
141
  function ____exports.isPassiveCollectible(self, collectibleType)
144
142
  local itemType = ____exports.getCollectibleItemType(nil, collectibleType)
145
- return (itemType == ItemType.ITEM_PASSIVE) or (itemType == ItemType.ITEM_FAMILIAR)
143
+ return itemType == ItemType.ITEM_PASSIVE or itemType == ItemType.ITEM_FAMILIAR
146
144
  end
147
145
  function ____exports.isQuestCollectible(self, collectibleType)
148
146
  return ____exports.collectibleHasTag(nil, collectibleType, 32768)
@@ -155,45 +153,42 @@ function ____exports.removeAllCollectibles(self, collectibleType, cap)
155
153
  end
156
154
  function ____exports.removeCollectiblePickupDelay(self, collectible)
157
155
  if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
158
- error(
159
- "You cannot remove pickup delay for pickups of variant: " .. tostring(collectible.Variant)
160
- )
156
+ error("You cannot remove pickup delay for pickups of variant: " .. tostring(collectible.Variant))
161
157
  end
162
158
  collectible.Wait = 0
163
159
  end
164
160
  function ____exports.removeCollectibleFromItemTracker(self, collectibleType)
165
161
  local collectibleName = ____exports.getCollectibleName(nil, collectibleType)
166
- Isaac.DebugString(
167
- ((("Removing collectible " .. tostring(collectibleType)) .. " (") .. collectibleName) .. ") on player 0 (Player)"
168
- )
162
+ Isaac.DebugString(((("Removing collectible " .. tostring(collectibleType)) .. " (") .. collectibleName) .. ") on player 0 (Player)")
169
163
  end
170
164
  function ____exports.setCollectibleBlind(self, collectible)
171
165
  if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
172
- error(
173
- "You cannot set a collectible to be blind for pickups of variant: " .. tostring(collectible.Variant)
174
- )
166
+ error("You cannot set a collectible to be blind for pickups of variant: " .. tostring(collectible.Variant))
175
167
  end
176
168
  ____exports.setCollectibleSprite(nil, collectible, BLIND_ITEM_PNG_PATH)
177
169
  end
178
170
  function ____exports.setCollectibleEmpty(self, collectible)
179
171
  if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
180
- error(
181
- "You cannot set a collectible to be empty for pickups of variant: " .. tostring(collectible.Variant)
182
- )
172
+ error("You cannot set a collectible to be empty for pickups of variant: " .. tostring(collectible.Variant))
183
173
  end
184
174
  collectible.SubType = CollectibleType.COLLECTIBLE_NULL
185
175
  ____exports.setCollectibleSprite(nil, collectible)
186
176
  end
187
177
  function ____exports.setCollectibleSubType(self, collectible, newCollectibleType)
188
178
  if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
189
- error(
190
- "You cannot set a collectible sub type for pickups of variant: " .. tostring(collectible.Variant)
191
- )
179
+ error("You cannot set a collectible sub type for pickups of variant: " .. tostring(collectible.Variant))
192
180
  end
193
181
  if newCollectibleType == CollectibleType.COLLECTIBLE_NULL then
194
182
  ____exports.setCollectibleEmpty(nil, collectible)
195
183
  return
196
184
  end
197
- collectible:Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, newCollectibleType, true, true, true)
185
+ collectible:Morph(
186
+ EntityType.ENTITY_PICKUP,
187
+ PickupVariant.PICKUP_COLLECTIBLE,
188
+ newCollectibleType,
189
+ true,
190
+ true,
191
+ true
192
+ )
198
193
  end
199
194
  return ____exports
@@ -7,7 +7,15 @@ function ____exports.getDefaultKColor(self)
7
7
  return KColor(1, 1, 1, 1)
8
8
  end
9
9
  function ____exports.copyColor(self, color)
10
- return Color(color.R, color.G, color.B, color.A, color.RO, color.GO, color.BO)
10
+ return Color(
11
+ color.R,
12
+ color.G,
13
+ color.B,
14
+ color.A,
15
+ color.RO,
16
+ color.GO,
17
+ color.BO
18
+ )
11
19
  end
12
20
  function ____exports.copyKColor(self, kColor)
13
21
  return KColor(kColor.Red, kColor.Green, kColor.Blue, kColor.Alpha)
@@ -39,18 +39,18 @@ function ____exports.deepCopy(self, oldObject, serializationType, traversalDescr
39
39
  local hasTSTLMapBrand = false
40
40
  local hasTSTLSetBrand = false
41
41
  local hasTSTLClassBrand = false
42
- if ((not __TS__InstanceOf(oldObject, Map)) and (not __TS__InstanceOf(oldObject, Set))) and (not isClass) then
42
+ if not __TS__InstanceOf(oldObject, Map) and not __TS__InstanceOf(oldObject, Set) and not isClass then
43
43
  checkMetatable(nil, oldTable, traversalDescription)
44
44
  hasTSTLMapBrand = oldTable[TSTL_MAP_BRAND] ~= nil
45
45
  hasTSTLSetBrand = oldTable[TSTL_SET_BRAND] ~= nil
46
46
  hasTSTLClassBrand = oldTable[TSTL_CLASS_BRAND] ~= nil
47
47
  end
48
48
  local newObject
49
- if ((serializationType == ____exports.SerializationType.NONE) and __TS__InstanceOf(oldObject, Map)) or ((serializationType == ____exports.SerializationType.DESERIALIZE) and hasTSTLMapBrand) then
49
+ if serializationType == ____exports.SerializationType.NONE and __TS__InstanceOf(oldObject, Map) or serializationType == ____exports.SerializationType.DESERIALIZE and hasTSTLMapBrand then
50
50
  newObject = __TS__New(Map)
51
- elseif ((serializationType == ____exports.SerializationType.NONE) and __TS__InstanceOf(oldObject, Set)) or ((serializationType == ____exports.SerializationType.DESERIALIZE) and hasTSTLSetBrand) then
51
+ elseif serializationType == ____exports.SerializationType.NONE and __TS__InstanceOf(oldObject, Set) or serializationType == ____exports.SerializationType.DESERIALIZE and hasTSTLSetBrand then
52
52
  newObject = __TS__New(Set)
53
- elseif ((serializationType == ____exports.SerializationType.NONE) and isClass) or ((serializationType == ____exports.SerializationType.DESERIALIZE) and hasTSTLClassBrand) then
53
+ elseif serializationType == ____exports.SerializationType.NONE and isClass or serializationType == ____exports.SerializationType.DESERIALIZE and hasTSTLClassBrand then
54
54
  newObject = copyClass(nil, oldObject)
55
55
  else
56
56
  newObject = {}
@@ -66,43 +66,61 @@ function ____exports.deepCopy(self, oldObject, serializationType, traversalDescr
66
66
  end
67
67
  end
68
68
  if __TS__InstanceOf(oldObject, Map) then
69
- for ____, ____value in __TS__Iterator(
70
- oldObject:entries()
71
- ) do
72
- local key
73
- key = ____value[1]
74
- local value
75
- value = ____value[2]
69
+ for ____, ____value in __TS__Iterator(oldObject:entries()) do
70
+ local key = ____value[1]
71
+ local value = ____value[2]
76
72
  do
77
73
  if ____exports.isBrand(nil, key) then
78
74
  goto __continue17
79
75
  end
80
- deepCopyValue(nil, oldObject, newObject, key, value, traversalDescription, serializationType)
76
+ deepCopyValue(
77
+ nil,
78
+ oldObject,
79
+ newObject,
80
+ key,
81
+ value,
82
+ traversalDescription,
83
+ serializationType
84
+ )
81
85
  end
82
86
  ::__continue17::
83
87
  end
84
88
  elseif __TS__InstanceOf(oldObject, Set) then
85
- for ____, key in __TS__Iterator(
86
- oldObject:values()
87
- ) do
89
+ for ____, key in __TS__Iterator(oldObject:values()) do
88
90
  do
89
91
  if ____exports.isBrand(nil, key) then
90
- goto __continue20
92
+ goto __continue21
91
93
  end
92
94
  local value = ""
93
- deepCopyValue(nil, oldObject, newObject, key, value, traversalDescription, serializationType)
95
+ deepCopyValue(
96
+ nil,
97
+ oldObject,
98
+ newObject,
99
+ key,
100
+ value,
101
+ traversalDescription,
102
+ serializationType
103
+ )
94
104
  end
95
- ::__continue20::
105
+ ::__continue21::
96
106
  end
97
107
  else
98
108
  for key, value in pairs(oldObject) do
99
109
  do
100
110
  if ____exports.isBrand(nil, key) then
101
- goto __continue23
111
+ goto __continue25
102
112
  end
103
- deepCopyValue(nil, oldObject, newObject, key, value, traversalDescription, serializationType)
113
+ deepCopyValue(
114
+ nil,
115
+ oldObject,
116
+ newObject,
117
+ key,
118
+ value,
119
+ traversalDescription,
120
+ serializationType
121
+ )
104
122
  end
105
- ::__continue23::
123
+ ::__continue25::
106
124
  end
107
125
  end
108
126
  return newObject
@@ -139,7 +157,7 @@ function getNewClassFromMetatable(self, metatable)
139
157
  return newClass
140
158
  end
141
159
  function ____exports.isBrand(self, key)
142
- return ((((key == TSTL_MAP_BRAND) or (key == TSTL_SET_BRAND)) or (key == TSTL_CLASS_BRAND)) or (key == TSTL_OBJECT_WITH_NUMBER_KEYS_BRAND)) or (key == VECTOR_BRAND)
160
+ return key == TSTL_MAP_BRAND or key == TSTL_SET_BRAND or key == TSTL_CLASS_BRAND or key == TSTL_OBJECT_WITH_NUMBER_KEYS_BRAND or key == VECTOR_BRAND
143
161
  end
144
162
  function deepCopyValue(self, oldObject, newObject, key, value, traversalDescription, serializationType)
145
163
  local valueType = type(value)
@@ -147,7 +165,7 @@ function deepCopyValue(self, oldObject, newObject, key, value, traversalDescript
147
165
  local convertNumberKeysToString = false
148
166
  local isTSTLObject = __TS__InstanceOf(oldObject, Map) or __TS__InstanceOf(oldObject, Set)
149
167
  local keyType = type(key)
150
- if ((serializationType == ____exports.SerializationType.SERIALIZE) and isTSTLObject) and (keyType == "number") then
168
+ if serializationType == ____exports.SerializationType.SERIALIZE and isTSTLObject and keyType == "number" then
151
169
  convertNumberKeysToString = true
152
170
  local newTable = newObject
153
171
  newTable[TSTL_OBJECT_WITH_NUMBER_KEYS_BRAND] = ""
@@ -159,7 +177,7 @@ function deepCopyValue(self, oldObject, newObject, key, value, traversalDescript
159
177
  if isVector(nil, value) then
160
178
  local vector = value
161
179
  newValue = copyVector(nil, vector, serializationType)
162
- elseif ____exports.isSerializedVector(nil, value) and (serializationType == ____exports.SerializationType.DESERIALIZE) then
180
+ elseif ____exports.isSerializedVector(nil, value) and serializationType == ____exports.SerializationType.DESERIALIZE then
163
181
  local serializedVector = value
164
182
  newValue = ____exports.deserializeVector(nil, serializedVector)
165
183
  elseif valueType == "table" then
@@ -174,7 +192,7 @@ function deepCopyValue(self, oldObject, newObject, key, value, traversalDescript
174
192
  elseif __TS__InstanceOf(newObject, Set) then
175
193
  newObject:add(key)
176
194
  else
177
- local keyToUse = (convertNumberKeysToString and tostring(key)) or key
195
+ local keyToUse = convertNumberKeysToString and tostring(key) or key
178
196
  newObject[keyToUse] = newValue
179
197
  end
180
198
  end
@@ -207,14 +225,14 @@ function checkMetatable(self, ____table, traversalDescription)
207
225
  if metatable == nil then
208
226
  return
209
227
  end
210
- local tableDescription = ((traversalDescription == "") and "the table to copy") or (("\"" .. traversalDescription) .. "\"")
228
+ local tableDescription = traversalDescription == "" and "the table to copy" or ("\"" .. traversalDescription) .. "\""
211
229
  error(("The deepCopy function detected that " .. tableDescription) .. " has a metatable. Copying tables with metatables is not supported (unless they are TypeScriptToLua Maps, Sets, or Classes).")
212
230
  end
213
231
  function validateValue(self, value, valueType, traversalDescription)
214
232
  if isVector(nil, value) then
215
233
  return
216
234
  end
217
- if (((valueType == "function") or (valueType == "nil")) or (valueType == "thread")) or (valueType == "userdata") then
235
+ if valueType == "function" or valueType == "nil" or valueType == "thread" or valueType == "userdata" then
218
236
  error(((("The deepCopy function detected that \"" .. traversalDescription) .. "\" is type ") .. valueType) .. ", which is not supported.")
219
237
  end
220
238
  end
@@ -231,7 +249,7 @@ function ____exports.isSerializedVector(self, object)
231
249
  return false
232
250
  end
233
251
  local ____table = object
234
- return ((____table[VECTOR_BRAND] ~= nil) and (____table.X ~= nil)) and (____table.Y ~= nil)
252
+ return ____table[VECTOR_BRAND] ~= nil and ____table.X ~= nil and ____table.Y ~= nil
235
253
  end
236
254
  ____exports.SerializationType = SerializationType or ({})
237
255
  ____exports.SerializationType.NONE = 0
@@ -43,18 +43,14 @@ function copiedTableHasKeyAndValueNumber(self)
43
43
  local newTable = newObject
44
44
  local value = newTable[keyToLookFor]
45
45
  if value == nil then
46
- error(
47
- "The copied object did not have a key of: " .. tostring(keyToLookFor)
48
- )
46
+ error("The copied object did not have a key of: " .. tostring(keyToLookFor))
49
47
  end
50
48
  local valueType = type(value)
51
49
  if valueType ~= "number" then
52
50
  error("The copied object had a value type of: " .. valueType)
53
51
  end
54
52
  if value ~= valueToLookFor then
55
- error(
56
- "The copied object had a value of: " .. tostring(value)
57
- )
53
+ error("The copied object had a value of: " .. tostring(value))
58
54
  end
59
55
  end
60
56
  function copiedTableDoesNotCoerceTypes(self)
@@ -115,20 +111,20 @@ function copiedObjectHasNoReferencesForArray(self)
115
111
  if not arrayEquals(nil, oldObject.abc, newObject.abc) then
116
112
  error("The copied object does not have an equal array.")
117
113
  end
118
- local ____obj, ____index = oldObject.abc, 0 + 1
119
- ____obj[____index] = ____obj[____index] + 1
114
+ local ____oldObject_abc_0, ____1_1 = oldObject.abc, 1
115
+ ____oldObject_abc_0[____1_1] = ____oldObject_abc_0[____1_1] + 1
120
116
  if arrayEquals(nil, oldObject.abc, newObject.abc) then
121
117
  error("The copied object has an equal array after a modification to the old array.")
122
118
  end
123
- local ____obj, ____index = oldObject.abc, 0 + 1
124
- ____obj[____index] = ____obj[____index] - 1
125
- local ____obj, ____index = newObject.abc, 0 + 1
126
- ____obj[____index] = ____obj[____index] + 1
119
+ local ____oldObject_abc_2, ____1_3 = oldObject.abc, 1
120
+ ____oldObject_abc_2[____1_3] = ____oldObject_abc_2[____1_3] - 1
121
+ local ____newObject_abc_4, ____1_5 = newObject.abc, 1
122
+ ____newObject_abc_4[____1_5] = ____newObject_abc_4[____1_5] + 1
127
123
  if arrayEquals(nil, oldObject.abc, newObject.abc) then
128
124
  error("The copied object has an equal array after a modification to the new array.")
129
125
  end
130
- local ____obj, ____index = newObject.abc, 0 + 1
131
- ____obj[____index] = ____obj[____index] - 1
126
+ local ____newObject_abc_6, ____1_7 = newObject.abc, 1
127
+ ____newObject_abc_6[____1_7] = ____newObject_abc_6[____1_7] - 1
132
128
  end
133
129
  function copiedObjectHasChildObject(self)
134
130
  local childObjectIndex = "abc"
@@ -235,14 +231,10 @@ function copiedMapHasChildMap(self)
235
231
  end
236
232
  local value = newChildMap:get(childMapKey)
237
233
  if value == nil then
238
- error(
239
- "The copied child Map did not have a key of: " .. tostring(childMapKey)
240
- )
234
+ error("The copied child Map did not have a key of: " .. tostring(childMapKey))
241
235
  end
242
236
  if value ~= childMapValue then
243
- error(
244
- "The copied child Map did not have a value of: " .. tostring(childMapValue)
245
- )
237
+ error("The copied child Map did not have a value of: " .. tostring(childMapValue))
246
238
  end
247
239
  end
248
240
  function ____exports.deepCopyTests(self)
@@ -1,5 +1,10 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  export declare function closeAllDoors(): void;
3
+ /**
4
+ * Use this instead of the `door.Close()` method if you want the door to immediately close without
5
+ * an animation.
6
+ */
7
+ export declare function closeDoorFast(door: GridEntityDoor): void;
3
8
  /**
4
9
  * Helper function to get all of the doors in the room. By default, it will return every door. You
5
10
  * can optionally specify one or more room types to return only the doors that match the specified
@@ -63,3 +68,8 @@ export declare function lockDoor(door: GridEntityDoor): void;
63
68
  * discovered yet will not be opened.
64
69
  */
65
70
  export declare function openAllDoors(): void;
71
+ /**
72
+ * Use this instead of the `door.Open()` method if you want the door to immediately open without
73
+ * an animation.
74
+ */
75
+ export declare function openDoorFast(door: GridEntityDoor): void;
@@ -15,7 +15,7 @@ function ____exports.getDoors(self, ...)
15
15
  do
16
16
  local door = room:GetDoor(i)
17
17
  if door == nil then
18
- goto __continue5
18
+ goto __continue7
19
19
  end
20
20
  if #roomTypes == 0 then
21
21
  __TS__ArrayPush(doors, door)
@@ -23,7 +23,7 @@ function ____exports.getDoors(self, ...)
23
23
  __TS__ArrayPush(doors, door)
24
24
  end
25
25
  end
26
- ::__continue5::
26
+ ::__continue7::
27
27
  i = i + 1
28
28
  end
29
29
  end
@@ -44,16 +44,17 @@ function ____exports.isSecretRoomDoor(self, door)
44
44
  return filename == "gfx/grid/Door_08_HoleInWall.anm2"
45
45
  end
46
46
  function ____exports.closeAllDoors(self)
47
- for ____, door in ipairs(
48
- ____exports.getDoors(nil)
49
- ) do
47
+ for ____, door in ipairs(____exports.getDoors(nil)) do
50
48
  door:Close(true)
51
49
  end
52
50
  end
51
+ function ____exports.closeDoorFast(self, door)
52
+ door.State = DoorState.STATE_CLOSED
53
+ local sprite = door:GetSprite()
54
+ sprite:Play("Closed", true)
55
+ end
53
56
  function ____exports.getAngelRoomDoor(self)
54
- for ____, door in ipairs(
55
- ____exports.getDoors(nil)
56
- ) do
57
+ for ____, door in ipairs(____exports.getDoors(nil)) do
57
58
  if ____exports.isAngelRoomDoor(nil, door) then
58
59
  return door
59
60
  end
@@ -61,9 +62,7 @@ function ____exports.getAngelRoomDoor(self)
61
62
  return nil
62
63
  end
63
64
  function ____exports.getDevilRoomDoor(self)
64
- for ____, door in ipairs(
65
- ____exports.getDoors(nil)
66
- ) do
65
+ for ____, door in ipairs(____exports.getDoors(nil)) do
67
66
  if ____exports.isDevilRoomDoor(nil, door) then
68
67
  return door
69
68
  end
@@ -71,9 +70,7 @@ function ____exports.getDevilRoomDoor(self)
71
70
  return nil
72
71
  end
73
72
  function ____exports.getDevilRoomOrAngelRoomDoor(self)
74
- for ____, door in ipairs(
75
- ____exports.getDoors(nil)
76
- ) do
73
+ for ____, door in ipairs(____exports.getDoors(nil)) do
77
74
  if ____exports.isDevilRoomDoor(nil, door) or ____exports.isAngelRoomDoor(nil, door) then
78
75
  return door
79
76
  end
@@ -81,9 +78,7 @@ function ____exports.getDevilRoomOrAngelRoomDoor(self)
81
78
  return nil
82
79
  end
83
80
  function ____exports.getRepentanceDoor(self)
84
- for ____, door in ipairs(
85
- ____exports.getDoors(nil)
86
- ) do
81
+ for ____, door in ipairs(____exports.getDoors(nil)) do
87
82
  if ____exports.isRepentanceDoor(nil, door) then
88
83
  return door
89
84
  end
@@ -93,7 +88,7 @@ end
93
88
  function ____exports.isHiddenSecretRoomDoor(self, door)
94
89
  local sprite = door:GetSprite()
95
90
  local animation = sprite:GetAnimation()
96
- return ____exports.isSecretRoomDoor(nil, door) and (animation == "Hidden")
91
+ return ____exports.isSecretRoomDoor(nil, door) and animation == "Hidden"
97
92
  end
98
93
  function ____exports.isDoorToDownpour(self, door)
99
94
  if not ____exports.isRepentanceDoor(nil, door) then
@@ -145,10 +140,13 @@ function ____exports.lockDoor(self, door)
145
140
  door:Close(true)
146
141
  end
147
142
  function ____exports.openAllDoors(self)
148
- for ____, door in ipairs(
149
- ____exports.getDoors(nil)
150
- ) do
143
+ for ____, door in ipairs(____exports.getDoors(nil)) do
151
144
  door:Open()
152
145
  end
153
146
  end
147
+ function ____exports.openDoorFast(self, door)
148
+ door.State = DoorState.STATE_OPEN
149
+ local sprite = door:GetSprite()
150
+ sprite:Play("Opened", true)
151
+ end
154
152
  return ____exports