isaacscript-common 31.4.0 → 31.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/dist/index.rollup.d.ts +38 -4
  2. package/dist/isaacscript-common.lua +722 -684
  3. package/dist/src/classes/ModFeature.d.ts.map +1 -1
  4. package/dist/src/classes/ModFeature.lua +5 -9
  5. package/dist/src/classes/ModUpgraded.d.ts.map +1 -1
  6. package/dist/src/classes/ModUpgraded.lua +8 -14
  7. package/dist/src/classes/callbacks/PostNewRoomEarly.lua +2 -2
  8. package/dist/src/classes/features/callbackLogic/CustomGridEntities.d.ts.map +1 -1
  9. package/dist/src/classes/features/callbackLogic/CustomGridEntities.lua +3 -3
  10. package/dist/src/classes/features/other/CharacterHealthConversion.lua +1 -1
  11. package/dist/src/classes/features/other/CustomItemPools.d.ts.map +1 -1
  12. package/dist/src/classes/features/other/CustomItemPools.lua +12 -6
  13. package/dist/src/classes/features/other/CustomStages.d.ts.map +1 -1
  14. package/dist/src/classes/features/other/CustomStages.lua +12 -14
  15. package/dist/src/classes/features/other/CustomTrapdoors.d.ts.map +1 -1
  16. package/dist/src/classes/features/other/CustomTrapdoors.lua +6 -8
  17. package/dist/src/classes/features/other/DeployJSONRoom.d.ts.map +1 -1
  18. package/dist/src/classes/features/other/DeployJSONRoom.lua +15 -15
  19. package/dist/src/classes/features/other/ModdedElementSets.d.ts.map +1 -1
  20. package/dist/src/classes/features/other/ModdedElementSets.lua +21 -12
  21. package/dist/src/classes/features/other/Pause.d.ts.map +1 -1
  22. package/dist/src/classes/features/other/Pause.lua +4 -6
  23. package/dist/src/classes/features/other/SaveDataManager.d.ts.map +1 -1
  24. package/dist/src/classes/features/other/SaveDataManager.lua +5 -9
  25. package/dist/src/classes/features/other/customStages/backdrop.lua +9 -10
  26. package/dist/src/classes/features/other/debugDisplay/DebugDisplayBomb.d.ts.map +1 -1
  27. package/dist/src/classes/features/other/debugDisplay/DebugDisplayBomb.lua +2 -1
  28. package/dist/src/classes/features/other/debugDisplay/DebugDisplayDoor.d.ts.map +1 -1
  29. package/dist/src/classes/features/other/debugDisplay/DebugDisplayDoor.lua +2 -1
  30. package/dist/src/classes/features/other/debugDisplay/DebugDisplayEffect.d.ts.map +1 -1
  31. package/dist/src/classes/features/other/debugDisplay/DebugDisplayEffect.lua +2 -1
  32. package/dist/src/classes/features/other/debugDisplay/DebugDisplayFamiliar.d.ts.map +1 -1
  33. package/dist/src/classes/features/other/debugDisplay/DebugDisplayFamiliar.lua +2 -1
  34. package/dist/src/classes/features/other/debugDisplay/DebugDisplayKnife.d.ts.map +1 -1
  35. package/dist/src/classes/features/other/debugDisplay/DebugDisplayKnife.lua +2 -1
  36. package/dist/src/classes/features/other/debugDisplay/DebugDisplayLaser.d.ts.map +1 -1
  37. package/dist/src/classes/features/other/debugDisplay/DebugDisplayLaser.lua +2 -1
  38. package/dist/src/classes/features/other/debugDisplay/DebugDisplayNPC.d.ts.map +1 -1
  39. package/dist/src/classes/features/other/debugDisplay/DebugDisplayNPC.lua +2 -1
  40. package/dist/src/classes/features/other/debugDisplay/DebugDisplayPickup.d.ts.map +1 -1
  41. package/dist/src/classes/features/other/debugDisplay/DebugDisplayPickup.lua +2 -1
  42. package/dist/src/classes/features/other/debugDisplay/DebugDisplayPit.d.ts.map +1 -1
  43. package/dist/src/classes/features/other/debugDisplay/DebugDisplayPit.lua +2 -1
  44. package/dist/src/classes/features/other/debugDisplay/DebugDisplayPlayer.d.ts.map +1 -1
  45. package/dist/src/classes/features/other/debugDisplay/DebugDisplayPlayer.lua +2 -1
  46. package/dist/src/classes/features/other/debugDisplay/DebugDisplayPoop.d.ts.map +1 -1
  47. package/dist/src/classes/features/other/debugDisplay/DebugDisplayPoop.lua +2 -1
  48. package/dist/src/classes/features/other/debugDisplay/DebugDisplayPressurePlate.d.ts.map +1 -1
  49. package/dist/src/classes/features/other/debugDisplay/DebugDisplayPressurePlate.lua +2 -1
  50. package/dist/src/classes/features/other/debugDisplay/DebugDisplayProjectile.d.ts.map +1 -1
  51. package/dist/src/classes/features/other/debugDisplay/DebugDisplayProjectile.lua +2 -1
  52. package/dist/src/classes/features/other/debugDisplay/DebugDisplayRock.d.ts.map +1 -1
  53. package/dist/src/classes/features/other/debugDisplay/DebugDisplayRock.lua +2 -1
  54. package/dist/src/classes/features/other/debugDisplay/DebugDisplaySlot.d.ts.map +1 -1
  55. package/dist/src/classes/features/other/debugDisplay/DebugDisplaySlot.lua +2 -1
  56. package/dist/src/classes/features/other/debugDisplay/DebugDisplaySpikes.d.ts.map +1 -1
  57. package/dist/src/classes/features/other/debugDisplay/DebugDisplaySpikes.lua +2 -1
  58. package/dist/src/classes/features/other/debugDisplay/DebugDisplayTNT.d.ts.map +1 -1
  59. package/dist/src/classes/features/other/debugDisplay/DebugDisplayTNT.lua +2 -1
  60. package/dist/src/classes/features/other/debugDisplay/DebugDisplayTear.d.ts.map +1 -1
  61. package/dist/src/classes/features/other/debugDisplay/DebugDisplayTear.lua +2 -1
  62. package/dist/src/classes/features/other/debugDisplay/utils.d.ts +0 -1
  63. package/dist/src/classes/features/other/debugDisplay/utils.d.ts.map +1 -1
  64. package/dist/src/classes/features/other/debugDisplay/utils.lua +0 -17
  65. package/dist/src/classes/features/other/saveDataManager/restoreDefaults.lua +1 -1
  66. package/dist/src/functions/array.d.ts +3 -0
  67. package/dist/src/functions/array.d.ts.map +1 -1
  68. package/dist/src/functions/array.lua +9 -3
  69. package/dist/src/functions/bitSet128.d.ts.map +1 -1
  70. package/dist/src/functions/bitSet128.lua +4 -6
  71. package/dist/src/functions/bitwise.d.ts.map +1 -1
  72. package/dist/src/functions/bitwise.lua +7 -3
  73. package/dist/src/functions/color.d.ts.map +1 -1
  74. package/dist/src/functions/color.lua +5 -9
  75. package/dist/src/functions/deepCopy.lua +23 -31
  76. package/dist/src/functions/entities.d.ts.map +1 -1
  77. package/dist/src/functions/entities.lua +20 -18
  78. package/dist/src/functions/entitiesSpecific.d.ts.map +1 -1
  79. package/dist/src/functions/entitiesSpecific.lua +11 -27
  80. package/dist/src/functions/enums.d.ts +6 -4
  81. package/dist/src/functions/enums.d.ts.map +1 -1
  82. package/dist/src/functions/enums.lua +13 -9
  83. package/dist/src/functions/gridEntities.d.ts.map +1 -1
  84. package/dist/src/functions/gridEntities.lua +18 -11
  85. package/dist/src/functions/gridEntitiesSpecific.d.ts.map +1 -1
  86. package/dist/src/functions/gridEntitiesSpecific.lua +16 -28
  87. package/dist/src/functions/input.d.ts +3 -0
  88. package/dist/src/functions/input.d.ts.map +1 -1
  89. package/dist/src/functions/input.lua +14 -14
  90. package/dist/src/functions/jsonRoom.d.ts.map +1 -1
  91. package/dist/src/functions/jsonRoom.lua +35 -23
  92. package/dist/src/functions/kColor.d.ts.map +1 -1
  93. package/dist/src/functions/kColor.lua +6 -12
  94. package/dist/src/functions/map.d.ts.map +1 -1
  95. package/dist/src/functions/map.lua +3 -3
  96. package/dist/src/functions/minimap.d.ts.map +1 -1
  97. package/dist/src/functions/minimap.lua +17 -9
  98. package/dist/src/functions/players.d.ts.map +1 -1
  99. package/dist/src/functions/players.lua +17 -22
  100. package/dist/src/functions/render.d.ts +16 -0
  101. package/dist/src/functions/render.d.ts.map +1 -0
  102. package/dist/src/functions/render.lua +50 -0
  103. package/dist/src/functions/rng.d.ts.map +1 -1
  104. package/dist/src/functions/rng.lua +3 -3
  105. package/dist/src/functions/roomShapeWalls.d.ts.map +1 -1
  106. package/dist/src/functions/roomShapeWalls.lua +7 -3
  107. package/dist/src/functions/roomTransition.d.ts.map +1 -1
  108. package/dist/src/functions/roomTransition.lua +7 -3
  109. package/dist/src/functions/rooms.d.ts.map +1 -1
  110. package/dist/src/functions/rooms.lua +8 -5
  111. package/dist/src/functions/serialization.d.ts.map +1 -1
  112. package/dist/src/functions/serialization.lua +8 -18
  113. package/dist/src/functions/table.d.ts.map +1 -1
  114. package/dist/src/functions/table.lua +6 -12
  115. package/dist/src/functions/tstlClass.d.ts.map +1 -1
  116. package/dist/src/functions/tstlClass.lua +3 -3
  117. package/dist/src/functions/utils.d.ts +9 -10
  118. package/dist/src/functions/utils.d.ts.map +1 -1
  119. package/dist/src/functions/utils.lua +14 -22
  120. package/dist/src/functions/vector.d.ts.map +1 -1
  121. package/dist/src/functions/vector.lua +4 -6
  122. package/dist/src/functions/weighted.d.ts.map +1 -1
  123. package/dist/src/functions/weighted.lua +7 -3
  124. package/dist/src/index.d.ts +2 -0
  125. package/dist/src/index.d.ts.map +1 -1
  126. package/dist/src/index.lua +8 -0
  127. package/dist/src/sets/bossSets.d.ts.map +1 -1
  128. package/dist/src/sets/bossSets.lua +3 -3
  129. package/dist/src/types/Expand.d.ts +8 -0
  130. package/dist/src/types/Expand.d.ts.map +1 -0
  131. package/dist/src/types/Expand.lua +2 -0
  132. package/package.json +2 -2
  133. package/src/classes/ModFeature.ts +16 -12
  134. package/src/classes/ModUpgraded.ts +18 -16
  135. package/src/classes/callbacks/PostNewRoomEarly.ts +2 -2
  136. package/src/classes/features/callbackLogic/CustomGridEntities.ts +2 -3
  137. package/src/classes/features/other/CharacterHealthConversion.ts +1 -1
  138. package/src/classes/features/other/CustomItemPools.ts +9 -8
  139. package/src/classes/features/other/CustomStages.ts +9 -10
  140. package/src/classes/features/other/CustomTrapdoors.ts +9 -10
  141. package/src/classes/features/other/DeployJSONRoom.ts +21 -21
  142. package/src/classes/features/other/ModdedElementSets.ts +18 -21
  143. package/src/classes/features/other/Pause.ts +9 -6
  144. package/src/classes/features/other/SaveDataManager.ts +14 -16
  145. package/src/classes/features/other/customStages/backdrop.ts +5 -6
  146. package/src/classes/features/other/debugDisplay/DebugDisplayBomb.ts +2 -1
  147. package/src/classes/features/other/debugDisplay/DebugDisplayDoor.ts +2 -1
  148. package/src/classes/features/other/debugDisplay/DebugDisplayEffect.ts +2 -1
  149. package/src/classes/features/other/debugDisplay/DebugDisplayFamiliar.ts +2 -1
  150. package/src/classes/features/other/debugDisplay/DebugDisplayKnife.ts +2 -1
  151. package/src/classes/features/other/debugDisplay/DebugDisplayLaser.ts +2 -1
  152. package/src/classes/features/other/debugDisplay/DebugDisplayNPC.ts +2 -1
  153. package/src/classes/features/other/debugDisplay/DebugDisplayPickup.ts +2 -1
  154. package/src/classes/features/other/debugDisplay/DebugDisplayPit.ts +2 -1
  155. package/src/classes/features/other/debugDisplay/DebugDisplayPlayer.ts +2 -1
  156. package/src/classes/features/other/debugDisplay/DebugDisplayPoop.ts +2 -1
  157. package/src/classes/features/other/debugDisplay/DebugDisplayPressurePlate.ts +2 -1
  158. package/src/classes/features/other/debugDisplay/DebugDisplayProjectile.ts +2 -1
  159. package/src/classes/features/other/debugDisplay/DebugDisplayRock.ts +2 -1
  160. package/src/classes/features/other/debugDisplay/DebugDisplaySlot.ts +2 -1
  161. package/src/classes/features/other/debugDisplay/DebugDisplaySpikes.ts +2 -1
  162. package/src/classes/features/other/debugDisplay/DebugDisplayTNT.ts +2 -1
  163. package/src/classes/features/other/debugDisplay/DebugDisplayTear.ts +2 -1
  164. package/src/classes/features/other/debugDisplay/utils.ts +0 -13
  165. package/src/classes/features/other/saveDataManager/restoreDefaults.ts +1 -1
  166. package/src/functions/array.ts +8 -6
  167. package/src/functions/bitSet128.ts +9 -10
  168. package/src/functions/bitwise.ts +6 -3
  169. package/src/functions/color.ts +13 -15
  170. package/src/functions/deepCopy.ts +18 -24
  171. package/src/functions/deepCopyTests.ts +5 -6
  172. package/src/functions/entities.ts +22 -20
  173. package/src/functions/entitiesSpecific.ts +10 -27
  174. package/src/functions/enums.ts +29 -17
  175. package/src/functions/gridEntities.ts +14 -16
  176. package/src/functions/gridEntitiesSpecific.ts +15 -28
  177. package/src/functions/input.ts +3 -3
  178. package/src/functions/jsonRoom.ts +39 -27
  179. package/src/functions/kColor.ts +17 -20
  180. package/src/functions/map.ts +5 -5
  181. package/src/functions/minimap.ts +16 -15
  182. package/src/functions/players.ts +7 -10
  183. package/src/functions/render.ts +53 -0
  184. package/src/functions/rng.ts +5 -5
  185. package/src/functions/roomShapeWalls.ts +3 -4
  186. package/src/functions/roomTransition.ts +5 -5
  187. package/src/functions/rooms.ts +5 -6
  188. package/src/functions/serialization.ts +25 -30
  189. package/src/functions/table.ts +18 -20
  190. package/src/functions/tstlClass.ts +5 -5
  191. package/src/functions/utils.ts +27 -23
  192. package/src/functions/vector.ts +9 -10
  193. package/src/functions/weighted.ts +5 -5
  194. package/src/index.ts +2 -0
  195. package/src/sets/bossSets.ts +5 -5
  196. package/src/types/Expand.ts +5 -0
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 31.4.0
3
+ isaacscript-common 31.6.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -15880,12 +15880,267 @@ return ____exports
15880
15880
  end,
15881
15881
  ["src.types.TSTLClass"] = function(...)
15882
15882
  local ____exports = {}
15883
+ return ____exports
15884
+ end,
15885
+ ["src.core.cachedClasses"] = function(...)
15886
+ local ____exports = {}
15887
+ ____exports.game = Game()
15888
+ ____exports.itemConfig = Isaac.GetItemConfig()
15889
+ ____exports.musicManager = MusicManager()
15890
+ ____exports.sfxManager = SFXManager()
15891
+ ____exports.fonts = {
15892
+ droid = Font(),
15893
+ pfTempestaSevenCondensed = Font(),
15894
+ teamMeatFont10 = Font(),
15895
+ teamMeatFont12 = Font(),
15896
+ teamMeatFont16Bold = Font(),
15897
+ terminus = Font(),
15898
+ upheaval = Font()
15899
+ }
15900
+ ____exports.fonts.droid:Load("font/droid.fnt")
15901
+ ____exports.fonts.pfTempestaSevenCondensed:Load("font/pftempestasevencondensed.fnt")
15902
+ ____exports.fonts.teamMeatFont10:Load("font/teammeatfont10.fnt")
15903
+ ____exports.fonts.teamMeatFont12:Load("font/teammeatfont12.fnt")
15904
+ ____exports.fonts.teamMeatFont16Bold:Load("font/teammeatfont16bold.fnt")
15905
+ ____exports.fonts.terminus:Load("font/terminus.fnt")
15906
+ ____exports.fonts.upheaval:Load("font/upheaval.fnt")
15907
+ return ____exports
15908
+ end,
15909
+ ["src.types.PlayerIndex"] = function(...)
15910
+ local ____exports = {}
15911
+ return ____exports
15912
+ end,
15913
+ ["src.functions.playerIndex"] = function(...)
15914
+ local ____lualib = require("lualib_bundle")
15915
+ local __TS__New = ____lualib.__TS__New
15916
+ local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
15917
+ local __TS__ArrayFind = ____lualib.__TS__ArrayFind
15918
+ local ____exports = {}
15919
+ local getPlayerIndexCollectibleType, DEFAULT_COLLECTIBLE_TYPE, EXCLUDED_CHARACTERS
15920
+ local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
15921
+ local BabySubType = ____isaac_2Dtypescript_2Ddefinitions.BabySubType
15922
+ local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
15923
+ local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
15924
+ local PlayerVariant = ____isaac_2Dtypescript_2Ddefinitions.PlayerVariant
15925
+ local ____cachedClasses = require("src.core.cachedClasses")
15926
+ local game = ____cachedClasses.game
15927
+ local ____ReadonlySet = require("src.types.ReadonlySet")
15928
+ local ReadonlySet = ____ReadonlySet.ReadonlySet
15929
+ function ____exports.getAllPlayers(self)
15930
+ local numPlayers = game:GetNumPlayers()
15931
+ local players = {}
15932
+ do
15933
+ local i = 0
15934
+ while i < numPlayers do
15935
+ local player = Isaac.GetPlayer(i)
15936
+ players[#players + 1] = player
15937
+ i = i + 1
15938
+ end
15939
+ end
15940
+ return players
15941
+ end
15942
+ function ____exports.getPlayerIndex(self, player, differentiateForgottenAndSoul)
15943
+ if differentiateForgottenAndSoul == nil then
15944
+ differentiateForgottenAndSoul = false
15945
+ end
15946
+ local playerToUse = player
15947
+ local isSubPlayer = player:IsSubPlayer()
15948
+ if isSubPlayer then
15949
+ local subPlayer = player
15950
+ local playerParent = ____exports.getSubPlayerParent(nil, subPlayer)
15951
+ if playerParent ~= nil then
15952
+ playerToUse = playerParent
15953
+ end
15954
+ end
15955
+ local collectibleType = getPlayerIndexCollectibleType(nil, player, differentiateForgottenAndSoul)
15956
+ local collectibleRNG = playerToUse:GetCollectibleRNG(collectibleType)
15957
+ local seed = collectibleRNG:GetSeed()
15958
+ return seed
15959
+ end
15960
+ function getPlayerIndexCollectibleType(self, player, differentiateForgottenAndSoul)
15961
+ local character = player:GetPlayerType()
15962
+ if character == PlayerType.SOUL then
15963
+ return differentiateForgottenAndSoul and CollectibleType.INNER_EYE or DEFAULT_COLLECTIBLE_TYPE
15964
+ end
15965
+ return DEFAULT_COLLECTIBLE_TYPE
15966
+ end
15967
+ function ____exports.getPlayers(self, performCharacterExclusions)
15968
+ if performCharacterExclusions == nil then
15969
+ performCharacterExclusions = false
15970
+ end
15971
+ local players = ____exports.getAllPlayers(nil)
15972
+ local nonChildPlayers = __TS__ArrayFilter(
15973
+ players,
15974
+ function(____, player) return not ____exports.isChildPlayer(nil, player) end
15975
+ )
15976
+ local nonChildPlayersFiltered = __TS__ArrayFilter(
15977
+ nonChildPlayers,
15978
+ function(____, player)
15979
+ local character = player:GetPlayerType()
15980
+ return not EXCLUDED_CHARACTERS:has(character)
15981
+ end
15982
+ )
15983
+ return performCharacterExclusions and nonChildPlayersFiltered or nonChildPlayers
15984
+ end
15985
+ function ____exports.getSubPlayerParent(self, subPlayer)
15986
+ local subPlayerPtrHash = GetPtrHash(subPlayer)
15987
+ local players = ____exports.getPlayers(nil)
15988
+ return __TS__ArrayFind(
15989
+ players,
15990
+ function(____, player)
15991
+ local thisPlayerSubPlayer = player:GetSubPlayer()
15992
+ if thisPlayerSubPlayer == nil then
15993
+ return false
15994
+ end
15995
+ local thisPlayerSubPlayerPtrHash = GetPtrHash(thisPlayerSubPlayer)
15996
+ return thisPlayerSubPlayerPtrHash == subPlayerPtrHash
15997
+ end
15998
+ )
15999
+ end
16000
+ function ____exports.isChildPlayer(self, player)
16001
+ return player.Parent ~= nil
16002
+ end
16003
+ DEFAULT_COLLECTIBLE_TYPE = CollectibleType.SAD_ONION
16004
+ EXCLUDED_CHARACTERS = __TS__New(ReadonlySet, {PlayerType.ESAU, PlayerType.SOUL_B})
16005
+ function ____exports.getOtherPlayers(self, player)
16006
+ local playerPtrHash = GetPtrHash(player)
16007
+ local players = ____exports.getAllPlayers(nil)
16008
+ return __TS__ArrayFilter(
16009
+ players,
16010
+ function(____, otherPlayer) return GetPtrHash(otherPlayer) ~= playerPtrHash end
16011
+ )
16012
+ end
16013
+ function ____exports.getPlayerFromIndex(self, playerIndex)
16014
+ local players = ____exports.getAllPlayers(nil)
16015
+ return __TS__ArrayFind(
16016
+ players,
16017
+ function(____, player) return ____exports.getPlayerIndex(nil, player) == playerIndex end
16018
+ )
16019
+ end
16020
+ function ____exports.getPlayerIndexVanilla(self, playerToFind)
16021
+ local numPlayers = game:GetNumPlayers()
16022
+ local playerToFindHash = GetPtrHash(playerToFind)
16023
+ do
16024
+ local i = 0
16025
+ while i < numPlayers do
16026
+ local player = Isaac.GetPlayer(i)
16027
+ local playerHash = GetPtrHash(player)
16028
+ if playerHash == playerToFindHash then
16029
+ return i
16030
+ end
16031
+ i = i + 1
16032
+ end
16033
+ end
16034
+ return nil
16035
+ end
16036
+ function ____exports.isFoundSoul(self, player)
16037
+ return ____exports.isChildPlayer(nil, player) and player.Variant == PlayerVariant.COOP_BABY and player.SubType == BabySubType.FOUND_SOUL
16038
+ end
16039
+ return ____exports
16040
+ end,
16041
+ ["src.functions.utils"] = function(...)
16042
+ local ____lualib = require("lualib_bundle")
16043
+ local __TS__ArrayMap = ____lualib.__TS__ArrayMap
16044
+ local __TS__New = ____lualib.__TS__New
16045
+ local ____exports = {}
16046
+ local ____ReadonlySet = require("src.types.ReadonlySet")
16047
+ local ReadonlySet = ____ReadonlySet.ReadonlySet
16048
+ local ____playerIndex = require("src.functions.playerIndex")
16049
+ local getAllPlayers = ____playerIndex.getAllPlayers
16050
+ local ____types = require("src.functions.types")
16051
+ local isFunction = ____types.isFunction
16052
+ function ____exports.assertDefined(self, value, ...)
16053
+ local ____bindingPattern0 = {...}
16054
+ local msg
16055
+ msg = ____bindingPattern0[1]
16056
+ if value == nil then
16057
+ error(msg)
16058
+ end
16059
+ end
16060
+ function ____exports.eRange(self, start, ____end, increment)
16061
+ if increment == nil then
16062
+ increment = 1
16063
+ end
16064
+ if ____end == nil then
16065
+ return ____exports.eRange(nil, 0, start, increment)
16066
+ end
16067
+ local array = {}
16068
+ if start < ____end then
16069
+ do
16070
+ local i = start
16071
+ while i < ____end do
16072
+ array[#array + 1] = i
16073
+ i = i + increment
16074
+ end
16075
+ end
16076
+ else
16077
+ do
16078
+ local i = start
16079
+ while i > ____end do
16080
+ array[#array + 1] = i
16081
+ i = i - increment
16082
+ end
16083
+ end
16084
+ end
16085
+ return array
16086
+ end
16087
+ function ____exports.getTraversalDescription(self, key, traversalDescription)
16088
+ if traversalDescription ~= "" then
16089
+ traversalDescription = traversalDescription .. " --> "
16090
+ end
16091
+ traversalDescription = traversalDescription .. tostring(key)
16092
+ return traversalDescription
16093
+ end
16094
+ function ____exports.iRange(self, start, ____end, increment)
16095
+ if increment == nil then
16096
+ increment = 1
16097
+ end
16098
+ if ____end == nil then
16099
+ return ____exports.iRange(nil, 0, start, increment)
16100
+ end
16101
+ local rangeIncreasing = start <= ____end
16102
+ local exclusiveEnd = rangeIncreasing and ____end + 1 or ____end - 1
16103
+ return ____exports.eRange(nil, start, exclusiveEnd, increment)
16104
+ end
16105
+ function ____exports.inRange(self, num, start, ____end)
16106
+ return num >= start and num <= ____end
16107
+ end
16108
+ function ____exports.isMultiplayer(self)
16109
+ local players = getAllPlayers(nil)
16110
+ local controllerIndexes = __TS__ArrayMap(
16111
+ players,
16112
+ function(____, player) return player.ControllerIndex end
16113
+ )
16114
+ local controllerIndexesSet = __TS__New(ReadonlySet, controllerIndexes)
16115
+ return controllerIndexesSet.size > 1
16116
+ end
16117
+ function ____exports.isRepentance(self)
16118
+ local metatable = getmetatable(Sprite)
16119
+ ____exports.assertDefined(nil, metatable, "Failed to get the metatable of the Sprite global table.")
16120
+ local classTable = metatable.__class
16121
+ ____exports.assertDefined(nil, classTable, "Failed to get the \"__class\" key of the Sprite metatable.")
16122
+ local getAnimation = classTable.GetAnimation
16123
+ return isFunction(nil, getAnimation)
16124
+ end
16125
+ ____exports["repeat"] = function(self, n, func)
16126
+ do
16127
+ local i = 0
16128
+ while i < n do
16129
+ func(nil, i)
16130
+ i = i + 1
16131
+ end
16132
+ end
16133
+ end
16134
+ function ____exports.todo(self, ...)
16135
+ end
15883
16136
  return ____exports
15884
16137
  end,
15885
16138
  ["src.functions.tstlClass"] = function(...)
15886
16139
  local ____exports = {}
15887
16140
  local ____types = require("src.functions.types")
15888
16141
  local isTable = ____types.isTable
16142
+ local ____utils = require("src.functions.utils")
16143
+ local assertDefined = ____utils.assertDefined
15889
16144
  function ____exports.getTSTLClassConstructor(self, object)
15890
16145
  if not isTable(nil, object) then
15891
16146
  return nil
@@ -15921,38 +16176,12 @@ function ____exports.isTSTLSet(self, object)
15921
16176
  end
15922
16177
  function ____exports.newTSTLClass(self, oldClass)
15923
16178
  local constructor = ____exports.getTSTLClassConstructor(nil, oldClass)
15924
- if constructor == nil then
15925
- error("Failed to instantiate a new TypeScriptToLua class since the provided old class does not have a metatable/constructor.")
15926
- end
16179
+ assertDefined(nil, constructor, "Failed to instantiate a new TypeScriptToLua class since the provided old class does not have a metatable/constructor.")
15927
16180
  local newClass = {}
15928
16181
  local newClassMetatable = setmetatable(newClass, constructor.prototype)
15929
16182
  newClassMetatable:____constructor()
15930
16183
  return newClass
15931
16184
  end
15932
- return ____exports
15933
- end,
15934
- ["src.core.cachedClasses"] = function(...)
15935
- local ____exports = {}
15936
- ____exports.game = Game()
15937
- ____exports.itemConfig = Isaac.GetItemConfig()
15938
- ____exports.musicManager = MusicManager()
15939
- ____exports.sfxManager = SFXManager()
15940
- ____exports.fonts = {
15941
- droid = Font(),
15942
- pfTempestaSevenCondensed = Font(),
15943
- teamMeatFont10 = Font(),
15944
- teamMeatFont12 = Font(),
15945
- teamMeatFont16Bold = Font(),
15946
- terminus = Font(),
15947
- upheaval = Font()
15948
- }
15949
- ____exports.fonts.droid:Load("font/droid.fnt")
15950
- ____exports.fonts.pfTempestaSevenCondensed:Load("font/pftempestasevencondensed.fnt")
15951
- ____exports.fonts.teamMeatFont10:Load("font/teammeatfont10.fnt")
15952
- ____exports.fonts.teamMeatFont12:Load("font/teammeatfont12.fnt")
15953
- ____exports.fonts.teamMeatFont16Bold:Load("font/teammeatfont16bold.fnt")
15954
- ____exports.fonts.terminus:Load("font/terminus.fnt")
15955
- ____exports.fonts.upheaval:Load("font/upheaval.fnt")
15956
16185
  return ____exports
15957
16186
  end,
15958
16187
  ["src.enums.private.SerializationBrand"] = function(...)
@@ -16146,6 +16375,8 @@ local isBoolean = ____types.isBoolean
16146
16375
  local isNumber = ____types.isNumber
16147
16376
  local isString = ____types.isString
16148
16377
  local isUserdata = ____types.isUserdata
16378
+ local ____utils = require("src.functions.utils")
16379
+ local assertDefined = ____utils.assertDefined
16149
16380
  function ____exports.clearTable(self, luaMap)
16150
16381
  for key in pairs(luaMap) do
16151
16382
  luaMap[key] = nil
@@ -16166,9 +16397,7 @@ function ____exports.getBooleansFromTable(self, luaMap, objectName, ...)
16166
16397
  local booleans = {}
16167
16398
  for ____, key in ipairs(keys) do
16168
16399
  local value = luaMap[key]
16169
- if value == nil then
16170
- error(((("Failed to find a value for \"" .. key) .. "\" in a table representing a \"") .. objectName) .. "\" object.")
16171
- end
16400
+ assertDefined(nil, value, ((("Failed to find a value for \"" .. key) .. "\" in a table representing a \"") .. objectName) .. "\" object.")
16172
16401
  if isBoolean(nil, value) then
16173
16402
  booleans[#booleans + 1] = value
16174
16403
  else
@@ -16182,16 +16411,12 @@ function ____exports.getNumbersFromTable(self, luaMap, objectName, ...)
16182
16411
  local numbers = {}
16183
16412
  for ____, key in ipairs(keys) do
16184
16413
  local value = luaMap[key]
16185
- if value == nil then
16186
- error(((("Failed to find a value for \"" .. key) .. "\" in a table representing a \"") .. objectName) .. "\" object.")
16187
- end
16414
+ assertDefined(nil, value, ((("Failed to find a value for \"" .. key) .. "\" in a table representing a \"") .. objectName) .. "\" object.")
16188
16415
  if isNumber(nil, value) then
16189
16416
  numbers[#numbers + 1] = value
16190
16417
  elseif isString(nil, value) then
16191
16418
  local number = tonumber(value)
16192
- if number == nil then
16193
- error((((("Failed to convert the \"" .. key) .. "\" value of a table representing a \"") .. objectName) .. "\" object to a number: ") .. value)
16194
- end
16419
+ assertDefined(nil, number, (((("Failed to convert the \"" .. key) .. "\" value of a table representing a \"") .. objectName) .. "\" object to a number: ") .. value)
16195
16420
  numbers[#numbers + 1] = number
16196
16421
  else
16197
16422
  error((((("Failed to get the number for the \"" .. key) .. "\" value of a table representing a \"") .. objectName) .. "\" object because the type was: ") .. __TS__TypeOf(value))
@@ -16204,9 +16429,7 @@ function ____exports.getStringsFromTable(self, luaMap, objectName, ...)
16204
16429
  local strings = {}
16205
16430
  for ____, key in ipairs(keys) do
16206
16431
  local value = luaMap[key]
16207
- if value == nil then
16208
- error(((("Failed to find a value for \"" .. key) .. "\" in a table representing a \"") .. objectName) .. "\" object.")
16209
- end
16432
+ assertDefined(nil, value, ((("Failed to find a value for \"" .. key) .. "\" in a table representing a \"") .. objectName) .. "\" object.")
16210
16433
  if isString(nil, value) then
16211
16434
  strings[#strings + 1] = value
16212
16435
  else
@@ -16282,6 +16505,8 @@ local getNumbersFromTable = ____table.getNumbersFromTable
16282
16505
  local tableHasKeys = ____table.tableHasKeys
16283
16506
  local ____types = require("src.functions.types")
16284
16507
  local isTable = ____types.isTable
16508
+ local ____utils = require("src.functions.utils")
16509
+ local assertDefined = ____utils.assertDefined
16285
16510
  function ____exports.getRandomSeed(self)
16286
16511
  local randomNumber = Random()
16287
16512
  local safeRandomNumber = randomNumber == 0 and 1 or randomNumber
@@ -16324,9 +16549,7 @@ function ____exports.deserializeRNG(self, rng)
16324
16549
  OBJECT_NAME,
16325
16550
  table.unpack(KEYS)
16326
16551
  ))
16327
- if seed == nil then
16328
- error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: seed")
16329
- end
16552
+ assertDefined(nil, seed, ("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: seed")
16330
16553
  return ____exports.newRNG(nil, seed)
16331
16554
  end
16332
16555
  function ____exports.isSerializedRNG(self, object)
@@ -16428,240 +16651,6 @@ function ____exports.getRandomInt(self, min, max, seedOrRNG, exceptions)
16428
16651
  until not exceptionsSet:has(randomInt)
16429
16652
  return randomInt
16430
16653
  end
16431
- return ____exports
16432
- end,
16433
- ["src.types.PlayerIndex"] = function(...)
16434
- local ____exports = {}
16435
- return ____exports
16436
- end,
16437
- ["src.functions.playerIndex"] = function(...)
16438
- local ____lualib = require("lualib_bundle")
16439
- local __TS__New = ____lualib.__TS__New
16440
- local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
16441
- local __TS__ArrayFind = ____lualib.__TS__ArrayFind
16442
- local ____exports = {}
16443
- local getPlayerIndexCollectibleType, DEFAULT_COLLECTIBLE_TYPE, EXCLUDED_CHARACTERS
16444
- local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
16445
- local BabySubType = ____isaac_2Dtypescript_2Ddefinitions.BabySubType
16446
- local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
16447
- local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
16448
- local PlayerVariant = ____isaac_2Dtypescript_2Ddefinitions.PlayerVariant
16449
- local ____cachedClasses = require("src.core.cachedClasses")
16450
- local game = ____cachedClasses.game
16451
- local ____ReadonlySet = require("src.types.ReadonlySet")
16452
- local ReadonlySet = ____ReadonlySet.ReadonlySet
16453
- function ____exports.getAllPlayers(self)
16454
- local numPlayers = game:GetNumPlayers()
16455
- local players = {}
16456
- do
16457
- local i = 0
16458
- while i < numPlayers do
16459
- local player = Isaac.GetPlayer(i)
16460
- players[#players + 1] = player
16461
- i = i + 1
16462
- end
16463
- end
16464
- return players
16465
- end
16466
- function ____exports.getPlayerIndex(self, player, differentiateForgottenAndSoul)
16467
- if differentiateForgottenAndSoul == nil then
16468
- differentiateForgottenAndSoul = false
16469
- end
16470
- local playerToUse = player
16471
- local isSubPlayer = player:IsSubPlayer()
16472
- if isSubPlayer then
16473
- local subPlayer = player
16474
- local playerParent = ____exports.getSubPlayerParent(nil, subPlayer)
16475
- if playerParent ~= nil then
16476
- playerToUse = playerParent
16477
- end
16478
- end
16479
- local collectibleType = getPlayerIndexCollectibleType(nil, player, differentiateForgottenAndSoul)
16480
- local collectibleRNG = playerToUse:GetCollectibleRNG(collectibleType)
16481
- local seed = collectibleRNG:GetSeed()
16482
- return seed
16483
- end
16484
- function getPlayerIndexCollectibleType(self, player, differentiateForgottenAndSoul)
16485
- local character = player:GetPlayerType()
16486
- if character == PlayerType.SOUL then
16487
- return differentiateForgottenAndSoul and CollectibleType.INNER_EYE or DEFAULT_COLLECTIBLE_TYPE
16488
- end
16489
- return DEFAULT_COLLECTIBLE_TYPE
16490
- end
16491
- function ____exports.getPlayers(self, performCharacterExclusions)
16492
- if performCharacterExclusions == nil then
16493
- performCharacterExclusions = false
16494
- end
16495
- local players = ____exports.getAllPlayers(nil)
16496
- local nonChildPlayers = __TS__ArrayFilter(
16497
- players,
16498
- function(____, player) return not ____exports.isChildPlayer(nil, player) end
16499
- )
16500
- local nonChildPlayersFiltered = __TS__ArrayFilter(
16501
- nonChildPlayers,
16502
- function(____, player)
16503
- local character = player:GetPlayerType()
16504
- return not EXCLUDED_CHARACTERS:has(character)
16505
- end
16506
- )
16507
- return performCharacterExclusions and nonChildPlayersFiltered or nonChildPlayers
16508
- end
16509
- function ____exports.getSubPlayerParent(self, subPlayer)
16510
- local subPlayerPtrHash = GetPtrHash(subPlayer)
16511
- local players = ____exports.getPlayers(nil)
16512
- return __TS__ArrayFind(
16513
- players,
16514
- function(____, player)
16515
- local thisPlayerSubPlayer = player:GetSubPlayer()
16516
- if thisPlayerSubPlayer == nil then
16517
- return false
16518
- end
16519
- local thisPlayerSubPlayerPtrHash = GetPtrHash(thisPlayerSubPlayer)
16520
- return thisPlayerSubPlayerPtrHash == subPlayerPtrHash
16521
- end
16522
- )
16523
- end
16524
- function ____exports.isChildPlayer(self, player)
16525
- return player.Parent ~= nil
16526
- end
16527
- DEFAULT_COLLECTIBLE_TYPE = CollectibleType.SAD_ONION
16528
- EXCLUDED_CHARACTERS = __TS__New(ReadonlySet, {PlayerType.ESAU, PlayerType.SOUL_B})
16529
- function ____exports.getOtherPlayers(self, player)
16530
- local playerPtrHash = GetPtrHash(player)
16531
- local players = ____exports.getAllPlayers(nil)
16532
- return __TS__ArrayFilter(
16533
- players,
16534
- function(____, otherPlayer) return GetPtrHash(otherPlayer) ~= playerPtrHash end
16535
- )
16536
- end
16537
- function ____exports.getPlayerFromIndex(self, playerIndex)
16538
- local players = ____exports.getAllPlayers(nil)
16539
- return __TS__ArrayFind(
16540
- players,
16541
- function(____, player) return ____exports.getPlayerIndex(nil, player) == playerIndex end
16542
- )
16543
- end
16544
- function ____exports.getPlayerIndexVanilla(self, playerToFind)
16545
- local numPlayers = game:GetNumPlayers()
16546
- local playerToFindHash = GetPtrHash(playerToFind)
16547
- do
16548
- local i = 0
16549
- while i < numPlayers do
16550
- local player = Isaac.GetPlayer(i)
16551
- local playerHash = GetPtrHash(player)
16552
- if playerHash == playerToFindHash then
16553
- return i
16554
- end
16555
- i = i + 1
16556
- end
16557
- end
16558
- return nil
16559
- end
16560
- function ____exports.isFoundSoul(self, player)
16561
- return ____exports.isChildPlayer(nil, player) and player.Variant == PlayerVariant.COOP_BABY and player.SubType == BabySubType.FOUND_SOUL
16562
- end
16563
- return ____exports
16564
- end,
16565
- ["src.functions.utils"] = function(...)
16566
- local ____lualib = require("lualib_bundle")
16567
- local __TS__ArrayMap = ____lualib.__TS__ArrayMap
16568
- local __TS__New = ____lualib.__TS__New
16569
- local ____exports = {}
16570
- local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
16571
- local RenderMode = ____isaac_2Dtypescript_2Ddefinitions.RenderMode
16572
- local ____cachedClasses = require("src.core.cachedClasses")
16573
- local game = ____cachedClasses.game
16574
- local ____ReadonlySet = require("src.types.ReadonlySet")
16575
- local ReadonlySet = ____ReadonlySet.ReadonlySet
16576
- local ____playerIndex = require("src.functions.playerIndex")
16577
- local getAllPlayers = ____playerIndex.getAllPlayers
16578
- local ____types = require("src.functions.types")
16579
- local isFunction = ____types.isFunction
16580
- function ____exports.eRange(self, start, ____end, increment)
16581
- if increment == nil then
16582
- increment = 1
16583
- end
16584
- if ____end == nil then
16585
- return ____exports.eRange(nil, 0, start, increment)
16586
- end
16587
- local array = {}
16588
- if start < ____end then
16589
- do
16590
- local i = start
16591
- while i < ____end do
16592
- array[#array + 1] = i
16593
- i = i + increment
16594
- end
16595
- end
16596
- else
16597
- do
16598
- local i = start
16599
- while i > ____end do
16600
- array[#array + 1] = i
16601
- i = i - increment
16602
- end
16603
- end
16604
- end
16605
- return array
16606
- end
16607
- function ____exports.getTraversalDescription(self, key, traversalDescription)
16608
- if traversalDescription ~= "" then
16609
- traversalDescription = traversalDescription .. " --> "
16610
- end
16611
- traversalDescription = traversalDescription .. tostring(key)
16612
- return traversalDescription
16613
- end
16614
- function ____exports.iRange(self, start, ____end, increment)
16615
- if increment == nil then
16616
- increment = 1
16617
- end
16618
- if ____end == nil then
16619
- return ____exports.iRange(nil, 0, start, increment)
16620
- end
16621
- local rangeIncreasing = start <= ____end
16622
- local exclusiveEnd = rangeIncreasing and ____end + 1 or ____end - 1
16623
- return ____exports.eRange(nil, start, exclusiveEnd, increment)
16624
- end
16625
- function ____exports.inRange(self, num, start, ____end)
16626
- return num >= start and num <= ____end
16627
- end
16628
- function ____exports.isMultiplayer(self)
16629
- local players = getAllPlayers(nil)
16630
- local controllerIndexes = __TS__ArrayMap(
16631
- players,
16632
- function(____, player) return player.ControllerIndex end
16633
- )
16634
- local controllerIndexesSet = __TS__New(ReadonlySet, controllerIndexes)
16635
- return controllerIndexesSet.size > 1
16636
- end
16637
- function ____exports.isReflectionRender(self)
16638
- local room = game:GetRoom()
16639
- local renderMode = room:GetRenderMode()
16640
- return renderMode == RenderMode.WATER_REFLECT
16641
- end
16642
- function ____exports.isRepentance(self)
16643
- local metatable = getmetatable(Sprite)
16644
- if metatable == nil then
16645
- error("Failed to get the metatable of the Sprite global table.")
16646
- end
16647
- local classTable = metatable.__class
16648
- if classTable == nil then
16649
- error("Failed to get the \"__class\" key of the Sprite metatable.")
16650
- end
16651
- local getAnimation = classTable.GetAnimation
16652
- return isFunction(nil, getAnimation)
16653
- end
16654
- ____exports["repeat"] = function(self, n, func)
16655
- do
16656
- local i = 0
16657
- while i < n do
16658
- func(nil, i)
16659
- i = i + 1
16660
- end
16661
- end
16662
- end
16663
- function ____exports.todo(self, ...)
16664
- end
16665
16654
  return ____exports
16666
16655
  end,
16667
16656
  ["src.functions.array"] = function(...)
@@ -16697,6 +16686,7 @@ local ____types = require("src.functions.types")
16697
16686
  local isNumber = ____types.isNumber
16698
16687
  local isTable = ____types.isTable
16699
16688
  local ____utils = require("src.functions.utils")
16689
+ local assertDefined = ____utils.assertDefined
16700
16690
  local eRange = ____utils.eRange
16701
16691
  function ____exports.arrayRemoveAllInPlace(self, array, ...)
16702
16692
  local elementsToRemove = {...}
@@ -16941,9 +16931,11 @@ function ____exports.getRandomArrayElement(self, array, seedOrRNG, exceptions)
16941
16931
  ) or array
16942
16932
  local randomIndex = ____exports.getRandomArrayIndex(nil, arrayToUse, seedOrRNG)
16943
16933
  local randomElement = arrayToUse[randomIndex + 1]
16944
- if randomElement == nil then
16945
- error(("Failed to get a random array element since the random index of " .. tostring(randomIndex)) .. " was not valid.")
16946
- end
16934
+ assertDefined(
16935
+ nil,
16936
+ randomElement,
16937
+ ("Failed to get a random array element since the random index of " .. tostring(randomIndex)) .. " was not valid."
16938
+ )
16947
16939
  return randomElement
16948
16940
  end
16949
16941
  function ____exports.getRandomArrayElementAndRemove(self, array, seedOrRNG, exceptions)
@@ -17041,6 +17033,7 @@ return ____exports
17041
17033
  local ____lualib = require("lualib_bundle")
17042
17034
  local __TS__ArraySort = ____lualib.__TS__ArraySort
17043
17035
  local __TS__ArrayMap = ____lualib.__TS__ArrayMap
17036
+ local __TS__ArrayIncludes = ____lualib.__TS__ArrayIncludes
17044
17037
  local __TS__New = ____lualib.__TS__New
17045
17038
  local ____exports = {}
17046
17039
  local ____ReadonlySet = require("src.types.ReadonlySet")
@@ -17050,8 +17043,10 @@ local getRandomArrayElement = ____array.getRandomArrayElement
17050
17043
  local ____rng = require("src.functions.rng")
17051
17044
  local getRandomSeed = ____rng.getRandomSeed
17052
17045
  local ____types = require("src.functions.types")
17046
+ local isNumber = ____types.isNumber
17053
17047
  local isString = ____types.isString
17054
17048
  local ____utils = require("src.functions.utils")
17049
+ local assertDefined = ____utils.assertDefined
17055
17050
  local iRange = ____utils.iRange
17056
17051
  function ____exports.getEnumEntries(self, transpiledEnum)
17057
17052
  local enumEntries = {}
@@ -17105,9 +17100,7 @@ end
17105
17100
  function ____exports.getHighestEnumValue(self, transpiledEnum)
17106
17101
  local enumValues = ____exports.getEnumValues(nil, transpiledEnum)
17107
17102
  local lastElement = enumValues[#enumValues]
17108
- if lastElement == nil then
17109
- error("Failed to get the last value from an enum since the enum was empty.")
17110
- end
17103
+ assertDefined(nil, lastElement, "Failed to get the last value from an enum since the enum was empty.")
17111
17104
  return lastElement
17112
17105
  end
17113
17106
  function ____exports.getRandomEnumValue(self, transpiledEnum, seedOrRNG, exceptions)
@@ -17120,6 +17113,10 @@ function ____exports.getRandomEnumValue(self, transpiledEnum, seedOrRNG, excepti
17120
17113
  local enumValues = ____exports.getEnumValues(nil, transpiledEnum)
17121
17114
  return getRandomArrayElement(nil, enumValues, seedOrRNG, exceptions)
17122
17115
  end
17116
+ function ____exports.isEnumValue(self, value, transpiledEnum)
17117
+ local enumValues = ____exports.getEnumValues(nil, transpiledEnum)
17118
+ return __TS__ArrayIncludes(enumValues, value)
17119
+ end
17123
17120
  function ____exports.validateCustomEnum(self, transpiledEnumName, transpiledEnum)
17124
17121
  for ____, ____value in ipairs(____exports.getEnumEntries(nil, transpiledEnum)) do
17125
17122
  local key = ____value[1]
@@ -17132,10 +17129,8 @@ end
17132
17129
  function ____exports.validateEnumContiguous(self, transpiledEnumName, transpiledEnum)
17133
17130
  local values = ____exports.getEnumValues(nil, transpiledEnum)
17134
17131
  local lastValue = values[#values]
17135
- if lastValue == nil then
17136
- error("Failed to validate that an enum was contiguous, since the last value was undefined.")
17137
- end
17138
- if type(lastValue) ~= "number" then
17132
+ assertDefined(nil, lastValue, "Failed to validate that an enum was contiguous, since the last value was undefined.")
17133
+ if not isNumber(nil, lastValue) then
17139
17134
  error("Failed to validate that an enum was contiguous, since the last value was not a number.")
17140
17135
  end
17141
17136
  local valuesSet = __TS__New(ReadonlySet, values)
@@ -17298,6 +17293,8 @@ local getNumbersFromTable = ____table.getNumbersFromTable
17298
17293
  local tableHasKeys = ____table.tableHasKeys
17299
17294
  local ____types = require("src.functions.types")
17300
17295
  local isTable = ____types.isTable
17296
+ local ____utils = require("src.functions.utils")
17297
+ local assertDefined = ____utils.assertDefined
17301
17298
  function ____exports.isBitSet128(self, object)
17302
17299
  return isIsaacAPIClassOfType(nil, object, OBJECT_NAME)
17303
17300
  end
@@ -17321,12 +17318,8 @@ function ____exports.deserializeBitSet128(self, bitSet128)
17321
17318
  OBJECT_NAME,
17322
17319
  table.unpack(KEYS)
17323
17320
  ))
17324
- if l == nil then
17325
- error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: l")
17326
- end
17327
- if h == nil then
17328
- error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: h")
17329
- end
17321
+ assertDefined(nil, l, ("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: l")
17322
+ assertDefined(nil, h, ("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: h")
17330
17323
  return BitSet128(l, h)
17331
17324
  end
17332
17325
  function ____exports.isSerializedBitSet128(self, object)
@@ -17370,6 +17363,8 @@ local getNumbersFromTable = ____table.getNumbersFromTable
17370
17363
  local tableHasKeys = ____table.tableHasKeys
17371
17364
  local ____types = require("src.functions.types")
17372
17365
  local isTable = ____types.isTable
17366
+ local ____utils = require("src.functions.utils")
17367
+ local assertDefined = ____utils.assertDefined
17373
17368
  function ____exports.isColor(self, object)
17374
17369
  return isIsaacAPIClassOfType(nil, object, OBJECT_NAME)
17375
17370
  end
@@ -17410,15 +17405,9 @@ function ____exports.deserializeColor(self, color)
17410
17405
  OBJECT_NAME,
17411
17406
  table.unpack(KEYS)
17412
17407
  ))
17413
- if r == nil then
17414
- error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: R")
17415
- end
17416
- if g == nil then
17417
- error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: G")
17418
- end
17419
- if b == nil then
17420
- error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: B")
17421
- end
17408
+ assertDefined(nil, r, ("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: R")
17409
+ assertDefined(nil, g, ("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: G")
17410
+ assertDefined(nil, b, ("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: B")
17422
17411
  return Color(
17423
17412
  r,
17424
17413
  g,
@@ -17483,6 +17472,8 @@ local getNumbersFromTable = ____table.getNumbersFromTable
17483
17472
  local tableHasKeys = ____table.tableHasKeys
17484
17473
  local ____types = require("src.functions.types")
17485
17474
  local isTable = ____types.isTable
17475
+ local ____utils = require("src.functions.utils")
17476
+ local assertDefined = ____utils.assertDefined
17486
17477
  function ____exports.isKColor(self, object)
17487
17478
  return isIsaacAPIClassOfType(nil, object, OBJECT_NAME)
17488
17479
  end
@@ -17504,18 +17495,10 @@ function ____exports.deserializeKColor(self, kColor)
17504
17495
  OBJECT_NAME,
17505
17496
  table.unpack(KEYS)
17506
17497
  ))
17507
- if r == nil then
17508
- error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: Red")
17509
- end
17510
- if g == nil then
17511
- error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: Green")
17512
- end
17513
- if b == nil then
17514
- error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: Blue")
17515
- end
17516
- if a == nil then
17517
- error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: Alpha")
17518
- end
17498
+ assertDefined(nil, r, ("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: Red")
17499
+ assertDefined(nil, g, ("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: Green")
17500
+ assertDefined(nil, b, ("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: Blue")
17501
+ assertDefined(nil, a, ("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: Alpha")
17519
17502
  return KColor(r, g, b, a)
17520
17503
  end
17521
17504
  function ____exports.getRandomKColor(self, seedOrRNG, alpha)
@@ -17902,6 +17885,8 @@ local getNumbersFromTable = ____table.getNumbersFromTable
17902
17885
  local tableHasKeys = ____table.tableHasKeys
17903
17886
  local ____types = require("src.functions.types")
17904
17887
  local isTable = ____types.isTable
17888
+ local ____utils = require("src.functions.utils")
17889
+ local assertDefined = ____utils.assertDefined
17905
17890
  function ____exports.isVector(self, object)
17906
17891
  return isIsaacAPIClassOfType(nil, object, OBJECT_NAME)
17907
17892
  end
@@ -17923,12 +17908,8 @@ function ____exports.deserializeVector(self, vector)
17923
17908
  OBJECT_NAME,
17924
17909
  table.unpack(KEYS)
17925
17910
  ))
17926
- if x == nil then
17927
- error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: X")
17928
- end
17929
- if y == nil then
17930
- error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: Y")
17931
- end
17911
+ assertDefined(nil, x, ("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: X")
17912
+ assertDefined(nil, y, ("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: Y")
17932
17913
  return Vector(x, y)
17933
17914
  end
17934
17915
  function ____exports.doesVectorHaveLength(self, vector, threshold)
@@ -20878,6 +20859,8 @@ local ____tstlClass = require("src.functions.tstlClass")
20878
20859
  local isTSTLSet = ____tstlClass.isTSTLSet
20879
20860
  local ____types = require("src.functions.types")
20880
20861
  local isPrimitive = ____types.isPrimitive
20862
+ local ____utils = require("src.functions.utils")
20863
+ local assertDefined = ____utils.assertDefined
20881
20864
  local ____vector = require("src.functions.vector")
20882
20865
  local doesVectorHaveLength = ____vector.doesVectorHaveLength
20883
20866
  local isVector = ____vector.isVector
@@ -20942,9 +20925,7 @@ function ____exports.doesEntityExist(self, entityType, variant, subType, ignoreF
20942
20925
  end
20943
20926
  function setPrimitiveEntityFields(self, entity, metatable, entityFields)
20944
20927
  local propGetTable = metatable.__propget
20945
- if propGetTable == nil then
20946
- error("Failed to get the \"__propget\" table for an entity.")
20947
- end
20928
+ assertDefined(nil, propGetTable, "Failed to get the \"__propget\" table for an entity.")
20948
20929
  for key in pairs(propGetTable) do
20949
20930
  local indexKey = key
20950
20931
  local value = entity[indexKey]
@@ -21014,17 +20995,23 @@ function ____exports.getConstituentsFromEntityID(self, entityID)
21014
20995
  end
21015
20996
  local entityTypeString, variantString, subTypeString = table.unpack(parts)
21016
20997
  local entityType = tonumber(entityTypeString)
21017
- if entityType == nil then
21018
- error("Failed to convert the entity type to a number: " .. tostring(entityTypeString))
21019
- end
20998
+ assertDefined(
20999
+ nil,
21000
+ entityType,
21001
+ "Failed to convert the entity type to a number: " .. tostring(entityTypeString)
21002
+ )
21020
21003
  local variant = tonumber(variantString)
21021
- if variant == nil then
21022
- error("Failed to convert the entity variant to a number: " .. tostring(variantString))
21023
- end
21004
+ assertDefined(
21005
+ nil,
21006
+ variant,
21007
+ "Failed to convert the entity variant to a number: " .. tostring(variantString)
21008
+ )
21024
21009
  local subType = tonumber(subTypeString)
21025
- if subType == nil then
21026
- error("Failed to convert the entity sub-type to a number: " .. tostring(subTypeString))
21027
- end
21010
+ assertDefined(
21011
+ nil,
21012
+ subType,
21013
+ "Failed to convert the entity sub-type to a number: " .. tostring(subTypeString)
21014
+ )
21028
21015
  return {entityType, variant, subType}
21029
21016
  end
21030
21017
  function ____exports.getEntities(self, entityType, variant, subType, ignoreFriendly)
@@ -21048,18 +21035,14 @@ end
21048
21035
  function ____exports.getEntityFields(self, entity)
21049
21036
  local entityFields = {}
21050
21037
  local metatable = getmetatable(entity)
21051
- if metatable == nil then
21052
- error("Failed to get the metatable for an entity.")
21053
- end
21038
+ assertDefined(nil, metatable, "Failed to get the metatable for an entity.")
21054
21039
  setPrimitiveEntityFields(nil, entity, metatable, entityFields)
21055
21040
  local className = getIsaacAPIClassName(nil, entity)
21056
21041
  if className == "Entity" then
21057
21042
  return entityFields
21058
21043
  end
21059
21044
  local parentTable = metatable.__parent
21060
- if parentTable == nil then
21061
- error("Failed to get the \"__parent\" table for an entity.")
21062
- end
21045
+ assertDefined(nil, parentTable, "Failed to get the \"__parent\" table for an entity.")
21063
21046
  setPrimitiveEntityFields(nil, entity, parentTable, entityFields)
21064
21047
  return entityFields
21065
21048
  end
@@ -21697,6 +21680,7 @@ local getPlayers = ____playerIndex.getPlayers
21697
21680
  local ____types = require("src.functions.types")
21698
21681
  local isNumber = ____types.isNumber
21699
21682
  local ____utils = require("src.functions.utils")
21683
+ local assertDefined = ____utils.assertDefined
21700
21684
  local ____repeat = ____utils["repeat"]
21701
21685
  function ____exports.getCharacters(self)
21702
21686
  local players = getPlayers(nil)
@@ -21804,9 +21788,7 @@ function ____exports.getClosestPlayer(self, position)
21804
21788
  closestDistance = distance
21805
21789
  end
21806
21790
  end
21807
- if closestPlayer == nil then
21808
- error("Failed to find the closest player.")
21809
- end
21791
+ assertDefined(nil, closestPlayer, "Failed to find the closest player.")
21810
21792
  return closestPlayer
21811
21793
  end
21812
21794
  function ____exports.getEffectsList(self, player)
@@ -21828,9 +21810,7 @@ end
21828
21810
  function ____exports.getFinalPlayer(self)
21829
21811
  local players = getPlayers(nil)
21830
21812
  local lastPlayer = getLastElement(nil, players)
21831
- if lastPlayer == nil then
21832
- error("Failed to get the final player since there were 0 players.")
21833
- end
21813
+ assertDefined(nil, lastPlayer, "Failed to get the final player since there were 0 players.")
21834
21814
  return lastPlayer
21835
21815
  end
21836
21816
  function ____exports.getNewestPlayer(self)
@@ -21842,9 +21822,7 @@ function ____exports.getNewestPlayer(self)
21842
21822
  lowestFrame = player.FrameCount
21843
21823
  end
21844
21824
  end
21845
- if newestPlayer == nil then
21846
- error("Failed to find the newest player.")
21847
- end
21825
+ assertDefined(nil, newestPlayer, "Failed to find the newest player.")
21848
21826
  return newestPlayer
21849
21827
  end
21850
21828
  function ____exports.getPlayerCloserThan(self, position, distance)
@@ -22065,7 +22043,7 @@ function ____exports.removeAllActiveItems(self, player)
22065
22043
  do
22066
22044
  local collectibleType = player:GetActiveItem(activeSlot)
22067
22045
  if collectibleType == CollectibleType.NULL then
22068
- goto __continue97
22046
+ goto __continue94
22069
22047
  end
22070
22048
  local stillHasCollectible
22071
22049
  repeat
@@ -22075,7 +22053,7 @@ function ____exports.removeAllActiveItems(self, player)
22075
22053
  end
22076
22054
  until not stillHasCollectible
22077
22055
  end
22078
- ::__continue97::
22056
+ ::__continue94::
22079
22057
  end
22080
22058
  end
22081
22059
  function ____exports.removeAllPlayerTrinkets(self, player)
@@ -22083,7 +22061,7 @@ function ____exports.removeAllPlayerTrinkets(self, player)
22083
22061
  do
22084
22062
  local trinketType = player:GetTrinket(trinketSlot)
22085
22063
  if trinketType == TrinketType.NULL then
22086
- goto __continue102
22064
+ goto __continue99
22087
22065
  end
22088
22066
  local hasTrinket
22089
22067
  repeat
@@ -22093,7 +22071,7 @@ function ____exports.removeAllPlayerTrinkets(self, player)
22093
22071
  end
22094
22072
  until not hasTrinket
22095
22073
  end
22096
- ::__continue102::
22074
+ ::__continue99::
22097
22075
  end
22098
22076
  end
22099
22077
  function ____exports.removeCollectible(self, player, ...)
@@ -22153,9 +22131,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
22153
22131
  itemPool:RemoveCollectible(collectibleType)
22154
22132
  end
22155
22133
  repeat
22156
- local ____switch124 = activeSlot
22157
- local ____cond124 = ____switch124 == ActiveSlot.PRIMARY
22158
- if ____cond124 then
22134
+ local ____switch121 = activeSlot
22135
+ local ____cond121 = ____switch121 == ActiveSlot.PRIMARY
22136
+ if ____cond121 then
22159
22137
  do
22160
22138
  if primaryCollectibleType ~= CollectibleType.NULL then
22161
22139
  player:RemoveCollectible(primaryCollectibleType)
@@ -22164,8 +22142,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
22164
22142
  break
22165
22143
  end
22166
22144
  end
22167
- ____cond124 = ____cond124 or ____switch124 == ActiveSlot.SECONDARY
22168
- if ____cond124 then
22145
+ ____cond121 = ____cond121 or ____switch121 == ActiveSlot.SECONDARY
22146
+ if ____cond121 then
22169
22147
  do
22170
22148
  if primaryCollectibleType ~= CollectibleType.NULL then
22171
22149
  player:RemoveCollectible(primaryCollectibleType)
@@ -22180,16 +22158,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
22180
22158
  break
22181
22159
  end
22182
22160
  end
22183
- ____cond124 = ____cond124 or ____switch124 == ActiveSlot.POCKET
22184
- if ____cond124 then
22161
+ ____cond121 = ____cond121 or ____switch121 == ActiveSlot.POCKET
22162
+ if ____cond121 then
22185
22163
  do
22186
22164
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
22187
22165
  player:SetActiveCharge(charge, activeSlot)
22188
22166
  break
22189
22167
  end
22190
22168
  end
22191
- ____cond124 = ____cond124 or ____switch124 == ActiveSlot.POCKET_SINGLE_USE
22192
- if ____cond124 then
22169
+ ____cond121 = ____cond121 or ____switch121 == ActiveSlot.POCKET_SINGLE_USE
22170
+ if ____cond121 then
22193
22171
  do
22194
22172
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
22195
22173
  break
@@ -22729,6 +22707,8 @@ local __TS__ArrayUnshift = ____lualib.__TS__ArrayUnshift
22729
22707
  local ____exports = {}
22730
22708
  local ____flag = require("src.functions.flag")
22731
22709
  local addFlag = ____flag.addFlag
22710
+ local ____utils = require("src.functions.utils")
22711
+ local assertDefined = ____utils.assertDefined
22732
22712
  function ____exports.arrayToBitFlags(self, array)
22733
22713
  local flags = 0
22734
22714
  for ____, flag in ipairs(array) do
@@ -22745,9 +22725,11 @@ function ____exports.convertDecimalToBinary(self, number, minLength)
22745
22725
  local bitsString = __TS__NumberToString(number, 2)
22746
22726
  for ____, bitString in __TS__Iterator(bitsString) do
22747
22727
  local bit = tonumber(bitString)
22748
- if bit == nil then
22749
- error("Failed to convert the following number to binary: " .. tostring(number))
22750
- end
22728
+ assertDefined(
22729
+ nil,
22730
+ bit,
22731
+ "Failed to convert the following number to binary: " .. tostring(number)
22732
+ )
22751
22733
  bits[#bits + 1] = bit
22752
22734
  end
22753
22735
  if minLength ~= nil then
@@ -23650,6 +23632,8 @@ local ____entities = require("src.functions.entities")
23650
23632
  local getEntities = ____entities.getEntities
23651
23633
  local removeEntities = ____entities.removeEntities
23652
23634
  local spawn = ____entities.spawn
23635
+ local ____utils = require("src.functions.utils")
23636
+ local assertDefined = ____utils.assertDefined
23653
23637
  function ____exports.getBombs(self, bombVariant, subType)
23654
23638
  if bombVariant == nil then
23655
23639
  bombVariant = -1
@@ -23943,9 +23927,7 @@ function ____exports.spawnBomb(self, bombVariant, subType, positionOrGridIndex,
23943
23927
  seedOrRNG
23944
23928
  )
23945
23929
  local bomb = entity:ToBomb()
23946
- if bomb == nil then
23947
- error("Failed to spawn a bomb.")
23948
- end
23930
+ assertDefined(nil, bomb, "Failed to spawn a bomb.")
23949
23931
  return bomb
23950
23932
  end
23951
23933
  function ____exports.spawnBombWithSeed(self, bombVariant, subType, positionOrGridIndex, seedOrRNG, velocity, spawner)
@@ -23977,9 +23959,7 @@ function ____exports.spawnEffect(self, effectVariant, subType, positionOrGridInd
23977
23959
  seedOrRNG
23978
23960
  )
23979
23961
  local effect = entity:ToEffect()
23980
- if effect == nil then
23981
- error("Failed to spawn an effect.")
23982
- end
23962
+ assertDefined(nil, effect, "Failed to spawn an effect.")
23983
23963
  return effect
23984
23964
  end
23985
23965
  function ____exports.spawnEffectWithSeed(self, effectVariant, subType, positionOrGridIndex, seedOrRNG, velocity, spawner)
@@ -24011,9 +23991,7 @@ function ____exports.spawnFamiliar(self, familiarVariant, subType, positionOrGri
24011
23991
  seedOrRNG
24012
23992
  )
24013
23993
  local familiar = entity:ToFamiliar()
24014
- if familiar == nil then
24015
- error("Failed to spawn a familiar.")
24016
- end
23994
+ assertDefined(nil, familiar, "Failed to spawn a familiar.")
24017
23995
  return familiar
24018
23996
  end
24019
23997
  function ____exports.spawnFamiliarWithSeed(self, familiarVariant, subType, positionOrGridIndex, seedOrRNG, velocity, spawner)
@@ -24045,9 +24023,7 @@ function ____exports.spawnKnife(self, knifeVariant, subType, positionOrGridIndex
24045
24023
  seedOrRNG
24046
24024
  )
24047
24025
  local knife = entity:ToKnife()
24048
- if knife == nil then
24049
- error("Failed to spawn a knife.")
24050
- end
24026
+ assertDefined(nil, knife, "Failed to spawn a knife.")
24051
24027
  return knife
24052
24028
  end
24053
24029
  function ____exports.spawnKnifeWithSeed(self, knifeVariant, subType, positionOrGridIndex, seedOrRNG, velocity, spawner)
@@ -24079,9 +24055,7 @@ function ____exports.spawnLaser(self, laserVariant, subType, positionOrGridIndex
24079
24055
  seedOrRNG
24080
24056
  )
24081
24057
  local laser = entity:ToLaser()
24082
- if laser == nil then
24083
- error("Failed to spawn a laser.")
24084
- end
24058
+ assertDefined(nil, laser, "Failed to spawn a laser.")
24085
24059
  return laser
24086
24060
  end
24087
24061
  function ____exports.spawnLaserWithSeed(self, laserVariant, subType, positionOrGridIndex, seedOrRNG, velocity, spawner)
@@ -24113,9 +24087,7 @@ function ____exports.spawnNPC(self, entityType, variant, subType, positionOrGrid
24113
24087
  seedOrRNG
24114
24088
  )
24115
24089
  local npc = entity:ToNPC()
24116
- if npc == nil then
24117
- error("Failed to spawn an NPC.")
24118
- end
24090
+ assertDefined(nil, npc, "Failed to spawn an NPC.")
24119
24091
  return npc
24120
24092
  end
24121
24093
  function ____exports.spawnNPCWithSeed(self, entityType, variant, subType, positionOrGridIndex, seedOrRNG, velocity, spawner)
@@ -24148,9 +24120,7 @@ function ____exports.spawnPickup(self, pickupVariant, subType, positionOrGridInd
24148
24120
  seedOrRNG
24149
24121
  )
24150
24122
  local pickup = entity:ToPickup()
24151
- if pickup == nil then
24152
- error("Failed to spawn a pickup.")
24153
- end
24123
+ assertDefined(nil, pickup, "Failed to spawn a pickup.")
24154
24124
  return pickup
24155
24125
  end
24156
24126
  function ____exports.spawnPickupWithSeed(self, pickupVariant, subType, positionOrGridIndex, seedOrRNG, velocity, spawner)
@@ -24182,9 +24152,7 @@ function ____exports.spawnProjectile(self, projectileVariant, subType, positionO
24182
24152
  seedOrRNG
24183
24153
  )
24184
24154
  local projectile = entity:ToProjectile()
24185
- if projectile == nil then
24186
- error("Failed to spawn a projectile.")
24187
- end
24155
+ assertDefined(nil, projectile, "Failed to spawn a projectile.")
24188
24156
  return projectile
24189
24157
  end
24190
24158
  function ____exports.spawnProjectileWithSeed(self, projectileVariant, subType, positionOrGridIndex, seedOrRNG, velocity, spawner)
@@ -24245,9 +24213,7 @@ function ____exports.spawnTear(self, tearVariant, subType, positionOrGridIndex,
24245
24213
  seedOrRNG
24246
24214
  )
24247
24215
  local tear = entity:ToTear()
24248
- if tear == nil then
24249
- error("Failed to spawn a tear.")
24250
- end
24216
+ assertDefined(nil, tear, "Failed to spawn a tear.")
24251
24217
  return tear
24252
24218
  end
24253
24219
  function ____exports.spawnTearWithSeed(self, tearVariant, subType, positionOrGridIndex, seedOrRNG, velocity, spawner)
@@ -25784,7 +25750,7 @@ local ____ReadonlySet = require("src.types.ReadonlySet")
25784
25750
  local ReadonlySet = ____ReadonlySet.ReadonlySet
25785
25751
  local ____string = require("src.functions.string")
25786
25752
  local trimPrefix = ____string.trimPrefix
25787
- local MODIFIER_KEYS = {
25753
+ ____exports.MODIFIER_KEYS = {
25788
25754
  Keyboard.LEFT_SHIFT,
25789
25755
  Keyboard.LEFT_CONTROL,
25790
25756
  Keyboard.LEFT_ALT,
@@ -25794,10 +25760,10 @@ local MODIFIER_KEYS = {
25794
25760
  Keyboard.RIGHT_ALT,
25795
25761
  Keyboard.RIGHT_SUPER
25796
25762
  }
25797
- local MOVEMENT_ACTIONS = {ButtonAction.LEFT, ButtonAction.RIGHT, ButtonAction.UP, ButtonAction.DOWN}
25798
- ____exports.MOVEMENT_ACTIONS_SET = __TS__New(ReadonlySet, MOVEMENT_ACTIONS)
25799
- local SHOOTING_ACTIONS = {ButtonAction.SHOOT_LEFT, ButtonAction.SHOOT_RIGHT, ButtonAction.SHOOT_UP, ButtonAction.SHOOT_DOWN}
25800
- ____exports.SHOOTING_ACTIONS_SET = __TS__New(ReadonlySet, SHOOTING_ACTIONS)
25763
+ ____exports.MOVEMENT_ACTIONS = {ButtonAction.LEFT, ButtonAction.RIGHT, ButtonAction.UP, ButtonAction.DOWN}
25764
+ ____exports.MOVEMENT_ACTIONS_SET = __TS__New(ReadonlySet, ____exports.MOVEMENT_ACTIONS)
25765
+ ____exports.SHOOTING_ACTIONS = {ButtonAction.SHOOT_LEFT, ButtonAction.SHOOT_RIGHT, ButtonAction.SHOOT_UP, ButtonAction.SHOOT_DOWN}
25766
+ ____exports.SHOOTING_ACTIONS_SET = __TS__New(ReadonlySet, ____exports.SHOOTING_ACTIONS)
25801
25767
  function ____exports.controllerToString(self, controller)
25802
25768
  local key = Controller[controller]
25803
25769
  if key == nil then
@@ -25857,7 +25823,7 @@ end
25857
25823
  function ____exports.isModifierKeyPressed(self)
25858
25824
  return ____exports.isKeyboardPressed(
25859
25825
  nil,
25860
- table.unpack(MODIFIER_KEYS)
25826
+ table.unpack(____exports.MODIFIER_KEYS)
25861
25827
  )
25862
25828
  end
25863
25829
  function ____exports.isMoveAction(self, buttonAction)
@@ -25867,12 +25833,12 @@ function ____exports.isMoveActionPressed(self, controllerIndex)
25867
25833
  return ____exports.isActionPressed(
25868
25834
  nil,
25869
25835
  controllerIndex,
25870
- table.unpack(MOVEMENT_ACTIONS)
25836
+ table.unpack(____exports.MOVEMENT_ACTIONS)
25871
25837
  )
25872
25838
  end
25873
25839
  function ____exports.isMoveActionPressedOnAnyInput(self)
25874
25840
  return __TS__ArraySome(
25875
- MOVEMENT_ACTIONS,
25841
+ ____exports.MOVEMENT_ACTIONS,
25876
25842
  function(____, moveAction) return ____exports.isActionPressedOnAnyInput(nil, moveAction) end
25877
25843
  )
25878
25844
  end
@@ -25880,12 +25846,12 @@ function ____exports.isMoveActionTriggered(self, controllerIndex)
25880
25846
  return ____exports.isActionTriggered(
25881
25847
  nil,
25882
25848
  controllerIndex,
25883
- table.unpack(MOVEMENT_ACTIONS)
25849
+ table.unpack(____exports.MOVEMENT_ACTIONS)
25884
25850
  )
25885
25851
  end
25886
25852
  function ____exports.isMoveActionTriggeredOnAnyInput(self)
25887
25853
  return __TS__ArraySome(
25888
- MOVEMENT_ACTIONS,
25854
+ ____exports.MOVEMENT_ACTIONS,
25889
25855
  function(____, moveAction) return ____exports.isActionTriggeredOnAnyInput(nil, moveAction) end
25890
25856
  )
25891
25857
  end
@@ -25896,12 +25862,12 @@ function ____exports.isShootActionPressed(self, controllerIndex)
25896
25862
  return ____exports.isActionPressed(
25897
25863
  nil,
25898
25864
  controllerIndex,
25899
- table.unpack(SHOOTING_ACTIONS)
25865
+ table.unpack(____exports.SHOOTING_ACTIONS)
25900
25866
  )
25901
25867
  end
25902
25868
  function ____exports.isShootActionPressedOnAnyInput(self)
25903
25869
  return __TS__ArraySome(
25904
- SHOOTING_ACTIONS,
25870
+ ____exports.SHOOTING_ACTIONS,
25905
25871
  function(____, shootAction) return ____exports.isActionPressedOnAnyInput(nil, shootAction) end
25906
25872
  )
25907
25873
  end
@@ -25909,12 +25875,12 @@ function ____exports.isShootActionTriggered(self, controllerIndex)
25909
25875
  return ____exports.isActionTriggered(
25910
25876
  nil,
25911
25877
  controllerIndex,
25912
- table.unpack(SHOOTING_ACTIONS)
25878
+ table.unpack(____exports.SHOOTING_ACTIONS)
25913
25879
  )
25914
25880
  end
25915
25881
  function ____exports.isShootActionTriggeredOnAnyInput(self)
25916
25882
  return __TS__ArraySome(
25917
- SHOOTING_ACTIONS,
25883
+ ____exports.SHOOTING_ACTIONS,
25918
25884
  function(____, shootAction) return ____exports.isActionTriggeredOnAnyInput(nil, shootAction) end
25919
25885
  )
25920
25886
  end
@@ -26811,6 +26777,8 @@ local game = ____cachedClasses.game
26811
26777
  local ____roomData = require("src.functions.roomData")
26812
26778
  local getRoomData = ____roomData.getRoomData
26813
26779
  local getRoomGridIndex = ____roomData.getRoomGridIndex
26780
+ local ____utils = require("src.functions.utils")
26781
+ local assertDefined = ____utils.assertDefined
26814
26782
  function ____exports.teleport(self, roomGridIndex, direction, roomTransitionAnim)
26815
26783
  if direction == nil then
26816
26784
  direction = Direction.NO_DIRECTION
@@ -26820,9 +26788,11 @@ function ____exports.teleport(self, roomGridIndex, direction, roomTransitionAnim
26820
26788
  end
26821
26789
  local level = game:GetLevel()
26822
26790
  local roomData = getRoomData(nil, roomGridIndex)
26823
- if roomData == nil then
26824
- error(("Failed to change the room to grid index " .. tostring(roomGridIndex)) .. " because that room does not exist.")
26825
- end
26791
+ assertDefined(
26792
+ nil,
26793
+ roomData,
26794
+ ("Failed to change the room to grid index " .. tostring(roomGridIndex)) .. " because that room does not exist."
26795
+ )
26826
26796
  level.LeaveDoor = DoorSlot.NO_DOOR_SLOT
26827
26797
  game:StartRoomTransition(roomGridIndex, direction, roomTransitionAnim)
26828
26798
  end
@@ -27398,6 +27368,7 @@ local getGotoCommand = ____stage.getGotoCommand
27398
27368
  local ____types = require("src.functions.types")
27399
27369
  local asNumber = ____types.asNumber
27400
27370
  local ____utils = require("src.functions.utils")
27371
+ local assertDefined = ____utils.assertDefined
27401
27372
  local iRange = ____utils.iRange
27402
27373
  function ____exports.getReadOnlyRooms(self)
27403
27374
  local level = game:GetLevel()
@@ -27503,9 +27474,11 @@ local SECRET_ROOM_TYPES = __TS__New(ReadonlySet, {RoomType.SECRET, RoomType.SUPE
27503
27474
  function ____exports.changeRoom(self, roomGridIndex)
27504
27475
  local level = game:GetLevel()
27505
27476
  local roomData = getRoomData(nil, roomGridIndex)
27506
- if roomData == nil then
27507
- error(("Failed to change the room to grid index " .. tostring(roomGridIndex)) .. " because that room does not exist.")
27508
- end
27477
+ assertDefined(
27478
+ nil,
27479
+ roomData,
27480
+ ("Failed to change the room to grid index " .. tostring(roomGridIndex)) .. " because that room does not exist."
27481
+ )
27509
27482
  level.LeaveDoor = DoorSlot.NO_DOOR_SLOT
27510
27483
  game:ChangeRoom(roomGridIndex)
27511
27484
  end
@@ -27702,12 +27675,12 @@ function ____exports.setRoomCleared(self)
27702
27675
  for ____, door in ipairs(getDoors(nil)) do
27703
27676
  do
27704
27677
  if isHiddenSecretRoomDoor(nil, door) then
27705
- goto __continue77
27678
+ goto __continue76
27706
27679
  end
27707
27680
  openDoorFast(nil, door)
27708
27681
  door.ExtraVisible = false
27709
27682
  end
27710
- ::__continue77::
27683
+ ::__continue76::
27711
27684
  end
27712
27685
  sfxManager:Stop(SoundEffect.DOOR_HEAVY_OPEN)
27713
27686
  game:ShakeScreen(0)
@@ -27762,6 +27735,7 @@ local ____types = require("src.functions.types")
27762
27735
  local asNumber = ____types.asNumber
27763
27736
  local isNumber = ____types.isNumber
27764
27737
  local ____utils = require("src.functions.utils")
27738
+ local assertDefined = ____utils.assertDefined
27765
27739
  local eRange = ____utils.eRange
27766
27740
  local iRange = ____utils.iRange
27767
27741
  local ____vector = require("src.functions.vector")
@@ -27870,9 +27844,11 @@ local BREAKABLE_GRID_ENTITY_TYPES_VARIANTS_BY_EXPLOSIONS = __TS__New(
27870
27844
  )
27871
27845
  function ____exports.convertXMLGridEntityType(self, gridEntityXMLType, gridEntityXMLVariant)
27872
27846
  local gridEntityArray = GRID_ENTITY_XML_MAP:get(gridEntityXMLType)
27873
- if gridEntityArray == nil then
27874
- error("Failed to find an entry in the grid entity map for XML entity type: " .. tostring(gridEntityXMLType))
27875
- end
27847
+ assertDefined(
27848
+ nil,
27849
+ gridEntityArray,
27850
+ "Failed to find an entry in the grid entity map for XML entity type: " .. tostring(gridEntityXMLType)
27851
+ )
27876
27852
  local gridEntityType = gridEntityArray[1]
27877
27853
  local variant = gridEntityArray[2]
27878
27854
  if gridEntityType == GridEntityType.SPIKES_ON_OFF or gridEntityType == GridEntityType.PRESSURE_PLATE or gridEntityType == GridEntityType.TELEPORTER then
@@ -27920,13 +27896,17 @@ function ____exports.getConstituentsFromGridEntityID(self, gridEntityID)
27920
27896
  end
27921
27897
  local gridEntityTypeString, variantString = table.unpack(parts)
27922
27898
  local gridEntityType = tonumber(gridEntityTypeString)
27923
- if gridEntityType == nil then
27924
- error("Failed to convert the grid entity type to a number: " .. tostring(gridEntityTypeString))
27925
- end
27899
+ assertDefined(
27900
+ nil,
27901
+ gridEntityType,
27902
+ "Failed to convert the grid entity type to a number: " .. tostring(gridEntityTypeString)
27903
+ )
27926
27904
  local variant = tonumber(variantString)
27927
- if variant == nil then
27928
- error("Failed to convert the grid entity variant to a number: " .. tostring(variantString))
27929
- end
27905
+ assertDefined(
27906
+ nil,
27907
+ variant,
27908
+ "Failed to convert the grid entity variant to a number: " .. tostring(variantString)
27909
+ )
27930
27910
  return {gridEntityType, variant}
27931
27911
  end
27932
27912
  function ____exports.getGridEntities(self, ...)
@@ -27976,7 +27956,7 @@ function ____exports.getGridEntitiesInRadius(self, targetPosition, radius)
27976
27956
  local gridIndex = room:GetGridIndex(position)
27977
27957
  local gridEntity = room:GetGridEntityFromPos(position)
27978
27958
  if gridEntity == nil or registeredGridIndexes:has(gridIndex) then
27979
- goto __continue27
27959
+ goto __continue24
27980
27960
  end
27981
27961
  registeredGridIndexes:add(gridIndex)
27982
27962
  local topLeft, bottomRight = table.unpack(____exports.getGridEntityCollisionPoints(nil, gridEntity))
@@ -27990,7 +27970,7 @@ function ____exports.getGridEntitiesInRadius(self, targetPosition, radius)
27990
27970
  gridEntities[#gridEntities + 1] = gridEntity
27991
27971
  end
27992
27972
  end
27993
- ::__continue27::
27973
+ ::__continue24::
27994
27974
  end
27995
27975
  end
27996
27976
  return gridEntities
@@ -29812,14 +29792,14 @@ function PostNewRoomEarly.prototype.isNewRoom(self)
29812
29792
  if topLeftWall == nil then
29813
29793
  topLeftWall = spawnGridEntity(nil, GridEntityType.WALL, topLeftWallGridIndex)
29814
29794
  if topLeftWall == nil then
29815
- logError("Failed to spawn a new wall (1) for the POST_NEW_ROOM_EARLY callback.")
29795
+ logError("Failed to spawn a new wall for the POST_NEW_ROOM_EARLY callback (on the first try).")
29816
29796
  return false
29817
29797
  end
29818
29798
  end
29819
29799
  if topLeftWall2 == nil then
29820
29800
  topLeftWall2 = spawnGridEntity(nil, GridEntityType.WALL, rightOfTopWallGridIndex)
29821
29801
  if topLeftWall2 == nil then
29822
- logError("Failed to spawn a new wall (2) for the POST_NEW_ROOM_EARLY callback.")
29802
+ logError("Failed to spawn a new wall for the POST_NEW_ROOM_EARLY callback (on the second try).")
29823
29803
  return false
29824
29804
  end
29825
29805
  end
@@ -30162,84 +30142,72 @@ local removeGridEntities = ____gridEntities.removeGridEntities
30162
30142
  local spawnGridEntityWithVariant = ____gridEntities.spawnGridEntityWithVariant
30163
30143
  local ____types = require("src.functions.types")
30164
30144
  local asNumber = ____types.asNumber
30145
+ local ____utils = require("src.functions.utils")
30146
+ local assertDefined = ____utils.assertDefined
30165
30147
  function ____exports.spawnCrawlSpaceWithVariant(self, crawlSpaceVariant, gridIndexOrPosition)
30166
30148
  return spawnGridEntityWithVariant(nil, GridEntityType.CRAWL_SPACE, crawlSpaceVariant, gridIndexOrPosition)
30167
30149
  end
30168
30150
  function ____exports.spawnDoorWithVariant(self, doorVariant, gridIndexOrPosition)
30169
30151
  local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.DOOR, doorVariant, gridIndexOrPosition)
30170
30152
  if gridEntity == nil then
30171
- return gridEntity
30153
+ return nil
30172
30154
  end
30173
30155
  local door = gridEntity:ToDoor()
30174
- if door == nil then
30175
- error("Failed to spawn a door.")
30176
- end
30156
+ assertDefined(nil, door, "Failed to spawn a door.")
30177
30157
  return door
30178
30158
  end
30179
30159
  function ____exports.spawnPitWithVariant(self, pitVariant, gridIndexOrPosition)
30180
30160
  local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.PIT, pitVariant, gridIndexOrPosition)
30181
30161
  if gridEntity == nil then
30182
- return gridEntity
30162
+ return nil
30183
30163
  end
30184
30164
  local pit = gridEntity:ToPit()
30185
- if pit == nil then
30186
- error("Failed to spawn a pit.")
30187
- end
30165
+ assertDefined(nil, pit, "Failed to spawn a pit.")
30188
30166
  return pit
30189
30167
  end
30190
30168
  function ____exports.spawnPoopWithVariant(self, poopVariant, gridIndexOrPosition)
30191
30169
  local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.POOP, poopVariant, gridIndexOrPosition)
30192
30170
  if gridEntity == nil then
30193
- return gridEntity
30171
+ return nil
30194
30172
  end
30195
30173
  local poop = gridEntity:ToPoop()
30196
- if poop == nil then
30197
- error("Failed to spawn a poop.")
30198
- end
30174
+ assertDefined(nil, poop, "Failed to spawn a poop.")
30199
30175
  return poop
30200
30176
  end
30201
30177
  function ____exports.spawnPressurePlateWithVariant(self, pressurePlateVariant, gridIndexOrPosition)
30202
30178
  local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.PRESSURE_PLATE, pressurePlateVariant, gridIndexOrPosition)
30203
30179
  if gridEntity == nil then
30204
- return gridEntity
30180
+ return nil
30205
30181
  end
30206
30182
  local pressurePlate = gridEntity:ToPressurePlate()
30207
- if pressurePlate == nil then
30208
- error("Failed to spawn a pressure plate.")
30209
- end
30183
+ assertDefined(nil, pressurePlate, "Failed to spawn a pressure plate.")
30210
30184
  return pressurePlate
30211
30185
  end
30212
30186
  function ____exports.spawnRockWithVariant(self, rockVariant, gridIndexOrPosition)
30213
30187
  local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.ROCK, rockVariant, gridIndexOrPosition)
30214
30188
  if gridEntity == nil then
30215
- return gridEntity
30189
+ return nil
30216
30190
  end
30217
30191
  local rock = gridEntity:ToRock()
30218
- if rock == nil then
30219
- error("Failed to spawn a rock.")
30220
- end
30192
+ assertDefined(nil, rock, "Failed to spawn a rock.")
30221
30193
  return rock
30222
30194
  end
30223
30195
  function ____exports.spawnSpikesWithVariant(self, variant, gridIndexOrPosition)
30224
30196
  local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.SPIKES, variant, gridIndexOrPosition)
30225
30197
  if gridEntity == nil then
30226
- return gridEntity
30198
+ return nil
30227
30199
  end
30228
30200
  local spikes = gridEntity:ToSpikes()
30229
- if spikes == nil then
30230
- error("Failed to spawn spikes.")
30231
- end
30201
+ assertDefined(nil, spikes, "Failed to spawn spikes.")
30232
30202
  return spikes
30233
30203
  end
30234
30204
  function ____exports.spawnTNTWithVariant(self, variant, gridIndexOrPosition)
30235
30205
  local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.TNT, variant, gridIndexOrPosition)
30236
30206
  if gridEntity == nil then
30237
- return gridEntity
30207
+ return nil
30238
30208
  end
30239
30209
  local tnt = gridEntity:ToTNT()
30240
- if tnt == nil then
30241
- error("Failed to spawn TNT.")
30242
- end
30210
+ assertDefined(nil, tnt, "Failed to spawn TNT.")
30243
30211
  return tnt
30244
30212
  end
30245
30213
  function ____exports.spawnTeleporterWithVariant(self, variant, gridIndexOrPosition)
@@ -34529,6 +34497,8 @@ local ____roomData = require("src.functions.roomData")
34529
34497
  local getRoomListIndex = ____roomData.getRoomListIndex
34530
34498
  local ____types = require("src.functions.types")
34531
34499
  local isNumber = ____types.isNumber
34500
+ local ____utils = require("src.functions.utils")
34501
+ local assertDefined = ____utils.assertDefined
34532
34502
  local ____vector = require("src.functions.vector")
34533
34503
  local isVector = ____vector.isVector
34534
34504
  local ____DefaultMap = require("src.classes.DefaultMap")
@@ -34622,9 +34592,7 @@ function CustomGridEntities.prototype.spawnCustomGridEntity(self, gridEntityType
34622
34592
  local roomListIndex = getRoomListIndex(nil)
34623
34593
  local gridIndex = isVector(nil, gridIndexOrPosition) and room:GetGridIndex(gridIndexOrPosition) or gridIndexOrPosition
34624
34594
  local customGridEntity = spawnGridEntityWithVariant(nil, baseGridEntityType, baseGridEntityVariant, gridIndexOrPosition)
34625
- if customGridEntity == nil then
34626
- error("Failed to spawn a custom grid entity.")
34627
- end
34595
+ assertDefined(nil, customGridEntity, "Failed to spawn a custom grid entity.")
34628
34596
  if gridCollisionClass ~= nil then
34629
34597
  customGridEntity.CollisionClass = gridCollisionClass
34630
34598
  end
@@ -35493,6 +35461,8 @@ local getIsaacAPIClassName = ____isaacAPIClass.getIsaacAPIClassName
35493
35461
  local ____types = require("src.functions.types")
35494
35462
  local isTable = ____types.isTable
35495
35463
  local isUserdata = ____types.isUserdata
35464
+ local ____utils = require("src.functions.utils")
35465
+ local assertDefined = ____utils.assertDefined
35496
35466
  function getSerializedTableType(self, serializedIsaacAPIClass)
35497
35467
  for ____, ____value in ipairs(__TS__ObjectEntries(ISAAC_API_CLASS_TYPE_TO_BRAND)) do
35498
35468
  local copyableIsaacAPIClassType = ____value[1]
@@ -35508,14 +35478,10 @@ function ____exports.copyIsaacAPIClass(self, isaacAPIClass)
35508
35478
  error("Failed to copy an Isaac API class since the provided object was of type: " .. __TS__TypeOf(isaacAPIClass))
35509
35479
  end
35510
35480
  local isaacAPIClassType = getIsaacAPIClassName(nil, isaacAPIClass)
35511
- if isaacAPIClassType == nil then
35512
- error("Failed to copy an Isaac API class since it does not have a class type.")
35513
- end
35481
+ assertDefined(nil, isaacAPIClassType, "Failed to copy an Isaac API class since it does not have a class type.")
35514
35482
  local copyableIsaacAPIClassType = isaacAPIClassType
35515
35483
  local functions = ISAAC_API_CLASS_TYPE_TO_FUNCTIONS[copyableIsaacAPIClassType]
35516
- if functions == nil then
35517
- error("Failed to copy an Isaac API class since the associated functions were not found for Isaac API class type: " .. copyableIsaacAPIClassType)
35518
- end
35484
+ assertDefined(nil, functions, "Failed to copy an Isaac API class since the associated functions were not found for Isaac API class type: " .. copyableIsaacAPIClassType)
35519
35485
  return functions:copy(isaacAPIClass)
35520
35486
  end
35521
35487
  function ____exports.deserializeIsaacAPIClass(self, serializedIsaacAPIClass)
@@ -35523,13 +35489,9 @@ function ____exports.deserializeIsaacAPIClass(self, serializedIsaacAPIClass)
35523
35489
  error("Failed to deserialize an Isaac API class since the provided object was of type: " .. __TS__TypeOf(serializedIsaacAPIClass))
35524
35490
  end
35525
35491
  local copyableIsaacAPIClassType = getSerializedTableType(nil, serializedIsaacAPIClass)
35526
- if copyableIsaacAPIClassType == nil then
35527
- error("Failed to deserialize an Isaac API class since a valid class type brand was not found.")
35528
- end
35492
+ assertDefined(nil, copyableIsaacAPIClassType, "Failed to deserialize an Isaac API class since a valid class type brand was not found.")
35529
35493
  local functions = ISAAC_API_CLASS_TYPE_TO_FUNCTIONS[copyableIsaacAPIClassType]
35530
- if functions == nil then
35531
- error("Failed to deserialize an Isaac API class since the associated functions were not found for class type: " .. copyableIsaacAPIClassType)
35532
- end
35494
+ assertDefined(nil, functions, "Failed to deserialize an Isaac API class since the associated functions were not found for class type: " .. copyableIsaacAPIClassType)
35533
35495
  return functions:deserialize(serializedIsaacAPIClass)
35534
35496
  end
35535
35497
  function ____exports.isCopyableIsaacAPIClass(self, object)
@@ -35559,14 +35521,10 @@ function ____exports.serializeIsaacAPIClass(self, isaacAPIClass)
35559
35521
  error("Failed to serialize an Isaac API class since the provided object was of type: " .. __TS__TypeOf(isaacAPIClass))
35560
35522
  end
35561
35523
  local isaacAPIClassType = getIsaacAPIClassName(nil, isaacAPIClass)
35562
- if isaacAPIClassType == nil then
35563
- error("Failed to serialize an Isaac API class since it does not have a class type.")
35564
- end
35524
+ assertDefined(nil, isaacAPIClassType, "Failed to serialize an Isaac API class since it does not have a class name.")
35565
35525
  local copyableIsaacAPIClassType = isaacAPIClassType
35566
35526
  local functions = ISAAC_API_CLASS_TYPE_TO_FUNCTIONS[copyableIsaacAPIClassType]
35567
- if functions == nil then
35568
- error("Failed to serialize an Isaac API class since the associated functions were not found for class type: " .. copyableIsaacAPIClassType)
35569
- end
35527
+ assertDefined(nil, functions, "Failed to serialize an Isaac API class since the associated functions were not found for class type: " .. copyableIsaacAPIClassType)
35570
35528
  return functions:serialize(isaacAPIClass)
35571
35529
  end
35572
35530
  return ____exports
@@ -35616,6 +35574,7 @@ local asString = ____types.asString
35616
35574
  local isNumber = ____types.isNumber
35617
35575
  local isPrimitive = ____types.isPrimitive
35618
35576
  local ____utils = require("src.functions.utils")
35577
+ local assertDefined = ____utils.assertDefined
35619
35578
  local getTraversalDescription = ____utils.getTraversalDescription
35620
35579
  function ____exports.deepCopy(self, value, serializationType, traversalDescription, classConstructors, insideMap)
35621
35580
  if serializationType == nil then
@@ -35841,9 +35800,7 @@ function getNewDefaultMap(self, defaultMap, serializationType, traversalDescript
35841
35800
  error(("Failed to deserialize a default map of \"" .. traversalDescription) .. "\", since it was not a Lua table.")
35842
35801
  end
35843
35802
  local defaultMapValue = defaultMap[SerializationBrand.DEFAULT_MAP_VALUE]
35844
- if defaultMapValue == nil then
35845
- error((("Failed to deserialize a default map of \"" .. traversalDescription) .. "\", since there was no serialization brand of: ") .. SerializationBrand.DEFAULT_MAP_VALUE)
35846
- end
35803
+ assertDefined(nil, defaultMapValue, (("Failed to deserialize a default map of \"" .. traversalDescription) .. "\", since there was no serialization brand of: ") .. SerializationBrand.DEFAULT_MAP_VALUE)
35847
35804
  return __TS__New(DefaultMap, defaultMapValue)
35848
35805
  end
35849
35806
  end
@@ -35934,16 +35891,16 @@ function deepCopyTSTLClass(self, tstlClass, serializationType, traversalDescript
35934
35891
  end
35935
35892
  local newClass
35936
35893
  repeat
35937
- local ____switch65 = serializationType
35938
- local ____cond65 = ____switch65 == SerializationType.NONE
35939
- if ____cond65 then
35894
+ local ____switch64 = serializationType
35895
+ local ____cond64 = ____switch64 == SerializationType.NONE
35896
+ if ____cond64 then
35940
35897
  do
35941
35898
  newClass = newTSTLClass(nil, tstlClass)
35942
35899
  break
35943
35900
  end
35944
35901
  end
35945
- ____cond65 = ____cond65 or ____switch65 == SerializationType.SERIALIZE
35946
- if ____cond65 then
35902
+ ____cond64 = ____cond64 or ____switch64 == SerializationType.SERIALIZE
35903
+ if ____cond64 then
35947
35904
  do
35948
35905
  newClass = {}
35949
35906
  local tstlClassName = getTSTLClassName(nil, tstlClass)
@@ -35953,20 +35910,16 @@ function deepCopyTSTLClass(self, tstlClass, serializationType, traversalDescript
35953
35910
  break
35954
35911
  end
35955
35912
  end
35956
- ____cond65 = ____cond65 or ____switch65 == SerializationType.DESERIALIZE
35957
- if ____cond65 then
35913
+ ____cond64 = ____cond64 or ____switch64 == SerializationType.DESERIALIZE
35914
+ if ____cond64 then
35958
35915
  do
35959
35916
  local tstlClassName = tstlClass[SerializationBrand.TSTL_CLASS]
35960
- if tstlClassName == nil then
35961
- error("Failed to deserialize a TSTL class since the brand did not contain the class name.")
35962
- end
35917
+ assertDefined(nil, tstlClassName, "Failed to deserialize a TSTL class since the brand did not contain the class name.")
35963
35918
  local classConstructor = classConstructors[tstlClassName]
35964
- if classConstructor == nil then
35965
- error(("Failed to deserialize a TSTL class since there was no constructor registered for a class name of \"" .. tstlClassName) .. "\". If this mod is using the save data manager, it must register the class constructor with the \"saveDataManagerRegisterClass\" method.")
35966
- end
35919
+ assertDefined(nil, classConstructor, ("Failed to deserialize a TSTL class since there was no constructor registered for a class name of \"" .. tstlClassName) .. "\". If this mod is using the save data manager, it must register the class constructor with the \"saveDataManagerRegisterClass\" method.")
35967
35920
  newClass = __TS__New(classConstructor)
35921
+ break
35968
35922
  end
35969
- break
35970
35923
  end
35971
35924
  until true
35972
35925
  local ____getCopiedEntries_result_4 = getCopiedEntries(
@@ -36071,7 +36024,7 @@ function getCopiedEntries(self, object, serializationType, traversalDescription,
36071
36024
  local value = ____value[2]
36072
36025
  do
36073
36026
  if isSerializationBrand(nil, key) then
36074
- goto __continue93
36027
+ goto __continue90
36075
36028
  end
36076
36029
  traversalDescription = getTraversalDescription(nil, key, traversalDescription)
36077
36030
  local newValue = ____exports.deepCopy(
@@ -36094,7 +36047,7 @@ function getCopiedEntries(self, object, serializationType, traversalDescription,
36094
36047
  end
36095
36048
  copiedEntries[#copiedEntries + 1] = {keyToUse, newValue}
36096
36049
  end
36097
- ::__continue93::
36050
+ ::__continue90::
36098
36051
  end
36099
36052
  return {entries = copiedEntries, convertedNumberKeysToStrings = convertNumberKeysToStrings}
36100
36053
  end
@@ -36107,29 +36060,26 @@ function checkMetatable(self, luaMap, traversalDescription)
36107
36060
  error(("The deepCopy function detected that " .. tableDescription) .. " has a metatable. Copying tables with metatables is not supported, unless they are explicitly handled by the save data manager. (e.g. TypeScriptToLua Maps, TypeScriptToLua Sets, etc.)")
36108
36061
  end
36109
36062
  function deepCopyUserdata(self, value, serializationType, traversalDescription)
36110
- local classType = getIsaacAPIClassName(nil, value)
36111
- if classType == nil then
36112
- error("The deep copy function was not able to derive the Isaac API class type for: " .. traversalDescription)
36113
- end
36114
36063
  if not isCopyableIsaacAPIClass(nil, value) then
36115
- error((("The deep copy function does not support serializing \"" .. traversalDescription) .. "\", since it is an Isaac API class of type: ") .. classType)
36064
+ local className = getIsaacAPIClassName(nil, value) or "Unknown"
36065
+ error((("The deep copy function does not support serializing \"" .. traversalDescription) .. "\", since it is an Isaac API class of type: ") .. className)
36116
36066
  end
36117
36067
  repeat
36118
- local ____switch104 = serializationType
36119
- local ____cond104 = ____switch104 == SerializationType.NONE
36120
- if ____cond104 then
36068
+ local ____switch100 = serializationType
36069
+ local ____cond100 = ____switch100 == SerializationType.NONE
36070
+ if ____cond100 then
36121
36071
  do
36122
36072
  return copyIsaacAPIClass(nil, value)
36123
36073
  end
36124
36074
  end
36125
- ____cond104 = ____cond104 or ____switch104 == SerializationType.SERIALIZE
36126
- if ____cond104 then
36075
+ ____cond100 = ____cond100 or ____switch100 == SerializationType.SERIALIZE
36076
+ if ____cond100 then
36127
36077
  do
36128
36078
  return serializeIsaacAPIClass(nil, value)
36129
36079
  end
36130
36080
  end
36131
- ____cond104 = ____cond104 or ____switch104 == SerializationType.DESERIALIZE
36132
- if ____cond104 then
36081
+ ____cond100 = ____cond100 or ____switch100 == SerializationType.DESERIALIZE
36082
+ if ____cond100 then
36133
36083
  do
36134
36084
  error(("The deep copy function can not deserialize \"" .. traversalDescription) .. "\", since it is userdata.")
36135
36085
  end
@@ -36977,7 +36927,7 @@ function ____exports.restoreDefaultForFeatureKey(self, saveDataDefaultsMap, subs
36977
36927
  end
36978
36928
  local childTableDefaults = saveDataDefaults[saveDataKey]
36979
36929
  if childTableDefaults == nil then
36980
- logError(((("Failed to find the default copy of the child table \"" .. saveDataKey) .. "\" for subscriber \"") .. subscriberName) .. "\". This error usually means that your save data is out of date. You can try purging all of your save data by deleting the following directory: C:\\Program Files (x86)\\Steam\\steamapps\\common\\The Binding of Isaac Rebirth\\data")
36930
+ logError(((("Failed to find the default copy of the child table \"" .. saveDataKey) .. "\" for subscriber \"") .. subscriberName) .. "\". This error usually means that your mod-specific save data is out of date. You can try purging all of your mod-specific save data by deleting the following directory: C:\\Program Files (x86)\\Steam\\steamapps\\common\\The Binding of Isaac Rebirth\\data")
36981
36931
  return
36982
36932
  end
36983
36933
  local childTableDefaultsCopy = deepCopy(nil, childTableDefaults, SerializationType.NONE, (subscriberName .. " --> ") .. saveDataKey)
@@ -37080,6 +37030,8 @@ local isTSTLClass = ____tstlClass.isTSTLClass
37080
37030
  local ____types = require("src.functions.types")
37081
37031
  local isString = ____types.isString
37082
37032
  local isTable = ____types.isTable
37033
+ local ____utils = require("src.functions.utils")
37034
+ local assertDefined = ____utils.assertDefined
37083
37035
  local ____ReadonlySet = require("src.types.ReadonlySet")
37084
37036
  local ReadonlySet = ____ReadonlySet.ReadonlySet
37085
37037
  local ____Feature = require("src.classes.private.Feature")
@@ -37158,9 +37110,7 @@ end
37158
37110
  function SaveDataManager.prototype.saveDataManager(self, key, v, conditionalFunc)
37159
37111
  if isTSTLClass(nil, key) then
37160
37112
  local className = getTSTLClassName(nil, key)
37161
- if className == nil then
37162
- error("Failed to get the class name for the submitted class (as part of the \"key\" parameter) when registering new data with the save data manager.")
37163
- end
37113
+ assertDefined(nil, className, "Failed to get the class name for the submitted class (as part of the \"key\" parameter) when registering new data with the save data manager.")
37164
37114
  key = className
37165
37115
  end
37166
37116
  if not isString(nil, key) then
@@ -37212,9 +37162,7 @@ function SaveDataManager.prototype.saveDataManagerRegisterClass(self, ...)
37212
37162
  local tstlClasses = {...}
37213
37163
  for ____, tstlClass in ipairs(tstlClasses) do
37214
37164
  local name = tstlClass.name
37215
- if name == nil then
37216
- error("Failed to register a class with the save data manager due to not being able to derive the name of the class.")
37217
- end
37165
+ assertDefined(nil, name, "Failed to register a class with the save data manager due to not being able to derive the name of the class.")
37218
37166
  self.classConstructors[name] = tstlClass
37219
37167
  end
37220
37168
  end
@@ -37237,9 +37185,7 @@ function SaveDataManager.prototype.saveDataManagerReset(self, key, childObjectKe
37237
37185
  error("The save data manager requires that keys are strings. You tried to use a key of type: " .. __TS__TypeOf(key))
37238
37186
  end
37239
37187
  local saveData = self.saveDataMap[key]
37240
- if saveData == nil then
37241
- error("The save data manager is not managing save data for a key of: " .. key)
37242
- end
37188
+ assertDefined(nil, saveData, "The save data manager is not managing save data for a key of: " .. key)
37243
37189
  restoreDefaultForFeatureKey(
37244
37190
  nil,
37245
37191
  self.saveDataDefaultsMap,
@@ -38138,6 +38084,7 @@ local ____trinkets = require("src.functions.trinkets")
38138
38084
  local getVanillaTrinketTypeRange = ____trinkets.getVanillaTrinketTypeRange
38139
38085
  local trinketHasCacheFlag = ____trinkets.trinketHasCacheFlag
38140
38086
  local ____utils = require("src.functions.utils")
38087
+ local assertDefined = ____utils.assertDefined
38141
38088
  local ____repeat = ____utils["repeat"]
38142
38089
  local ____itemConfigCardTypesForCardsSet = require("src.sets.itemConfigCardTypesForCardsSet")
38143
38090
  local ITEM_CONFIG_CARD_TYPES_FOR_CARDS_SET = ____itemConfigCardTypesForCardsSet.ITEM_CONFIG_CARD_TYPES_FOR_CARDS_SET
@@ -38431,9 +38378,11 @@ function ModdedElementSets.prototype.lazyInitCardTypes(self)
38431
38378
  local itemConfigCardType = getItemConfigCardType(nil, cardType)
38432
38379
  if itemConfigCardType ~= nil then
38433
38380
  local cardTypeSet = self.itemConfigCardTypeToCardTypeMap:get(itemConfigCardType)
38434
- if cardTypeSet == nil then
38435
- error("Failed to get the card set for item config card type: " .. tostring(itemConfigCardType))
38436
- end
38381
+ assertDefined(
38382
+ nil,
38383
+ cardTypeSet,
38384
+ "Failed to get the card set for item config card type: " .. tostring(itemConfigCardType)
38385
+ )
38437
38386
  cardTypeSet:add(cardType)
38438
38387
  if ITEM_CONFIG_CARD_TYPES_FOR_CARDS_SET:has(itemConfigCardType) then
38439
38388
  self.cardSet:add(cardType)
@@ -38459,9 +38408,11 @@ function ModdedElementSets.prototype.getCardTypesOfType(self, ...)
38459
38408
  local matchingCardTypes = __TS__New(Set)
38460
38409
  for ____, itemConfigCardType in ipairs(itemConfigCardTypes) do
38461
38410
  local cardTypeSet = self.itemConfigCardTypeToCardTypeMap:get(itemConfigCardType)
38462
- if cardTypeSet == nil then
38463
- error("Failed to get the card type set for item config type: " .. tostring(itemConfigCardType))
38464
- end
38411
+ assertDefined(
38412
+ nil,
38413
+ cardTypeSet,
38414
+ "Failed to get the card type set for item config type: " .. tostring(itemConfigCardType)
38415
+ )
38465
38416
  for ____, cardType in __TS__Iterator(cardTypeSet) do
38466
38417
  matchingCardTypes:add(cardType)
38467
38418
  end
@@ -38481,9 +38432,11 @@ end
38481
38432
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCollectibleSet", true)
38482
38433
  function ModdedElementSets.prototype.getCollectiblesForTransformation(self, playerForm)
38483
38434
  local itemConfigTag = TRANSFORMATION_TO_TAG_MAP:get(playerForm)
38484
- if itemConfigTag == nil then
38485
- error(("Failed to get the collectible types for the transformation of " .. tostring(playerForm)) .. " because that transformation is not based on collectibles.")
38486
- end
38435
+ assertDefined(
38436
+ nil,
38437
+ itemConfigTag,
38438
+ ("Failed to get the collectible types for the transformation of " .. tostring(playerForm)) .. " because that transformation is not based on collectibles."
38439
+ )
38487
38440
  return self:getCollectiblesWithTag(itemConfigTag)
38488
38441
  end
38489
38442
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCollectiblesForTransformation", true)
@@ -38499,9 +38452,11 @@ __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCollectiblesWi
38499
38452
  function ModdedElementSets.prototype.getCollectiblesWithTag(self, itemConfigTag)
38500
38453
  self:lazyInitTagToCollectibleTypesMap()
38501
38454
  local collectibleTypes = self.tagToCollectibleTypesMap:get(itemConfigTag)
38502
- if collectibleTypes == nil then
38503
- error(("The item config tag of " .. tostring(itemConfigTag)) .. " is not a valid value of the \"ItemConfigTag\" enum.")
38504
- end
38455
+ assertDefined(
38456
+ nil,
38457
+ collectibleTypes,
38458
+ ("The item config tag of " .. tostring(itemConfigTag)) .. " is not a valid value of the \"ItemConfigTag\" enum."
38459
+ )
38505
38460
  return collectibleTypes
38506
38461
  end
38507
38462
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCollectiblesWithTag", true)
@@ -39724,7 +39679,7 @@ function CharacterHealthConversion.prototype.____constructor(self)
39724
39679
  local character = player:GetPlayerType()
39725
39680
  local conversionHeartSubType = self.characterHealthReplacementMap:get(character)
39726
39681
  if conversionHeartSubType == nil then
39727
- return
39682
+ return nil
39728
39683
  end
39729
39684
  convertRedHeartContainers(nil, player, conversionHeartSubType)
39730
39685
  removeRedHearts(nil, player)
@@ -40080,6 +40035,8 @@ local ____array = require("src.functions.array")
40080
40035
  local sumArray = ____array.sumArray
40081
40036
  local ____string = require("src.functions.string")
40082
40037
  local getPartialMatch = ____string.getPartialMatch
40038
+ local ____utils = require("src.functions.utils")
40039
+ local assertDefined = ____utils.assertDefined
40083
40040
  function ____exports.mapSetHash(self, map, entity, value)
40084
40041
  local hash = GetPtrHash(entity)
40085
40042
  map:set(hash, value)
@@ -40107,9 +40064,7 @@ function ____exports.getMapPartialMatch(self, searchText, map)
40107
40064
  return nil
40108
40065
  end
40109
40066
  local value = map:get(matchingKey)
40110
- if value == nil then
40111
- error("Failed to get the map value corresponding to the partial match of: " .. matchingKey)
40112
- end
40067
+ assertDefined(nil, value, "Failed to get the map value corresponding to the partial match of: " .. matchingKey)
40113
40068
  return {matchingKey, value}
40114
40069
  end
40115
40070
  function ____exports.getReversedMap(self, map)
@@ -40143,6 +40098,8 @@ local ____random = require("src.functions.random")
40143
40098
  local getRandomFloat = ____random.getRandomFloat
40144
40099
  local ____rng = require("src.functions.rng")
40145
40100
  local getRandomSeed = ____rng.getRandomSeed
40101
+ local ____utils = require("src.functions.utils")
40102
+ local assertDefined = ____utils.assertDefined
40146
40103
  function ____exports.getRandomIndexFromWeightedArray(self, weightedArray, seedOrRNG)
40147
40104
  if seedOrRNG == nil then
40148
40105
  seedOrRNG = getRandomSeed(nil)
@@ -40174,9 +40131,11 @@ function ____exports.getRandomFromWeightedArray(self, weightedArray, seedOrRNG)
40174
40131
  end
40175
40132
  local randomIndex = ____exports.getRandomIndexFromWeightedArray(nil, weightedArray, seedOrRNG)
40176
40133
  local randomElement = weightedArray[randomIndex + 1]
40177
- if randomElement == nil then
40178
- error("Failed to get an element from a weighted array using a random index of: " .. tostring(randomIndex))
40179
- end
40134
+ assertDefined(
40135
+ nil,
40136
+ randomElement,
40137
+ "Failed to get an element from a weighted array using a random index of: " .. tostring(randomIndex)
40138
+ )
40180
40139
  return randomElement[1]
40181
40140
  end
40182
40141
  return ____exports
@@ -40201,6 +40160,8 @@ local ____map = require("src.functions.map")
40201
40160
  local copyMap = ____map.copyMap
40202
40161
  local ____rng = require("src.functions.rng")
40203
40162
  local getRandomSeed = ____rng.getRandomSeed
40163
+ local ____utils = require("src.functions.utils")
40164
+ local assertDefined = ____utils.assertDefined
40204
40165
  local ____weighted = require("src.functions.weighted")
40205
40166
  local getRandomIndexFromWeightedArray = ____weighted.getRandomIndexFromWeightedArray
40206
40167
  local ____Feature = require("src.classes.private.Feature")
@@ -40237,17 +40198,21 @@ function CustomItemPools.prototype.getCustomItemPoolCollectible(self, itemPoolTy
40237
40198
  defaultItem = CollectibleType.NULL
40238
40199
  end
40239
40200
  local customItemPool = v.run.customItemPools:get(itemPoolTypeCustom)
40240
- if customItemPool == nil then
40241
- error("Failed to find the custom item pool of: " .. tostring(itemPoolTypeCustom))
40242
- end
40201
+ assertDefined(
40202
+ nil,
40203
+ customItemPool,
40204
+ "Failed to find the custom item pool of: " .. tostring(itemPoolTypeCustom)
40205
+ )
40243
40206
  if #customItemPool == 0 then
40244
40207
  return defaultItem
40245
40208
  end
40246
40209
  local randomIndex = getRandomIndexFromWeightedArray(nil, customItemPool, seedOrRNG)
40247
40210
  local tuple = customItemPool[randomIndex + 1]
40248
- if tuple == nil then
40249
- error("Failed to get an element from a custom item pool using a random index of: " .. tostring(randomIndex))
40250
- end
40211
+ assertDefined(
40212
+ nil,
40213
+ tuple,
40214
+ "Failed to get an element from a custom item pool using a random index of: " .. tostring(randomIndex)
40215
+ )
40251
40216
  if decrease then
40252
40217
  arrayRemoveIndexInPlace(nil, customItemPool, randomIndex)
40253
40218
  end
@@ -41577,6 +41542,8 @@ local ____stage = require("src.functions.stage")
41577
41542
  local setStage = ____stage.setStage
41578
41543
  local ____tstlClass = require("src.functions.tstlClass")
41579
41544
  local getTSTLClassName = ____tstlClass.getTSTLClassName
41545
+ local ____utils = require("src.functions.utils")
41546
+ local assertDefined = ____utils.assertDefined
41580
41547
  local ____vector = require("src.functions.vector")
41581
41548
  local isVector = ____vector.isVector
41582
41549
  local ____ReadonlySet = require("src.types.ReadonlySet")
@@ -41792,9 +41759,7 @@ function CustomTrapdoors.prototype.checkAllPlayersLayingDownComplete(self)
41792
41759
  v.run.state = StageTravelState.NONE
41793
41760
  self:logStateChanged()
41794
41761
  local tstlClassName = getTSTLClassName(nil, self)
41795
- if tstlClassName == nil then
41796
- error("Failed to find get the class name for the custom trapdoor feature.")
41797
- end
41762
+ assertDefined(nil, tstlClassName, "Failed to find get the class name for the custom trapdoor feature.")
41798
41763
  self.disableInputs:enableAllInputs(tstlClassName)
41799
41764
  end
41800
41765
  function CustomTrapdoors.prototype.drawBlackSprite(self)
@@ -41843,14 +41808,14 @@ function CustomTrapdoors.prototype.checkCustomTrapdoorPlayerTouched(self, gridEn
41843
41808
  do
41844
41809
  local player = playerEntity:ToPlayer()
41845
41810
  if player == nil then
41846
- goto __continue43
41811
+ goto __continue42
41847
41812
  end
41848
41813
  if not self.ponyDetection:isPlayerUsingPony(player) and not isChildPlayer(nil, player) and canPlayerInteractWithTrapdoor(nil, player) then
41849
41814
  self:playerTouchedCustomTrapdoor(gridEntity, trapdoorDescription, player)
41850
41815
  return
41851
41816
  end
41852
41817
  end
41853
- ::__continue43::
41818
+ ::__continue42::
41854
41819
  end
41855
41820
  end
41856
41821
  function CustomTrapdoors.prototype.playerTouchedCustomTrapdoor(self, gridEntity, trapdoorDescription, player)
@@ -41858,9 +41823,7 @@ function CustomTrapdoors.prototype.playerTouchedCustomTrapdoor(self, gridEntity,
41858
41823
  v.run.customTrapdoorActivated = trapdoorDescription
41859
41824
  self:logStateChanged()
41860
41825
  local tstlClassName = getTSTLClassName(nil, self)
41861
- if tstlClassName == nil then
41862
- error("Failed to find get the class name for the custom trapdoor feature.")
41863
- end
41826
+ assertDefined(nil, tstlClassName, "Failed to find get the class name for the custom trapdoor feature.")
41864
41827
  local whitelist = __TS__New(ReadonlySet, {ButtonAction.CONSOLE})
41865
41828
  self.disableInputs:disableAllInputsExceptFor(tstlClassName, whitelist)
41866
41829
  setPlayerAttributes(nil, player, gridEntity.Position)
@@ -42098,6 +42061,8 @@ local ____players = require("src.functions.players")
42098
42061
  local useActiveItemTemp = ____players.useActiveItemTemp
42099
42062
  local ____tstlClass = require("src.functions.tstlClass")
42100
42063
  local getTSTLClassName = ____tstlClass.getTSTLClassName
42064
+ local ____utils = require("src.functions.utils")
42065
+ local assertDefined = ____utils.assertDefined
42101
42066
  local ____ReadonlySet = require("src.types.ReadonlySet")
42102
42067
  local ReadonlySet = ____ReadonlySet.ReadonlySet
42103
42068
  local ____Feature = require("src.classes.private.Feature")
@@ -42195,9 +42160,7 @@ function Pause.prototype.pause(self)
42195
42160
  local firstPlayer = Isaac.GetPlayer()
42196
42161
  useActiveItemTemp(nil, firstPlayer, CollectibleType.PAUSE)
42197
42162
  local tstlClassName = getTSTLClassName(nil, self)
42198
- if tstlClassName == nil then
42199
- error("Failed to get the class name for the pause feature.")
42200
- end
42163
+ assertDefined(nil, tstlClassName, "Failed to get the class name for the pause feature.")
42201
42164
  local whitelist = __TS__New(ReadonlySet, {ButtonAction.MENU_CONFIRM, ButtonAction.CONSOLE})
42202
42165
  self.disableInputs:disableAllInputsExceptFor(tstlClassName, whitelist)
42203
42166
  for ____, player in ipairs(getAllPlayers(nil)) do
@@ -42215,9 +42178,7 @@ function Pause.prototype.unpause(self)
42215
42178
  v.run.isPseudoPaused = false
42216
42179
  v.run.shouldUnpause = true
42217
42180
  local tstlClassName = getTSTLClassName(nil, self)
42218
- if tstlClassName == nil then
42219
- error("Failed to find get the class name for the pause feature.")
42220
- end
42181
+ assertDefined(nil, tstlClassName, "Failed to find get the class name for the pause feature.")
42221
42182
  self.disableInputs:enableAllInputs(tstlClassName)
42222
42183
  for ____, player in ipairs(getAllPlayers(nil)) do
42223
42184
  player.ControlsEnabled = true
@@ -42257,6 +42218,7 @@ local ____string = require("src.functions.string")
42257
42218
  local removeCharactersBefore = ____string.removeCharactersBefore
42258
42219
  local trimPrefix = ____string.trimPrefix
42259
42220
  local ____utils = require("src.functions.utils")
42221
+ local assertDefined = ____utils.assertDefined
42260
42222
  local eRange = ____utils.eRange
42261
42223
  local iRange = ____utils.iRange
42262
42224
  local ____ReadonlySet = require("src.types.ReadonlySet")
@@ -42285,9 +42247,7 @@ function spawnWallEntity(self, customStage, rng, isExtraWall)
42285
42247
  sprite:Load(ISAACSCRIPT_CUSTOM_STAGE_GFX_PATH .. "/wall-backdrop.anm2", false)
42286
42248
  local wallLayersArray = isExtraWall and ROOM_SHAPE_WALL_EXTRA_ANM2_LAYERS or ROOM_SHAPE_WALL_ANM2_LAYERS
42287
42249
  local numWallLayers = wallLayersArray[roomShape]
42288
- if numWallLayers == nil then
42289
- error("Failed to get the layers when creating the backdrop for custom stage: " .. customStage.name)
42290
- end
42250
+ assertDefined(nil, numWallLayers, "Failed to get the layers when creating the backdrop for custom stage: " .. customStage.name)
42291
42251
  if isLRoomShape(nil, roomShape) then
42292
42252
  local cornerPNGPath = getBackdropPNGPath(nil, customStage, BackdropKind.CORNER, rng)
42293
42253
  sprite:ReplaceSpritesheet(0, cornerPNGPath)
@@ -42357,21 +42317,21 @@ function spawnFloorEntity(self, customStage, rng)
42357
42317
  end
42358
42318
  function getNumFloorLayers(self, roomShape)
42359
42319
  repeat
42360
- local ____switch23 = roomShape
42361
- local ____cond23 = ____switch23 == RoomShape.SHAPE_1x1
42362
- if ____cond23 then
42320
+ local ____switch22 = roomShape
42321
+ local ____cond22 = ____switch22 == RoomShape.SHAPE_1x1
42322
+ if ____cond22 then
42363
42323
  do
42364
42324
  return 4
42365
42325
  end
42366
42326
  end
42367
- ____cond23 = ____cond23 or (____switch23 == RoomShape.SHAPE_1x2 or ____switch23 == RoomShape.SHAPE_2x1)
42368
- if ____cond23 then
42327
+ ____cond22 = ____cond22 or (____switch22 == RoomShape.SHAPE_1x2 or ____switch22 == RoomShape.SHAPE_2x1)
42328
+ if ____cond22 then
42369
42329
  do
42370
42330
  return 8
42371
42331
  end
42372
42332
  end
42373
- ____cond23 = ____cond23 or ____switch23 == RoomShape.SHAPE_2x2
42374
- if ____cond23 then
42333
+ ____cond22 = ____cond22 or ____switch22 == RoomShape.SHAPE_2x2
42334
+ if ____cond22 then
42375
42335
  do
42376
42336
  return 16
42377
42337
  end
@@ -43185,6 +43145,8 @@ local ____entities = require("src.functions.entities")
43185
43145
  local parseEntityTypeVariantString = ____entities.parseEntityTypeVariantString
43186
43146
  local ____set = require("src.functions.set")
43187
43147
  local copySet = ____set.copySet
43148
+ local ____utils = require("src.functions.utils")
43149
+ local assertDefined = ____utils.assertDefined
43188
43150
  local ____ReadonlyMap = require("src.types.ReadonlyMap")
43189
43151
  local ReadonlyMap = ____ReadonlyMap.ReadonlyMap
43190
43152
  local ____ReadonlySet = require("src.types.ReadonlySet")
@@ -43196,9 +43158,7 @@ function getAllBossesExcludingStoryBossesSet(self)
43196
43158
  local allBosses = {__TS__Spread(____exports.ALL_BOSSES_SET:values())}
43197
43159
  for ____, entityTypeVariantString in ipairs(allBosses) do
43198
43160
  local tuple = parseEntityTypeVariantString(nil, entityTypeVariantString)
43199
- if tuple == nil then
43200
- error("Failed to parse a boss tuple when constructing the story boss set.")
43201
- end
43161
+ assertDefined(nil, tuple, "Failed to parse a boss tuple when constructing the story boss set.")
43202
43162
  local entityType, _variant = table.unpack(tuple)
43203
43163
  if STORY_BOSSES_SET:has(entityType) then
43204
43164
  allBossesExcludingStoryBossesSet:delete(entityTypeVariantString)
@@ -44737,6 +44697,8 @@ local ____stage = require("src.functions.stage")
44737
44697
  local setStage = ____stage.setStage
44738
44698
  local ____types = require("src.functions.types")
44739
44699
  local asNumber = ____types.asNumber
44700
+ local ____utils = require("src.functions.utils")
44701
+ local assertDefined = ____utils.assertDefined
44740
44702
  local ____Feature = require("src.classes.private.Feature")
44741
44703
  local Feature = ____Feature.Feature
44742
44704
  local ____backdrop = require("src.classes.features.other.customStages.backdrop")
@@ -44803,9 +44765,7 @@ function CustomStages.prototype.____constructor(self, customGridEntities, custom
44803
44765
  self.customStageCachedRoomData = __TS__New(Map)
44804
44766
  self.usingRedKey = false
44805
44767
  self.goToCustomStage = function(____, destinationName, destinationStage, _destinationStageType)
44806
- if destinationName == nil then
44807
- error("Failed to go to a custom stage since the custom trapdoors feature did not pass a destination name to the logic function.")
44808
- end
44768
+ assertDefined(nil, destinationName, "Failed to go to a custom stage since the custom trapdoors feature did not pass a destination name to the logic function.")
44809
44769
  local firstFloor = destinationStage == LevelStage.BASEMENT_1
44810
44770
  self:setCustomStage(destinationName, firstFloor)
44811
44771
  end
@@ -44968,10 +44928,10 @@ function CustomStages.prototype.setStageRoomsData(self, customStage, rng, verbos
44968
44928
  for ____, room in ipairs(getRoomsInsideGrid(nil)) do
44969
44929
  do
44970
44930
  if room.SafeGridIndex == startingRoomGridIndex then
44971
- goto __continue36
44931
+ goto __continue35
44972
44932
  end
44973
44933
  if room.Data == nil then
44974
- goto __continue36
44934
+ goto __continue35
44975
44935
  end
44976
44936
  local roomType = room.Data.Type
44977
44937
  local roomShapeMap = customStage.roomTypeMap:get(roomType)
@@ -44979,13 +44939,13 @@ function CustomStages.prototype.setStageRoomsData(self, customStage, rng, verbos
44979
44939
  if roomType == RoomType.DEFAULT then
44980
44940
  logError((((("Failed to find any custom rooms for RoomType." .. RoomType[roomType]) .. " (") .. tostring(roomType)) .. ") for custom stage: ") .. customStage.name)
44981
44941
  end
44982
- goto __continue36
44942
+ goto __continue35
44983
44943
  end
44984
44944
  local roomShape = room.Data.Shape
44985
44945
  local roomDoorSlotFlagMap = roomShapeMap:get(roomShape)
44986
44946
  if roomDoorSlotFlagMap == nil then
44987
44947
  logError((((((((("Failed to find any custom rooms for RoomType." .. RoomType[roomType]) .. " (") .. tostring(roomType)) .. ") + RoomShape.") .. RoomShape[roomShape]) .. " (") .. tostring(roomShape)) .. ") for custom stage: ") .. customStage.name)
44988
- goto __continue36
44948
+ goto __continue35
44989
44949
  end
44990
44950
  local doorSlotFlags = room.Data.Doors
44991
44951
  local roomsMetadata = roomDoorSlotFlagMap:get(doorSlotFlags)
@@ -44995,13 +44955,13 @@ function CustomStages.prototype.setStageRoomsData(self, customStage, rng, verbos
44995
44955
  roomsMetadata = roomDoorSlotFlagMap:get(allDoorSlotFlags)
44996
44956
  if roomsMetadata == nil then
44997
44957
  logError((((((((("Failed to find any custom rooms for RoomType." .. RoomType[roomType]) .. " (") .. tostring(roomType)) .. ") + RoomShape.") .. RoomShape[roomShape]) .. " (") .. tostring(roomShape)) .. ") + all doors enabled for custom stage: ") .. customStage.name)
44998
- goto __continue36
44958
+ goto __continue35
44999
44959
  end
45000
44960
  end
45001
44961
  local randomRoom
45002
44962
  if roomType == RoomType.BOSS then
45003
44963
  if customStage.bossPool == nil then
45004
- goto __continue36
44964
+ goto __continue35
45005
44965
  end
45006
44966
  randomRoom = getRandomBossRoomFromPool(
45007
44967
  nil,
@@ -45024,13 +44984,13 @@ function CustomStages.prototype.setStageRoomsData(self, customStage, rng, verbos
45024
44984
  )
45025
44985
  if newRoomData == nil then
45026
44986
  logError((("Failed to get the room data for room variant " .. tostring(randomRoom.variant)) .. " for custom stage: ") .. customStage.name)
45027
- goto __continue36
44987
+ goto __continue35
45028
44988
  end
45029
44989
  self.customStageCachedRoomData:set(randomRoom.variant, newRoomData)
45030
44990
  end
45031
44991
  room.Data = newRoomData
45032
44992
  end
45033
- ::__continue36::
44993
+ ::__continue35::
45034
44994
  end
45035
44995
  end
45036
44996
  function CustomStages.prototype.setCustomStage(self, name, firstFloor, streakText, verbose)
@@ -45044,9 +45004,7 @@ function CustomStages.prototype.setCustomStage(self, name, firstFloor, streakTex
45044
45004
  verbose = false
45045
45005
  end
45046
45006
  local customStage = self.customStagesMap:get(name)
45047
- if customStage == nil then
45048
- error(("Failed to set the custom stage of \"" .. name) .. "\" because it was not found in the custom stages map. (Try restarting IsaacScript / recompiling the mod / restarting the game, and try again. If that does not work, you probably forgot to define it in your \"tsconfig.json\" file.) See the website for more details on how to set up custom stages.")
45049
- end
45007
+ assertDefined(nil, customStage, ("Failed to set the custom stage of \"" .. name) .. "\" because it was not found in the custom stages map. (Try restarting IsaacScript / recompiling the mod / restarting the game, and try again. If that does not work, you probably forgot to define it in your \"tsconfig.json\" file.) See the website for more details on how to set up custom stages.")
45050
45008
  local level = game:GetLevel()
45051
45009
  local stage = level:GetStage()
45052
45010
  local seeds = game:GetSeeds()
@@ -45178,22 +45136,36 @@ return ____exports
45178
45136
  local ____exports = {}
45179
45137
  return ____exports
45180
45138
  end,
45181
- ["src.classes.features.other.debugDisplay.utils"] = function(...)
45139
+ ["src.functions.render"] = function(...)
45182
45140
  local ____exports = {}
45183
- local ____entities = require("src.functions.entities")
45184
- local getEntityID = ____entities.getEntityID
45185
- local ____gridEntities = require("src.functions.gridEntities")
45186
- local getGridEntityID = ____gridEntities.getGridEntityID
45187
- local ____utils = require("src.functions.utils")
45188
- local isReflectionRender = ____utils.isReflectionRender
45189
- function ____exports.defaultEntityDisplayCallback(self, entity)
45190
- return getEntityID(nil, entity)
45141
+ local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
45142
+ local RenderMode = ____isaac_2Dtypescript_2Ddefinitions.RenderMode
45143
+ local ____cachedClasses = require("src.core.cachedClasses")
45144
+ local game = ____cachedClasses.game
45145
+ function ____exports.isReflectionRender(self)
45146
+ local room = game:GetRoom()
45147
+ local renderMode = room:GetRenderMode()
45148
+ return renderMode == RenderMode.WATER_REFLECT
45191
45149
  end
45192
- function ____exports.defaultGridEntityDisplayCallback(self, gridEntity)
45193
- return getGridEntityID(nil, gridEntity)
45150
+ function ____exports.renderScaledTextOnEntity(self, entity, text, scaleX, scaleY)
45151
+ if ____exports.isReflectionRender(nil) then
45152
+ return
45153
+ end
45154
+ local position = Isaac.WorldToScreen(entity.Position)
45155
+ Isaac.RenderScaledText(
45156
+ text,
45157
+ position.X,
45158
+ position.Y,
45159
+ scaleX,
45160
+ scaleY,
45161
+ 1,
45162
+ 1,
45163
+ 1,
45164
+ 1
45165
+ )
45194
45166
  end
45195
45167
  function ____exports.renderTextOnEntity(self, entity, text)
45196
- if isReflectionRender(nil) then
45168
+ if ____exports.isReflectionRender(nil) then
45197
45169
  return
45198
45170
  end
45199
45171
  local position = Isaac.WorldToScreen(entity.Position)
@@ -45207,6 +45179,20 @@ function ____exports.renderTextOnEntity(self, entity, text)
45207
45179
  1
45208
45180
  )
45209
45181
  end
45182
+ return ____exports
45183
+ end,
45184
+ ["src.classes.features.other.debugDisplay.utils"] = function(...)
45185
+ local ____exports = {}
45186
+ local ____entities = require("src.functions.entities")
45187
+ local getEntityID = ____entities.getEntityID
45188
+ local ____gridEntities = require("src.functions.gridEntities")
45189
+ local getGridEntityID = ____gridEntities.getGridEntityID
45190
+ function ____exports.defaultEntityDisplayCallback(self, entity)
45191
+ return getEntityID(nil, entity)
45192
+ end
45193
+ function ____exports.defaultGridEntityDisplayCallback(self, gridEntity)
45194
+ return getGridEntityID(nil, gridEntity)
45195
+ end
45210
45196
  return ____exports
45211
45197
  end,
45212
45198
  ["src.classes.features.other.debugDisplay.DebugDisplayBomb"] = function(...)
@@ -45216,11 +45202,12 @@ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
45216
45202
  local ____exports = {}
45217
45203
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
45218
45204
  local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
45205
+ local ____render = require("src.functions.render")
45206
+ local renderTextOnEntity = ____render.renderTextOnEntity
45219
45207
  local ____Feature = require("src.classes.private.Feature")
45220
45208
  local Feature = ____Feature.Feature
45221
45209
  local ____utils = require("src.classes.features.other.debugDisplay.utils")
45222
45210
  local defaultEntityDisplayCallback = ____utils.defaultEntityDisplayCallback
45223
- local renderTextOnEntity = ____utils.renderTextOnEntity
45224
45211
  ____exports.DebugDisplayBomb = __TS__Class()
45225
45212
  local DebugDisplayBomb = ____exports.DebugDisplayBomb
45226
45213
  DebugDisplayBomb.name = "DebugDisplayBomb"
@@ -45243,11 +45230,12 @@ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
45243
45230
  local ____exports = {}
45244
45231
  local ____ModCallbackCustom = require("src.enums.ModCallbackCustom")
45245
45232
  local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
45233
+ local ____render = require("src.functions.render")
45234
+ local renderTextOnEntity = ____render.renderTextOnEntity
45246
45235
  local ____Feature = require("src.classes.private.Feature")
45247
45236
  local Feature = ____Feature.Feature
45248
45237
  local ____utils = require("src.classes.features.other.debugDisplay.utils")
45249
45238
  local defaultGridEntityDisplayCallback = ____utils.defaultGridEntityDisplayCallback
45250
- local renderTextOnEntity = ____utils.renderTextOnEntity
45251
45239
  ____exports.DebugDisplayDoor = __TS__Class()
45252
45240
  local DebugDisplayDoor = ____exports.DebugDisplayDoor
45253
45241
  DebugDisplayDoor.name = "DebugDisplayDoor"
@@ -45270,11 +45258,12 @@ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
45270
45258
  local ____exports = {}
45271
45259
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
45272
45260
  local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
45261
+ local ____render = require("src.functions.render")
45262
+ local renderTextOnEntity = ____render.renderTextOnEntity
45273
45263
  local ____Feature = require("src.classes.private.Feature")
45274
45264
  local Feature = ____Feature.Feature
45275
45265
  local ____utils = require("src.classes.features.other.debugDisplay.utils")
45276
45266
  local defaultEntityDisplayCallback = ____utils.defaultEntityDisplayCallback
45277
- local renderTextOnEntity = ____utils.renderTextOnEntity
45278
45267
  ____exports.DebugDisplayEffect = __TS__Class()
45279
45268
  local DebugDisplayEffect = ____exports.DebugDisplayEffect
45280
45269
  DebugDisplayEffect.name = "DebugDisplayEffect"
@@ -45297,11 +45286,12 @@ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
45297
45286
  local ____exports = {}
45298
45287
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
45299
45288
  local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
45289
+ local ____render = require("src.functions.render")
45290
+ local renderTextOnEntity = ____render.renderTextOnEntity
45300
45291
  local ____Feature = require("src.classes.private.Feature")
45301
45292
  local Feature = ____Feature.Feature
45302
45293
  local ____utils = require("src.classes.features.other.debugDisplay.utils")
45303
45294
  local defaultEntityDisplayCallback = ____utils.defaultEntityDisplayCallback
45304
- local renderTextOnEntity = ____utils.renderTextOnEntity
45305
45295
  ____exports.DebugDisplayFamiliar = __TS__Class()
45306
45296
  local DebugDisplayFamiliar = ____exports.DebugDisplayFamiliar
45307
45297
  DebugDisplayFamiliar.name = "DebugDisplayFamiliar"
@@ -45324,11 +45314,12 @@ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
45324
45314
  local ____exports = {}
45325
45315
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
45326
45316
  local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
45317
+ local ____render = require("src.functions.render")
45318
+ local renderTextOnEntity = ____render.renderTextOnEntity
45327
45319
  local ____Feature = require("src.classes.private.Feature")
45328
45320
  local Feature = ____Feature.Feature
45329
45321
  local ____utils = require("src.classes.features.other.debugDisplay.utils")
45330
45322
  local defaultEntityDisplayCallback = ____utils.defaultEntityDisplayCallback
45331
- local renderTextOnEntity = ____utils.renderTextOnEntity
45332
45323
  ____exports.DebugDisplayKnife = __TS__Class()
45333
45324
  local DebugDisplayKnife = ____exports.DebugDisplayKnife
45334
45325
  DebugDisplayKnife.name = "DebugDisplayKnife"
@@ -45351,11 +45342,12 @@ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
45351
45342
  local ____exports = {}
45352
45343
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
45353
45344
  local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
45345
+ local ____render = require("src.functions.render")
45346
+ local renderTextOnEntity = ____render.renderTextOnEntity
45354
45347
  local ____Feature = require("src.classes.private.Feature")
45355
45348
  local Feature = ____Feature.Feature
45356
45349
  local ____utils = require("src.classes.features.other.debugDisplay.utils")
45357
45350
  local defaultEntityDisplayCallback = ____utils.defaultEntityDisplayCallback
45358
- local renderTextOnEntity = ____utils.renderTextOnEntity
45359
45351
  ____exports.DebugDisplayLaser = __TS__Class()
45360
45352
  local DebugDisplayLaser = ____exports.DebugDisplayLaser
45361
45353
  DebugDisplayLaser.name = "DebugDisplayLaser"
@@ -45378,11 +45370,12 @@ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
45378
45370
  local ____exports = {}
45379
45371
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
45380
45372
  local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
45373
+ local ____render = require("src.functions.render")
45374
+ local renderTextOnEntity = ____render.renderTextOnEntity
45381
45375
  local ____Feature = require("src.classes.private.Feature")
45382
45376
  local Feature = ____Feature.Feature
45383
45377
  local ____utils = require("src.classes.features.other.debugDisplay.utils")
45384
45378
  local defaultEntityDisplayCallback = ____utils.defaultEntityDisplayCallback
45385
- local renderTextOnEntity = ____utils.renderTextOnEntity
45386
45379
  ____exports.DebugDisplayNPC = __TS__Class()
45387
45380
  local DebugDisplayNPC = ____exports.DebugDisplayNPC
45388
45381
  DebugDisplayNPC.name = "DebugDisplayNPC"
@@ -45405,11 +45398,12 @@ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
45405
45398
  local ____exports = {}
45406
45399
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
45407
45400
  local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
45401
+ local ____render = require("src.functions.render")
45402
+ local renderTextOnEntity = ____render.renderTextOnEntity
45408
45403
  local ____Feature = require("src.classes.private.Feature")
45409
45404
  local Feature = ____Feature.Feature
45410
45405
  local ____utils = require("src.classes.features.other.debugDisplay.utils")
45411
45406
  local defaultEntityDisplayCallback = ____utils.defaultEntityDisplayCallback
45412
- local renderTextOnEntity = ____utils.renderTextOnEntity
45413
45407
  ____exports.DebugDisplayPickup = __TS__Class()
45414
45408
  local DebugDisplayPickup = ____exports.DebugDisplayPickup
45415
45409
  DebugDisplayPickup.name = "DebugDisplayPickup"
@@ -45432,11 +45426,12 @@ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
45432
45426
  local ____exports = {}
45433
45427
  local ____ModCallbackCustom = require("src.enums.ModCallbackCustom")
45434
45428
  local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
45429
+ local ____render = require("src.functions.render")
45430
+ local renderTextOnEntity = ____render.renderTextOnEntity
45435
45431
  local ____Feature = require("src.classes.private.Feature")
45436
45432
  local Feature = ____Feature.Feature
45437
45433
  local ____utils = require("src.classes.features.other.debugDisplay.utils")
45438
45434
  local defaultGridEntityDisplayCallback = ____utils.defaultGridEntityDisplayCallback
45439
- local renderTextOnEntity = ____utils.renderTextOnEntity
45440
45435
  ____exports.DebugDisplayPit = __TS__Class()
45441
45436
  local DebugDisplayPit = ____exports.DebugDisplayPit
45442
45437
  DebugDisplayPit.name = "DebugDisplayPit"
@@ -45459,11 +45454,12 @@ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
45459
45454
  local ____exports = {}
45460
45455
  local ____ModCallbackCustom = require("src.enums.ModCallbackCustom")
45461
45456
  local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
45457
+ local ____render = require("src.functions.render")
45458
+ local renderTextOnEntity = ____render.renderTextOnEntity
45462
45459
  local ____Feature = require("src.classes.private.Feature")
45463
45460
  local Feature = ____Feature.Feature
45464
45461
  local ____utils = require("src.classes.features.other.debugDisplay.utils")
45465
45462
  local defaultEntityDisplayCallback = ____utils.defaultEntityDisplayCallback
45466
- local renderTextOnEntity = ____utils.renderTextOnEntity
45467
45463
  ____exports.DebugDisplayPlayer = __TS__Class()
45468
45464
  local DebugDisplayPlayer = ____exports.DebugDisplayPlayer
45469
45465
  DebugDisplayPlayer.name = "DebugDisplayPlayer"
@@ -45486,11 +45482,12 @@ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
45486
45482
  local ____exports = {}
45487
45483
  local ____ModCallbackCustom = require("src.enums.ModCallbackCustom")
45488
45484
  local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
45485
+ local ____render = require("src.functions.render")
45486
+ local renderTextOnEntity = ____render.renderTextOnEntity
45489
45487
  local ____Feature = require("src.classes.private.Feature")
45490
45488
  local Feature = ____Feature.Feature
45491
45489
  local ____utils = require("src.classes.features.other.debugDisplay.utils")
45492
45490
  local defaultGridEntityDisplayCallback = ____utils.defaultGridEntityDisplayCallback
45493
- local renderTextOnEntity = ____utils.renderTextOnEntity
45494
45491
  ____exports.DebugDisplayPoop = __TS__Class()
45495
45492
  local DebugDisplayPoop = ____exports.DebugDisplayPoop
45496
45493
  DebugDisplayPoop.name = "DebugDisplayPoop"
@@ -45513,11 +45510,12 @@ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
45513
45510
  local ____exports = {}
45514
45511
  local ____ModCallbackCustom = require("src.enums.ModCallbackCustom")
45515
45512
  local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
45513
+ local ____render = require("src.functions.render")
45514
+ local renderTextOnEntity = ____render.renderTextOnEntity
45516
45515
  local ____Feature = require("src.classes.private.Feature")
45517
45516
  local Feature = ____Feature.Feature
45518
45517
  local ____utils = require("src.classes.features.other.debugDisplay.utils")
45519
45518
  local defaultGridEntityDisplayCallback = ____utils.defaultGridEntityDisplayCallback
45520
- local renderTextOnEntity = ____utils.renderTextOnEntity
45521
45519
  ____exports.DebugDisplayPressurePlate = __TS__Class()
45522
45520
  local DebugDisplayPressurePlate = ____exports.DebugDisplayPressurePlate
45523
45521
  DebugDisplayPressurePlate.name = "DebugDisplayPressurePlate"
@@ -45540,11 +45538,12 @@ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
45540
45538
  local ____exports = {}
45541
45539
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
45542
45540
  local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
45541
+ local ____render = require("src.functions.render")
45542
+ local renderTextOnEntity = ____render.renderTextOnEntity
45543
45543
  local ____Feature = require("src.classes.private.Feature")
45544
45544
  local Feature = ____Feature.Feature
45545
45545
  local ____utils = require("src.classes.features.other.debugDisplay.utils")
45546
45546
  local defaultEntityDisplayCallback = ____utils.defaultEntityDisplayCallback
45547
- local renderTextOnEntity = ____utils.renderTextOnEntity
45548
45547
  ____exports.DebugDisplayProjectile = __TS__Class()
45549
45548
  local DebugDisplayProjectile = ____exports.DebugDisplayProjectile
45550
45549
  DebugDisplayProjectile.name = "DebugDisplayProjectile"
@@ -45567,11 +45566,12 @@ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
45567
45566
  local ____exports = {}
45568
45567
  local ____ModCallbackCustom = require("src.enums.ModCallbackCustom")
45569
45568
  local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
45569
+ local ____render = require("src.functions.render")
45570
+ local renderTextOnEntity = ____render.renderTextOnEntity
45570
45571
  local ____Feature = require("src.classes.private.Feature")
45571
45572
  local Feature = ____Feature.Feature
45572
45573
  local ____utils = require("src.classes.features.other.debugDisplay.utils")
45573
45574
  local defaultGridEntityDisplayCallback = ____utils.defaultGridEntityDisplayCallback
45574
- local renderTextOnEntity = ____utils.renderTextOnEntity
45575
45575
  ____exports.DebugDisplayRock = __TS__Class()
45576
45576
  local DebugDisplayRock = ____exports.DebugDisplayRock
45577
45577
  DebugDisplayRock.name = "DebugDisplayRock"
@@ -45594,11 +45594,12 @@ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
45594
45594
  local ____exports = {}
45595
45595
  local ____ModCallbackCustom = require("src.enums.ModCallbackCustom")
45596
45596
  local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
45597
+ local ____render = require("src.functions.render")
45598
+ local renderTextOnEntity = ____render.renderTextOnEntity
45597
45599
  local ____Feature = require("src.classes.private.Feature")
45598
45600
  local Feature = ____Feature.Feature
45599
45601
  local ____utils = require("src.classes.features.other.debugDisplay.utils")
45600
45602
  local defaultEntityDisplayCallback = ____utils.defaultEntityDisplayCallback
45601
- local renderTextOnEntity = ____utils.renderTextOnEntity
45602
45603
  ____exports.DebugDisplaySlot = __TS__Class()
45603
45604
  local DebugDisplaySlot = ____exports.DebugDisplaySlot
45604
45605
  DebugDisplaySlot.name = "DebugDisplaySlot"
@@ -45621,11 +45622,12 @@ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
45621
45622
  local ____exports = {}
45622
45623
  local ____ModCallbackCustom = require("src.enums.ModCallbackCustom")
45623
45624
  local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
45625
+ local ____render = require("src.functions.render")
45626
+ local renderTextOnEntity = ____render.renderTextOnEntity
45624
45627
  local ____Feature = require("src.classes.private.Feature")
45625
45628
  local Feature = ____Feature.Feature
45626
45629
  local ____utils = require("src.classes.features.other.debugDisplay.utils")
45627
45630
  local defaultGridEntityDisplayCallback = ____utils.defaultGridEntityDisplayCallback
45628
- local renderTextOnEntity = ____utils.renderTextOnEntity
45629
45631
  ____exports.DebugDisplaySpikes = __TS__Class()
45630
45632
  local DebugDisplaySpikes = ____exports.DebugDisplaySpikes
45631
45633
  DebugDisplaySpikes.name = "DebugDisplaySpikes"
@@ -45648,11 +45650,12 @@ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
45648
45650
  local ____exports = {}
45649
45651
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
45650
45652
  local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
45653
+ local ____render = require("src.functions.render")
45654
+ local renderTextOnEntity = ____render.renderTextOnEntity
45651
45655
  local ____Feature = require("src.classes.private.Feature")
45652
45656
  local Feature = ____Feature.Feature
45653
45657
  local ____utils = require("src.classes.features.other.debugDisplay.utils")
45654
45658
  local defaultEntityDisplayCallback = ____utils.defaultEntityDisplayCallback
45655
- local renderTextOnEntity = ____utils.renderTextOnEntity
45656
45659
  ____exports.DebugDisplayTear = __TS__Class()
45657
45660
  local DebugDisplayTear = ____exports.DebugDisplayTear
45658
45661
  DebugDisplayTear.name = "DebugDisplayTear"
@@ -45675,11 +45678,12 @@ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
45675
45678
  local ____exports = {}
45676
45679
  local ____ModCallbackCustom = require("src.enums.ModCallbackCustom")
45677
45680
  local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
45681
+ local ____render = require("src.functions.render")
45682
+ local renderTextOnEntity = ____render.renderTextOnEntity
45678
45683
  local ____Feature = require("src.classes.private.Feature")
45679
45684
  local Feature = ____Feature.Feature
45680
45685
  local ____utils = require("src.classes.features.other.debugDisplay.utils")
45681
45686
  local defaultGridEntityDisplayCallback = ____utils.defaultGridEntityDisplayCallback
45682
- local renderTextOnEntity = ____utils.renderTextOnEntity
45683
45687
  ____exports.DebugDisplayTNT = __TS__Class()
45684
45688
  local DebugDisplayTNT = ____exports.DebugDisplayTNT
45685
45689
  DebugDisplayTNT.name = "DebugDisplayTNT"
@@ -45985,6 +45989,8 @@ local isLRoomShape = ____roomShape.isLRoomShape
45985
45989
  local ____rooms = require("src.functions.rooms")
45986
45990
  local inBossRoomOf = ____rooms.inBossRoomOf
45987
45991
  local inHomeCloset = ____rooms.inHomeCloset
45992
+ local ____utils = require("src.functions.utils")
45993
+ local assertDefined = ____utils.assertDefined
45988
45994
  function getVanillaWallGridIndexSetForRoomShape(self, roomShape)
45989
45995
  local corners = getRoomShapeCorners(nil, roomShape)
45990
45996
  local lRoom = isLRoomShape(nil, roomShape)
@@ -46216,9 +46222,11 @@ function ____exports.isVanillaWallGridIndex(self, gridIndex)
46216
46222
  wallGridIndexSet = MOTHER_ROOM_CORNERS_SET
46217
46223
  else
46218
46224
  wallGridIndexSet = ROOM_SHAPE_TO_WALL_GRID_INDEX_SET:get(roomShape)
46219
- end
46220
- if wallGridIndexSet == nil then
46221
- error(((("Failed to find the wall grid index set for: RoomShape." .. RoomShape[roomShape]) .. " (") .. tostring(roomShape)) .. ")")
46225
+ assertDefined(
46226
+ nil,
46227
+ wallGridIndexSet,
46228
+ ((("Failed to find the wall grid index set for: RoomShape." .. RoomShape[roomShape]) .. " (") .. tostring(roomShape)) .. ")"
46229
+ )
46222
46230
  end
46223
46231
  return wallGridIndexSet:has(gridIndex)
46224
46232
  end
@@ -46314,11 +46322,14 @@ local ____exports = {}
46314
46322
  local getTotalWeightOfJSONObject, getJSONObjectWithChosenWeight
46315
46323
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
46316
46324
  local DoorSlotFlagZero = ____isaac_2Dtypescript_2Ddefinitions.DoorSlotFlagZero
46325
+ local RoomShape = ____isaac_2Dtypescript_2Ddefinitions.RoomShape
46317
46326
  local ____array = require("src.functions.array")
46318
46327
  local sumArray = ____array.sumArray
46319
46328
  local ____doors = require("src.functions.doors")
46320
46329
  local doorSlotToDoorSlotFlag = ____doors.doorSlotToDoorSlotFlag
46321
46330
  local getRoomShapeDoorSlot = ____doors.getRoomShapeDoorSlot
46331
+ local ____enums = require("src.functions.enums")
46332
+ local isEnumValue = ____enums.isEnumValue
46322
46333
  local ____flag = require("src.functions.flag")
46323
46334
  local addFlag = ____flag.addFlag
46324
46335
  local ____log = require("src.functions.log")
@@ -46327,15 +46338,19 @@ local ____random = require("src.functions.random")
46327
46338
  local getRandomFloat = ____random.getRandomFloat
46328
46339
  local ____rng = require("src.functions.rng")
46329
46340
  local getRandomSeed = ____rng.getRandomSeed
46341
+ local ____utils = require("src.functions.utils")
46342
+ local assertDefined = ____utils.assertDefined
46330
46343
  function getTotalWeightOfJSONObject(self, jsonOjectArray)
46331
46344
  local weights = __TS__ArrayMap(
46332
46345
  jsonOjectArray,
46333
46346
  function(____, jsonObject)
46334
46347
  local weightString = jsonObject["$"].weight
46335
46348
  local weight = tonumber(weightString)
46336
- if weight == nil then
46337
- error(("Failed to parse the weight of a JSON object: " .. tostring(weightString)) .. ".")
46338
- end
46349
+ assertDefined(
46350
+ nil,
46351
+ weight,
46352
+ ("Failed to parse the weight of a JSON object: " .. tostring(weightString)) .. "."
46353
+ )
46339
46354
  return weight
46340
46355
  end
46341
46356
  )
@@ -46346,9 +46361,11 @@ function getJSONObjectWithChosenWeight(self, jsonOjectArray, chosenWeight)
46346
46361
  for ____, jsonObject in ipairs(jsonOjectArray) do
46347
46362
  local weightString = jsonObject["$"].weight
46348
46363
  local weight = tonumber(weightString)
46349
- if weight == nil then
46350
- error("Failed to parse the weight of a JSON object: " .. tostring(weightString))
46351
- end
46364
+ assertDefined(
46365
+ nil,
46366
+ weight,
46367
+ "Failed to parse the weight of a JSON object: " .. tostring(weightString)
46368
+ )
46352
46369
  weightAccumulator = weightAccumulator + weight
46353
46370
  if weightAccumulator >= chosenWeight then
46354
46371
  return jsonObject
@@ -46359,8 +46376,9 @@ end
46359
46376
  function ____exports.getJSONRoomDoorSlotFlags(self, jsonRoom)
46360
46377
  local roomShapeString = jsonRoom["$"].shape
46361
46378
  local roomShapeNumber = tonumber(roomShapeString)
46362
- if roomShapeNumber == nil then
46363
- error("Failed to parse the \"shape\" field of a JSON room: " .. roomShapeString)
46379
+ assertDefined(nil, roomShapeNumber, "Failed to parse the \"shape\" field of a JSON room: " .. roomShapeString)
46380
+ if not isEnumValue(nil, roomShapeNumber, RoomShape) then
46381
+ error("Failed to parse the \"shape\" field of a JSON room since it was an invalid number: " .. tostring(roomShapeNumber))
46364
46382
  end
46365
46383
  local roomShape = roomShapeNumber
46366
46384
  local doorSlotFlags = DoorSlotFlagZero
@@ -46375,18 +46393,16 @@ function ____exports.getJSONRoomDoorSlotFlags(self, jsonRoom)
46375
46393
  end
46376
46394
  local xString = door["$"].x
46377
46395
  local x = tonumber(xString)
46378
- if x == nil then
46379
- error("Failed to parse the \"x\" field of a JSON room door: " .. xString)
46380
- end
46396
+ assertDefined(nil, x, "Failed to parse the \"x\" field of a JSON room door: " .. xString)
46381
46397
  local yString = door["$"].y
46382
46398
  local y = tonumber(yString)
46383
- if y == nil then
46384
- error("Failed to parse the \"y\" field of a JSON room door: " .. yString)
46385
- end
46399
+ assertDefined(nil, y, "Failed to parse the \"y\" field of a JSON room door: " .. yString)
46386
46400
  local doorSlot = getRoomShapeDoorSlot(nil, roomShape, x, y)
46387
- if doorSlot == nil then
46388
- error(((("Failed to retrieve the door slot for a JSON room door at coordinates: [" .. tostring(x)) .. ", ") .. tostring(y)) .. "]")
46389
- end
46401
+ assertDefined(
46402
+ nil,
46403
+ doorSlot,
46404
+ ((("Failed to retrieve the door slot for a JSON room door at coordinates: [" .. tostring(x)) .. ", ") .. tostring(y)) .. "]"
46405
+ )
46390
46406
  local doorSlotFlag = doorSlotToDoorSlotFlag(nil, doorSlot)
46391
46407
  doorSlotFlags = addFlag(nil, doorSlotFlags, doorSlotFlag)
46392
46408
  end
@@ -46437,9 +46453,11 @@ function ____exports.getRandomJSONEntity(self, jsonEntities, seedOrRNG, verbose)
46437
46453
  log("Randomly chose weight for JSON entity: " .. tostring(chosenWeight))
46438
46454
  end
46439
46455
  local randomJSONEntity = getJSONObjectWithChosenWeight(nil, jsonEntities, chosenWeight)
46440
- if randomJSONEntity == nil then
46441
- error("Failed to get a JSON entity with chosen weight: " .. tostring(chosenWeight))
46442
- end
46456
+ assertDefined(
46457
+ nil,
46458
+ randomJSONEntity,
46459
+ "Failed to get a JSON entity with chosen weight: " .. tostring(chosenWeight)
46460
+ )
46443
46461
  return randomJSONEntity
46444
46462
  end
46445
46463
  function ____exports.getRandomJSONRoom(self, jsonRooms, seedOrRNG, verbose)
@@ -46458,9 +46476,11 @@ function ____exports.getRandomJSONRoom(self, jsonRooms, seedOrRNG, verbose)
46458
46476
  log("Randomly chose weight for JSON room: " .. tostring(chosenWeight))
46459
46477
  end
46460
46478
  local randomJSONRoom = getJSONObjectWithChosenWeight(nil, jsonRooms, chosenWeight)
46461
- if randomJSONRoom == nil then
46462
- error("Failed to get a JSON room with chosen weight: " .. tostring(chosenWeight))
46463
- end
46479
+ assertDefined(
46480
+ nil,
46481
+ randomJSONRoom,
46482
+ "Failed to get a JSON room with chosen weight: " .. tostring(chosenWeight)
46483
+ )
46464
46484
  return randomJSONRoom
46465
46485
  end
46466
46486
  return ____exports
@@ -47000,6 +47020,8 @@ local setRoomUncleared = ____rooms.setRoomUncleared
47000
47020
  local ____types = require("src.functions.types")
47001
47021
  local asCollectibleType = ____types.asCollectibleType
47002
47022
  local asNumber = ____types.asNumber
47023
+ local ____utils = require("src.functions.utils")
47024
+ local assertDefined = ____utils.assertDefined
47003
47025
  local ____ReadonlySet = require("src.types.ReadonlySet")
47004
47026
  local ReadonlySet = ____ReadonlySet.ReadonlySet
47005
47027
  local ____Feature = require("src.classes.private.Feature")
@@ -47153,30 +47175,28 @@ function DeployJSONRoom.prototype.spawnAllEntities(self, jsonRoom, rng, verbose)
47153
47175
  for ____, jsonSpawn in ipairs(jsonRoom.spawn) do
47154
47176
  local xString = jsonSpawn["$"].x
47155
47177
  local x = tonumber(xString)
47156
- if x == nil then
47157
- error("Failed to convert the following x coordinate to a number (for a spawn): " .. xString)
47158
- end
47178
+ assertDefined(nil, x, "Failed to convert the following x coordinate to a number (for a spawn): " .. xString)
47159
47179
  local yString = jsonSpawn["$"].y
47160
47180
  local y = tonumber(yString)
47161
- if y == nil then
47162
- error("Failed to convert the following y coordinate to a number (for a spawn): " .. yString)
47163
- end
47181
+ assertDefined(nil, y, "Failed to convert the following y coordinate to a number (for a spawn): " .. yString)
47164
47182
  local jsonEntity = getRandomJSONEntity(nil, jsonSpawn.entity)
47165
47183
  local entityTypeString = jsonEntity["$"].type
47166
47184
  local entityTypeNumber = tonumber(entityTypeString)
47167
- if entityTypeNumber == nil then
47168
- error("Failed to convert the entity type to a number: " .. entityTypeString)
47169
- end
47185
+ assertDefined(nil, entityTypeNumber, "Failed to convert the entity type to a number: " .. entityTypeString)
47170
47186
  local variantString = jsonEntity["$"].variant
47171
47187
  local variant = tonumber(variantString)
47172
- if variant == nil then
47173
- error("Failed to convert the entity variant to a number: " .. tostring(variant))
47174
- end
47188
+ assertDefined(
47189
+ nil,
47190
+ variant,
47191
+ "Failed to convert the entity variant to a number: " .. tostring(variant)
47192
+ )
47175
47193
  local subTypeString = jsonEntity["$"].subtype
47176
47194
  local subType = tonumber(subTypeString)
47177
- if subType == nil then
47178
- error("Failed to convert the entity sub-type to a number: " .. tostring(subType))
47179
- end
47195
+ assertDefined(
47196
+ nil,
47197
+ subType,
47198
+ "Failed to convert the entity sub-type to a number: " .. tostring(subType)
47199
+ )
47180
47200
  local isGridEntity = GRID_ENTITY_XML_TYPE_SET:has(entityTypeNumber)
47181
47201
  if isGridEntity then
47182
47202
  local gridEntityXMLType = entityTypeNumber
@@ -52116,6 +52136,8 @@ local log = ____log.log
52116
52136
  local ____tstlClass = require("src.functions.tstlClass")
52117
52137
  local getTSTLClassConstructor = ____tstlClass.getTSTLClassConstructor
52118
52138
  local getTSTLClassName = ____tstlClass.getTSTLClassName
52139
+ local ____utils = require("src.functions.utils")
52140
+ local assertDefined = ____utils.assertDefined
52119
52141
  function getExportedMethodsFromFeature(self, featureClass)
52120
52142
  local constructor = getTSTLClassConstructor(nil, featureClass)
52121
52143
  local exportedMethodNames = constructor[EXPORTED_METHOD_NAMES_KEY]
@@ -52223,9 +52245,7 @@ function ModUpgraded.prototype.logUsedFeatures(self)
52223
52245
  goto __continue19
52224
52246
  end
52225
52247
  local modCallbackCustom = tonumber(modCallbackCustomString)
52226
- if modCallbackCustom == nil then
52227
- error("Failed to convert an index on the callbacks object to a number.")
52228
- end
52248
+ assertDefined(nil, modCallbackCustom, "Failed to convert an index on the callbacks object to a number.")
52229
52249
  log(((("- ModCallbackCustom." .. tostring(ModCallbackCustom[modCallbackCustom])) .. " (") .. tostring(modCallbackCustom)) .. ")")
52230
52250
  end
52231
52251
  ::__continue19::
@@ -52235,15 +52255,13 @@ function ModUpgraded.prototype.logUsedFeatures(self)
52235
52255
  local featureClass = ____value[2]
52236
52256
  do
52237
52257
  if featureClass.numConsumers == 0 then
52238
- goto __continue23
52258
+ goto __continue22
52239
52259
  end
52240
52260
  local iscFeature = tonumber(iscFeatureString)
52241
- if iscFeature == nil then
52242
- error("Failed to convert an index on the features object to a number.")
52243
- end
52261
+ assertDefined(nil, iscFeature, "Failed to convert an index on the features object to a number.")
52244
52262
  log(((("- ISCFeature." .. tostring(ISCFeature[iscFeature])) .. " (") .. tostring(iscFeature)) .. ")")
52245
52263
  end
52246
- ::__continue23::
52264
+ ::__continue22::
52247
52265
  end
52248
52266
  end
52249
52267
  function ModUpgraded.prototype.initFeature(self, feature)
@@ -52290,9 +52308,7 @@ function ModUpgraded.prototype.initFeature(self, feature)
52290
52308
  end
52291
52309
  if feature.v ~= nil then
52292
52310
  local className = getTSTLClassName(nil, feature)
52293
- if className == nil then
52294
- error("Failed to get the name of a feature.")
52295
- end
52311
+ assertDefined(nil, className, "Failed to get the name of a feature.")
52296
52312
  local saveDataManagerClass = self.features[ISCFeature.SAVE_DATA_MANAGER]
52297
52313
  saveDataManagerClass:saveDataManager(className, feature.v, feature.vConditionalFunc)
52298
52314
  end
@@ -52331,9 +52347,7 @@ function ModUpgraded.prototype.uninitFeature(self, feature)
52331
52347
  end
52332
52348
  if feature.v ~= nil then
52333
52349
  local className = getTSTLClassName(nil, feature)
52334
- if className == nil then
52335
- error("Failed to get the name of a feature.")
52336
- end
52350
+ assertDefined(nil, className, "Failed to get the name of a feature.")
52337
52351
  local saveDataManagerClass = self.features[ISCFeature.SAVE_DATA_MANAGER]
52338
52352
  saveDataManagerClass:saveDataManagerRemove(className)
52339
52353
  end
@@ -52361,6 +52375,8 @@ local ____types = require("src.functions.types")
52361
52375
  local isFunction = ____types.isFunction
52362
52376
  local isNumber = ____types.isNumber
52363
52377
  local isTable = ____types.isTable
52378
+ local ____utils = require("src.functions.utils")
52379
+ local assertDefined = ____utils.assertDefined
52364
52380
  function initDecoratedCallbacks(self, modFeature, constructor, tstlClassName, vanilla, init)
52365
52381
  local modFeatureConstructor = constructor
52366
52382
  local callbackTuplesKey = vanilla and ____exports.MOD_FEATURE_CALLBACKS_KEY or ____exports.MOD_FEATURE_CUSTOM_CALLBACKS_KEY
@@ -52491,9 +52507,7 @@ function initSaveDataManager(self, modFeature, tstlClassName, init)
52491
52507
  local mod = modFeature.mod
52492
52508
  local saveDataManagerMethodName = init and "saveDataManager" or "saveDataManagerRemove"
52493
52509
  local saveDataManagerMethod = mod[saveDataManagerMethodName]
52494
- if saveDataManagerMethod == nil then
52495
- error("Failed to initialize a mod feature class due to having a \"v\" object and not having the save data manager initialized. You must pass \"ISCFeature.SAVE_DATA_MANAGER\" to the \"upgradeMod\" function.")
52496
- end
52510
+ assertDefined(nil, saveDataManagerMethod, "Failed to initialize a mod feature class due to having a \"v\" object and not having the save data manager initialized. You must pass \"ISCFeature.SAVE_DATA_MANAGER\" to the \"upgradeMod\" function.")
52497
52511
  if type(saveDataManagerMethod) ~= "function" then
52498
52512
  error(("The \"" .. saveDataManagerMethodName) .. "\" property of the \"ModUpgraded\" object was not a function.")
52499
52513
  end
@@ -52530,13 +52544,9 @@ function ModFeature.prototype.init(self, init)
52530
52544
  end
52531
52545
  self.initialized = init
52532
52546
  local constructor = getTSTLClassConstructor(nil, self)
52533
- if constructor == nil then
52534
- error("Failed to get the TSTL class constructor for a mod feature.")
52535
- end
52547
+ assertDefined(nil, constructor, "Failed to get the TSTL class constructor for a mod feature.")
52536
52548
  local tstlClassName = getTSTLClassName(nil, self)
52537
- if tstlClassName == nil then
52538
- error("Failed to get the TSTL class name for a mod feature.")
52539
- end
52549
+ assertDefined(nil, tstlClassName, "Failed to get the TSTL class name for a mod feature.")
52540
52550
  initDecoratedCallbacks(
52541
52551
  nil,
52542
52552
  self,
@@ -53427,6 +53437,8 @@ local getRoomDescriptor = ____roomData.getRoomDescriptor
53427
53437
  local getRoomGridIndex = ____roomData.getRoomGridIndex
53428
53438
  local ____rooms = require("src.functions.rooms")
53429
53439
  local getRoomsInsideGrid = ____rooms.getRoomsInsideGrid
53440
+ local ____utils = require("src.functions.utils")
53441
+ local assertDefined = ____utils.assertDefined
53430
53442
  function ____exports.getRoomDisplayFlags(self, roomGridIndex, minimapAPI)
53431
53443
  if minimapAPI == nil then
53432
53444
  minimapAPI = true
@@ -53439,9 +53451,11 @@ function ____exports.getRoomDisplayFlags(self, roomGridIndex, minimapAPI)
53439
53451
  return roomDescriptor.DisplayFlags
53440
53452
  end
53441
53453
  local minimapAPIRoomDescriptor = MinimapAPI:GetRoomByIdx(roomGridIndex)
53442
- if minimapAPIRoomDescriptor == nil then
53443
- error("Failed to get the MinimapAPI room descriptor for the room at grid index: " .. tostring(roomGridIndex))
53444
- end
53454
+ assertDefined(
53455
+ nil,
53456
+ minimapAPIRoomDescriptor,
53457
+ "Failed to get the MinimapAPI room descriptor for the room at grid index: " .. tostring(roomGridIndex)
53458
+ )
53445
53459
  return minimapAPIRoomDescriptor:GetDisplayFlags()
53446
53460
  end
53447
53461
  function ____exports.setAllDisplayFlags(self, displayFlags)
@@ -53469,9 +53483,11 @@ function ____exports.setRoomDisplayFlags(self, roomGridIndex, displayFlags, upda
53469
53483
  end
53470
53484
  else
53471
53485
  local minimapAPIRoomDescriptor = MinimapAPI:GetRoomByIdx(roomGridIndex)
53472
- if minimapAPIRoomDescriptor == nil then
53473
- error("Failed to get the MinimapAPI room descriptor for the room at grid index: " .. tostring(roomGridIndex))
53474
- end
53486
+ assertDefined(
53487
+ nil,
53488
+ minimapAPIRoomDescriptor,
53489
+ "Failed to get the MinimapAPI room descriptor for the room at grid index: " .. tostring(roomGridIndex)
53490
+ )
53475
53491
  minimapAPIRoomDescriptor:SetDisplayFlags(displayFlags)
53476
53492
  end
53477
53493
  end
@@ -53505,9 +53521,11 @@ function ____exports.hideRoomOnMinimap(self, roomGridIndex)
53505
53521
  ____exports.clearRoomDisplayFlags(nil, roomGridIndex)
53506
53522
  if MinimapAPI ~= nil then
53507
53523
  local minimapAPIRoomDescriptor = MinimapAPI:GetRoomByIdx(roomGridIndex)
53508
- if minimapAPIRoomDescriptor == nil then
53509
- error("Failed to get the MinimapAPI room descriptor for the room at grid index: " .. tostring(roomGridIndex))
53510
- end
53524
+ assertDefined(
53525
+ nil,
53526
+ minimapAPIRoomDescriptor,
53527
+ "Failed to get the MinimapAPI room descriptor for the room at grid index: " .. tostring(roomGridIndex)
53528
+ )
53511
53529
  minimapAPIRoomDescriptor.Hidden = true
53512
53530
  end
53513
53531
  end
@@ -53836,6 +53854,10 @@ return ____exports
53836
53854
  end,
53837
53855
  ["src.types.Decrement"] = function(...)
53838
53856
  local ____exports = {}
53857
+ return ____exports
53858
+ end,
53859
+ ["src.types.Expand"] = function(...)
53860
+ local ____exports = {}
53839
53861
  return ____exports
53840
53862
  end,
53841
53863
  ["src.types.HasFunction"] = function(...)
@@ -54685,6 +54707,14 @@ do
54685
54707
  end
54686
54708
  end
54687
54709
  end
54710
+ do
54711
+ local ____export = require("src.functions.render")
54712
+ for ____exportKey, ____exportValue in pairs(____export) do
54713
+ if ____exportKey ~= "default" then
54714
+ ____exports[____exportKey] = ____exportValue
54715
+ end
54716
+ end
54717
+ end
54688
54718
  do
54689
54719
  local ____export = require("src.functions.revive")
54690
54720
  for ____exportKey, ____exportValue in pairs(____export) do
@@ -55801,6 +55831,14 @@ do
55801
55831
  end
55802
55832
  end
55803
55833
  end
55834
+ do
55835
+ local ____export = require("src.functions.render")
55836
+ for ____exportKey, ____exportValue in pairs(____export) do
55837
+ if ____exportKey ~= "default" then
55838
+ ____exports[____exportKey] = ____exportValue
55839
+ end
55840
+ end
55841
+ end
55804
55842
  do
55805
55843
  local ____export = require("src.functions.revive")
55806
55844
  for ____exportKey, ____exportValue in pairs(____export) do