isaacscript-common 31.5.0 → 31.7.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 (140) hide show
  1. package/dist/index.rollup.d.ts +34 -6
  2. package/dist/isaacscript-common.lua +641 -655
  3. package/dist/src/classes/DefaultMap.d.ts +2 -0
  4. package/dist/src/classes/DefaultMap.d.ts.map +1 -1
  5. package/dist/src/classes/ModFeature.d.ts.map +1 -1
  6. package/dist/src/classes/ModFeature.lua +5 -9
  7. package/dist/src/classes/ModUpgraded.d.ts.map +1 -1
  8. package/dist/src/classes/ModUpgraded.lua +8 -14
  9. package/dist/src/classes/callbacks/PostNewRoomEarly.lua +2 -2
  10. package/dist/src/classes/features/callbackLogic/CustomGridEntities.d.ts.map +1 -1
  11. package/dist/src/classes/features/callbackLogic/CustomGridEntities.lua +3 -3
  12. package/dist/src/classes/features/other/CharacterHealthConversion.lua +1 -1
  13. package/dist/src/classes/features/other/CustomItemPools.d.ts.map +1 -1
  14. package/dist/src/classes/features/other/CustomItemPools.lua +12 -6
  15. package/dist/src/classes/features/other/CustomStages.d.ts.map +1 -1
  16. package/dist/src/classes/features/other/CustomStages.lua +12 -14
  17. package/dist/src/classes/features/other/CustomTrapdoors.d.ts.map +1 -1
  18. package/dist/src/classes/features/other/CustomTrapdoors.lua +6 -8
  19. package/dist/src/classes/features/other/DeployJSONRoom.d.ts.map +1 -1
  20. package/dist/src/classes/features/other/DeployJSONRoom.lua +15 -15
  21. package/dist/src/classes/features/other/DisableInputs.d.ts.map +1 -1
  22. package/dist/src/classes/features/other/DisableInputs.lua +4 -6
  23. package/dist/src/classes/features/other/ModdedElementSets.d.ts.map +1 -1
  24. package/dist/src/classes/features/other/ModdedElementSets.lua +21 -12
  25. package/dist/src/classes/features/other/Pause.d.ts.map +1 -1
  26. package/dist/src/classes/features/other/Pause.lua +4 -6
  27. package/dist/src/classes/features/other/SaveDataManager.d.ts.map +1 -1
  28. package/dist/src/classes/features/other/SaveDataManager.lua +5 -9
  29. package/dist/src/classes/features/other/customStages/backdrop.lua +9 -10
  30. package/dist/src/classes/features/other/saveDataManager/restoreDefaults.lua +1 -1
  31. package/dist/src/functions/array.d.ts +3 -0
  32. package/dist/src/functions/array.d.ts.map +1 -1
  33. package/dist/src/functions/array.lua +9 -3
  34. package/dist/src/functions/bitSet128.d.ts.map +1 -1
  35. package/dist/src/functions/bitSet128.lua +4 -6
  36. package/dist/src/functions/bitwise.d.ts.map +1 -1
  37. package/dist/src/functions/bitwise.lua +7 -3
  38. package/dist/src/functions/color.d.ts.map +1 -1
  39. package/dist/src/functions/color.lua +5 -9
  40. package/dist/src/functions/deepCopy.lua +23 -31
  41. package/dist/src/functions/entities.d.ts.map +1 -1
  42. package/dist/src/functions/entities.lua +20 -18
  43. package/dist/src/functions/entitiesSpecific.d.ts.map +1 -1
  44. package/dist/src/functions/entitiesSpecific.lua +11 -27
  45. package/dist/src/functions/enums.d.ts +6 -4
  46. package/dist/src/functions/enums.d.ts.map +1 -1
  47. package/dist/src/functions/enums.lua +13 -9
  48. package/dist/src/functions/gridEntities.d.ts.map +1 -1
  49. package/dist/src/functions/gridEntities.lua +18 -11
  50. package/dist/src/functions/gridEntitiesSpecific.d.ts.map +1 -1
  51. package/dist/src/functions/gridEntitiesSpecific.lua +16 -28
  52. package/dist/src/functions/input.d.ts +5 -2
  53. package/dist/src/functions/input.d.ts.map +1 -1
  54. package/dist/src/functions/input.lua +25 -18
  55. package/dist/src/functions/jsonRoom.d.ts.map +1 -1
  56. package/dist/src/functions/jsonRoom.lua +35 -23
  57. package/dist/src/functions/kColor.d.ts.map +1 -1
  58. package/dist/src/functions/kColor.lua +6 -12
  59. package/dist/src/functions/map.d.ts.map +1 -1
  60. package/dist/src/functions/map.lua +3 -3
  61. package/dist/src/functions/minimap.d.ts.map +1 -1
  62. package/dist/src/functions/minimap.lua +17 -9
  63. package/dist/src/functions/playerDataStructures.d.ts +2 -0
  64. package/dist/src/functions/playerDataStructures.d.ts.map +1 -1
  65. package/dist/src/functions/playerDataStructures.lua +2 -0
  66. package/dist/src/functions/players.d.ts.map +1 -1
  67. package/dist/src/functions/players.lua +17 -22
  68. package/dist/src/functions/rng.d.ts.map +1 -1
  69. package/dist/src/functions/rng.lua +3 -3
  70. package/dist/src/functions/roomShapeWalls.d.ts.map +1 -1
  71. package/dist/src/functions/roomShapeWalls.lua +7 -3
  72. package/dist/src/functions/roomTransition.d.ts.map +1 -1
  73. package/dist/src/functions/roomTransition.lua +7 -3
  74. package/dist/src/functions/rooms.d.ts.map +1 -1
  75. package/dist/src/functions/rooms.lua +8 -5
  76. package/dist/src/functions/serialization.d.ts.map +1 -1
  77. package/dist/src/functions/serialization.lua +8 -18
  78. package/dist/src/functions/sprites.d.ts +2 -0
  79. package/dist/src/functions/sprites.d.ts.map +1 -1
  80. package/dist/src/functions/sprites.lua +2 -0
  81. package/dist/src/functions/table.d.ts.map +1 -1
  82. package/dist/src/functions/table.lua +6 -12
  83. package/dist/src/functions/tstlClass.d.ts.map +1 -1
  84. package/dist/src/functions/tstlClass.lua +3 -3
  85. package/dist/src/functions/utils.d.ts +9 -0
  86. package/dist/src/functions/utils.d.ts.map +1 -1
  87. package/dist/src/functions/utils.lua +14 -6
  88. package/dist/src/functions/vector.d.ts.map +1 -1
  89. package/dist/src/functions/vector.lua +4 -6
  90. package/dist/src/functions/weighted.d.ts.map +1 -1
  91. package/dist/src/functions/weighted.lua +7 -3
  92. package/dist/src/sets/bossSets.d.ts.map +1 -1
  93. package/dist/src/sets/bossSets.lua +3 -3
  94. package/package.json +2 -2
  95. package/src/classes/DefaultMap.ts +2 -0
  96. package/src/classes/ModFeature.ts +16 -12
  97. package/src/classes/ModUpgraded.ts +19 -16
  98. package/src/classes/callbacks/PostNewRoomEarly.ts +2 -2
  99. package/src/classes/features/callbackLogic/CustomGridEntities.ts +2 -3
  100. package/src/classes/features/other/CharacterHealthConversion.ts +1 -1
  101. package/src/classes/features/other/CustomItemPools.ts +9 -8
  102. package/src/classes/features/other/CustomStages.ts +9 -10
  103. package/src/classes/features/other/CustomTrapdoors.ts +9 -10
  104. package/src/classes/features/other/DeployJSONRoom.ts +21 -21
  105. package/src/classes/features/other/DisableInputs.ts +6 -5
  106. package/src/classes/features/other/ModdedElementSets.ts +18 -21
  107. package/src/classes/features/other/Pause.ts +9 -6
  108. package/src/classes/features/other/SaveDataManager.ts +14 -16
  109. package/src/classes/features/other/customStages/backdrop.ts +5 -6
  110. package/src/classes/features/other/saveDataManager/restoreDefaults.ts +1 -1
  111. package/src/functions/array.ts +8 -6
  112. package/src/functions/bitSet128.ts +9 -10
  113. package/src/functions/bitwise.ts +6 -3
  114. package/src/functions/color.ts +13 -15
  115. package/src/functions/deepCopy.ts +18 -24
  116. package/src/functions/deepCopyTests.ts +5 -6
  117. package/src/functions/entities.ts +22 -20
  118. package/src/functions/entitiesSpecific.ts +10 -27
  119. package/src/functions/enums.ts +29 -17
  120. package/src/functions/gridEntities.ts +14 -16
  121. package/src/functions/gridEntitiesSpecific.ts +15 -28
  122. package/src/functions/input.ts +15 -7
  123. package/src/functions/jsonRoom.ts +39 -27
  124. package/src/functions/kColor.ts +17 -20
  125. package/src/functions/map.ts +5 -5
  126. package/src/functions/minimap.ts +16 -15
  127. package/src/functions/playerDataStructures.ts +2 -0
  128. package/src/functions/players.ts +7 -10
  129. package/src/functions/rng.ts +5 -5
  130. package/src/functions/roomShapeWalls.ts +3 -4
  131. package/src/functions/roomTransition.ts +5 -5
  132. package/src/functions/rooms.ts +5 -6
  133. package/src/functions/serialization.ts +25 -30
  134. package/src/functions/sprites.ts +2 -0
  135. package/src/functions/table.ts +18 -20
  136. package/src/functions/tstlClass.ts +5 -5
  137. package/src/functions/utils.ts +27 -6
  138. package/src/functions/vector.ts +9 -10
  139. package/src/functions/weighted.ts +5 -5
  140. package/src/sets/bossSets.ts +5 -5
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 31.5.0
3
+ isaacscript-common 31.7.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,231 +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 ____ReadonlySet = require("src.types.ReadonlySet")
16571
- local ReadonlySet = ____ReadonlySet.ReadonlySet
16572
- local ____playerIndex = require("src.functions.playerIndex")
16573
- local getAllPlayers = ____playerIndex.getAllPlayers
16574
- local ____types = require("src.functions.types")
16575
- local isFunction = ____types.isFunction
16576
- function ____exports.eRange(self, start, ____end, increment)
16577
- if increment == nil then
16578
- increment = 1
16579
- end
16580
- if ____end == nil then
16581
- return ____exports.eRange(nil, 0, start, increment)
16582
- end
16583
- local array = {}
16584
- if start < ____end then
16585
- do
16586
- local i = start
16587
- while i < ____end do
16588
- array[#array + 1] = i
16589
- i = i + increment
16590
- end
16591
- end
16592
- else
16593
- do
16594
- local i = start
16595
- while i > ____end do
16596
- array[#array + 1] = i
16597
- i = i - increment
16598
- end
16599
- end
16600
- end
16601
- return array
16602
- end
16603
- function ____exports.getTraversalDescription(self, key, traversalDescription)
16604
- if traversalDescription ~= "" then
16605
- traversalDescription = traversalDescription .. " --> "
16606
- end
16607
- traversalDescription = traversalDescription .. tostring(key)
16608
- return traversalDescription
16609
- end
16610
- function ____exports.iRange(self, start, ____end, increment)
16611
- if increment == nil then
16612
- increment = 1
16613
- end
16614
- if ____end == nil then
16615
- return ____exports.iRange(nil, 0, start, increment)
16616
- end
16617
- local rangeIncreasing = start <= ____end
16618
- local exclusiveEnd = rangeIncreasing and ____end + 1 or ____end - 1
16619
- return ____exports.eRange(nil, start, exclusiveEnd, increment)
16620
- end
16621
- function ____exports.inRange(self, num, start, ____end)
16622
- return num >= start and num <= ____end
16623
- end
16624
- function ____exports.isMultiplayer(self)
16625
- local players = getAllPlayers(nil)
16626
- local controllerIndexes = __TS__ArrayMap(
16627
- players,
16628
- function(____, player) return player.ControllerIndex end
16629
- )
16630
- local controllerIndexesSet = __TS__New(ReadonlySet, controllerIndexes)
16631
- return controllerIndexesSet.size > 1
16632
- end
16633
- function ____exports.isRepentance(self)
16634
- local metatable = getmetatable(Sprite)
16635
- if metatable == nil then
16636
- error("Failed to get the metatable of the Sprite global table.")
16637
- end
16638
- local classTable = metatable.__class
16639
- if classTable == nil then
16640
- error("Failed to get the \"__class\" key of the Sprite metatable.")
16641
- end
16642
- local getAnimation = classTable.GetAnimation
16643
- return isFunction(nil, getAnimation)
16644
- end
16645
- ____exports["repeat"] = function(self, n, func)
16646
- do
16647
- local i = 0
16648
- while i < n do
16649
- func(nil, i)
16650
- i = i + 1
16651
- end
16652
- end
16653
- end
16654
- function ____exports.todo(self, ...)
16655
- end
16656
16654
  return ____exports
16657
16655
  end,
16658
16656
  ["src.functions.array"] = function(...)
@@ -16688,6 +16686,7 @@ local ____types = require("src.functions.types")
16688
16686
  local isNumber = ____types.isNumber
16689
16687
  local isTable = ____types.isTable
16690
16688
  local ____utils = require("src.functions.utils")
16689
+ local assertDefined = ____utils.assertDefined
16691
16690
  local eRange = ____utils.eRange
16692
16691
  function ____exports.arrayRemoveAllInPlace(self, array, ...)
16693
16692
  local elementsToRemove = {...}
@@ -16932,9 +16931,11 @@ function ____exports.getRandomArrayElement(self, array, seedOrRNG, exceptions)
16932
16931
  ) or array
16933
16932
  local randomIndex = ____exports.getRandomArrayIndex(nil, arrayToUse, seedOrRNG)
16934
16933
  local randomElement = arrayToUse[randomIndex + 1]
16935
- if randomElement == nil then
16936
- error(("Failed to get a random array element since the random index of " .. tostring(randomIndex)) .. " was not valid.")
16937
- 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
+ )
16938
16939
  return randomElement
16939
16940
  end
16940
16941
  function ____exports.getRandomArrayElementAndRemove(self, array, seedOrRNG, exceptions)
@@ -17032,6 +17033,7 @@ return ____exports
17032
17033
  local ____lualib = require("lualib_bundle")
17033
17034
  local __TS__ArraySort = ____lualib.__TS__ArraySort
17034
17035
  local __TS__ArrayMap = ____lualib.__TS__ArrayMap
17036
+ local __TS__ArrayIncludes = ____lualib.__TS__ArrayIncludes
17035
17037
  local __TS__New = ____lualib.__TS__New
17036
17038
  local ____exports = {}
17037
17039
  local ____ReadonlySet = require("src.types.ReadonlySet")
@@ -17041,8 +17043,10 @@ local getRandomArrayElement = ____array.getRandomArrayElement
17041
17043
  local ____rng = require("src.functions.rng")
17042
17044
  local getRandomSeed = ____rng.getRandomSeed
17043
17045
  local ____types = require("src.functions.types")
17046
+ local isNumber = ____types.isNumber
17044
17047
  local isString = ____types.isString
17045
17048
  local ____utils = require("src.functions.utils")
17049
+ local assertDefined = ____utils.assertDefined
17046
17050
  local iRange = ____utils.iRange
17047
17051
  function ____exports.getEnumEntries(self, transpiledEnum)
17048
17052
  local enumEntries = {}
@@ -17096,9 +17100,7 @@ end
17096
17100
  function ____exports.getHighestEnumValue(self, transpiledEnum)
17097
17101
  local enumValues = ____exports.getEnumValues(nil, transpiledEnum)
17098
17102
  local lastElement = enumValues[#enumValues]
17099
- if lastElement == nil then
17100
- error("Failed to get the last value from an enum since the enum was empty.")
17101
- end
17103
+ assertDefined(nil, lastElement, "Failed to get the last value from an enum since the enum was empty.")
17102
17104
  return lastElement
17103
17105
  end
17104
17106
  function ____exports.getRandomEnumValue(self, transpiledEnum, seedOrRNG, exceptions)
@@ -17111,6 +17113,10 @@ function ____exports.getRandomEnumValue(self, transpiledEnum, seedOrRNG, excepti
17111
17113
  local enumValues = ____exports.getEnumValues(nil, transpiledEnum)
17112
17114
  return getRandomArrayElement(nil, enumValues, seedOrRNG, exceptions)
17113
17115
  end
17116
+ function ____exports.isEnumValue(self, value, transpiledEnum)
17117
+ local enumValues = ____exports.getEnumValues(nil, transpiledEnum)
17118
+ return __TS__ArrayIncludes(enumValues, value)
17119
+ end
17114
17120
  function ____exports.validateCustomEnum(self, transpiledEnumName, transpiledEnum)
17115
17121
  for ____, ____value in ipairs(____exports.getEnumEntries(nil, transpiledEnum)) do
17116
17122
  local key = ____value[1]
@@ -17123,10 +17129,8 @@ end
17123
17129
  function ____exports.validateEnumContiguous(self, transpiledEnumName, transpiledEnum)
17124
17130
  local values = ____exports.getEnumValues(nil, transpiledEnum)
17125
17131
  local lastValue = values[#values]
17126
- if lastValue == nil then
17127
- error("Failed to validate that an enum was contiguous, since the last value was undefined.")
17128
- end
17129
- 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
17130
17134
  error("Failed to validate that an enum was contiguous, since the last value was not a number.")
17131
17135
  end
17132
17136
  local valuesSet = __TS__New(ReadonlySet, values)
@@ -17289,6 +17293,8 @@ local getNumbersFromTable = ____table.getNumbersFromTable
17289
17293
  local tableHasKeys = ____table.tableHasKeys
17290
17294
  local ____types = require("src.functions.types")
17291
17295
  local isTable = ____types.isTable
17296
+ local ____utils = require("src.functions.utils")
17297
+ local assertDefined = ____utils.assertDefined
17292
17298
  function ____exports.isBitSet128(self, object)
17293
17299
  return isIsaacAPIClassOfType(nil, object, OBJECT_NAME)
17294
17300
  end
@@ -17312,12 +17318,8 @@ function ____exports.deserializeBitSet128(self, bitSet128)
17312
17318
  OBJECT_NAME,
17313
17319
  table.unpack(KEYS)
17314
17320
  ))
17315
- if l == nil then
17316
- error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: l")
17317
- end
17318
- if h == nil then
17319
- error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: h")
17320
- 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")
17321
17323
  return BitSet128(l, h)
17322
17324
  end
17323
17325
  function ____exports.isSerializedBitSet128(self, object)
@@ -17361,6 +17363,8 @@ local getNumbersFromTable = ____table.getNumbersFromTable
17361
17363
  local tableHasKeys = ____table.tableHasKeys
17362
17364
  local ____types = require("src.functions.types")
17363
17365
  local isTable = ____types.isTable
17366
+ local ____utils = require("src.functions.utils")
17367
+ local assertDefined = ____utils.assertDefined
17364
17368
  function ____exports.isColor(self, object)
17365
17369
  return isIsaacAPIClassOfType(nil, object, OBJECT_NAME)
17366
17370
  end
@@ -17401,15 +17405,9 @@ function ____exports.deserializeColor(self, color)
17401
17405
  OBJECT_NAME,
17402
17406
  table.unpack(KEYS)
17403
17407
  ))
17404
- if r == nil then
17405
- error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: R")
17406
- end
17407
- if g == nil then
17408
- error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: G")
17409
- end
17410
- if b == nil then
17411
- error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: B")
17412
- 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")
17413
17411
  return Color(
17414
17412
  r,
17415
17413
  g,
@@ -17474,6 +17472,8 @@ local getNumbersFromTable = ____table.getNumbersFromTable
17474
17472
  local tableHasKeys = ____table.tableHasKeys
17475
17473
  local ____types = require("src.functions.types")
17476
17474
  local isTable = ____types.isTable
17475
+ local ____utils = require("src.functions.utils")
17476
+ local assertDefined = ____utils.assertDefined
17477
17477
  function ____exports.isKColor(self, object)
17478
17478
  return isIsaacAPIClassOfType(nil, object, OBJECT_NAME)
17479
17479
  end
@@ -17495,18 +17495,10 @@ function ____exports.deserializeKColor(self, kColor)
17495
17495
  OBJECT_NAME,
17496
17496
  table.unpack(KEYS)
17497
17497
  ))
17498
- if r == nil then
17499
- error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: Red")
17500
- end
17501
- if g == nil then
17502
- error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: Green")
17503
- end
17504
- if b == nil then
17505
- error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: Blue")
17506
- end
17507
- if a == nil then
17508
- error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: Alpha")
17509
- 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")
17510
17502
  return KColor(r, g, b, a)
17511
17503
  end
17512
17504
  function ____exports.getRandomKColor(self, seedOrRNG, alpha)
@@ -17893,6 +17885,8 @@ local getNumbersFromTable = ____table.getNumbersFromTable
17893
17885
  local tableHasKeys = ____table.tableHasKeys
17894
17886
  local ____types = require("src.functions.types")
17895
17887
  local isTable = ____types.isTable
17888
+ local ____utils = require("src.functions.utils")
17889
+ local assertDefined = ____utils.assertDefined
17896
17890
  function ____exports.isVector(self, object)
17897
17891
  return isIsaacAPIClassOfType(nil, object, OBJECT_NAME)
17898
17892
  end
@@ -17914,12 +17908,8 @@ function ____exports.deserializeVector(self, vector)
17914
17908
  OBJECT_NAME,
17915
17909
  table.unpack(KEYS)
17916
17910
  ))
17917
- if x == nil then
17918
- error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: X")
17919
- end
17920
- if y == nil then
17921
- error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: Y")
17922
- 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")
17923
17913
  return Vector(x, y)
17924
17914
  end
17925
17915
  function ____exports.doesVectorHaveLength(self, vector, threshold)
@@ -20869,6 +20859,8 @@ local ____tstlClass = require("src.functions.tstlClass")
20869
20859
  local isTSTLSet = ____tstlClass.isTSTLSet
20870
20860
  local ____types = require("src.functions.types")
20871
20861
  local isPrimitive = ____types.isPrimitive
20862
+ local ____utils = require("src.functions.utils")
20863
+ local assertDefined = ____utils.assertDefined
20872
20864
  local ____vector = require("src.functions.vector")
20873
20865
  local doesVectorHaveLength = ____vector.doesVectorHaveLength
20874
20866
  local isVector = ____vector.isVector
@@ -20933,9 +20925,7 @@ function ____exports.doesEntityExist(self, entityType, variant, subType, ignoreF
20933
20925
  end
20934
20926
  function setPrimitiveEntityFields(self, entity, metatable, entityFields)
20935
20927
  local propGetTable = metatable.__propget
20936
- if propGetTable == nil then
20937
- error("Failed to get the \"__propget\" table for an entity.")
20938
- end
20928
+ assertDefined(nil, propGetTable, "Failed to get the \"__propget\" table for an entity.")
20939
20929
  for key in pairs(propGetTable) do
20940
20930
  local indexKey = key
20941
20931
  local value = entity[indexKey]
@@ -21005,17 +20995,23 @@ function ____exports.getConstituentsFromEntityID(self, entityID)
21005
20995
  end
21006
20996
  local entityTypeString, variantString, subTypeString = table.unpack(parts)
21007
20997
  local entityType = tonumber(entityTypeString)
21008
- if entityType == nil then
21009
- error("Failed to convert the entity type to a number: " .. tostring(entityTypeString))
21010
- end
20998
+ assertDefined(
20999
+ nil,
21000
+ entityType,
21001
+ "Failed to convert the entity type to a number: " .. tostring(entityTypeString)
21002
+ )
21011
21003
  local variant = tonumber(variantString)
21012
- if variant == nil then
21013
- error("Failed to convert the entity variant to a number: " .. tostring(variantString))
21014
- end
21004
+ assertDefined(
21005
+ nil,
21006
+ variant,
21007
+ "Failed to convert the entity variant to a number: " .. tostring(variantString)
21008
+ )
21015
21009
  local subType = tonumber(subTypeString)
21016
- if subType == nil then
21017
- error("Failed to convert the entity sub-type to a number: " .. tostring(subTypeString))
21018
- end
21010
+ assertDefined(
21011
+ nil,
21012
+ subType,
21013
+ "Failed to convert the entity sub-type to a number: " .. tostring(subTypeString)
21014
+ )
21019
21015
  return {entityType, variant, subType}
21020
21016
  end
21021
21017
  function ____exports.getEntities(self, entityType, variant, subType, ignoreFriendly)
@@ -21039,18 +21035,14 @@ end
21039
21035
  function ____exports.getEntityFields(self, entity)
21040
21036
  local entityFields = {}
21041
21037
  local metatable = getmetatable(entity)
21042
- if metatable == nil then
21043
- error("Failed to get the metatable for an entity.")
21044
- end
21038
+ assertDefined(nil, metatable, "Failed to get the metatable for an entity.")
21045
21039
  setPrimitiveEntityFields(nil, entity, metatable, entityFields)
21046
21040
  local className = getIsaacAPIClassName(nil, entity)
21047
21041
  if className == "Entity" then
21048
21042
  return entityFields
21049
21043
  end
21050
21044
  local parentTable = metatable.__parent
21051
- if parentTable == nil then
21052
- error("Failed to get the \"__parent\" table for an entity.")
21053
- end
21045
+ assertDefined(nil, parentTable, "Failed to get the \"__parent\" table for an entity.")
21054
21046
  setPrimitiveEntityFields(nil, entity, parentTable, entityFields)
21055
21047
  return entityFields
21056
21048
  end
@@ -21688,6 +21680,7 @@ local getPlayers = ____playerIndex.getPlayers
21688
21680
  local ____types = require("src.functions.types")
21689
21681
  local isNumber = ____types.isNumber
21690
21682
  local ____utils = require("src.functions.utils")
21683
+ local assertDefined = ____utils.assertDefined
21691
21684
  local ____repeat = ____utils["repeat"]
21692
21685
  function ____exports.getCharacters(self)
21693
21686
  local players = getPlayers(nil)
@@ -21795,9 +21788,7 @@ function ____exports.getClosestPlayer(self, position)
21795
21788
  closestDistance = distance
21796
21789
  end
21797
21790
  end
21798
- if closestPlayer == nil then
21799
- error("Failed to find the closest player.")
21800
- end
21791
+ assertDefined(nil, closestPlayer, "Failed to find the closest player.")
21801
21792
  return closestPlayer
21802
21793
  end
21803
21794
  function ____exports.getEffectsList(self, player)
@@ -21819,9 +21810,7 @@ end
21819
21810
  function ____exports.getFinalPlayer(self)
21820
21811
  local players = getPlayers(nil)
21821
21812
  local lastPlayer = getLastElement(nil, players)
21822
- if lastPlayer == nil then
21823
- error("Failed to get the final player since there were 0 players.")
21824
- end
21813
+ assertDefined(nil, lastPlayer, "Failed to get the final player since there were 0 players.")
21825
21814
  return lastPlayer
21826
21815
  end
21827
21816
  function ____exports.getNewestPlayer(self)
@@ -21833,9 +21822,7 @@ function ____exports.getNewestPlayer(self)
21833
21822
  lowestFrame = player.FrameCount
21834
21823
  end
21835
21824
  end
21836
- if newestPlayer == nil then
21837
- error("Failed to find the newest player.")
21838
- end
21825
+ assertDefined(nil, newestPlayer, "Failed to find the newest player.")
21839
21826
  return newestPlayer
21840
21827
  end
21841
21828
  function ____exports.getPlayerCloserThan(self, position, distance)
@@ -22056,7 +22043,7 @@ function ____exports.removeAllActiveItems(self, player)
22056
22043
  do
22057
22044
  local collectibleType = player:GetActiveItem(activeSlot)
22058
22045
  if collectibleType == CollectibleType.NULL then
22059
- goto __continue97
22046
+ goto __continue94
22060
22047
  end
22061
22048
  local stillHasCollectible
22062
22049
  repeat
@@ -22066,7 +22053,7 @@ function ____exports.removeAllActiveItems(self, player)
22066
22053
  end
22067
22054
  until not stillHasCollectible
22068
22055
  end
22069
- ::__continue97::
22056
+ ::__continue94::
22070
22057
  end
22071
22058
  end
22072
22059
  function ____exports.removeAllPlayerTrinkets(self, player)
@@ -22074,7 +22061,7 @@ function ____exports.removeAllPlayerTrinkets(self, player)
22074
22061
  do
22075
22062
  local trinketType = player:GetTrinket(trinketSlot)
22076
22063
  if trinketType == TrinketType.NULL then
22077
- goto __continue102
22064
+ goto __continue99
22078
22065
  end
22079
22066
  local hasTrinket
22080
22067
  repeat
@@ -22084,7 +22071,7 @@ function ____exports.removeAllPlayerTrinkets(self, player)
22084
22071
  end
22085
22072
  until not hasTrinket
22086
22073
  end
22087
- ::__continue102::
22074
+ ::__continue99::
22088
22075
  end
22089
22076
  end
22090
22077
  function ____exports.removeCollectible(self, player, ...)
@@ -22144,9 +22131,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
22144
22131
  itemPool:RemoveCollectible(collectibleType)
22145
22132
  end
22146
22133
  repeat
22147
- local ____switch124 = activeSlot
22148
- local ____cond124 = ____switch124 == ActiveSlot.PRIMARY
22149
- if ____cond124 then
22134
+ local ____switch121 = activeSlot
22135
+ local ____cond121 = ____switch121 == ActiveSlot.PRIMARY
22136
+ if ____cond121 then
22150
22137
  do
22151
22138
  if primaryCollectibleType ~= CollectibleType.NULL then
22152
22139
  player:RemoveCollectible(primaryCollectibleType)
@@ -22155,8 +22142,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
22155
22142
  break
22156
22143
  end
22157
22144
  end
22158
- ____cond124 = ____cond124 or ____switch124 == ActiveSlot.SECONDARY
22159
- if ____cond124 then
22145
+ ____cond121 = ____cond121 or ____switch121 == ActiveSlot.SECONDARY
22146
+ if ____cond121 then
22160
22147
  do
22161
22148
  if primaryCollectibleType ~= CollectibleType.NULL then
22162
22149
  player:RemoveCollectible(primaryCollectibleType)
@@ -22171,16 +22158,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
22171
22158
  break
22172
22159
  end
22173
22160
  end
22174
- ____cond124 = ____cond124 or ____switch124 == ActiveSlot.POCKET
22175
- if ____cond124 then
22161
+ ____cond121 = ____cond121 or ____switch121 == ActiveSlot.POCKET
22162
+ if ____cond121 then
22176
22163
  do
22177
22164
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
22178
22165
  player:SetActiveCharge(charge, activeSlot)
22179
22166
  break
22180
22167
  end
22181
22168
  end
22182
- ____cond124 = ____cond124 or ____switch124 == ActiveSlot.POCKET_SINGLE_USE
22183
- if ____cond124 then
22169
+ ____cond121 = ____cond121 or ____switch121 == ActiveSlot.POCKET_SINGLE_USE
22170
+ if ____cond121 then
22184
22171
  do
22185
22172
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
22186
22173
  break
@@ -22720,6 +22707,8 @@ local __TS__ArrayUnshift = ____lualib.__TS__ArrayUnshift
22720
22707
  local ____exports = {}
22721
22708
  local ____flag = require("src.functions.flag")
22722
22709
  local addFlag = ____flag.addFlag
22710
+ local ____utils = require("src.functions.utils")
22711
+ local assertDefined = ____utils.assertDefined
22723
22712
  function ____exports.arrayToBitFlags(self, array)
22724
22713
  local flags = 0
22725
22714
  for ____, flag in ipairs(array) do
@@ -22736,9 +22725,11 @@ function ____exports.convertDecimalToBinary(self, number, minLength)
22736
22725
  local bitsString = __TS__NumberToString(number, 2)
22737
22726
  for ____, bitString in __TS__Iterator(bitsString) do
22738
22727
  local bit = tonumber(bitString)
22739
- if bit == nil then
22740
- error("Failed to convert the following number to binary: " .. tostring(number))
22741
- end
22728
+ assertDefined(
22729
+ nil,
22730
+ bit,
22731
+ "Failed to convert the following number to binary: " .. tostring(number)
22732
+ )
22742
22733
  bits[#bits + 1] = bit
22743
22734
  end
22744
22735
  if minLength ~= nil then
@@ -23641,6 +23632,8 @@ local ____entities = require("src.functions.entities")
23641
23632
  local getEntities = ____entities.getEntities
23642
23633
  local removeEntities = ____entities.removeEntities
23643
23634
  local spawn = ____entities.spawn
23635
+ local ____utils = require("src.functions.utils")
23636
+ local assertDefined = ____utils.assertDefined
23644
23637
  function ____exports.getBombs(self, bombVariant, subType)
23645
23638
  if bombVariant == nil then
23646
23639
  bombVariant = -1
@@ -23934,9 +23927,7 @@ function ____exports.spawnBomb(self, bombVariant, subType, positionOrGridIndex,
23934
23927
  seedOrRNG
23935
23928
  )
23936
23929
  local bomb = entity:ToBomb()
23937
- if bomb == nil then
23938
- error("Failed to spawn a bomb.")
23939
- end
23930
+ assertDefined(nil, bomb, "Failed to spawn a bomb.")
23940
23931
  return bomb
23941
23932
  end
23942
23933
  function ____exports.spawnBombWithSeed(self, bombVariant, subType, positionOrGridIndex, seedOrRNG, velocity, spawner)
@@ -23968,9 +23959,7 @@ function ____exports.spawnEffect(self, effectVariant, subType, positionOrGridInd
23968
23959
  seedOrRNG
23969
23960
  )
23970
23961
  local effect = entity:ToEffect()
23971
- if effect == nil then
23972
- error("Failed to spawn an effect.")
23973
- end
23962
+ assertDefined(nil, effect, "Failed to spawn an effect.")
23974
23963
  return effect
23975
23964
  end
23976
23965
  function ____exports.spawnEffectWithSeed(self, effectVariant, subType, positionOrGridIndex, seedOrRNG, velocity, spawner)
@@ -24002,9 +23991,7 @@ function ____exports.spawnFamiliar(self, familiarVariant, subType, positionOrGri
24002
23991
  seedOrRNG
24003
23992
  )
24004
23993
  local familiar = entity:ToFamiliar()
24005
- if familiar == nil then
24006
- error("Failed to spawn a familiar.")
24007
- end
23994
+ assertDefined(nil, familiar, "Failed to spawn a familiar.")
24008
23995
  return familiar
24009
23996
  end
24010
23997
  function ____exports.spawnFamiliarWithSeed(self, familiarVariant, subType, positionOrGridIndex, seedOrRNG, velocity, spawner)
@@ -24036,9 +24023,7 @@ function ____exports.spawnKnife(self, knifeVariant, subType, positionOrGridIndex
24036
24023
  seedOrRNG
24037
24024
  )
24038
24025
  local knife = entity:ToKnife()
24039
- if knife == nil then
24040
- error("Failed to spawn a knife.")
24041
- end
24026
+ assertDefined(nil, knife, "Failed to spawn a knife.")
24042
24027
  return knife
24043
24028
  end
24044
24029
  function ____exports.spawnKnifeWithSeed(self, knifeVariant, subType, positionOrGridIndex, seedOrRNG, velocity, spawner)
@@ -24070,9 +24055,7 @@ function ____exports.spawnLaser(self, laserVariant, subType, positionOrGridIndex
24070
24055
  seedOrRNG
24071
24056
  )
24072
24057
  local laser = entity:ToLaser()
24073
- if laser == nil then
24074
- error("Failed to spawn a laser.")
24075
- end
24058
+ assertDefined(nil, laser, "Failed to spawn a laser.")
24076
24059
  return laser
24077
24060
  end
24078
24061
  function ____exports.spawnLaserWithSeed(self, laserVariant, subType, positionOrGridIndex, seedOrRNG, velocity, spawner)
@@ -24104,9 +24087,7 @@ function ____exports.spawnNPC(self, entityType, variant, subType, positionOrGrid
24104
24087
  seedOrRNG
24105
24088
  )
24106
24089
  local npc = entity:ToNPC()
24107
- if npc == nil then
24108
- error("Failed to spawn an NPC.")
24109
- end
24090
+ assertDefined(nil, npc, "Failed to spawn an NPC.")
24110
24091
  return npc
24111
24092
  end
24112
24093
  function ____exports.spawnNPCWithSeed(self, entityType, variant, subType, positionOrGridIndex, seedOrRNG, velocity, spawner)
@@ -24139,9 +24120,7 @@ function ____exports.spawnPickup(self, pickupVariant, subType, positionOrGridInd
24139
24120
  seedOrRNG
24140
24121
  )
24141
24122
  local pickup = entity:ToPickup()
24142
- if pickup == nil then
24143
- error("Failed to spawn a pickup.")
24144
- end
24123
+ assertDefined(nil, pickup, "Failed to spawn a pickup.")
24145
24124
  return pickup
24146
24125
  end
24147
24126
  function ____exports.spawnPickupWithSeed(self, pickupVariant, subType, positionOrGridIndex, seedOrRNG, velocity, spawner)
@@ -24173,9 +24152,7 @@ function ____exports.spawnProjectile(self, projectileVariant, subType, positionO
24173
24152
  seedOrRNG
24174
24153
  )
24175
24154
  local projectile = entity:ToProjectile()
24176
- if projectile == nil then
24177
- error("Failed to spawn a projectile.")
24178
- end
24155
+ assertDefined(nil, projectile, "Failed to spawn a projectile.")
24179
24156
  return projectile
24180
24157
  end
24181
24158
  function ____exports.spawnProjectileWithSeed(self, projectileVariant, subType, positionOrGridIndex, seedOrRNG, velocity, spawner)
@@ -24236,9 +24213,7 @@ function ____exports.spawnTear(self, tearVariant, subType, positionOrGridIndex,
24236
24213
  seedOrRNG
24237
24214
  )
24238
24215
  local tear = entity:ToTear()
24239
- if tear == nil then
24240
- error("Failed to spawn a tear.")
24241
- end
24216
+ assertDefined(nil, tear, "Failed to spawn a tear.")
24242
24217
  return tear
24243
24218
  end
24244
24219
  function ____exports.spawnTearWithSeed(self, tearVariant, subType, positionOrGridIndex, seedOrRNG, velocity, spawner)
@@ -25760,6 +25735,7 @@ return ____exports
25760
25735
  ["src.functions.input"] = function(...)
25761
25736
  local ____lualib = require("lualib_bundle")
25762
25737
  local __TS__New = ____lualib.__TS__New
25738
+ local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
25763
25739
  local __TS__ArraySome = ____lualib.__TS__ArraySome
25764
25740
  local ____exports = {}
25765
25741
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
@@ -25775,7 +25751,7 @@ local ____ReadonlySet = require("src.types.ReadonlySet")
25775
25751
  local ReadonlySet = ____ReadonlySet.ReadonlySet
25776
25752
  local ____string = require("src.functions.string")
25777
25753
  local trimPrefix = ____string.trimPrefix
25778
- local MODIFIER_KEYS = {
25754
+ ____exports.MODIFIER_KEYS = {
25779
25755
  Keyboard.LEFT_SHIFT,
25780
25756
  Keyboard.LEFT_CONTROL,
25781
25757
  Keyboard.LEFT_ALT,
@@ -25785,10 +25761,10 @@ local MODIFIER_KEYS = {
25785
25761
  Keyboard.RIGHT_ALT,
25786
25762
  Keyboard.RIGHT_SUPER
25787
25763
  }
25788
- local MOVEMENT_ACTIONS = {ButtonAction.LEFT, ButtonAction.RIGHT, ButtonAction.UP, ButtonAction.DOWN}
25789
- ____exports.MOVEMENT_ACTIONS_SET = __TS__New(ReadonlySet, MOVEMENT_ACTIONS)
25790
- local SHOOTING_ACTIONS = {ButtonAction.SHOOT_LEFT, ButtonAction.SHOOT_RIGHT, ButtonAction.SHOOT_UP, ButtonAction.SHOOT_DOWN}
25791
- ____exports.SHOOTING_ACTIONS_SET = __TS__New(ReadonlySet, SHOOTING_ACTIONS)
25764
+ ____exports.MOVEMENT_ACTIONS = {ButtonAction.LEFT, ButtonAction.RIGHT, ButtonAction.UP, ButtonAction.DOWN}
25765
+ ____exports.MOVEMENT_ACTIONS_SET = __TS__New(ReadonlySet, ____exports.MOVEMENT_ACTIONS)
25766
+ ____exports.SHOOTING_ACTIONS = {ButtonAction.SHOOT_LEFT, ButtonAction.SHOOT_RIGHT, ButtonAction.SHOOT_UP, ButtonAction.SHOOT_DOWN}
25767
+ ____exports.SHOOTING_ACTIONS_SET = __TS__New(ReadonlySet, ____exports.SHOOTING_ACTIONS)
25792
25768
  function ____exports.controllerToString(self, controller)
25793
25769
  local key = Controller[controller]
25794
25770
  if key == nil then
@@ -25796,11 +25772,17 @@ function ____exports.controllerToString(self, controller)
25796
25772
  end
25797
25773
  return trimPrefix(nil, key, "BUTTON_")
25798
25774
  end
25799
- function ____exports.getMoveActions(self)
25800
- return ____exports.MOVEMENT_ACTIONS_SET
25775
+ function ____exports.getMoveActions(self, controllerIndex)
25776
+ return __TS__ArrayFilter(
25777
+ ____exports.MOVEMENT_ACTIONS,
25778
+ function(____, buttonAction) return Input.IsActionPressed(buttonAction, controllerIndex) end
25779
+ )
25801
25780
  end
25802
- function ____exports.getShootActions(self)
25803
- return ____exports.SHOOTING_ACTIONS_SET
25781
+ function ____exports.getShootActions(self, controllerIndex)
25782
+ return __TS__ArrayFilter(
25783
+ ____exports.SHOOTING_ACTIONS,
25784
+ function(____, buttonAction) return Input.IsActionPressed(buttonAction, controllerIndex) end
25785
+ )
25804
25786
  end
25805
25787
  function ____exports.isActionPressed(self, controllerIndex, ...)
25806
25788
  local buttonActions = {...}
@@ -25848,7 +25830,7 @@ end
25848
25830
  function ____exports.isModifierKeyPressed(self)
25849
25831
  return ____exports.isKeyboardPressed(
25850
25832
  nil,
25851
- table.unpack(MODIFIER_KEYS)
25833
+ table.unpack(____exports.MODIFIER_KEYS)
25852
25834
  )
25853
25835
  end
25854
25836
  function ____exports.isMoveAction(self, buttonAction)
@@ -25858,12 +25840,12 @@ function ____exports.isMoveActionPressed(self, controllerIndex)
25858
25840
  return ____exports.isActionPressed(
25859
25841
  nil,
25860
25842
  controllerIndex,
25861
- table.unpack(MOVEMENT_ACTIONS)
25843
+ table.unpack(____exports.MOVEMENT_ACTIONS)
25862
25844
  )
25863
25845
  end
25864
25846
  function ____exports.isMoveActionPressedOnAnyInput(self)
25865
25847
  return __TS__ArraySome(
25866
- MOVEMENT_ACTIONS,
25848
+ ____exports.MOVEMENT_ACTIONS,
25867
25849
  function(____, moveAction) return ____exports.isActionPressedOnAnyInput(nil, moveAction) end
25868
25850
  )
25869
25851
  end
@@ -25871,12 +25853,12 @@ function ____exports.isMoveActionTriggered(self, controllerIndex)
25871
25853
  return ____exports.isActionTriggered(
25872
25854
  nil,
25873
25855
  controllerIndex,
25874
- table.unpack(MOVEMENT_ACTIONS)
25856
+ table.unpack(____exports.MOVEMENT_ACTIONS)
25875
25857
  )
25876
25858
  end
25877
25859
  function ____exports.isMoveActionTriggeredOnAnyInput(self)
25878
25860
  return __TS__ArraySome(
25879
- MOVEMENT_ACTIONS,
25861
+ ____exports.MOVEMENT_ACTIONS,
25880
25862
  function(____, moveAction) return ____exports.isActionTriggeredOnAnyInput(nil, moveAction) end
25881
25863
  )
25882
25864
  end
@@ -25887,12 +25869,12 @@ function ____exports.isShootActionPressed(self, controllerIndex)
25887
25869
  return ____exports.isActionPressed(
25888
25870
  nil,
25889
25871
  controllerIndex,
25890
- table.unpack(SHOOTING_ACTIONS)
25872
+ table.unpack(____exports.SHOOTING_ACTIONS)
25891
25873
  )
25892
25874
  end
25893
25875
  function ____exports.isShootActionPressedOnAnyInput(self)
25894
25876
  return __TS__ArraySome(
25895
- SHOOTING_ACTIONS,
25877
+ ____exports.SHOOTING_ACTIONS,
25896
25878
  function(____, shootAction) return ____exports.isActionPressedOnAnyInput(nil, shootAction) end
25897
25879
  )
25898
25880
  end
@@ -25900,12 +25882,12 @@ function ____exports.isShootActionTriggered(self, controllerIndex)
25900
25882
  return ____exports.isActionTriggered(
25901
25883
  nil,
25902
25884
  controllerIndex,
25903
- table.unpack(SHOOTING_ACTIONS)
25885
+ table.unpack(____exports.SHOOTING_ACTIONS)
25904
25886
  )
25905
25887
  end
25906
25888
  function ____exports.isShootActionTriggeredOnAnyInput(self)
25907
25889
  return __TS__ArraySome(
25908
- SHOOTING_ACTIONS,
25890
+ ____exports.SHOOTING_ACTIONS,
25909
25891
  function(____, shootAction) return ____exports.isActionTriggeredOnAnyInput(nil, shootAction) end
25910
25892
  )
25911
25893
  end
@@ -26802,6 +26784,8 @@ local game = ____cachedClasses.game
26802
26784
  local ____roomData = require("src.functions.roomData")
26803
26785
  local getRoomData = ____roomData.getRoomData
26804
26786
  local getRoomGridIndex = ____roomData.getRoomGridIndex
26787
+ local ____utils = require("src.functions.utils")
26788
+ local assertDefined = ____utils.assertDefined
26805
26789
  function ____exports.teleport(self, roomGridIndex, direction, roomTransitionAnim)
26806
26790
  if direction == nil then
26807
26791
  direction = Direction.NO_DIRECTION
@@ -26811,9 +26795,11 @@ function ____exports.teleport(self, roomGridIndex, direction, roomTransitionAnim
26811
26795
  end
26812
26796
  local level = game:GetLevel()
26813
26797
  local roomData = getRoomData(nil, roomGridIndex)
26814
- if roomData == nil then
26815
- error(("Failed to change the room to grid index " .. tostring(roomGridIndex)) .. " because that room does not exist.")
26816
- end
26798
+ assertDefined(
26799
+ nil,
26800
+ roomData,
26801
+ ("Failed to change the room to grid index " .. tostring(roomGridIndex)) .. " because that room does not exist."
26802
+ )
26817
26803
  level.LeaveDoor = DoorSlot.NO_DOOR_SLOT
26818
26804
  game:StartRoomTransition(roomGridIndex, direction, roomTransitionAnim)
26819
26805
  end
@@ -27389,6 +27375,7 @@ local getGotoCommand = ____stage.getGotoCommand
27389
27375
  local ____types = require("src.functions.types")
27390
27376
  local asNumber = ____types.asNumber
27391
27377
  local ____utils = require("src.functions.utils")
27378
+ local assertDefined = ____utils.assertDefined
27392
27379
  local iRange = ____utils.iRange
27393
27380
  function ____exports.getReadOnlyRooms(self)
27394
27381
  local level = game:GetLevel()
@@ -27494,9 +27481,11 @@ local SECRET_ROOM_TYPES = __TS__New(ReadonlySet, {RoomType.SECRET, RoomType.SUPE
27494
27481
  function ____exports.changeRoom(self, roomGridIndex)
27495
27482
  local level = game:GetLevel()
27496
27483
  local roomData = getRoomData(nil, roomGridIndex)
27497
- if roomData == nil then
27498
- error(("Failed to change the room to grid index " .. tostring(roomGridIndex)) .. " because that room does not exist.")
27499
- end
27484
+ assertDefined(
27485
+ nil,
27486
+ roomData,
27487
+ ("Failed to change the room to grid index " .. tostring(roomGridIndex)) .. " because that room does not exist."
27488
+ )
27500
27489
  level.LeaveDoor = DoorSlot.NO_DOOR_SLOT
27501
27490
  game:ChangeRoom(roomGridIndex)
27502
27491
  end
@@ -27693,12 +27682,12 @@ function ____exports.setRoomCleared(self)
27693
27682
  for ____, door in ipairs(getDoors(nil)) do
27694
27683
  do
27695
27684
  if isHiddenSecretRoomDoor(nil, door) then
27696
- goto __continue77
27685
+ goto __continue76
27697
27686
  end
27698
27687
  openDoorFast(nil, door)
27699
27688
  door.ExtraVisible = false
27700
27689
  end
27701
- ::__continue77::
27690
+ ::__continue76::
27702
27691
  end
27703
27692
  sfxManager:Stop(SoundEffect.DOOR_HEAVY_OPEN)
27704
27693
  game:ShakeScreen(0)
@@ -27753,6 +27742,7 @@ local ____types = require("src.functions.types")
27753
27742
  local asNumber = ____types.asNumber
27754
27743
  local isNumber = ____types.isNumber
27755
27744
  local ____utils = require("src.functions.utils")
27745
+ local assertDefined = ____utils.assertDefined
27756
27746
  local eRange = ____utils.eRange
27757
27747
  local iRange = ____utils.iRange
27758
27748
  local ____vector = require("src.functions.vector")
@@ -27861,9 +27851,11 @@ local BREAKABLE_GRID_ENTITY_TYPES_VARIANTS_BY_EXPLOSIONS = __TS__New(
27861
27851
  )
27862
27852
  function ____exports.convertXMLGridEntityType(self, gridEntityXMLType, gridEntityXMLVariant)
27863
27853
  local gridEntityArray = GRID_ENTITY_XML_MAP:get(gridEntityXMLType)
27864
- if gridEntityArray == nil then
27865
- error("Failed to find an entry in the grid entity map for XML entity type: " .. tostring(gridEntityXMLType))
27866
- end
27854
+ assertDefined(
27855
+ nil,
27856
+ gridEntityArray,
27857
+ "Failed to find an entry in the grid entity map for XML entity type: " .. tostring(gridEntityXMLType)
27858
+ )
27867
27859
  local gridEntityType = gridEntityArray[1]
27868
27860
  local variant = gridEntityArray[2]
27869
27861
  if gridEntityType == GridEntityType.SPIKES_ON_OFF or gridEntityType == GridEntityType.PRESSURE_PLATE or gridEntityType == GridEntityType.TELEPORTER then
@@ -27911,13 +27903,17 @@ function ____exports.getConstituentsFromGridEntityID(self, gridEntityID)
27911
27903
  end
27912
27904
  local gridEntityTypeString, variantString = table.unpack(parts)
27913
27905
  local gridEntityType = tonumber(gridEntityTypeString)
27914
- if gridEntityType == nil then
27915
- error("Failed to convert the grid entity type to a number: " .. tostring(gridEntityTypeString))
27916
- end
27906
+ assertDefined(
27907
+ nil,
27908
+ gridEntityType,
27909
+ "Failed to convert the grid entity type to a number: " .. tostring(gridEntityTypeString)
27910
+ )
27917
27911
  local variant = tonumber(variantString)
27918
- if variant == nil then
27919
- error("Failed to convert the grid entity variant to a number: " .. tostring(variantString))
27920
- end
27912
+ assertDefined(
27913
+ nil,
27914
+ variant,
27915
+ "Failed to convert the grid entity variant to a number: " .. tostring(variantString)
27916
+ )
27921
27917
  return {gridEntityType, variant}
27922
27918
  end
27923
27919
  function ____exports.getGridEntities(self, ...)
@@ -27967,7 +27963,7 @@ function ____exports.getGridEntitiesInRadius(self, targetPosition, radius)
27967
27963
  local gridIndex = room:GetGridIndex(position)
27968
27964
  local gridEntity = room:GetGridEntityFromPos(position)
27969
27965
  if gridEntity == nil or registeredGridIndexes:has(gridIndex) then
27970
- goto __continue27
27966
+ goto __continue24
27971
27967
  end
27972
27968
  registeredGridIndexes:add(gridIndex)
27973
27969
  local topLeft, bottomRight = table.unpack(____exports.getGridEntityCollisionPoints(nil, gridEntity))
@@ -27981,7 +27977,7 @@ function ____exports.getGridEntitiesInRadius(self, targetPosition, radius)
27981
27977
  gridEntities[#gridEntities + 1] = gridEntity
27982
27978
  end
27983
27979
  end
27984
- ::__continue27::
27980
+ ::__continue24::
27985
27981
  end
27986
27982
  end
27987
27983
  return gridEntities
@@ -29803,14 +29799,14 @@ function PostNewRoomEarly.prototype.isNewRoom(self)
29803
29799
  if topLeftWall == nil then
29804
29800
  topLeftWall = spawnGridEntity(nil, GridEntityType.WALL, topLeftWallGridIndex)
29805
29801
  if topLeftWall == nil then
29806
- logError("Failed to spawn a new wall (1) for the POST_NEW_ROOM_EARLY callback.")
29802
+ logError("Failed to spawn a new wall for the POST_NEW_ROOM_EARLY callback (on the first try).")
29807
29803
  return false
29808
29804
  end
29809
29805
  end
29810
29806
  if topLeftWall2 == nil then
29811
29807
  topLeftWall2 = spawnGridEntity(nil, GridEntityType.WALL, rightOfTopWallGridIndex)
29812
29808
  if topLeftWall2 == nil then
29813
- logError("Failed to spawn a new wall (2) for the POST_NEW_ROOM_EARLY callback.")
29809
+ logError("Failed to spawn a new wall for the POST_NEW_ROOM_EARLY callback (on the second try).")
29814
29810
  return false
29815
29811
  end
29816
29812
  end
@@ -30153,84 +30149,72 @@ local removeGridEntities = ____gridEntities.removeGridEntities
30153
30149
  local spawnGridEntityWithVariant = ____gridEntities.spawnGridEntityWithVariant
30154
30150
  local ____types = require("src.functions.types")
30155
30151
  local asNumber = ____types.asNumber
30152
+ local ____utils = require("src.functions.utils")
30153
+ local assertDefined = ____utils.assertDefined
30156
30154
  function ____exports.spawnCrawlSpaceWithVariant(self, crawlSpaceVariant, gridIndexOrPosition)
30157
30155
  return spawnGridEntityWithVariant(nil, GridEntityType.CRAWL_SPACE, crawlSpaceVariant, gridIndexOrPosition)
30158
30156
  end
30159
30157
  function ____exports.spawnDoorWithVariant(self, doorVariant, gridIndexOrPosition)
30160
30158
  local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.DOOR, doorVariant, gridIndexOrPosition)
30161
30159
  if gridEntity == nil then
30162
- return gridEntity
30160
+ return nil
30163
30161
  end
30164
30162
  local door = gridEntity:ToDoor()
30165
- if door == nil then
30166
- error("Failed to spawn a door.")
30167
- end
30163
+ assertDefined(nil, door, "Failed to spawn a door.")
30168
30164
  return door
30169
30165
  end
30170
30166
  function ____exports.spawnPitWithVariant(self, pitVariant, gridIndexOrPosition)
30171
30167
  local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.PIT, pitVariant, gridIndexOrPosition)
30172
30168
  if gridEntity == nil then
30173
- return gridEntity
30169
+ return nil
30174
30170
  end
30175
30171
  local pit = gridEntity:ToPit()
30176
- if pit == nil then
30177
- error("Failed to spawn a pit.")
30178
- end
30172
+ assertDefined(nil, pit, "Failed to spawn a pit.")
30179
30173
  return pit
30180
30174
  end
30181
30175
  function ____exports.spawnPoopWithVariant(self, poopVariant, gridIndexOrPosition)
30182
30176
  local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.POOP, poopVariant, gridIndexOrPosition)
30183
30177
  if gridEntity == nil then
30184
- return gridEntity
30178
+ return nil
30185
30179
  end
30186
30180
  local poop = gridEntity:ToPoop()
30187
- if poop == nil then
30188
- error("Failed to spawn a poop.")
30189
- end
30181
+ assertDefined(nil, poop, "Failed to spawn a poop.")
30190
30182
  return poop
30191
30183
  end
30192
30184
  function ____exports.spawnPressurePlateWithVariant(self, pressurePlateVariant, gridIndexOrPosition)
30193
30185
  local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.PRESSURE_PLATE, pressurePlateVariant, gridIndexOrPosition)
30194
30186
  if gridEntity == nil then
30195
- return gridEntity
30187
+ return nil
30196
30188
  end
30197
30189
  local pressurePlate = gridEntity:ToPressurePlate()
30198
- if pressurePlate == nil then
30199
- error("Failed to spawn a pressure plate.")
30200
- end
30190
+ assertDefined(nil, pressurePlate, "Failed to spawn a pressure plate.")
30201
30191
  return pressurePlate
30202
30192
  end
30203
30193
  function ____exports.spawnRockWithVariant(self, rockVariant, gridIndexOrPosition)
30204
30194
  local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.ROCK, rockVariant, gridIndexOrPosition)
30205
30195
  if gridEntity == nil then
30206
- return gridEntity
30196
+ return nil
30207
30197
  end
30208
30198
  local rock = gridEntity:ToRock()
30209
- if rock == nil then
30210
- error("Failed to spawn a rock.")
30211
- end
30199
+ assertDefined(nil, rock, "Failed to spawn a rock.")
30212
30200
  return rock
30213
30201
  end
30214
30202
  function ____exports.spawnSpikesWithVariant(self, variant, gridIndexOrPosition)
30215
30203
  local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.SPIKES, variant, gridIndexOrPosition)
30216
30204
  if gridEntity == nil then
30217
- return gridEntity
30205
+ return nil
30218
30206
  end
30219
30207
  local spikes = gridEntity:ToSpikes()
30220
- if spikes == nil then
30221
- error("Failed to spawn spikes.")
30222
- end
30208
+ assertDefined(nil, spikes, "Failed to spawn spikes.")
30223
30209
  return spikes
30224
30210
  end
30225
30211
  function ____exports.spawnTNTWithVariant(self, variant, gridIndexOrPosition)
30226
30212
  local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.TNT, variant, gridIndexOrPosition)
30227
30213
  if gridEntity == nil then
30228
- return gridEntity
30214
+ return nil
30229
30215
  end
30230
30216
  local tnt = gridEntity:ToTNT()
30231
- if tnt == nil then
30232
- error("Failed to spawn TNT.")
30233
- end
30217
+ assertDefined(nil, tnt, "Failed to spawn TNT.")
30234
30218
  return tnt
30235
30219
  end
30236
30220
  function ____exports.spawnTeleporterWithVariant(self, variant, gridIndexOrPosition)
@@ -34520,6 +34504,8 @@ local ____roomData = require("src.functions.roomData")
34520
34504
  local getRoomListIndex = ____roomData.getRoomListIndex
34521
34505
  local ____types = require("src.functions.types")
34522
34506
  local isNumber = ____types.isNumber
34507
+ local ____utils = require("src.functions.utils")
34508
+ local assertDefined = ____utils.assertDefined
34523
34509
  local ____vector = require("src.functions.vector")
34524
34510
  local isVector = ____vector.isVector
34525
34511
  local ____DefaultMap = require("src.classes.DefaultMap")
@@ -34613,9 +34599,7 @@ function CustomGridEntities.prototype.spawnCustomGridEntity(self, gridEntityType
34613
34599
  local roomListIndex = getRoomListIndex(nil)
34614
34600
  local gridIndex = isVector(nil, gridIndexOrPosition) and room:GetGridIndex(gridIndexOrPosition) or gridIndexOrPosition
34615
34601
  local customGridEntity = spawnGridEntityWithVariant(nil, baseGridEntityType, baseGridEntityVariant, gridIndexOrPosition)
34616
- if customGridEntity == nil then
34617
- error("Failed to spawn a custom grid entity.")
34618
- end
34602
+ assertDefined(nil, customGridEntity, "Failed to spawn a custom grid entity.")
34619
34603
  if gridCollisionClass ~= nil then
34620
34604
  customGridEntity.CollisionClass = gridCollisionClass
34621
34605
  end
@@ -35484,6 +35468,8 @@ local getIsaacAPIClassName = ____isaacAPIClass.getIsaacAPIClassName
35484
35468
  local ____types = require("src.functions.types")
35485
35469
  local isTable = ____types.isTable
35486
35470
  local isUserdata = ____types.isUserdata
35471
+ local ____utils = require("src.functions.utils")
35472
+ local assertDefined = ____utils.assertDefined
35487
35473
  function getSerializedTableType(self, serializedIsaacAPIClass)
35488
35474
  for ____, ____value in ipairs(__TS__ObjectEntries(ISAAC_API_CLASS_TYPE_TO_BRAND)) do
35489
35475
  local copyableIsaacAPIClassType = ____value[1]
@@ -35499,14 +35485,10 @@ function ____exports.copyIsaacAPIClass(self, isaacAPIClass)
35499
35485
  error("Failed to copy an Isaac API class since the provided object was of type: " .. __TS__TypeOf(isaacAPIClass))
35500
35486
  end
35501
35487
  local isaacAPIClassType = getIsaacAPIClassName(nil, isaacAPIClass)
35502
- if isaacAPIClassType == nil then
35503
- error("Failed to copy an Isaac API class since it does not have a class type.")
35504
- end
35488
+ assertDefined(nil, isaacAPIClassType, "Failed to copy an Isaac API class since it does not have a class type.")
35505
35489
  local copyableIsaacAPIClassType = isaacAPIClassType
35506
35490
  local functions = ISAAC_API_CLASS_TYPE_TO_FUNCTIONS[copyableIsaacAPIClassType]
35507
- if functions == nil then
35508
- error("Failed to copy an Isaac API class since the associated functions were not found for Isaac API class type: " .. copyableIsaacAPIClassType)
35509
- end
35491
+ assertDefined(nil, functions, "Failed to copy an Isaac API class since the associated functions were not found for Isaac API class type: " .. copyableIsaacAPIClassType)
35510
35492
  return functions:copy(isaacAPIClass)
35511
35493
  end
35512
35494
  function ____exports.deserializeIsaacAPIClass(self, serializedIsaacAPIClass)
@@ -35514,13 +35496,9 @@ function ____exports.deserializeIsaacAPIClass(self, serializedIsaacAPIClass)
35514
35496
  error("Failed to deserialize an Isaac API class since the provided object was of type: " .. __TS__TypeOf(serializedIsaacAPIClass))
35515
35497
  end
35516
35498
  local copyableIsaacAPIClassType = getSerializedTableType(nil, serializedIsaacAPIClass)
35517
- if copyableIsaacAPIClassType == nil then
35518
- error("Failed to deserialize an Isaac API class since a valid class type brand was not found.")
35519
- end
35499
+ assertDefined(nil, copyableIsaacAPIClassType, "Failed to deserialize an Isaac API class since a valid class type brand was not found.")
35520
35500
  local functions = ISAAC_API_CLASS_TYPE_TO_FUNCTIONS[copyableIsaacAPIClassType]
35521
- if functions == nil then
35522
- error("Failed to deserialize an Isaac API class since the associated functions were not found for class type: " .. copyableIsaacAPIClassType)
35523
- end
35501
+ assertDefined(nil, functions, "Failed to deserialize an Isaac API class since the associated functions were not found for class type: " .. copyableIsaacAPIClassType)
35524
35502
  return functions:deserialize(serializedIsaacAPIClass)
35525
35503
  end
35526
35504
  function ____exports.isCopyableIsaacAPIClass(self, object)
@@ -35550,14 +35528,10 @@ function ____exports.serializeIsaacAPIClass(self, isaacAPIClass)
35550
35528
  error("Failed to serialize an Isaac API class since the provided object was of type: " .. __TS__TypeOf(isaacAPIClass))
35551
35529
  end
35552
35530
  local isaacAPIClassType = getIsaacAPIClassName(nil, isaacAPIClass)
35553
- if isaacAPIClassType == nil then
35554
- error("Failed to serialize an Isaac API class since it does not have a class type.")
35555
- end
35531
+ assertDefined(nil, isaacAPIClassType, "Failed to serialize an Isaac API class since it does not have a class name.")
35556
35532
  local copyableIsaacAPIClassType = isaacAPIClassType
35557
35533
  local functions = ISAAC_API_CLASS_TYPE_TO_FUNCTIONS[copyableIsaacAPIClassType]
35558
- if functions == nil then
35559
- error("Failed to serialize an Isaac API class since the associated functions were not found for class type: " .. copyableIsaacAPIClassType)
35560
- end
35534
+ assertDefined(nil, functions, "Failed to serialize an Isaac API class since the associated functions were not found for class type: " .. copyableIsaacAPIClassType)
35561
35535
  return functions:serialize(isaacAPIClass)
35562
35536
  end
35563
35537
  return ____exports
@@ -35607,6 +35581,7 @@ local asString = ____types.asString
35607
35581
  local isNumber = ____types.isNumber
35608
35582
  local isPrimitive = ____types.isPrimitive
35609
35583
  local ____utils = require("src.functions.utils")
35584
+ local assertDefined = ____utils.assertDefined
35610
35585
  local getTraversalDescription = ____utils.getTraversalDescription
35611
35586
  function ____exports.deepCopy(self, value, serializationType, traversalDescription, classConstructors, insideMap)
35612
35587
  if serializationType == nil then
@@ -35832,9 +35807,7 @@ function getNewDefaultMap(self, defaultMap, serializationType, traversalDescript
35832
35807
  error(("Failed to deserialize a default map of \"" .. traversalDescription) .. "\", since it was not a Lua table.")
35833
35808
  end
35834
35809
  local defaultMapValue = defaultMap[SerializationBrand.DEFAULT_MAP_VALUE]
35835
- if defaultMapValue == nil then
35836
- error((("Failed to deserialize a default map of \"" .. traversalDescription) .. "\", since there was no serialization brand of: ") .. SerializationBrand.DEFAULT_MAP_VALUE)
35837
- end
35810
+ assertDefined(nil, defaultMapValue, (("Failed to deserialize a default map of \"" .. traversalDescription) .. "\", since there was no serialization brand of: ") .. SerializationBrand.DEFAULT_MAP_VALUE)
35838
35811
  return __TS__New(DefaultMap, defaultMapValue)
35839
35812
  end
35840
35813
  end
@@ -35925,16 +35898,16 @@ function deepCopyTSTLClass(self, tstlClass, serializationType, traversalDescript
35925
35898
  end
35926
35899
  local newClass
35927
35900
  repeat
35928
- local ____switch65 = serializationType
35929
- local ____cond65 = ____switch65 == SerializationType.NONE
35930
- if ____cond65 then
35901
+ local ____switch64 = serializationType
35902
+ local ____cond64 = ____switch64 == SerializationType.NONE
35903
+ if ____cond64 then
35931
35904
  do
35932
35905
  newClass = newTSTLClass(nil, tstlClass)
35933
35906
  break
35934
35907
  end
35935
35908
  end
35936
- ____cond65 = ____cond65 or ____switch65 == SerializationType.SERIALIZE
35937
- if ____cond65 then
35909
+ ____cond64 = ____cond64 or ____switch64 == SerializationType.SERIALIZE
35910
+ if ____cond64 then
35938
35911
  do
35939
35912
  newClass = {}
35940
35913
  local tstlClassName = getTSTLClassName(nil, tstlClass)
@@ -35944,20 +35917,16 @@ function deepCopyTSTLClass(self, tstlClass, serializationType, traversalDescript
35944
35917
  break
35945
35918
  end
35946
35919
  end
35947
- ____cond65 = ____cond65 or ____switch65 == SerializationType.DESERIALIZE
35948
- if ____cond65 then
35920
+ ____cond64 = ____cond64 or ____switch64 == SerializationType.DESERIALIZE
35921
+ if ____cond64 then
35949
35922
  do
35950
35923
  local tstlClassName = tstlClass[SerializationBrand.TSTL_CLASS]
35951
- if tstlClassName == nil then
35952
- error("Failed to deserialize a TSTL class since the brand did not contain the class name.")
35953
- end
35924
+ assertDefined(nil, tstlClassName, "Failed to deserialize a TSTL class since the brand did not contain the class name.")
35954
35925
  local classConstructor = classConstructors[tstlClassName]
35955
- if classConstructor == nil then
35956
- 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.")
35957
- end
35926
+ 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.")
35958
35927
  newClass = __TS__New(classConstructor)
35928
+ break
35959
35929
  end
35960
- break
35961
35930
  end
35962
35931
  until true
35963
35932
  local ____getCopiedEntries_result_4 = getCopiedEntries(
@@ -36062,7 +36031,7 @@ function getCopiedEntries(self, object, serializationType, traversalDescription,
36062
36031
  local value = ____value[2]
36063
36032
  do
36064
36033
  if isSerializationBrand(nil, key) then
36065
- goto __continue93
36034
+ goto __continue90
36066
36035
  end
36067
36036
  traversalDescription = getTraversalDescription(nil, key, traversalDescription)
36068
36037
  local newValue = ____exports.deepCopy(
@@ -36085,7 +36054,7 @@ function getCopiedEntries(self, object, serializationType, traversalDescription,
36085
36054
  end
36086
36055
  copiedEntries[#copiedEntries + 1] = {keyToUse, newValue}
36087
36056
  end
36088
- ::__continue93::
36057
+ ::__continue90::
36089
36058
  end
36090
36059
  return {entries = copiedEntries, convertedNumberKeysToStrings = convertNumberKeysToStrings}
36091
36060
  end
@@ -36098,29 +36067,26 @@ function checkMetatable(self, luaMap, traversalDescription)
36098
36067
  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.)")
36099
36068
  end
36100
36069
  function deepCopyUserdata(self, value, serializationType, traversalDescription)
36101
- local classType = getIsaacAPIClassName(nil, value)
36102
- if classType == nil then
36103
- error("The deep copy function was not able to derive the Isaac API class type for: " .. traversalDescription)
36104
- end
36105
36070
  if not isCopyableIsaacAPIClass(nil, value) then
36106
- error((("The deep copy function does not support serializing \"" .. traversalDescription) .. "\", since it is an Isaac API class of type: ") .. classType)
36071
+ local className = getIsaacAPIClassName(nil, value) or "Unknown"
36072
+ error((("The deep copy function does not support serializing \"" .. traversalDescription) .. "\", since it is an Isaac API class of type: ") .. className)
36107
36073
  end
36108
36074
  repeat
36109
- local ____switch104 = serializationType
36110
- local ____cond104 = ____switch104 == SerializationType.NONE
36111
- if ____cond104 then
36075
+ local ____switch100 = serializationType
36076
+ local ____cond100 = ____switch100 == SerializationType.NONE
36077
+ if ____cond100 then
36112
36078
  do
36113
36079
  return copyIsaacAPIClass(nil, value)
36114
36080
  end
36115
36081
  end
36116
- ____cond104 = ____cond104 or ____switch104 == SerializationType.SERIALIZE
36117
- if ____cond104 then
36082
+ ____cond100 = ____cond100 or ____switch100 == SerializationType.SERIALIZE
36083
+ if ____cond100 then
36118
36084
  do
36119
36085
  return serializeIsaacAPIClass(nil, value)
36120
36086
  end
36121
36087
  end
36122
- ____cond104 = ____cond104 or ____switch104 == SerializationType.DESERIALIZE
36123
- if ____cond104 then
36088
+ ____cond100 = ____cond100 or ____switch100 == SerializationType.DESERIALIZE
36089
+ if ____cond100 then
36124
36090
  do
36125
36091
  error(("The deep copy function can not deserialize \"" .. traversalDescription) .. "\", since it is userdata.")
36126
36092
  end
@@ -36968,7 +36934,7 @@ function ____exports.restoreDefaultForFeatureKey(self, saveDataDefaultsMap, subs
36968
36934
  end
36969
36935
  local childTableDefaults = saveDataDefaults[saveDataKey]
36970
36936
  if childTableDefaults == nil then
36971
- 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")
36937
+ 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")
36972
36938
  return
36973
36939
  end
36974
36940
  local childTableDefaultsCopy = deepCopy(nil, childTableDefaults, SerializationType.NONE, (subscriberName .. " --> ") .. saveDataKey)
@@ -37071,6 +37037,8 @@ local isTSTLClass = ____tstlClass.isTSTLClass
37071
37037
  local ____types = require("src.functions.types")
37072
37038
  local isString = ____types.isString
37073
37039
  local isTable = ____types.isTable
37040
+ local ____utils = require("src.functions.utils")
37041
+ local assertDefined = ____utils.assertDefined
37074
37042
  local ____ReadonlySet = require("src.types.ReadonlySet")
37075
37043
  local ReadonlySet = ____ReadonlySet.ReadonlySet
37076
37044
  local ____Feature = require("src.classes.private.Feature")
@@ -37149,9 +37117,7 @@ end
37149
37117
  function SaveDataManager.prototype.saveDataManager(self, key, v, conditionalFunc)
37150
37118
  if isTSTLClass(nil, key) then
37151
37119
  local className = getTSTLClassName(nil, key)
37152
- if className == nil then
37153
- 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.")
37154
- end
37120
+ 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.")
37155
37121
  key = className
37156
37122
  end
37157
37123
  if not isString(nil, key) then
@@ -37203,9 +37169,7 @@ function SaveDataManager.prototype.saveDataManagerRegisterClass(self, ...)
37203
37169
  local tstlClasses = {...}
37204
37170
  for ____, tstlClass in ipairs(tstlClasses) do
37205
37171
  local name = tstlClass.name
37206
- if name == nil then
37207
- error("Failed to register a class with the save data manager due to not being able to derive the name of the class.")
37208
- end
37172
+ 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.")
37209
37173
  self.classConstructors[name] = tstlClass
37210
37174
  end
37211
37175
  end
@@ -37228,9 +37192,7 @@ function SaveDataManager.prototype.saveDataManagerReset(self, key, childObjectKe
37228
37192
  error("The save data manager requires that keys are strings. You tried to use a key of type: " .. __TS__TypeOf(key))
37229
37193
  end
37230
37194
  local saveData = self.saveDataMap[key]
37231
- if saveData == nil then
37232
- error("The save data manager is not managing save data for a key of: " .. key)
37233
- end
37195
+ assertDefined(nil, saveData, "The save data manager is not managing save data for a key of: " .. key)
37234
37196
  restoreDefaultForFeatureKey(
37235
37197
  nil,
37236
37198
  self.saveDataDefaultsMap,
@@ -38129,6 +38091,7 @@ local ____trinkets = require("src.functions.trinkets")
38129
38091
  local getVanillaTrinketTypeRange = ____trinkets.getVanillaTrinketTypeRange
38130
38092
  local trinketHasCacheFlag = ____trinkets.trinketHasCacheFlag
38131
38093
  local ____utils = require("src.functions.utils")
38094
+ local assertDefined = ____utils.assertDefined
38132
38095
  local ____repeat = ____utils["repeat"]
38133
38096
  local ____itemConfigCardTypesForCardsSet = require("src.sets.itemConfigCardTypesForCardsSet")
38134
38097
  local ITEM_CONFIG_CARD_TYPES_FOR_CARDS_SET = ____itemConfigCardTypesForCardsSet.ITEM_CONFIG_CARD_TYPES_FOR_CARDS_SET
@@ -38422,9 +38385,11 @@ function ModdedElementSets.prototype.lazyInitCardTypes(self)
38422
38385
  local itemConfigCardType = getItemConfigCardType(nil, cardType)
38423
38386
  if itemConfigCardType ~= nil then
38424
38387
  local cardTypeSet = self.itemConfigCardTypeToCardTypeMap:get(itemConfigCardType)
38425
- if cardTypeSet == nil then
38426
- error("Failed to get the card set for item config card type: " .. tostring(itemConfigCardType))
38427
- end
38388
+ assertDefined(
38389
+ nil,
38390
+ cardTypeSet,
38391
+ "Failed to get the card set for item config card type: " .. tostring(itemConfigCardType)
38392
+ )
38428
38393
  cardTypeSet:add(cardType)
38429
38394
  if ITEM_CONFIG_CARD_TYPES_FOR_CARDS_SET:has(itemConfigCardType) then
38430
38395
  self.cardSet:add(cardType)
@@ -38450,9 +38415,11 @@ function ModdedElementSets.prototype.getCardTypesOfType(self, ...)
38450
38415
  local matchingCardTypes = __TS__New(Set)
38451
38416
  for ____, itemConfigCardType in ipairs(itemConfigCardTypes) do
38452
38417
  local cardTypeSet = self.itemConfigCardTypeToCardTypeMap:get(itemConfigCardType)
38453
- if cardTypeSet == nil then
38454
- error("Failed to get the card type set for item config type: " .. tostring(itemConfigCardType))
38455
- end
38418
+ assertDefined(
38419
+ nil,
38420
+ cardTypeSet,
38421
+ "Failed to get the card type set for item config type: " .. tostring(itemConfigCardType)
38422
+ )
38456
38423
  for ____, cardType in __TS__Iterator(cardTypeSet) do
38457
38424
  matchingCardTypes:add(cardType)
38458
38425
  end
@@ -38472,9 +38439,11 @@ end
38472
38439
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCollectibleSet", true)
38473
38440
  function ModdedElementSets.prototype.getCollectiblesForTransformation(self, playerForm)
38474
38441
  local itemConfigTag = TRANSFORMATION_TO_TAG_MAP:get(playerForm)
38475
- if itemConfigTag == nil then
38476
- error(("Failed to get the collectible types for the transformation of " .. tostring(playerForm)) .. " because that transformation is not based on collectibles.")
38477
- end
38442
+ assertDefined(
38443
+ nil,
38444
+ itemConfigTag,
38445
+ ("Failed to get the collectible types for the transformation of " .. tostring(playerForm)) .. " because that transformation is not based on collectibles."
38446
+ )
38478
38447
  return self:getCollectiblesWithTag(itemConfigTag)
38479
38448
  end
38480
38449
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCollectiblesForTransformation", true)
@@ -38490,9 +38459,11 @@ __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCollectiblesWi
38490
38459
  function ModdedElementSets.prototype.getCollectiblesWithTag(self, itemConfigTag)
38491
38460
  self:lazyInitTagToCollectibleTypesMap()
38492
38461
  local collectibleTypes = self.tagToCollectibleTypesMap:get(itemConfigTag)
38493
- if collectibleTypes == nil then
38494
- error(("The item config tag of " .. tostring(itemConfigTag)) .. " is not a valid value of the \"ItemConfigTag\" enum.")
38495
- end
38462
+ assertDefined(
38463
+ nil,
38464
+ collectibleTypes,
38465
+ ("The item config tag of " .. tostring(itemConfigTag)) .. " is not a valid value of the \"ItemConfigTag\" enum."
38466
+ )
38496
38467
  return collectibleTypes
38497
38468
  end
38498
38469
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCollectiblesWithTag", true)
@@ -39715,7 +39686,7 @@ function CharacterHealthConversion.prototype.____constructor(self)
39715
39686
  local character = player:GetPlayerType()
39716
39687
  local conversionHeartSubType = self.characterHealthReplacementMap:get(character)
39717
39688
  if conversionHeartSubType == nil then
39718
- return
39689
+ return nil
39719
39690
  end
39720
39691
  convertRedHeartContainers(nil, player, conversionHeartSubType)
39721
39692
  removeRedHearts(nil, player)
@@ -40071,6 +40042,8 @@ local ____array = require("src.functions.array")
40071
40042
  local sumArray = ____array.sumArray
40072
40043
  local ____string = require("src.functions.string")
40073
40044
  local getPartialMatch = ____string.getPartialMatch
40045
+ local ____utils = require("src.functions.utils")
40046
+ local assertDefined = ____utils.assertDefined
40074
40047
  function ____exports.mapSetHash(self, map, entity, value)
40075
40048
  local hash = GetPtrHash(entity)
40076
40049
  map:set(hash, value)
@@ -40098,9 +40071,7 @@ function ____exports.getMapPartialMatch(self, searchText, map)
40098
40071
  return nil
40099
40072
  end
40100
40073
  local value = map:get(matchingKey)
40101
- if value == nil then
40102
- error("Failed to get the map value corresponding to the partial match of: " .. matchingKey)
40103
- end
40074
+ assertDefined(nil, value, "Failed to get the map value corresponding to the partial match of: " .. matchingKey)
40104
40075
  return {matchingKey, value}
40105
40076
  end
40106
40077
  function ____exports.getReversedMap(self, map)
@@ -40134,6 +40105,8 @@ local ____random = require("src.functions.random")
40134
40105
  local getRandomFloat = ____random.getRandomFloat
40135
40106
  local ____rng = require("src.functions.rng")
40136
40107
  local getRandomSeed = ____rng.getRandomSeed
40108
+ local ____utils = require("src.functions.utils")
40109
+ local assertDefined = ____utils.assertDefined
40137
40110
  function ____exports.getRandomIndexFromWeightedArray(self, weightedArray, seedOrRNG)
40138
40111
  if seedOrRNG == nil then
40139
40112
  seedOrRNG = getRandomSeed(nil)
@@ -40165,9 +40138,11 @@ function ____exports.getRandomFromWeightedArray(self, weightedArray, seedOrRNG)
40165
40138
  end
40166
40139
  local randomIndex = ____exports.getRandomIndexFromWeightedArray(nil, weightedArray, seedOrRNG)
40167
40140
  local randomElement = weightedArray[randomIndex + 1]
40168
- if randomElement == nil then
40169
- error("Failed to get an element from a weighted array using a random index of: " .. tostring(randomIndex))
40170
- end
40141
+ assertDefined(
40142
+ nil,
40143
+ randomElement,
40144
+ "Failed to get an element from a weighted array using a random index of: " .. tostring(randomIndex)
40145
+ )
40171
40146
  return randomElement[1]
40172
40147
  end
40173
40148
  return ____exports
@@ -40192,6 +40167,8 @@ local ____map = require("src.functions.map")
40192
40167
  local copyMap = ____map.copyMap
40193
40168
  local ____rng = require("src.functions.rng")
40194
40169
  local getRandomSeed = ____rng.getRandomSeed
40170
+ local ____utils = require("src.functions.utils")
40171
+ local assertDefined = ____utils.assertDefined
40195
40172
  local ____weighted = require("src.functions.weighted")
40196
40173
  local getRandomIndexFromWeightedArray = ____weighted.getRandomIndexFromWeightedArray
40197
40174
  local ____Feature = require("src.classes.private.Feature")
@@ -40228,17 +40205,21 @@ function CustomItemPools.prototype.getCustomItemPoolCollectible(self, itemPoolTy
40228
40205
  defaultItem = CollectibleType.NULL
40229
40206
  end
40230
40207
  local customItemPool = v.run.customItemPools:get(itemPoolTypeCustom)
40231
- if customItemPool == nil then
40232
- error("Failed to find the custom item pool of: " .. tostring(itemPoolTypeCustom))
40233
- end
40208
+ assertDefined(
40209
+ nil,
40210
+ customItemPool,
40211
+ "Failed to find the custom item pool of: " .. tostring(itemPoolTypeCustom)
40212
+ )
40234
40213
  if #customItemPool == 0 then
40235
40214
  return defaultItem
40236
40215
  end
40237
40216
  local randomIndex = getRandomIndexFromWeightedArray(nil, customItemPool, seedOrRNG)
40238
40217
  local tuple = customItemPool[randomIndex + 1]
40239
- if tuple == nil then
40240
- error("Failed to get an element from a custom item pool using a random index of: " .. tostring(randomIndex))
40241
- end
40218
+ assertDefined(
40219
+ nil,
40220
+ tuple,
40221
+ "Failed to get an element from a custom item pool using a random index of: " .. tostring(randomIndex)
40222
+ )
40242
40223
  if decrease then
40243
40224
  arrayRemoveIndexInPlace(nil, customItemPool, randomIndex)
40244
40225
  end
@@ -40926,8 +40907,8 @@ local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
40926
40907
  local ____decorators = require("src.decorators")
40927
40908
  local Exported = ____decorators.Exported
40928
40909
  local ____input = require("src.functions.input")
40929
- local getMoveActions = ____input.getMoveActions
40930
- local getShootActions = ____input.getShootActions
40910
+ local MOVEMENT_ACTIONS_SET = ____input.MOVEMENT_ACTIONS_SET
40911
+ local SHOOTING_ACTIONS_SET = ____input.SHOOTING_ACTIONS_SET
40931
40912
  local ____ReadonlySet = require("src.types.ReadonlySet")
40932
40913
  local ReadonlySet = ____ReadonlySet.ReadonlySet
40933
40914
  local ____Feature = require("src.classes.private.Feature")
@@ -41009,13 +40990,11 @@ function DisableInputs.prototype.disableAllInputsExceptFor(self, key, whitelist)
41009
40990
  end
41010
40991
  __TS__DecorateLegacy({Exported}, DisableInputs.prototype, "disableAllInputsExceptFor", true)
41011
40992
  function DisableInputs.prototype.disableMovementInputs(self, key)
41012
- local moveActions = getMoveActions(nil)
41013
- self:enableAllInputsExceptFor(key, moveActions)
40993
+ self:enableAllInputsExceptFor(key, MOVEMENT_ACTIONS_SET)
41014
40994
  end
41015
40995
  __TS__DecorateLegacy({Exported}, DisableInputs.prototype, "disableMovementInputs", true)
41016
40996
  function DisableInputs.prototype.disableShootingInputs(self, key)
41017
- local shootActions = getShootActions(nil)
41018
- self:enableAllInputsExceptFor(key, shootActions)
40997
+ self:enableAllInputsExceptFor(key, SHOOTING_ACTIONS_SET)
41019
40998
  end
41020
40999
  __TS__DecorateLegacy({Exported}, DisableInputs.prototype, "disableShootingInputs", true)
41021
41000
  return ____exports
@@ -41568,6 +41547,8 @@ local ____stage = require("src.functions.stage")
41568
41547
  local setStage = ____stage.setStage
41569
41548
  local ____tstlClass = require("src.functions.tstlClass")
41570
41549
  local getTSTLClassName = ____tstlClass.getTSTLClassName
41550
+ local ____utils = require("src.functions.utils")
41551
+ local assertDefined = ____utils.assertDefined
41571
41552
  local ____vector = require("src.functions.vector")
41572
41553
  local isVector = ____vector.isVector
41573
41554
  local ____ReadonlySet = require("src.types.ReadonlySet")
@@ -41783,9 +41764,7 @@ function CustomTrapdoors.prototype.checkAllPlayersLayingDownComplete(self)
41783
41764
  v.run.state = StageTravelState.NONE
41784
41765
  self:logStateChanged()
41785
41766
  local tstlClassName = getTSTLClassName(nil, self)
41786
- if tstlClassName == nil then
41787
- error("Failed to find get the class name for the custom trapdoor feature.")
41788
- end
41767
+ assertDefined(nil, tstlClassName, "Failed to find get the class name for the custom trapdoor feature.")
41789
41768
  self.disableInputs:enableAllInputs(tstlClassName)
41790
41769
  end
41791
41770
  function CustomTrapdoors.prototype.drawBlackSprite(self)
@@ -41834,14 +41813,14 @@ function CustomTrapdoors.prototype.checkCustomTrapdoorPlayerTouched(self, gridEn
41834
41813
  do
41835
41814
  local player = playerEntity:ToPlayer()
41836
41815
  if player == nil then
41837
- goto __continue43
41816
+ goto __continue42
41838
41817
  end
41839
41818
  if not self.ponyDetection:isPlayerUsingPony(player) and not isChildPlayer(nil, player) and canPlayerInteractWithTrapdoor(nil, player) then
41840
41819
  self:playerTouchedCustomTrapdoor(gridEntity, trapdoorDescription, player)
41841
41820
  return
41842
41821
  end
41843
41822
  end
41844
- ::__continue43::
41823
+ ::__continue42::
41845
41824
  end
41846
41825
  end
41847
41826
  function CustomTrapdoors.prototype.playerTouchedCustomTrapdoor(self, gridEntity, trapdoorDescription, player)
@@ -41849,9 +41828,7 @@ function CustomTrapdoors.prototype.playerTouchedCustomTrapdoor(self, gridEntity,
41849
41828
  v.run.customTrapdoorActivated = trapdoorDescription
41850
41829
  self:logStateChanged()
41851
41830
  local tstlClassName = getTSTLClassName(nil, self)
41852
- if tstlClassName == nil then
41853
- error("Failed to find get the class name for the custom trapdoor feature.")
41854
- end
41831
+ assertDefined(nil, tstlClassName, "Failed to find get the class name for the custom trapdoor feature.")
41855
41832
  local whitelist = __TS__New(ReadonlySet, {ButtonAction.CONSOLE})
41856
41833
  self.disableInputs:disableAllInputsExceptFor(tstlClassName, whitelist)
41857
41834
  setPlayerAttributes(nil, player, gridEntity.Position)
@@ -42089,6 +42066,8 @@ local ____players = require("src.functions.players")
42089
42066
  local useActiveItemTemp = ____players.useActiveItemTemp
42090
42067
  local ____tstlClass = require("src.functions.tstlClass")
42091
42068
  local getTSTLClassName = ____tstlClass.getTSTLClassName
42069
+ local ____utils = require("src.functions.utils")
42070
+ local assertDefined = ____utils.assertDefined
42092
42071
  local ____ReadonlySet = require("src.types.ReadonlySet")
42093
42072
  local ReadonlySet = ____ReadonlySet.ReadonlySet
42094
42073
  local ____Feature = require("src.classes.private.Feature")
@@ -42186,9 +42165,7 @@ function Pause.prototype.pause(self)
42186
42165
  local firstPlayer = Isaac.GetPlayer()
42187
42166
  useActiveItemTemp(nil, firstPlayer, CollectibleType.PAUSE)
42188
42167
  local tstlClassName = getTSTLClassName(nil, self)
42189
- if tstlClassName == nil then
42190
- error("Failed to get the class name for the pause feature.")
42191
- end
42168
+ assertDefined(nil, tstlClassName, "Failed to get the class name for the pause feature.")
42192
42169
  local whitelist = __TS__New(ReadonlySet, {ButtonAction.MENU_CONFIRM, ButtonAction.CONSOLE})
42193
42170
  self.disableInputs:disableAllInputsExceptFor(tstlClassName, whitelist)
42194
42171
  for ____, player in ipairs(getAllPlayers(nil)) do
@@ -42206,9 +42183,7 @@ function Pause.prototype.unpause(self)
42206
42183
  v.run.isPseudoPaused = false
42207
42184
  v.run.shouldUnpause = true
42208
42185
  local tstlClassName = getTSTLClassName(nil, self)
42209
- if tstlClassName == nil then
42210
- error("Failed to find get the class name for the pause feature.")
42211
- end
42186
+ assertDefined(nil, tstlClassName, "Failed to find get the class name for the pause feature.")
42212
42187
  self.disableInputs:enableAllInputs(tstlClassName)
42213
42188
  for ____, player in ipairs(getAllPlayers(nil)) do
42214
42189
  player.ControlsEnabled = true
@@ -42248,6 +42223,7 @@ local ____string = require("src.functions.string")
42248
42223
  local removeCharactersBefore = ____string.removeCharactersBefore
42249
42224
  local trimPrefix = ____string.trimPrefix
42250
42225
  local ____utils = require("src.functions.utils")
42226
+ local assertDefined = ____utils.assertDefined
42251
42227
  local eRange = ____utils.eRange
42252
42228
  local iRange = ____utils.iRange
42253
42229
  local ____ReadonlySet = require("src.types.ReadonlySet")
@@ -42276,9 +42252,7 @@ function spawnWallEntity(self, customStage, rng, isExtraWall)
42276
42252
  sprite:Load(ISAACSCRIPT_CUSTOM_STAGE_GFX_PATH .. "/wall-backdrop.anm2", false)
42277
42253
  local wallLayersArray = isExtraWall and ROOM_SHAPE_WALL_EXTRA_ANM2_LAYERS or ROOM_SHAPE_WALL_ANM2_LAYERS
42278
42254
  local numWallLayers = wallLayersArray[roomShape]
42279
- if numWallLayers == nil then
42280
- error("Failed to get the layers when creating the backdrop for custom stage: " .. customStage.name)
42281
- end
42255
+ assertDefined(nil, numWallLayers, "Failed to get the layers when creating the backdrop for custom stage: " .. customStage.name)
42282
42256
  if isLRoomShape(nil, roomShape) then
42283
42257
  local cornerPNGPath = getBackdropPNGPath(nil, customStage, BackdropKind.CORNER, rng)
42284
42258
  sprite:ReplaceSpritesheet(0, cornerPNGPath)
@@ -42348,21 +42322,21 @@ function spawnFloorEntity(self, customStage, rng)
42348
42322
  end
42349
42323
  function getNumFloorLayers(self, roomShape)
42350
42324
  repeat
42351
- local ____switch23 = roomShape
42352
- local ____cond23 = ____switch23 == RoomShape.SHAPE_1x1
42353
- if ____cond23 then
42325
+ local ____switch22 = roomShape
42326
+ local ____cond22 = ____switch22 == RoomShape.SHAPE_1x1
42327
+ if ____cond22 then
42354
42328
  do
42355
42329
  return 4
42356
42330
  end
42357
42331
  end
42358
- ____cond23 = ____cond23 or (____switch23 == RoomShape.SHAPE_1x2 or ____switch23 == RoomShape.SHAPE_2x1)
42359
- if ____cond23 then
42332
+ ____cond22 = ____cond22 or (____switch22 == RoomShape.SHAPE_1x2 or ____switch22 == RoomShape.SHAPE_2x1)
42333
+ if ____cond22 then
42360
42334
  do
42361
42335
  return 8
42362
42336
  end
42363
42337
  end
42364
- ____cond23 = ____cond23 or ____switch23 == RoomShape.SHAPE_2x2
42365
- if ____cond23 then
42338
+ ____cond22 = ____cond22 or ____switch22 == RoomShape.SHAPE_2x2
42339
+ if ____cond22 then
42366
42340
  do
42367
42341
  return 16
42368
42342
  end
@@ -43176,6 +43150,8 @@ local ____entities = require("src.functions.entities")
43176
43150
  local parseEntityTypeVariantString = ____entities.parseEntityTypeVariantString
43177
43151
  local ____set = require("src.functions.set")
43178
43152
  local copySet = ____set.copySet
43153
+ local ____utils = require("src.functions.utils")
43154
+ local assertDefined = ____utils.assertDefined
43179
43155
  local ____ReadonlyMap = require("src.types.ReadonlyMap")
43180
43156
  local ReadonlyMap = ____ReadonlyMap.ReadonlyMap
43181
43157
  local ____ReadonlySet = require("src.types.ReadonlySet")
@@ -43187,9 +43163,7 @@ function getAllBossesExcludingStoryBossesSet(self)
43187
43163
  local allBosses = {__TS__Spread(____exports.ALL_BOSSES_SET:values())}
43188
43164
  for ____, entityTypeVariantString in ipairs(allBosses) do
43189
43165
  local tuple = parseEntityTypeVariantString(nil, entityTypeVariantString)
43190
- if tuple == nil then
43191
- error("Failed to parse a boss tuple when constructing the story boss set.")
43192
- end
43166
+ assertDefined(nil, tuple, "Failed to parse a boss tuple when constructing the story boss set.")
43193
43167
  local entityType, _variant = table.unpack(tuple)
43194
43168
  if STORY_BOSSES_SET:has(entityType) then
43195
43169
  allBossesExcludingStoryBossesSet:delete(entityTypeVariantString)
@@ -44728,6 +44702,8 @@ local ____stage = require("src.functions.stage")
44728
44702
  local setStage = ____stage.setStage
44729
44703
  local ____types = require("src.functions.types")
44730
44704
  local asNumber = ____types.asNumber
44705
+ local ____utils = require("src.functions.utils")
44706
+ local assertDefined = ____utils.assertDefined
44731
44707
  local ____Feature = require("src.classes.private.Feature")
44732
44708
  local Feature = ____Feature.Feature
44733
44709
  local ____backdrop = require("src.classes.features.other.customStages.backdrop")
@@ -44794,9 +44770,7 @@ function CustomStages.prototype.____constructor(self, customGridEntities, custom
44794
44770
  self.customStageCachedRoomData = __TS__New(Map)
44795
44771
  self.usingRedKey = false
44796
44772
  self.goToCustomStage = function(____, destinationName, destinationStage, _destinationStageType)
44797
- if destinationName == nil then
44798
- error("Failed to go to a custom stage since the custom trapdoors feature did not pass a destination name to the logic function.")
44799
- end
44773
+ 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.")
44800
44774
  local firstFloor = destinationStage == LevelStage.BASEMENT_1
44801
44775
  self:setCustomStage(destinationName, firstFloor)
44802
44776
  end
@@ -44959,10 +44933,10 @@ function CustomStages.prototype.setStageRoomsData(self, customStage, rng, verbos
44959
44933
  for ____, room in ipairs(getRoomsInsideGrid(nil)) do
44960
44934
  do
44961
44935
  if room.SafeGridIndex == startingRoomGridIndex then
44962
- goto __continue36
44936
+ goto __continue35
44963
44937
  end
44964
44938
  if room.Data == nil then
44965
- goto __continue36
44939
+ goto __continue35
44966
44940
  end
44967
44941
  local roomType = room.Data.Type
44968
44942
  local roomShapeMap = customStage.roomTypeMap:get(roomType)
@@ -44970,13 +44944,13 @@ function CustomStages.prototype.setStageRoomsData(self, customStage, rng, verbos
44970
44944
  if roomType == RoomType.DEFAULT then
44971
44945
  logError((((("Failed to find any custom rooms for RoomType." .. RoomType[roomType]) .. " (") .. tostring(roomType)) .. ") for custom stage: ") .. customStage.name)
44972
44946
  end
44973
- goto __continue36
44947
+ goto __continue35
44974
44948
  end
44975
44949
  local roomShape = room.Data.Shape
44976
44950
  local roomDoorSlotFlagMap = roomShapeMap:get(roomShape)
44977
44951
  if roomDoorSlotFlagMap == nil then
44978
44952
  logError((((((((("Failed to find any custom rooms for RoomType." .. RoomType[roomType]) .. " (") .. tostring(roomType)) .. ") + RoomShape.") .. RoomShape[roomShape]) .. " (") .. tostring(roomShape)) .. ") for custom stage: ") .. customStage.name)
44979
- goto __continue36
44953
+ goto __continue35
44980
44954
  end
44981
44955
  local doorSlotFlags = room.Data.Doors
44982
44956
  local roomsMetadata = roomDoorSlotFlagMap:get(doorSlotFlags)
@@ -44986,13 +44960,13 @@ function CustomStages.prototype.setStageRoomsData(self, customStage, rng, verbos
44986
44960
  roomsMetadata = roomDoorSlotFlagMap:get(allDoorSlotFlags)
44987
44961
  if roomsMetadata == nil then
44988
44962
  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)
44989
- goto __continue36
44963
+ goto __continue35
44990
44964
  end
44991
44965
  end
44992
44966
  local randomRoom
44993
44967
  if roomType == RoomType.BOSS then
44994
44968
  if customStage.bossPool == nil then
44995
- goto __continue36
44969
+ goto __continue35
44996
44970
  end
44997
44971
  randomRoom = getRandomBossRoomFromPool(
44998
44972
  nil,
@@ -45015,13 +44989,13 @@ function CustomStages.prototype.setStageRoomsData(self, customStage, rng, verbos
45015
44989
  )
45016
44990
  if newRoomData == nil then
45017
44991
  logError((("Failed to get the room data for room variant " .. tostring(randomRoom.variant)) .. " for custom stage: ") .. customStage.name)
45018
- goto __continue36
44992
+ goto __continue35
45019
44993
  end
45020
44994
  self.customStageCachedRoomData:set(randomRoom.variant, newRoomData)
45021
44995
  end
45022
44996
  room.Data = newRoomData
45023
44997
  end
45024
- ::__continue36::
44998
+ ::__continue35::
45025
44999
  end
45026
45000
  end
45027
45001
  function CustomStages.prototype.setCustomStage(self, name, firstFloor, streakText, verbose)
@@ -45035,9 +45009,7 @@ function CustomStages.prototype.setCustomStage(self, name, firstFloor, streakTex
45035
45009
  verbose = false
45036
45010
  end
45037
45011
  local customStage = self.customStagesMap:get(name)
45038
- if customStage == nil then
45039
- 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.")
45040
- end
45012
+ 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.")
45041
45013
  local level = game:GetLevel()
45042
45014
  local stage = level:GetStage()
45043
45015
  local seeds = game:GetSeeds()
@@ -46022,6 +45994,8 @@ local isLRoomShape = ____roomShape.isLRoomShape
46022
45994
  local ____rooms = require("src.functions.rooms")
46023
45995
  local inBossRoomOf = ____rooms.inBossRoomOf
46024
45996
  local inHomeCloset = ____rooms.inHomeCloset
45997
+ local ____utils = require("src.functions.utils")
45998
+ local assertDefined = ____utils.assertDefined
46025
45999
  function getVanillaWallGridIndexSetForRoomShape(self, roomShape)
46026
46000
  local corners = getRoomShapeCorners(nil, roomShape)
46027
46001
  local lRoom = isLRoomShape(nil, roomShape)
@@ -46253,9 +46227,11 @@ function ____exports.isVanillaWallGridIndex(self, gridIndex)
46253
46227
  wallGridIndexSet = MOTHER_ROOM_CORNERS_SET
46254
46228
  else
46255
46229
  wallGridIndexSet = ROOM_SHAPE_TO_WALL_GRID_INDEX_SET:get(roomShape)
46256
- end
46257
- if wallGridIndexSet == nil then
46258
- error(((("Failed to find the wall grid index set for: RoomShape." .. RoomShape[roomShape]) .. " (") .. tostring(roomShape)) .. ")")
46230
+ assertDefined(
46231
+ nil,
46232
+ wallGridIndexSet,
46233
+ ((("Failed to find the wall grid index set for: RoomShape." .. RoomShape[roomShape]) .. " (") .. tostring(roomShape)) .. ")"
46234
+ )
46259
46235
  end
46260
46236
  return wallGridIndexSet:has(gridIndex)
46261
46237
  end
@@ -46351,11 +46327,14 @@ local ____exports = {}
46351
46327
  local getTotalWeightOfJSONObject, getJSONObjectWithChosenWeight
46352
46328
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
46353
46329
  local DoorSlotFlagZero = ____isaac_2Dtypescript_2Ddefinitions.DoorSlotFlagZero
46330
+ local RoomShape = ____isaac_2Dtypescript_2Ddefinitions.RoomShape
46354
46331
  local ____array = require("src.functions.array")
46355
46332
  local sumArray = ____array.sumArray
46356
46333
  local ____doors = require("src.functions.doors")
46357
46334
  local doorSlotToDoorSlotFlag = ____doors.doorSlotToDoorSlotFlag
46358
46335
  local getRoomShapeDoorSlot = ____doors.getRoomShapeDoorSlot
46336
+ local ____enums = require("src.functions.enums")
46337
+ local isEnumValue = ____enums.isEnumValue
46359
46338
  local ____flag = require("src.functions.flag")
46360
46339
  local addFlag = ____flag.addFlag
46361
46340
  local ____log = require("src.functions.log")
@@ -46364,15 +46343,19 @@ local ____random = require("src.functions.random")
46364
46343
  local getRandomFloat = ____random.getRandomFloat
46365
46344
  local ____rng = require("src.functions.rng")
46366
46345
  local getRandomSeed = ____rng.getRandomSeed
46346
+ local ____utils = require("src.functions.utils")
46347
+ local assertDefined = ____utils.assertDefined
46367
46348
  function getTotalWeightOfJSONObject(self, jsonOjectArray)
46368
46349
  local weights = __TS__ArrayMap(
46369
46350
  jsonOjectArray,
46370
46351
  function(____, jsonObject)
46371
46352
  local weightString = jsonObject["$"].weight
46372
46353
  local weight = tonumber(weightString)
46373
- if weight == nil then
46374
- error(("Failed to parse the weight of a JSON object: " .. tostring(weightString)) .. ".")
46375
- end
46354
+ assertDefined(
46355
+ nil,
46356
+ weight,
46357
+ ("Failed to parse the weight of a JSON object: " .. tostring(weightString)) .. "."
46358
+ )
46376
46359
  return weight
46377
46360
  end
46378
46361
  )
@@ -46383,9 +46366,11 @@ function getJSONObjectWithChosenWeight(self, jsonOjectArray, chosenWeight)
46383
46366
  for ____, jsonObject in ipairs(jsonOjectArray) do
46384
46367
  local weightString = jsonObject["$"].weight
46385
46368
  local weight = tonumber(weightString)
46386
- if weight == nil then
46387
- error("Failed to parse the weight of a JSON object: " .. tostring(weightString))
46388
- end
46369
+ assertDefined(
46370
+ nil,
46371
+ weight,
46372
+ "Failed to parse the weight of a JSON object: " .. tostring(weightString)
46373
+ )
46389
46374
  weightAccumulator = weightAccumulator + weight
46390
46375
  if weightAccumulator >= chosenWeight then
46391
46376
  return jsonObject
@@ -46396,8 +46381,9 @@ end
46396
46381
  function ____exports.getJSONRoomDoorSlotFlags(self, jsonRoom)
46397
46382
  local roomShapeString = jsonRoom["$"].shape
46398
46383
  local roomShapeNumber = tonumber(roomShapeString)
46399
- if roomShapeNumber == nil then
46400
- error("Failed to parse the \"shape\" field of a JSON room: " .. roomShapeString)
46384
+ assertDefined(nil, roomShapeNumber, "Failed to parse the \"shape\" field of a JSON room: " .. roomShapeString)
46385
+ if not isEnumValue(nil, roomShapeNumber, RoomShape) then
46386
+ error("Failed to parse the \"shape\" field of a JSON room since it was an invalid number: " .. tostring(roomShapeNumber))
46401
46387
  end
46402
46388
  local roomShape = roomShapeNumber
46403
46389
  local doorSlotFlags = DoorSlotFlagZero
@@ -46412,18 +46398,16 @@ function ____exports.getJSONRoomDoorSlotFlags(self, jsonRoom)
46412
46398
  end
46413
46399
  local xString = door["$"].x
46414
46400
  local x = tonumber(xString)
46415
- if x == nil then
46416
- error("Failed to parse the \"x\" field of a JSON room door: " .. xString)
46417
- end
46401
+ assertDefined(nil, x, "Failed to parse the \"x\" field of a JSON room door: " .. xString)
46418
46402
  local yString = door["$"].y
46419
46403
  local y = tonumber(yString)
46420
- if y == nil then
46421
- error("Failed to parse the \"y\" field of a JSON room door: " .. yString)
46422
- end
46404
+ assertDefined(nil, y, "Failed to parse the \"y\" field of a JSON room door: " .. yString)
46423
46405
  local doorSlot = getRoomShapeDoorSlot(nil, roomShape, x, y)
46424
- if doorSlot == nil then
46425
- error(((("Failed to retrieve the door slot for a JSON room door at coordinates: [" .. tostring(x)) .. ", ") .. tostring(y)) .. "]")
46426
- end
46406
+ assertDefined(
46407
+ nil,
46408
+ doorSlot,
46409
+ ((("Failed to retrieve the door slot for a JSON room door at coordinates: [" .. tostring(x)) .. ", ") .. tostring(y)) .. "]"
46410
+ )
46427
46411
  local doorSlotFlag = doorSlotToDoorSlotFlag(nil, doorSlot)
46428
46412
  doorSlotFlags = addFlag(nil, doorSlotFlags, doorSlotFlag)
46429
46413
  end
@@ -46474,9 +46458,11 @@ function ____exports.getRandomJSONEntity(self, jsonEntities, seedOrRNG, verbose)
46474
46458
  log("Randomly chose weight for JSON entity: " .. tostring(chosenWeight))
46475
46459
  end
46476
46460
  local randomJSONEntity = getJSONObjectWithChosenWeight(nil, jsonEntities, chosenWeight)
46477
- if randomJSONEntity == nil then
46478
- error("Failed to get a JSON entity with chosen weight: " .. tostring(chosenWeight))
46479
- end
46461
+ assertDefined(
46462
+ nil,
46463
+ randomJSONEntity,
46464
+ "Failed to get a JSON entity with chosen weight: " .. tostring(chosenWeight)
46465
+ )
46480
46466
  return randomJSONEntity
46481
46467
  end
46482
46468
  function ____exports.getRandomJSONRoom(self, jsonRooms, seedOrRNG, verbose)
@@ -46495,9 +46481,11 @@ function ____exports.getRandomJSONRoom(self, jsonRooms, seedOrRNG, verbose)
46495
46481
  log("Randomly chose weight for JSON room: " .. tostring(chosenWeight))
46496
46482
  end
46497
46483
  local randomJSONRoom = getJSONObjectWithChosenWeight(nil, jsonRooms, chosenWeight)
46498
- if randomJSONRoom == nil then
46499
- error("Failed to get a JSON room with chosen weight: " .. tostring(chosenWeight))
46500
- end
46484
+ assertDefined(
46485
+ nil,
46486
+ randomJSONRoom,
46487
+ "Failed to get a JSON room with chosen weight: " .. tostring(chosenWeight)
46488
+ )
46501
46489
  return randomJSONRoom
46502
46490
  end
46503
46491
  return ____exports
@@ -47037,6 +47025,8 @@ local setRoomUncleared = ____rooms.setRoomUncleared
47037
47025
  local ____types = require("src.functions.types")
47038
47026
  local asCollectibleType = ____types.asCollectibleType
47039
47027
  local asNumber = ____types.asNumber
47028
+ local ____utils = require("src.functions.utils")
47029
+ local assertDefined = ____utils.assertDefined
47040
47030
  local ____ReadonlySet = require("src.types.ReadonlySet")
47041
47031
  local ReadonlySet = ____ReadonlySet.ReadonlySet
47042
47032
  local ____Feature = require("src.classes.private.Feature")
@@ -47190,30 +47180,28 @@ function DeployJSONRoom.prototype.spawnAllEntities(self, jsonRoom, rng, verbose)
47190
47180
  for ____, jsonSpawn in ipairs(jsonRoom.spawn) do
47191
47181
  local xString = jsonSpawn["$"].x
47192
47182
  local x = tonumber(xString)
47193
- if x == nil then
47194
- error("Failed to convert the following x coordinate to a number (for a spawn): " .. xString)
47195
- end
47183
+ assertDefined(nil, x, "Failed to convert the following x coordinate to a number (for a spawn): " .. xString)
47196
47184
  local yString = jsonSpawn["$"].y
47197
47185
  local y = tonumber(yString)
47198
- if y == nil then
47199
- error("Failed to convert the following y coordinate to a number (for a spawn): " .. yString)
47200
- end
47186
+ assertDefined(nil, y, "Failed to convert the following y coordinate to a number (for a spawn): " .. yString)
47201
47187
  local jsonEntity = getRandomJSONEntity(nil, jsonSpawn.entity)
47202
47188
  local entityTypeString = jsonEntity["$"].type
47203
47189
  local entityTypeNumber = tonumber(entityTypeString)
47204
- if entityTypeNumber == nil then
47205
- error("Failed to convert the entity type to a number: " .. entityTypeString)
47206
- end
47190
+ assertDefined(nil, entityTypeNumber, "Failed to convert the entity type to a number: " .. entityTypeString)
47207
47191
  local variantString = jsonEntity["$"].variant
47208
47192
  local variant = tonumber(variantString)
47209
- if variant == nil then
47210
- error("Failed to convert the entity variant to a number: " .. tostring(variant))
47211
- end
47193
+ assertDefined(
47194
+ nil,
47195
+ variant,
47196
+ "Failed to convert the entity variant to a number: " .. tostring(variant)
47197
+ )
47212
47198
  local subTypeString = jsonEntity["$"].subtype
47213
47199
  local subType = tonumber(subTypeString)
47214
- if subType == nil then
47215
- error("Failed to convert the entity sub-type to a number: " .. tostring(subType))
47216
- end
47200
+ assertDefined(
47201
+ nil,
47202
+ subType,
47203
+ "Failed to convert the entity sub-type to a number: " .. tostring(subType)
47204
+ )
47217
47205
  local isGridEntity = GRID_ENTITY_XML_TYPE_SET:has(entityTypeNumber)
47218
47206
  if isGridEntity then
47219
47207
  local gridEntityXMLType = entityTypeNumber
@@ -52153,6 +52141,8 @@ local log = ____log.log
52153
52141
  local ____tstlClass = require("src.functions.tstlClass")
52154
52142
  local getTSTLClassConstructor = ____tstlClass.getTSTLClassConstructor
52155
52143
  local getTSTLClassName = ____tstlClass.getTSTLClassName
52144
+ local ____utils = require("src.functions.utils")
52145
+ local assertDefined = ____utils.assertDefined
52156
52146
  function getExportedMethodsFromFeature(self, featureClass)
52157
52147
  local constructor = getTSTLClassConstructor(nil, featureClass)
52158
52148
  local exportedMethodNames = constructor[EXPORTED_METHOD_NAMES_KEY]
@@ -52260,9 +52250,7 @@ function ModUpgraded.prototype.logUsedFeatures(self)
52260
52250
  goto __continue19
52261
52251
  end
52262
52252
  local modCallbackCustom = tonumber(modCallbackCustomString)
52263
- if modCallbackCustom == nil then
52264
- error("Failed to convert an index on the callbacks object to a number.")
52265
- end
52253
+ assertDefined(nil, modCallbackCustom, "Failed to convert an index on the callbacks object to a number.")
52266
52254
  log(((("- ModCallbackCustom." .. tostring(ModCallbackCustom[modCallbackCustom])) .. " (") .. tostring(modCallbackCustom)) .. ")")
52267
52255
  end
52268
52256
  ::__continue19::
@@ -52272,15 +52260,13 @@ function ModUpgraded.prototype.logUsedFeatures(self)
52272
52260
  local featureClass = ____value[2]
52273
52261
  do
52274
52262
  if featureClass.numConsumers == 0 then
52275
- goto __continue23
52263
+ goto __continue22
52276
52264
  end
52277
52265
  local iscFeature = tonumber(iscFeatureString)
52278
- if iscFeature == nil then
52279
- error("Failed to convert an index on the features object to a number.")
52280
- end
52266
+ assertDefined(nil, iscFeature, "Failed to convert an index on the features object to a number.")
52281
52267
  log(((("- ISCFeature." .. tostring(ISCFeature[iscFeature])) .. " (") .. tostring(iscFeature)) .. ")")
52282
52268
  end
52283
- ::__continue23::
52269
+ ::__continue22::
52284
52270
  end
52285
52271
  end
52286
52272
  function ModUpgraded.prototype.initFeature(self, feature)
@@ -52327,9 +52313,7 @@ function ModUpgraded.prototype.initFeature(self, feature)
52327
52313
  end
52328
52314
  if feature.v ~= nil then
52329
52315
  local className = getTSTLClassName(nil, feature)
52330
- if className == nil then
52331
- error("Failed to get the name of a feature.")
52332
- end
52316
+ assertDefined(nil, className, "Failed to get the name of a feature.")
52333
52317
  local saveDataManagerClass = self.features[ISCFeature.SAVE_DATA_MANAGER]
52334
52318
  saveDataManagerClass:saveDataManager(className, feature.v, feature.vConditionalFunc)
52335
52319
  end
@@ -52368,9 +52352,7 @@ function ModUpgraded.prototype.uninitFeature(self, feature)
52368
52352
  end
52369
52353
  if feature.v ~= nil then
52370
52354
  local className = getTSTLClassName(nil, feature)
52371
- if className == nil then
52372
- error("Failed to get the name of a feature.")
52373
- end
52355
+ assertDefined(nil, className, "Failed to get the name of a feature.")
52374
52356
  local saveDataManagerClass = self.features[ISCFeature.SAVE_DATA_MANAGER]
52375
52357
  saveDataManagerClass:saveDataManagerRemove(className)
52376
52358
  end
@@ -52398,6 +52380,8 @@ local ____types = require("src.functions.types")
52398
52380
  local isFunction = ____types.isFunction
52399
52381
  local isNumber = ____types.isNumber
52400
52382
  local isTable = ____types.isTable
52383
+ local ____utils = require("src.functions.utils")
52384
+ local assertDefined = ____utils.assertDefined
52401
52385
  function initDecoratedCallbacks(self, modFeature, constructor, tstlClassName, vanilla, init)
52402
52386
  local modFeatureConstructor = constructor
52403
52387
  local callbackTuplesKey = vanilla and ____exports.MOD_FEATURE_CALLBACKS_KEY or ____exports.MOD_FEATURE_CUSTOM_CALLBACKS_KEY
@@ -52528,9 +52512,7 @@ function initSaveDataManager(self, modFeature, tstlClassName, init)
52528
52512
  local mod = modFeature.mod
52529
52513
  local saveDataManagerMethodName = init and "saveDataManager" or "saveDataManagerRemove"
52530
52514
  local saveDataManagerMethod = mod[saveDataManagerMethodName]
52531
- if saveDataManagerMethod == nil then
52532
- 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.")
52533
- end
52515
+ 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.")
52534
52516
  if type(saveDataManagerMethod) ~= "function" then
52535
52517
  error(("The \"" .. saveDataManagerMethodName) .. "\" property of the \"ModUpgraded\" object was not a function.")
52536
52518
  end
@@ -52567,13 +52549,9 @@ function ModFeature.prototype.init(self, init)
52567
52549
  end
52568
52550
  self.initialized = init
52569
52551
  local constructor = getTSTLClassConstructor(nil, self)
52570
- if constructor == nil then
52571
- error("Failed to get the TSTL class constructor for a mod feature.")
52572
- end
52552
+ assertDefined(nil, constructor, "Failed to get the TSTL class constructor for a mod feature.")
52573
52553
  local tstlClassName = getTSTLClassName(nil, self)
52574
- if tstlClassName == nil then
52575
- error("Failed to get the TSTL class name for a mod feature.")
52576
- end
52554
+ assertDefined(nil, tstlClassName, "Failed to get the TSTL class name for a mod feature.")
52577
52555
  initDecoratedCallbacks(
52578
52556
  nil,
52579
52557
  self,
@@ -53464,6 +53442,8 @@ local getRoomDescriptor = ____roomData.getRoomDescriptor
53464
53442
  local getRoomGridIndex = ____roomData.getRoomGridIndex
53465
53443
  local ____rooms = require("src.functions.rooms")
53466
53444
  local getRoomsInsideGrid = ____rooms.getRoomsInsideGrid
53445
+ local ____utils = require("src.functions.utils")
53446
+ local assertDefined = ____utils.assertDefined
53467
53447
  function ____exports.getRoomDisplayFlags(self, roomGridIndex, minimapAPI)
53468
53448
  if minimapAPI == nil then
53469
53449
  minimapAPI = true
@@ -53476,9 +53456,11 @@ function ____exports.getRoomDisplayFlags(self, roomGridIndex, minimapAPI)
53476
53456
  return roomDescriptor.DisplayFlags
53477
53457
  end
53478
53458
  local minimapAPIRoomDescriptor = MinimapAPI:GetRoomByIdx(roomGridIndex)
53479
- if minimapAPIRoomDescriptor == nil then
53480
- error("Failed to get the MinimapAPI room descriptor for the room at grid index: " .. tostring(roomGridIndex))
53481
- end
53459
+ assertDefined(
53460
+ nil,
53461
+ minimapAPIRoomDescriptor,
53462
+ "Failed to get the MinimapAPI room descriptor for the room at grid index: " .. tostring(roomGridIndex)
53463
+ )
53482
53464
  return minimapAPIRoomDescriptor:GetDisplayFlags()
53483
53465
  end
53484
53466
  function ____exports.setAllDisplayFlags(self, displayFlags)
@@ -53506,9 +53488,11 @@ function ____exports.setRoomDisplayFlags(self, roomGridIndex, displayFlags, upda
53506
53488
  end
53507
53489
  else
53508
53490
  local minimapAPIRoomDescriptor = MinimapAPI:GetRoomByIdx(roomGridIndex)
53509
- if minimapAPIRoomDescriptor == nil then
53510
- error("Failed to get the MinimapAPI room descriptor for the room at grid index: " .. tostring(roomGridIndex))
53511
- end
53491
+ assertDefined(
53492
+ nil,
53493
+ minimapAPIRoomDescriptor,
53494
+ "Failed to get the MinimapAPI room descriptor for the room at grid index: " .. tostring(roomGridIndex)
53495
+ )
53512
53496
  minimapAPIRoomDescriptor:SetDisplayFlags(displayFlags)
53513
53497
  end
53514
53498
  end
@@ -53542,9 +53526,11 @@ function ____exports.hideRoomOnMinimap(self, roomGridIndex)
53542
53526
  ____exports.clearRoomDisplayFlags(nil, roomGridIndex)
53543
53527
  if MinimapAPI ~= nil then
53544
53528
  local minimapAPIRoomDescriptor = MinimapAPI:GetRoomByIdx(roomGridIndex)
53545
- if minimapAPIRoomDescriptor == nil then
53546
- error("Failed to get the MinimapAPI room descriptor for the room at grid index: " .. tostring(roomGridIndex))
53547
- end
53529
+ assertDefined(
53530
+ nil,
53531
+ minimapAPIRoomDescriptor,
53532
+ "Failed to get the MinimapAPI room descriptor for the room at grid index: " .. tostring(roomGridIndex)
53533
+ )
53548
53534
  minimapAPIRoomDescriptor.Hidden = true
53549
53535
  end
53550
53536
  end