isaacscript-common 31.5.0 → 31.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/dist/index.rollup.d.ts +26 -4
  2. package/dist/isaacscript-common.lua +626 -645
  3. package/dist/src/classes/ModFeature.d.ts.map +1 -1
  4. package/dist/src/classes/ModFeature.lua +5 -9
  5. package/dist/src/classes/ModUpgraded.d.ts.map +1 -1
  6. package/dist/src/classes/ModUpgraded.lua +8 -14
  7. package/dist/src/classes/callbacks/PostNewRoomEarly.lua +2 -2
  8. package/dist/src/classes/features/callbackLogic/CustomGridEntities.d.ts.map +1 -1
  9. package/dist/src/classes/features/callbackLogic/CustomGridEntities.lua +3 -3
  10. package/dist/src/classes/features/other/CharacterHealthConversion.lua +1 -1
  11. package/dist/src/classes/features/other/CustomItemPools.d.ts.map +1 -1
  12. package/dist/src/classes/features/other/CustomItemPools.lua +12 -6
  13. package/dist/src/classes/features/other/CustomStages.d.ts.map +1 -1
  14. package/dist/src/classes/features/other/CustomStages.lua +12 -14
  15. package/dist/src/classes/features/other/CustomTrapdoors.d.ts.map +1 -1
  16. package/dist/src/classes/features/other/CustomTrapdoors.lua +6 -8
  17. package/dist/src/classes/features/other/DeployJSONRoom.d.ts.map +1 -1
  18. package/dist/src/classes/features/other/DeployJSONRoom.lua +15 -15
  19. package/dist/src/classes/features/other/ModdedElementSets.d.ts.map +1 -1
  20. package/dist/src/classes/features/other/ModdedElementSets.lua +21 -12
  21. package/dist/src/classes/features/other/Pause.d.ts.map +1 -1
  22. package/dist/src/classes/features/other/Pause.lua +4 -6
  23. package/dist/src/classes/features/other/SaveDataManager.d.ts.map +1 -1
  24. package/dist/src/classes/features/other/SaveDataManager.lua +5 -9
  25. package/dist/src/classes/features/other/customStages/backdrop.lua +9 -10
  26. package/dist/src/classes/features/other/saveDataManager/restoreDefaults.lua +1 -1
  27. package/dist/src/functions/array.d.ts +3 -0
  28. package/dist/src/functions/array.d.ts.map +1 -1
  29. package/dist/src/functions/array.lua +9 -3
  30. package/dist/src/functions/bitSet128.d.ts.map +1 -1
  31. package/dist/src/functions/bitSet128.lua +4 -6
  32. package/dist/src/functions/bitwise.d.ts.map +1 -1
  33. package/dist/src/functions/bitwise.lua +7 -3
  34. package/dist/src/functions/color.d.ts.map +1 -1
  35. package/dist/src/functions/color.lua +5 -9
  36. package/dist/src/functions/deepCopy.lua +23 -31
  37. package/dist/src/functions/entities.d.ts.map +1 -1
  38. package/dist/src/functions/entities.lua +20 -18
  39. package/dist/src/functions/entitiesSpecific.d.ts.map +1 -1
  40. package/dist/src/functions/entitiesSpecific.lua +11 -27
  41. package/dist/src/functions/enums.d.ts +6 -4
  42. package/dist/src/functions/enums.d.ts.map +1 -1
  43. package/dist/src/functions/enums.lua +13 -9
  44. package/dist/src/functions/gridEntities.d.ts.map +1 -1
  45. package/dist/src/functions/gridEntities.lua +18 -11
  46. package/dist/src/functions/gridEntitiesSpecific.d.ts.map +1 -1
  47. package/dist/src/functions/gridEntitiesSpecific.lua +16 -28
  48. package/dist/src/functions/input.d.ts +3 -0
  49. package/dist/src/functions/input.d.ts.map +1 -1
  50. package/dist/src/functions/input.lua +14 -14
  51. package/dist/src/functions/jsonRoom.d.ts.map +1 -1
  52. package/dist/src/functions/jsonRoom.lua +35 -23
  53. package/dist/src/functions/kColor.d.ts.map +1 -1
  54. package/dist/src/functions/kColor.lua +6 -12
  55. package/dist/src/functions/map.d.ts.map +1 -1
  56. package/dist/src/functions/map.lua +3 -3
  57. package/dist/src/functions/minimap.d.ts.map +1 -1
  58. package/dist/src/functions/minimap.lua +17 -9
  59. package/dist/src/functions/players.d.ts.map +1 -1
  60. package/dist/src/functions/players.lua +17 -22
  61. package/dist/src/functions/rng.d.ts.map +1 -1
  62. package/dist/src/functions/rng.lua +3 -3
  63. package/dist/src/functions/roomShapeWalls.d.ts.map +1 -1
  64. package/dist/src/functions/roomShapeWalls.lua +7 -3
  65. package/dist/src/functions/roomTransition.d.ts.map +1 -1
  66. package/dist/src/functions/roomTransition.lua +7 -3
  67. package/dist/src/functions/rooms.d.ts.map +1 -1
  68. package/dist/src/functions/rooms.lua +8 -5
  69. package/dist/src/functions/serialization.d.ts.map +1 -1
  70. package/dist/src/functions/serialization.lua +8 -18
  71. package/dist/src/functions/table.d.ts.map +1 -1
  72. package/dist/src/functions/table.lua +6 -12
  73. package/dist/src/functions/tstlClass.d.ts.map +1 -1
  74. package/dist/src/functions/tstlClass.lua +3 -3
  75. package/dist/src/functions/utils.d.ts +9 -0
  76. package/dist/src/functions/utils.d.ts.map +1 -1
  77. package/dist/src/functions/utils.lua +14 -6
  78. package/dist/src/functions/vector.d.ts.map +1 -1
  79. package/dist/src/functions/vector.lua +4 -6
  80. package/dist/src/functions/weighted.d.ts.map +1 -1
  81. package/dist/src/functions/weighted.lua +7 -3
  82. package/dist/src/sets/bossSets.d.ts.map +1 -1
  83. package/dist/src/sets/bossSets.lua +3 -3
  84. package/package.json +2 -2
  85. package/src/classes/ModFeature.ts +16 -12
  86. package/src/classes/ModUpgraded.ts +18 -16
  87. package/src/classes/callbacks/PostNewRoomEarly.ts +2 -2
  88. package/src/classes/features/callbackLogic/CustomGridEntities.ts +2 -3
  89. package/src/classes/features/other/CharacterHealthConversion.ts +1 -1
  90. package/src/classes/features/other/CustomItemPools.ts +9 -8
  91. package/src/classes/features/other/CustomStages.ts +9 -10
  92. package/src/classes/features/other/CustomTrapdoors.ts +9 -10
  93. package/src/classes/features/other/DeployJSONRoom.ts +21 -21
  94. package/src/classes/features/other/ModdedElementSets.ts +18 -21
  95. package/src/classes/features/other/Pause.ts +9 -6
  96. package/src/classes/features/other/SaveDataManager.ts +14 -16
  97. package/src/classes/features/other/customStages/backdrop.ts +5 -6
  98. package/src/classes/features/other/saveDataManager/restoreDefaults.ts +1 -1
  99. package/src/functions/array.ts +8 -6
  100. package/src/functions/bitSet128.ts +9 -10
  101. package/src/functions/bitwise.ts +6 -3
  102. package/src/functions/color.ts +13 -15
  103. package/src/functions/deepCopy.ts +18 -24
  104. package/src/functions/deepCopyTests.ts +5 -6
  105. package/src/functions/entities.ts +22 -20
  106. package/src/functions/entitiesSpecific.ts +10 -27
  107. package/src/functions/enums.ts +29 -17
  108. package/src/functions/gridEntities.ts +14 -16
  109. package/src/functions/gridEntitiesSpecific.ts +15 -28
  110. package/src/functions/input.ts +3 -3
  111. package/src/functions/jsonRoom.ts +39 -27
  112. package/src/functions/kColor.ts +17 -20
  113. package/src/functions/map.ts +5 -5
  114. package/src/functions/minimap.ts +16 -15
  115. package/src/functions/players.ts +7 -10
  116. package/src/functions/rng.ts +5 -5
  117. package/src/functions/roomShapeWalls.ts +3 -4
  118. package/src/functions/roomTransition.ts +5 -5
  119. package/src/functions/rooms.ts +5 -6
  120. package/src/functions/serialization.ts +25 -30
  121. package/src/functions/table.ts +18 -20
  122. package/src/functions/tstlClass.ts +5 -5
  123. package/src/functions/utils.ts +27 -6
  124. package/src/functions/vector.ts +9 -10
  125. package/src/functions/weighted.ts +5 -5
  126. 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.6.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -15880,12 +15880,267 @@ return ____exports
15880
15880
  end,
15881
15881
  ["src.types.TSTLClass"] = function(...)
15882
15882
  local ____exports = {}
15883
+ return ____exports
15884
+ end,
15885
+ ["src.core.cachedClasses"] = function(...)
15886
+ local ____exports = {}
15887
+ ____exports.game = Game()
15888
+ ____exports.itemConfig = Isaac.GetItemConfig()
15889
+ ____exports.musicManager = MusicManager()
15890
+ ____exports.sfxManager = SFXManager()
15891
+ ____exports.fonts = {
15892
+ droid = Font(),
15893
+ pfTempestaSevenCondensed = Font(),
15894
+ teamMeatFont10 = Font(),
15895
+ teamMeatFont12 = Font(),
15896
+ teamMeatFont16Bold = Font(),
15897
+ terminus = Font(),
15898
+ upheaval = Font()
15899
+ }
15900
+ ____exports.fonts.droid:Load("font/droid.fnt")
15901
+ ____exports.fonts.pfTempestaSevenCondensed:Load("font/pftempestasevencondensed.fnt")
15902
+ ____exports.fonts.teamMeatFont10:Load("font/teammeatfont10.fnt")
15903
+ ____exports.fonts.teamMeatFont12:Load("font/teammeatfont12.fnt")
15904
+ ____exports.fonts.teamMeatFont16Bold:Load("font/teammeatfont16bold.fnt")
15905
+ ____exports.fonts.terminus:Load("font/terminus.fnt")
15906
+ ____exports.fonts.upheaval:Load("font/upheaval.fnt")
15907
+ return ____exports
15908
+ end,
15909
+ ["src.types.PlayerIndex"] = function(...)
15910
+ local ____exports = {}
15911
+ return ____exports
15912
+ end,
15913
+ ["src.functions.playerIndex"] = function(...)
15914
+ local ____lualib = require("lualib_bundle")
15915
+ local __TS__New = ____lualib.__TS__New
15916
+ local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
15917
+ local __TS__ArrayFind = ____lualib.__TS__ArrayFind
15918
+ local ____exports = {}
15919
+ local getPlayerIndexCollectibleType, DEFAULT_COLLECTIBLE_TYPE, EXCLUDED_CHARACTERS
15920
+ local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
15921
+ local BabySubType = ____isaac_2Dtypescript_2Ddefinitions.BabySubType
15922
+ local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
15923
+ local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
15924
+ local PlayerVariant = ____isaac_2Dtypescript_2Ddefinitions.PlayerVariant
15925
+ local ____cachedClasses = require("src.core.cachedClasses")
15926
+ local game = ____cachedClasses.game
15927
+ local ____ReadonlySet = require("src.types.ReadonlySet")
15928
+ local ReadonlySet = ____ReadonlySet.ReadonlySet
15929
+ function ____exports.getAllPlayers(self)
15930
+ local numPlayers = game:GetNumPlayers()
15931
+ local players = {}
15932
+ do
15933
+ local i = 0
15934
+ while i < numPlayers do
15935
+ local player = Isaac.GetPlayer(i)
15936
+ players[#players + 1] = player
15937
+ i = i + 1
15938
+ end
15939
+ end
15940
+ return players
15941
+ end
15942
+ function ____exports.getPlayerIndex(self, player, differentiateForgottenAndSoul)
15943
+ if differentiateForgottenAndSoul == nil then
15944
+ differentiateForgottenAndSoul = false
15945
+ end
15946
+ local playerToUse = player
15947
+ local isSubPlayer = player:IsSubPlayer()
15948
+ if isSubPlayer then
15949
+ local subPlayer = player
15950
+ local playerParent = ____exports.getSubPlayerParent(nil, subPlayer)
15951
+ if playerParent ~= nil then
15952
+ playerToUse = playerParent
15953
+ end
15954
+ end
15955
+ local collectibleType = getPlayerIndexCollectibleType(nil, player, differentiateForgottenAndSoul)
15956
+ local collectibleRNG = playerToUse:GetCollectibleRNG(collectibleType)
15957
+ local seed = collectibleRNG:GetSeed()
15958
+ return seed
15959
+ end
15960
+ function getPlayerIndexCollectibleType(self, player, differentiateForgottenAndSoul)
15961
+ local character = player:GetPlayerType()
15962
+ if character == PlayerType.SOUL then
15963
+ return differentiateForgottenAndSoul and CollectibleType.INNER_EYE or DEFAULT_COLLECTIBLE_TYPE
15964
+ end
15965
+ return DEFAULT_COLLECTIBLE_TYPE
15966
+ end
15967
+ function ____exports.getPlayers(self, performCharacterExclusions)
15968
+ if performCharacterExclusions == nil then
15969
+ performCharacterExclusions = false
15970
+ end
15971
+ local players = ____exports.getAllPlayers(nil)
15972
+ local nonChildPlayers = __TS__ArrayFilter(
15973
+ players,
15974
+ function(____, player) return not ____exports.isChildPlayer(nil, player) end
15975
+ )
15976
+ local nonChildPlayersFiltered = __TS__ArrayFilter(
15977
+ nonChildPlayers,
15978
+ function(____, player)
15979
+ local character = player:GetPlayerType()
15980
+ return not EXCLUDED_CHARACTERS:has(character)
15981
+ end
15982
+ )
15983
+ return performCharacterExclusions and nonChildPlayersFiltered or nonChildPlayers
15984
+ end
15985
+ function ____exports.getSubPlayerParent(self, subPlayer)
15986
+ local subPlayerPtrHash = GetPtrHash(subPlayer)
15987
+ local players = ____exports.getPlayers(nil)
15988
+ return __TS__ArrayFind(
15989
+ players,
15990
+ function(____, player)
15991
+ local thisPlayerSubPlayer = player:GetSubPlayer()
15992
+ if thisPlayerSubPlayer == nil then
15993
+ return false
15994
+ end
15995
+ local thisPlayerSubPlayerPtrHash = GetPtrHash(thisPlayerSubPlayer)
15996
+ return thisPlayerSubPlayerPtrHash == subPlayerPtrHash
15997
+ end
15998
+ )
15999
+ end
16000
+ function ____exports.isChildPlayer(self, player)
16001
+ return player.Parent ~= nil
16002
+ end
16003
+ DEFAULT_COLLECTIBLE_TYPE = CollectibleType.SAD_ONION
16004
+ EXCLUDED_CHARACTERS = __TS__New(ReadonlySet, {PlayerType.ESAU, PlayerType.SOUL_B})
16005
+ function ____exports.getOtherPlayers(self, player)
16006
+ local playerPtrHash = GetPtrHash(player)
16007
+ local players = ____exports.getAllPlayers(nil)
16008
+ return __TS__ArrayFilter(
16009
+ players,
16010
+ function(____, otherPlayer) return GetPtrHash(otherPlayer) ~= playerPtrHash end
16011
+ )
16012
+ end
16013
+ function ____exports.getPlayerFromIndex(self, playerIndex)
16014
+ local players = ____exports.getAllPlayers(nil)
16015
+ return __TS__ArrayFind(
16016
+ players,
16017
+ function(____, player) return ____exports.getPlayerIndex(nil, player) == playerIndex end
16018
+ )
16019
+ end
16020
+ function ____exports.getPlayerIndexVanilla(self, playerToFind)
16021
+ local numPlayers = game:GetNumPlayers()
16022
+ local playerToFindHash = GetPtrHash(playerToFind)
16023
+ do
16024
+ local i = 0
16025
+ while i < numPlayers do
16026
+ local player = Isaac.GetPlayer(i)
16027
+ local playerHash = GetPtrHash(player)
16028
+ if playerHash == playerToFindHash then
16029
+ return i
16030
+ end
16031
+ i = i + 1
16032
+ end
16033
+ end
16034
+ return nil
16035
+ end
16036
+ function ____exports.isFoundSoul(self, player)
16037
+ return ____exports.isChildPlayer(nil, player) and player.Variant == PlayerVariant.COOP_BABY and player.SubType == BabySubType.FOUND_SOUL
16038
+ end
16039
+ return ____exports
16040
+ end,
16041
+ ["src.functions.utils"] = function(...)
16042
+ local ____lualib = require("lualib_bundle")
16043
+ local __TS__ArrayMap = ____lualib.__TS__ArrayMap
16044
+ local __TS__New = ____lualib.__TS__New
16045
+ local ____exports = {}
16046
+ local ____ReadonlySet = require("src.types.ReadonlySet")
16047
+ local ReadonlySet = ____ReadonlySet.ReadonlySet
16048
+ local ____playerIndex = require("src.functions.playerIndex")
16049
+ local getAllPlayers = ____playerIndex.getAllPlayers
16050
+ local ____types = require("src.functions.types")
16051
+ local isFunction = ____types.isFunction
16052
+ function ____exports.assertDefined(self, value, ...)
16053
+ local ____bindingPattern0 = {...}
16054
+ local msg
16055
+ msg = ____bindingPattern0[1]
16056
+ if value == nil then
16057
+ error(msg)
16058
+ end
16059
+ end
16060
+ function ____exports.eRange(self, start, ____end, increment)
16061
+ if increment == nil then
16062
+ increment = 1
16063
+ end
16064
+ if ____end == nil then
16065
+ return ____exports.eRange(nil, 0, start, increment)
16066
+ end
16067
+ local array = {}
16068
+ if start < ____end then
16069
+ do
16070
+ local i = start
16071
+ while i < ____end do
16072
+ array[#array + 1] = i
16073
+ i = i + increment
16074
+ end
16075
+ end
16076
+ else
16077
+ do
16078
+ local i = start
16079
+ while i > ____end do
16080
+ array[#array + 1] = i
16081
+ i = i - increment
16082
+ end
16083
+ end
16084
+ end
16085
+ return array
16086
+ end
16087
+ function ____exports.getTraversalDescription(self, key, traversalDescription)
16088
+ if traversalDescription ~= "" then
16089
+ traversalDescription = traversalDescription .. " --> "
16090
+ end
16091
+ traversalDescription = traversalDescription .. tostring(key)
16092
+ return traversalDescription
16093
+ end
16094
+ function ____exports.iRange(self, start, ____end, increment)
16095
+ if increment == nil then
16096
+ increment = 1
16097
+ end
16098
+ if ____end == nil then
16099
+ return ____exports.iRange(nil, 0, start, increment)
16100
+ end
16101
+ local rangeIncreasing = start <= ____end
16102
+ local exclusiveEnd = rangeIncreasing and ____end + 1 or ____end - 1
16103
+ return ____exports.eRange(nil, start, exclusiveEnd, increment)
16104
+ end
16105
+ function ____exports.inRange(self, num, start, ____end)
16106
+ return num >= start and num <= ____end
16107
+ end
16108
+ function ____exports.isMultiplayer(self)
16109
+ local players = getAllPlayers(nil)
16110
+ local controllerIndexes = __TS__ArrayMap(
16111
+ players,
16112
+ function(____, player) return player.ControllerIndex end
16113
+ )
16114
+ local controllerIndexesSet = __TS__New(ReadonlySet, controllerIndexes)
16115
+ return controllerIndexesSet.size > 1
16116
+ end
16117
+ function ____exports.isRepentance(self)
16118
+ local metatable = getmetatable(Sprite)
16119
+ ____exports.assertDefined(nil, metatable, "Failed to get the metatable of the Sprite global table.")
16120
+ local classTable = metatable.__class
16121
+ ____exports.assertDefined(nil, classTable, "Failed to get the \"__class\" key of the Sprite metatable.")
16122
+ local getAnimation = classTable.GetAnimation
16123
+ return isFunction(nil, getAnimation)
16124
+ end
16125
+ ____exports["repeat"] = function(self, n, func)
16126
+ do
16127
+ local i = 0
16128
+ while i < n do
16129
+ func(nil, i)
16130
+ i = i + 1
16131
+ end
16132
+ end
16133
+ end
16134
+ function ____exports.todo(self, ...)
16135
+ end
15883
16136
  return ____exports
15884
16137
  end,
15885
16138
  ["src.functions.tstlClass"] = function(...)
15886
16139
  local ____exports = {}
15887
16140
  local ____types = require("src.functions.types")
15888
16141
  local isTable = ____types.isTable
16142
+ local ____utils = require("src.functions.utils")
16143
+ local assertDefined = ____utils.assertDefined
15889
16144
  function ____exports.getTSTLClassConstructor(self, object)
15890
16145
  if not isTable(nil, object) then
15891
16146
  return nil
@@ -15921,38 +16176,12 @@ function ____exports.isTSTLSet(self, object)
15921
16176
  end
15922
16177
  function ____exports.newTSTLClass(self, oldClass)
15923
16178
  local constructor = ____exports.getTSTLClassConstructor(nil, oldClass)
15924
- if constructor == nil then
15925
- error("Failed to instantiate a new TypeScriptToLua class since the provided old class does not have a metatable/constructor.")
15926
- end
16179
+ assertDefined(nil, constructor, "Failed to instantiate a new TypeScriptToLua class since the provided old class does not have a metatable/constructor.")
15927
16180
  local newClass = {}
15928
16181
  local newClassMetatable = setmetatable(newClass, constructor.prototype)
15929
16182
  newClassMetatable:____constructor()
15930
16183
  return newClass
15931
16184
  end
15932
- return ____exports
15933
- end,
15934
- ["src.core.cachedClasses"] = function(...)
15935
- local ____exports = {}
15936
- ____exports.game = Game()
15937
- ____exports.itemConfig = Isaac.GetItemConfig()
15938
- ____exports.musicManager = MusicManager()
15939
- ____exports.sfxManager = SFXManager()
15940
- ____exports.fonts = {
15941
- droid = Font(),
15942
- pfTempestaSevenCondensed = Font(),
15943
- teamMeatFont10 = Font(),
15944
- teamMeatFont12 = Font(),
15945
- teamMeatFont16Bold = Font(),
15946
- terminus = Font(),
15947
- upheaval = Font()
15948
- }
15949
- ____exports.fonts.droid:Load("font/droid.fnt")
15950
- ____exports.fonts.pfTempestaSevenCondensed:Load("font/pftempestasevencondensed.fnt")
15951
- ____exports.fonts.teamMeatFont10:Load("font/teammeatfont10.fnt")
15952
- ____exports.fonts.teamMeatFont12:Load("font/teammeatfont12.fnt")
15953
- ____exports.fonts.teamMeatFont16Bold:Load("font/teammeatfont16bold.fnt")
15954
- ____exports.fonts.terminus:Load("font/terminus.fnt")
15955
- ____exports.fonts.upheaval:Load("font/upheaval.fnt")
15956
16185
  return ____exports
15957
16186
  end,
15958
16187
  ["src.enums.private.SerializationBrand"] = function(...)
@@ -16146,6 +16375,8 @@ local isBoolean = ____types.isBoolean
16146
16375
  local isNumber = ____types.isNumber
16147
16376
  local isString = ____types.isString
16148
16377
  local isUserdata = ____types.isUserdata
16378
+ local ____utils = require("src.functions.utils")
16379
+ local assertDefined = ____utils.assertDefined
16149
16380
  function ____exports.clearTable(self, luaMap)
16150
16381
  for key in pairs(luaMap) do
16151
16382
  luaMap[key] = nil
@@ -16166,9 +16397,7 @@ function ____exports.getBooleansFromTable(self, luaMap, objectName, ...)
16166
16397
  local booleans = {}
16167
16398
  for ____, key in ipairs(keys) do
16168
16399
  local value = luaMap[key]
16169
- if value == nil then
16170
- error(((("Failed to find a value for \"" .. key) .. "\" in a table representing a \"") .. objectName) .. "\" object.")
16171
- end
16400
+ assertDefined(nil, value, ((("Failed to find a value for \"" .. key) .. "\" in a table representing a \"") .. objectName) .. "\" object.")
16172
16401
  if isBoolean(nil, value) then
16173
16402
  booleans[#booleans + 1] = value
16174
16403
  else
@@ -16182,16 +16411,12 @@ function ____exports.getNumbersFromTable(self, luaMap, objectName, ...)
16182
16411
  local numbers = {}
16183
16412
  for ____, key in ipairs(keys) do
16184
16413
  local value = luaMap[key]
16185
- if value == nil then
16186
- error(((("Failed to find a value for \"" .. key) .. "\" in a table representing a \"") .. objectName) .. "\" object.")
16187
- end
16414
+ assertDefined(nil, value, ((("Failed to find a value for \"" .. key) .. "\" in a table representing a \"") .. objectName) .. "\" object.")
16188
16415
  if isNumber(nil, value) then
16189
16416
  numbers[#numbers + 1] = value
16190
16417
  elseif isString(nil, value) then
16191
16418
  local number = tonumber(value)
16192
- if number == nil then
16193
- error((((("Failed to convert the \"" .. key) .. "\" value of a table representing a \"") .. objectName) .. "\" object to a number: ") .. value)
16194
- end
16419
+ assertDefined(nil, number, (((("Failed to convert the \"" .. key) .. "\" value of a table representing a \"") .. objectName) .. "\" object to a number: ") .. value)
16195
16420
  numbers[#numbers + 1] = number
16196
16421
  else
16197
16422
  error((((("Failed to get the number for the \"" .. key) .. "\" value of a table representing a \"") .. objectName) .. "\" object because the type was: ") .. __TS__TypeOf(value))
@@ -16204,9 +16429,7 @@ function ____exports.getStringsFromTable(self, luaMap, objectName, ...)
16204
16429
  local strings = {}
16205
16430
  for ____, key in ipairs(keys) do
16206
16431
  local value = luaMap[key]
16207
- if value == nil then
16208
- error(((("Failed to find a value for \"" .. key) .. "\" in a table representing a \"") .. objectName) .. "\" object.")
16209
- end
16432
+ assertDefined(nil, value, ((("Failed to find a value for \"" .. key) .. "\" in a table representing a \"") .. objectName) .. "\" object.")
16210
16433
  if isString(nil, value) then
16211
16434
  strings[#strings + 1] = value
16212
16435
  else
@@ -16282,6 +16505,8 @@ local getNumbersFromTable = ____table.getNumbersFromTable
16282
16505
  local tableHasKeys = ____table.tableHasKeys
16283
16506
  local ____types = require("src.functions.types")
16284
16507
  local isTable = ____types.isTable
16508
+ local ____utils = require("src.functions.utils")
16509
+ local assertDefined = ____utils.assertDefined
16285
16510
  function ____exports.getRandomSeed(self)
16286
16511
  local randomNumber = Random()
16287
16512
  local safeRandomNumber = randomNumber == 0 and 1 or randomNumber
@@ -16324,9 +16549,7 @@ function ____exports.deserializeRNG(self, rng)
16324
16549
  OBJECT_NAME,
16325
16550
  table.unpack(KEYS)
16326
16551
  ))
16327
- if seed == nil then
16328
- error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: seed")
16329
- end
16552
+ assertDefined(nil, seed, ("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: seed")
16330
16553
  return ____exports.newRNG(nil, seed)
16331
16554
  end
16332
16555
  function ____exports.isSerializedRNG(self, object)
@@ -16428,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)
@@ -25775,7 +25750,7 @@ local ____ReadonlySet = require("src.types.ReadonlySet")
25775
25750
  local ReadonlySet = ____ReadonlySet.ReadonlySet
25776
25751
  local ____string = require("src.functions.string")
25777
25752
  local trimPrefix = ____string.trimPrefix
25778
- local MODIFIER_KEYS = {
25753
+ ____exports.MODIFIER_KEYS = {
25779
25754
  Keyboard.LEFT_SHIFT,
25780
25755
  Keyboard.LEFT_CONTROL,
25781
25756
  Keyboard.LEFT_ALT,
@@ -25785,10 +25760,10 @@ local MODIFIER_KEYS = {
25785
25760
  Keyboard.RIGHT_ALT,
25786
25761
  Keyboard.RIGHT_SUPER
25787
25762
  }
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)
25763
+ ____exports.MOVEMENT_ACTIONS = {ButtonAction.LEFT, ButtonAction.RIGHT, ButtonAction.UP, ButtonAction.DOWN}
25764
+ ____exports.MOVEMENT_ACTIONS_SET = __TS__New(ReadonlySet, ____exports.MOVEMENT_ACTIONS)
25765
+ ____exports.SHOOTING_ACTIONS = {ButtonAction.SHOOT_LEFT, ButtonAction.SHOOT_RIGHT, ButtonAction.SHOOT_UP, ButtonAction.SHOOT_DOWN}
25766
+ ____exports.SHOOTING_ACTIONS_SET = __TS__New(ReadonlySet, ____exports.SHOOTING_ACTIONS)
25792
25767
  function ____exports.controllerToString(self, controller)
25793
25768
  local key = Controller[controller]
25794
25769
  if key == nil then
@@ -25848,7 +25823,7 @@ end
25848
25823
  function ____exports.isModifierKeyPressed(self)
25849
25824
  return ____exports.isKeyboardPressed(
25850
25825
  nil,
25851
- table.unpack(MODIFIER_KEYS)
25826
+ table.unpack(____exports.MODIFIER_KEYS)
25852
25827
  )
25853
25828
  end
25854
25829
  function ____exports.isMoveAction(self, buttonAction)
@@ -25858,12 +25833,12 @@ function ____exports.isMoveActionPressed(self, controllerIndex)
25858
25833
  return ____exports.isActionPressed(
25859
25834
  nil,
25860
25835
  controllerIndex,
25861
- table.unpack(MOVEMENT_ACTIONS)
25836
+ table.unpack(____exports.MOVEMENT_ACTIONS)
25862
25837
  )
25863
25838
  end
25864
25839
  function ____exports.isMoveActionPressedOnAnyInput(self)
25865
25840
  return __TS__ArraySome(
25866
- MOVEMENT_ACTIONS,
25841
+ ____exports.MOVEMENT_ACTIONS,
25867
25842
  function(____, moveAction) return ____exports.isActionPressedOnAnyInput(nil, moveAction) end
25868
25843
  )
25869
25844
  end
@@ -25871,12 +25846,12 @@ function ____exports.isMoveActionTriggered(self, controllerIndex)
25871
25846
  return ____exports.isActionTriggered(
25872
25847
  nil,
25873
25848
  controllerIndex,
25874
- table.unpack(MOVEMENT_ACTIONS)
25849
+ table.unpack(____exports.MOVEMENT_ACTIONS)
25875
25850
  )
25876
25851
  end
25877
25852
  function ____exports.isMoveActionTriggeredOnAnyInput(self)
25878
25853
  return __TS__ArraySome(
25879
- MOVEMENT_ACTIONS,
25854
+ ____exports.MOVEMENT_ACTIONS,
25880
25855
  function(____, moveAction) return ____exports.isActionTriggeredOnAnyInput(nil, moveAction) end
25881
25856
  )
25882
25857
  end
@@ -25887,12 +25862,12 @@ function ____exports.isShootActionPressed(self, controllerIndex)
25887
25862
  return ____exports.isActionPressed(
25888
25863
  nil,
25889
25864
  controllerIndex,
25890
- table.unpack(SHOOTING_ACTIONS)
25865
+ table.unpack(____exports.SHOOTING_ACTIONS)
25891
25866
  )
25892
25867
  end
25893
25868
  function ____exports.isShootActionPressedOnAnyInput(self)
25894
25869
  return __TS__ArraySome(
25895
- SHOOTING_ACTIONS,
25870
+ ____exports.SHOOTING_ACTIONS,
25896
25871
  function(____, shootAction) return ____exports.isActionPressedOnAnyInput(nil, shootAction) end
25897
25872
  )
25898
25873
  end
@@ -25900,12 +25875,12 @@ function ____exports.isShootActionTriggered(self, controllerIndex)
25900
25875
  return ____exports.isActionTriggered(
25901
25876
  nil,
25902
25877
  controllerIndex,
25903
- table.unpack(SHOOTING_ACTIONS)
25878
+ table.unpack(____exports.SHOOTING_ACTIONS)
25904
25879
  )
25905
25880
  end
25906
25881
  function ____exports.isShootActionTriggeredOnAnyInput(self)
25907
25882
  return __TS__ArraySome(
25908
- SHOOTING_ACTIONS,
25883
+ ____exports.SHOOTING_ACTIONS,
25909
25884
  function(____, shootAction) return ____exports.isActionTriggeredOnAnyInput(nil, shootAction) end
25910
25885
  )
25911
25886
  end
@@ -26802,6 +26777,8 @@ local game = ____cachedClasses.game
26802
26777
  local ____roomData = require("src.functions.roomData")
26803
26778
  local getRoomData = ____roomData.getRoomData
26804
26779
  local getRoomGridIndex = ____roomData.getRoomGridIndex
26780
+ local ____utils = require("src.functions.utils")
26781
+ local assertDefined = ____utils.assertDefined
26805
26782
  function ____exports.teleport(self, roomGridIndex, direction, roomTransitionAnim)
26806
26783
  if direction == nil then
26807
26784
  direction = Direction.NO_DIRECTION
@@ -26811,9 +26788,11 @@ function ____exports.teleport(self, roomGridIndex, direction, roomTransitionAnim
26811
26788
  end
26812
26789
  local level = game:GetLevel()
26813
26790
  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
26791
+ assertDefined(
26792
+ nil,
26793
+ roomData,
26794
+ ("Failed to change the room to grid index " .. tostring(roomGridIndex)) .. " because that room does not exist."
26795
+ )
26817
26796
  level.LeaveDoor = DoorSlot.NO_DOOR_SLOT
26818
26797
  game:StartRoomTransition(roomGridIndex, direction, roomTransitionAnim)
26819
26798
  end
@@ -27389,6 +27368,7 @@ local getGotoCommand = ____stage.getGotoCommand
27389
27368
  local ____types = require("src.functions.types")
27390
27369
  local asNumber = ____types.asNumber
27391
27370
  local ____utils = require("src.functions.utils")
27371
+ local assertDefined = ____utils.assertDefined
27392
27372
  local iRange = ____utils.iRange
27393
27373
  function ____exports.getReadOnlyRooms(self)
27394
27374
  local level = game:GetLevel()
@@ -27494,9 +27474,11 @@ local SECRET_ROOM_TYPES = __TS__New(ReadonlySet, {RoomType.SECRET, RoomType.SUPE
27494
27474
  function ____exports.changeRoom(self, roomGridIndex)
27495
27475
  local level = game:GetLevel()
27496
27476
  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
27477
+ assertDefined(
27478
+ nil,
27479
+ roomData,
27480
+ ("Failed to change the room to grid index " .. tostring(roomGridIndex)) .. " because that room does not exist."
27481
+ )
27500
27482
  level.LeaveDoor = DoorSlot.NO_DOOR_SLOT
27501
27483
  game:ChangeRoom(roomGridIndex)
27502
27484
  end
@@ -27693,12 +27675,12 @@ function ____exports.setRoomCleared(self)
27693
27675
  for ____, door in ipairs(getDoors(nil)) do
27694
27676
  do
27695
27677
  if isHiddenSecretRoomDoor(nil, door) then
27696
- goto __continue77
27678
+ goto __continue76
27697
27679
  end
27698
27680
  openDoorFast(nil, door)
27699
27681
  door.ExtraVisible = false
27700
27682
  end
27701
- ::__continue77::
27683
+ ::__continue76::
27702
27684
  end
27703
27685
  sfxManager:Stop(SoundEffect.DOOR_HEAVY_OPEN)
27704
27686
  game:ShakeScreen(0)
@@ -27753,6 +27735,7 @@ local ____types = require("src.functions.types")
27753
27735
  local asNumber = ____types.asNumber
27754
27736
  local isNumber = ____types.isNumber
27755
27737
  local ____utils = require("src.functions.utils")
27738
+ local assertDefined = ____utils.assertDefined
27756
27739
  local eRange = ____utils.eRange
27757
27740
  local iRange = ____utils.iRange
27758
27741
  local ____vector = require("src.functions.vector")
@@ -27861,9 +27844,11 @@ local BREAKABLE_GRID_ENTITY_TYPES_VARIANTS_BY_EXPLOSIONS = __TS__New(
27861
27844
  )
27862
27845
  function ____exports.convertXMLGridEntityType(self, gridEntityXMLType, gridEntityXMLVariant)
27863
27846
  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
27847
+ assertDefined(
27848
+ nil,
27849
+ gridEntityArray,
27850
+ "Failed to find an entry in the grid entity map for XML entity type: " .. tostring(gridEntityXMLType)
27851
+ )
27867
27852
  local gridEntityType = gridEntityArray[1]
27868
27853
  local variant = gridEntityArray[2]
27869
27854
  if gridEntityType == GridEntityType.SPIKES_ON_OFF or gridEntityType == GridEntityType.PRESSURE_PLATE or gridEntityType == GridEntityType.TELEPORTER then
@@ -27911,13 +27896,17 @@ function ____exports.getConstituentsFromGridEntityID(self, gridEntityID)
27911
27896
  end
27912
27897
  local gridEntityTypeString, variantString = table.unpack(parts)
27913
27898
  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
27899
+ assertDefined(
27900
+ nil,
27901
+ gridEntityType,
27902
+ "Failed to convert the grid entity type to a number: " .. tostring(gridEntityTypeString)
27903
+ )
27917
27904
  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
27905
+ assertDefined(
27906
+ nil,
27907
+ variant,
27908
+ "Failed to convert the grid entity variant to a number: " .. tostring(variantString)
27909
+ )
27921
27910
  return {gridEntityType, variant}
27922
27911
  end
27923
27912
  function ____exports.getGridEntities(self, ...)
@@ -27967,7 +27956,7 @@ function ____exports.getGridEntitiesInRadius(self, targetPosition, radius)
27967
27956
  local gridIndex = room:GetGridIndex(position)
27968
27957
  local gridEntity = room:GetGridEntityFromPos(position)
27969
27958
  if gridEntity == nil or registeredGridIndexes:has(gridIndex) then
27970
- goto __continue27
27959
+ goto __continue24
27971
27960
  end
27972
27961
  registeredGridIndexes:add(gridIndex)
27973
27962
  local topLeft, bottomRight = table.unpack(____exports.getGridEntityCollisionPoints(nil, gridEntity))
@@ -27981,7 +27970,7 @@ function ____exports.getGridEntitiesInRadius(self, targetPosition, radius)
27981
27970
  gridEntities[#gridEntities + 1] = gridEntity
27982
27971
  end
27983
27972
  end
27984
- ::__continue27::
27973
+ ::__continue24::
27985
27974
  end
27986
27975
  end
27987
27976
  return gridEntities
@@ -29803,14 +29792,14 @@ function PostNewRoomEarly.prototype.isNewRoom(self)
29803
29792
  if topLeftWall == nil then
29804
29793
  topLeftWall = spawnGridEntity(nil, GridEntityType.WALL, topLeftWallGridIndex)
29805
29794
  if topLeftWall == nil then
29806
- logError("Failed to spawn a new wall (1) for the POST_NEW_ROOM_EARLY callback.")
29795
+ logError("Failed to spawn a new wall for the POST_NEW_ROOM_EARLY callback (on the first try).")
29807
29796
  return false
29808
29797
  end
29809
29798
  end
29810
29799
  if topLeftWall2 == nil then
29811
29800
  topLeftWall2 = spawnGridEntity(nil, GridEntityType.WALL, rightOfTopWallGridIndex)
29812
29801
  if topLeftWall2 == nil then
29813
- logError("Failed to spawn a new wall (2) for the POST_NEW_ROOM_EARLY callback.")
29802
+ logError("Failed to spawn a new wall for the POST_NEW_ROOM_EARLY callback (on the second try).")
29814
29803
  return false
29815
29804
  end
29816
29805
  end
@@ -30153,84 +30142,72 @@ local removeGridEntities = ____gridEntities.removeGridEntities
30153
30142
  local spawnGridEntityWithVariant = ____gridEntities.spawnGridEntityWithVariant
30154
30143
  local ____types = require("src.functions.types")
30155
30144
  local asNumber = ____types.asNumber
30145
+ local ____utils = require("src.functions.utils")
30146
+ local assertDefined = ____utils.assertDefined
30156
30147
  function ____exports.spawnCrawlSpaceWithVariant(self, crawlSpaceVariant, gridIndexOrPosition)
30157
30148
  return spawnGridEntityWithVariant(nil, GridEntityType.CRAWL_SPACE, crawlSpaceVariant, gridIndexOrPosition)
30158
30149
  end
30159
30150
  function ____exports.spawnDoorWithVariant(self, doorVariant, gridIndexOrPosition)
30160
30151
  local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.DOOR, doorVariant, gridIndexOrPosition)
30161
30152
  if gridEntity == nil then
30162
- return gridEntity
30153
+ return nil
30163
30154
  end
30164
30155
  local door = gridEntity:ToDoor()
30165
- if door == nil then
30166
- error("Failed to spawn a door.")
30167
- end
30156
+ assertDefined(nil, door, "Failed to spawn a door.")
30168
30157
  return door
30169
30158
  end
30170
30159
  function ____exports.spawnPitWithVariant(self, pitVariant, gridIndexOrPosition)
30171
30160
  local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.PIT, pitVariant, gridIndexOrPosition)
30172
30161
  if gridEntity == nil then
30173
- return gridEntity
30162
+ return nil
30174
30163
  end
30175
30164
  local pit = gridEntity:ToPit()
30176
- if pit == nil then
30177
- error("Failed to spawn a pit.")
30178
- end
30165
+ assertDefined(nil, pit, "Failed to spawn a pit.")
30179
30166
  return pit
30180
30167
  end
30181
30168
  function ____exports.spawnPoopWithVariant(self, poopVariant, gridIndexOrPosition)
30182
30169
  local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.POOP, poopVariant, gridIndexOrPosition)
30183
30170
  if gridEntity == nil then
30184
- return gridEntity
30171
+ return nil
30185
30172
  end
30186
30173
  local poop = gridEntity:ToPoop()
30187
- if poop == nil then
30188
- error("Failed to spawn a poop.")
30189
- end
30174
+ assertDefined(nil, poop, "Failed to spawn a poop.")
30190
30175
  return poop
30191
30176
  end
30192
30177
  function ____exports.spawnPressurePlateWithVariant(self, pressurePlateVariant, gridIndexOrPosition)
30193
30178
  local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.PRESSURE_PLATE, pressurePlateVariant, gridIndexOrPosition)
30194
30179
  if gridEntity == nil then
30195
- return gridEntity
30180
+ return nil
30196
30181
  end
30197
30182
  local pressurePlate = gridEntity:ToPressurePlate()
30198
- if pressurePlate == nil then
30199
- error("Failed to spawn a pressure plate.")
30200
- end
30183
+ assertDefined(nil, pressurePlate, "Failed to spawn a pressure plate.")
30201
30184
  return pressurePlate
30202
30185
  end
30203
30186
  function ____exports.spawnRockWithVariant(self, rockVariant, gridIndexOrPosition)
30204
30187
  local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.ROCK, rockVariant, gridIndexOrPosition)
30205
30188
  if gridEntity == nil then
30206
- return gridEntity
30189
+ return nil
30207
30190
  end
30208
30191
  local rock = gridEntity:ToRock()
30209
- if rock == nil then
30210
- error("Failed to spawn a rock.")
30211
- end
30192
+ assertDefined(nil, rock, "Failed to spawn a rock.")
30212
30193
  return rock
30213
30194
  end
30214
30195
  function ____exports.spawnSpikesWithVariant(self, variant, gridIndexOrPosition)
30215
30196
  local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.SPIKES, variant, gridIndexOrPosition)
30216
30197
  if gridEntity == nil then
30217
- return gridEntity
30198
+ return nil
30218
30199
  end
30219
30200
  local spikes = gridEntity:ToSpikes()
30220
- if spikes == nil then
30221
- error("Failed to spawn spikes.")
30222
- end
30201
+ assertDefined(nil, spikes, "Failed to spawn spikes.")
30223
30202
  return spikes
30224
30203
  end
30225
30204
  function ____exports.spawnTNTWithVariant(self, variant, gridIndexOrPosition)
30226
30205
  local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.TNT, variant, gridIndexOrPosition)
30227
30206
  if gridEntity == nil then
30228
- return gridEntity
30207
+ return nil
30229
30208
  end
30230
30209
  local tnt = gridEntity:ToTNT()
30231
- if tnt == nil then
30232
- error("Failed to spawn TNT.")
30233
- end
30210
+ assertDefined(nil, tnt, "Failed to spawn TNT.")
30234
30211
  return tnt
30235
30212
  end
30236
30213
  function ____exports.spawnTeleporterWithVariant(self, variant, gridIndexOrPosition)
@@ -34520,6 +34497,8 @@ local ____roomData = require("src.functions.roomData")
34520
34497
  local getRoomListIndex = ____roomData.getRoomListIndex
34521
34498
  local ____types = require("src.functions.types")
34522
34499
  local isNumber = ____types.isNumber
34500
+ local ____utils = require("src.functions.utils")
34501
+ local assertDefined = ____utils.assertDefined
34523
34502
  local ____vector = require("src.functions.vector")
34524
34503
  local isVector = ____vector.isVector
34525
34504
  local ____DefaultMap = require("src.classes.DefaultMap")
@@ -34613,9 +34592,7 @@ function CustomGridEntities.prototype.spawnCustomGridEntity(self, gridEntityType
34613
34592
  local roomListIndex = getRoomListIndex(nil)
34614
34593
  local gridIndex = isVector(nil, gridIndexOrPosition) and room:GetGridIndex(gridIndexOrPosition) or gridIndexOrPosition
34615
34594
  local customGridEntity = spawnGridEntityWithVariant(nil, baseGridEntityType, baseGridEntityVariant, gridIndexOrPosition)
34616
- if customGridEntity == nil then
34617
- error("Failed to spawn a custom grid entity.")
34618
- end
34595
+ assertDefined(nil, customGridEntity, "Failed to spawn a custom grid entity.")
34619
34596
  if gridCollisionClass ~= nil then
34620
34597
  customGridEntity.CollisionClass = gridCollisionClass
34621
34598
  end
@@ -35484,6 +35461,8 @@ local getIsaacAPIClassName = ____isaacAPIClass.getIsaacAPIClassName
35484
35461
  local ____types = require("src.functions.types")
35485
35462
  local isTable = ____types.isTable
35486
35463
  local isUserdata = ____types.isUserdata
35464
+ local ____utils = require("src.functions.utils")
35465
+ local assertDefined = ____utils.assertDefined
35487
35466
  function getSerializedTableType(self, serializedIsaacAPIClass)
35488
35467
  for ____, ____value in ipairs(__TS__ObjectEntries(ISAAC_API_CLASS_TYPE_TO_BRAND)) do
35489
35468
  local copyableIsaacAPIClassType = ____value[1]
@@ -35499,14 +35478,10 @@ function ____exports.copyIsaacAPIClass(self, isaacAPIClass)
35499
35478
  error("Failed to copy an Isaac API class since the provided object was of type: " .. __TS__TypeOf(isaacAPIClass))
35500
35479
  end
35501
35480
  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
35481
+ assertDefined(nil, isaacAPIClassType, "Failed to copy an Isaac API class since it does not have a class type.")
35505
35482
  local copyableIsaacAPIClassType = isaacAPIClassType
35506
35483
  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
35484
+ assertDefined(nil, functions, "Failed to copy an Isaac API class since the associated functions were not found for Isaac API class type: " .. copyableIsaacAPIClassType)
35510
35485
  return functions:copy(isaacAPIClass)
35511
35486
  end
35512
35487
  function ____exports.deserializeIsaacAPIClass(self, serializedIsaacAPIClass)
@@ -35514,13 +35489,9 @@ function ____exports.deserializeIsaacAPIClass(self, serializedIsaacAPIClass)
35514
35489
  error("Failed to deserialize an Isaac API class since the provided object was of type: " .. __TS__TypeOf(serializedIsaacAPIClass))
35515
35490
  end
35516
35491
  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
35492
+ assertDefined(nil, copyableIsaacAPIClassType, "Failed to deserialize an Isaac API class since a valid class type brand was not found.")
35520
35493
  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
35494
+ assertDefined(nil, functions, "Failed to deserialize an Isaac API class since the associated functions were not found for class type: " .. copyableIsaacAPIClassType)
35524
35495
  return functions:deserialize(serializedIsaacAPIClass)
35525
35496
  end
35526
35497
  function ____exports.isCopyableIsaacAPIClass(self, object)
@@ -35550,14 +35521,10 @@ function ____exports.serializeIsaacAPIClass(self, isaacAPIClass)
35550
35521
  error("Failed to serialize an Isaac API class since the provided object was of type: " .. __TS__TypeOf(isaacAPIClass))
35551
35522
  end
35552
35523
  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
35524
+ assertDefined(nil, isaacAPIClassType, "Failed to serialize an Isaac API class since it does not have a class name.")
35556
35525
  local copyableIsaacAPIClassType = isaacAPIClassType
35557
35526
  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
35527
+ assertDefined(nil, functions, "Failed to serialize an Isaac API class since the associated functions were not found for class type: " .. copyableIsaacAPIClassType)
35561
35528
  return functions:serialize(isaacAPIClass)
35562
35529
  end
35563
35530
  return ____exports
@@ -35607,6 +35574,7 @@ local asString = ____types.asString
35607
35574
  local isNumber = ____types.isNumber
35608
35575
  local isPrimitive = ____types.isPrimitive
35609
35576
  local ____utils = require("src.functions.utils")
35577
+ local assertDefined = ____utils.assertDefined
35610
35578
  local getTraversalDescription = ____utils.getTraversalDescription
35611
35579
  function ____exports.deepCopy(self, value, serializationType, traversalDescription, classConstructors, insideMap)
35612
35580
  if serializationType == nil then
@@ -35832,9 +35800,7 @@ function getNewDefaultMap(self, defaultMap, serializationType, traversalDescript
35832
35800
  error(("Failed to deserialize a default map of \"" .. traversalDescription) .. "\", since it was not a Lua table.")
35833
35801
  end
35834
35802
  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
35803
+ assertDefined(nil, defaultMapValue, (("Failed to deserialize a default map of \"" .. traversalDescription) .. "\", since there was no serialization brand of: ") .. SerializationBrand.DEFAULT_MAP_VALUE)
35838
35804
  return __TS__New(DefaultMap, defaultMapValue)
35839
35805
  end
35840
35806
  end
@@ -35925,16 +35891,16 @@ function deepCopyTSTLClass(self, tstlClass, serializationType, traversalDescript
35925
35891
  end
35926
35892
  local newClass
35927
35893
  repeat
35928
- local ____switch65 = serializationType
35929
- local ____cond65 = ____switch65 == SerializationType.NONE
35930
- if ____cond65 then
35894
+ local ____switch64 = serializationType
35895
+ local ____cond64 = ____switch64 == SerializationType.NONE
35896
+ if ____cond64 then
35931
35897
  do
35932
35898
  newClass = newTSTLClass(nil, tstlClass)
35933
35899
  break
35934
35900
  end
35935
35901
  end
35936
- ____cond65 = ____cond65 or ____switch65 == SerializationType.SERIALIZE
35937
- if ____cond65 then
35902
+ ____cond64 = ____cond64 or ____switch64 == SerializationType.SERIALIZE
35903
+ if ____cond64 then
35938
35904
  do
35939
35905
  newClass = {}
35940
35906
  local tstlClassName = getTSTLClassName(nil, tstlClass)
@@ -35944,20 +35910,16 @@ function deepCopyTSTLClass(self, tstlClass, serializationType, traversalDescript
35944
35910
  break
35945
35911
  end
35946
35912
  end
35947
- ____cond65 = ____cond65 or ____switch65 == SerializationType.DESERIALIZE
35948
- if ____cond65 then
35913
+ ____cond64 = ____cond64 or ____switch64 == SerializationType.DESERIALIZE
35914
+ if ____cond64 then
35949
35915
  do
35950
35916
  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
35917
+ assertDefined(nil, tstlClassName, "Failed to deserialize a TSTL class since the brand did not contain the class name.")
35954
35918
  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
35919
+ assertDefined(nil, classConstructor, ("Failed to deserialize a TSTL class since there was no constructor registered for a class name of \"" .. tstlClassName) .. "\". If this mod is using the save data manager, it must register the class constructor with the \"saveDataManagerRegisterClass\" method.")
35958
35920
  newClass = __TS__New(classConstructor)
35921
+ break
35959
35922
  end
35960
- break
35961
35923
  end
35962
35924
  until true
35963
35925
  local ____getCopiedEntries_result_4 = getCopiedEntries(
@@ -36062,7 +36024,7 @@ function getCopiedEntries(self, object, serializationType, traversalDescription,
36062
36024
  local value = ____value[2]
36063
36025
  do
36064
36026
  if isSerializationBrand(nil, key) then
36065
- goto __continue93
36027
+ goto __continue90
36066
36028
  end
36067
36029
  traversalDescription = getTraversalDescription(nil, key, traversalDescription)
36068
36030
  local newValue = ____exports.deepCopy(
@@ -36085,7 +36047,7 @@ function getCopiedEntries(self, object, serializationType, traversalDescription,
36085
36047
  end
36086
36048
  copiedEntries[#copiedEntries + 1] = {keyToUse, newValue}
36087
36049
  end
36088
- ::__continue93::
36050
+ ::__continue90::
36089
36051
  end
36090
36052
  return {entries = copiedEntries, convertedNumberKeysToStrings = convertNumberKeysToStrings}
36091
36053
  end
@@ -36098,29 +36060,26 @@ function checkMetatable(self, luaMap, traversalDescription)
36098
36060
  error(("The deepCopy function detected that " .. tableDescription) .. " has a metatable. Copying tables with metatables is not supported, unless they are explicitly handled by the save data manager. (e.g. TypeScriptToLua Maps, TypeScriptToLua Sets, etc.)")
36099
36061
  end
36100
36062
  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
36063
  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)
36064
+ local className = getIsaacAPIClassName(nil, value) or "Unknown"
36065
+ error((("The deep copy function does not support serializing \"" .. traversalDescription) .. "\", since it is an Isaac API class of type: ") .. className)
36107
36066
  end
36108
36067
  repeat
36109
- local ____switch104 = serializationType
36110
- local ____cond104 = ____switch104 == SerializationType.NONE
36111
- if ____cond104 then
36068
+ local ____switch100 = serializationType
36069
+ local ____cond100 = ____switch100 == SerializationType.NONE
36070
+ if ____cond100 then
36112
36071
  do
36113
36072
  return copyIsaacAPIClass(nil, value)
36114
36073
  end
36115
36074
  end
36116
- ____cond104 = ____cond104 or ____switch104 == SerializationType.SERIALIZE
36117
- if ____cond104 then
36075
+ ____cond100 = ____cond100 or ____switch100 == SerializationType.SERIALIZE
36076
+ if ____cond100 then
36118
36077
  do
36119
36078
  return serializeIsaacAPIClass(nil, value)
36120
36079
  end
36121
36080
  end
36122
- ____cond104 = ____cond104 or ____switch104 == SerializationType.DESERIALIZE
36123
- if ____cond104 then
36081
+ ____cond100 = ____cond100 or ____switch100 == SerializationType.DESERIALIZE
36082
+ if ____cond100 then
36124
36083
  do
36125
36084
  error(("The deep copy function can not deserialize \"" .. traversalDescription) .. "\", since it is userdata.")
36126
36085
  end
@@ -36968,7 +36927,7 @@ function ____exports.restoreDefaultForFeatureKey(self, saveDataDefaultsMap, subs
36968
36927
  end
36969
36928
  local childTableDefaults = saveDataDefaults[saveDataKey]
36970
36929
  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")
36930
+ logError(((("Failed to find the default copy of the child table \"" .. saveDataKey) .. "\" for subscriber \"") .. subscriberName) .. "\". This error usually means that your mod-specific save data is out of date. You can try purging all of your mod-specific save data by deleting the following directory: C:\\Program Files (x86)\\Steam\\steamapps\\common\\The Binding of Isaac Rebirth\\data")
36972
36931
  return
36973
36932
  end
36974
36933
  local childTableDefaultsCopy = deepCopy(nil, childTableDefaults, SerializationType.NONE, (subscriberName .. " --> ") .. saveDataKey)
@@ -37071,6 +37030,8 @@ local isTSTLClass = ____tstlClass.isTSTLClass
37071
37030
  local ____types = require("src.functions.types")
37072
37031
  local isString = ____types.isString
37073
37032
  local isTable = ____types.isTable
37033
+ local ____utils = require("src.functions.utils")
37034
+ local assertDefined = ____utils.assertDefined
37074
37035
  local ____ReadonlySet = require("src.types.ReadonlySet")
37075
37036
  local ReadonlySet = ____ReadonlySet.ReadonlySet
37076
37037
  local ____Feature = require("src.classes.private.Feature")
@@ -37149,9 +37110,7 @@ end
37149
37110
  function SaveDataManager.prototype.saveDataManager(self, key, v, conditionalFunc)
37150
37111
  if isTSTLClass(nil, key) then
37151
37112
  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
37113
+ assertDefined(nil, className, "Failed to get the class name for the submitted class (as part of the \"key\" parameter) when registering new data with the save data manager.")
37155
37114
  key = className
37156
37115
  end
37157
37116
  if not isString(nil, key) then
@@ -37203,9 +37162,7 @@ function SaveDataManager.prototype.saveDataManagerRegisterClass(self, ...)
37203
37162
  local tstlClasses = {...}
37204
37163
  for ____, tstlClass in ipairs(tstlClasses) do
37205
37164
  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
37165
+ assertDefined(nil, name, "Failed to register a class with the save data manager due to not being able to derive the name of the class.")
37209
37166
  self.classConstructors[name] = tstlClass
37210
37167
  end
37211
37168
  end
@@ -37228,9 +37185,7 @@ function SaveDataManager.prototype.saveDataManagerReset(self, key, childObjectKe
37228
37185
  error("The save data manager requires that keys are strings. You tried to use a key of type: " .. __TS__TypeOf(key))
37229
37186
  end
37230
37187
  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
37188
+ assertDefined(nil, saveData, "The save data manager is not managing save data for a key of: " .. key)
37234
37189
  restoreDefaultForFeatureKey(
37235
37190
  nil,
37236
37191
  self.saveDataDefaultsMap,
@@ -38129,6 +38084,7 @@ local ____trinkets = require("src.functions.trinkets")
38129
38084
  local getVanillaTrinketTypeRange = ____trinkets.getVanillaTrinketTypeRange
38130
38085
  local trinketHasCacheFlag = ____trinkets.trinketHasCacheFlag
38131
38086
  local ____utils = require("src.functions.utils")
38087
+ local assertDefined = ____utils.assertDefined
38132
38088
  local ____repeat = ____utils["repeat"]
38133
38089
  local ____itemConfigCardTypesForCardsSet = require("src.sets.itemConfigCardTypesForCardsSet")
38134
38090
  local ITEM_CONFIG_CARD_TYPES_FOR_CARDS_SET = ____itemConfigCardTypesForCardsSet.ITEM_CONFIG_CARD_TYPES_FOR_CARDS_SET
@@ -38422,9 +38378,11 @@ function ModdedElementSets.prototype.lazyInitCardTypes(self)
38422
38378
  local itemConfigCardType = getItemConfigCardType(nil, cardType)
38423
38379
  if itemConfigCardType ~= nil then
38424
38380
  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
38381
+ assertDefined(
38382
+ nil,
38383
+ cardTypeSet,
38384
+ "Failed to get the card set for item config card type: " .. tostring(itemConfigCardType)
38385
+ )
38428
38386
  cardTypeSet:add(cardType)
38429
38387
  if ITEM_CONFIG_CARD_TYPES_FOR_CARDS_SET:has(itemConfigCardType) then
38430
38388
  self.cardSet:add(cardType)
@@ -38450,9 +38408,11 @@ function ModdedElementSets.prototype.getCardTypesOfType(self, ...)
38450
38408
  local matchingCardTypes = __TS__New(Set)
38451
38409
  for ____, itemConfigCardType in ipairs(itemConfigCardTypes) do
38452
38410
  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
38411
+ assertDefined(
38412
+ nil,
38413
+ cardTypeSet,
38414
+ "Failed to get the card type set for item config type: " .. tostring(itemConfigCardType)
38415
+ )
38456
38416
  for ____, cardType in __TS__Iterator(cardTypeSet) do
38457
38417
  matchingCardTypes:add(cardType)
38458
38418
  end
@@ -38472,9 +38432,11 @@ end
38472
38432
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCollectibleSet", true)
38473
38433
  function ModdedElementSets.prototype.getCollectiblesForTransformation(self, playerForm)
38474
38434
  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
38435
+ assertDefined(
38436
+ nil,
38437
+ itemConfigTag,
38438
+ ("Failed to get the collectible types for the transformation of " .. tostring(playerForm)) .. " because that transformation is not based on collectibles."
38439
+ )
38478
38440
  return self:getCollectiblesWithTag(itemConfigTag)
38479
38441
  end
38480
38442
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCollectiblesForTransformation", true)
@@ -38490,9 +38452,11 @@ __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCollectiblesWi
38490
38452
  function ModdedElementSets.prototype.getCollectiblesWithTag(self, itemConfigTag)
38491
38453
  self:lazyInitTagToCollectibleTypesMap()
38492
38454
  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
38455
+ assertDefined(
38456
+ nil,
38457
+ collectibleTypes,
38458
+ ("The item config tag of " .. tostring(itemConfigTag)) .. " is not a valid value of the \"ItemConfigTag\" enum."
38459
+ )
38496
38460
  return collectibleTypes
38497
38461
  end
38498
38462
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCollectiblesWithTag", true)
@@ -39715,7 +39679,7 @@ function CharacterHealthConversion.prototype.____constructor(self)
39715
39679
  local character = player:GetPlayerType()
39716
39680
  local conversionHeartSubType = self.characterHealthReplacementMap:get(character)
39717
39681
  if conversionHeartSubType == nil then
39718
- return
39682
+ return nil
39719
39683
  end
39720
39684
  convertRedHeartContainers(nil, player, conversionHeartSubType)
39721
39685
  removeRedHearts(nil, player)
@@ -40071,6 +40035,8 @@ local ____array = require("src.functions.array")
40071
40035
  local sumArray = ____array.sumArray
40072
40036
  local ____string = require("src.functions.string")
40073
40037
  local getPartialMatch = ____string.getPartialMatch
40038
+ local ____utils = require("src.functions.utils")
40039
+ local assertDefined = ____utils.assertDefined
40074
40040
  function ____exports.mapSetHash(self, map, entity, value)
40075
40041
  local hash = GetPtrHash(entity)
40076
40042
  map:set(hash, value)
@@ -40098,9 +40064,7 @@ function ____exports.getMapPartialMatch(self, searchText, map)
40098
40064
  return nil
40099
40065
  end
40100
40066
  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
40067
+ assertDefined(nil, value, "Failed to get the map value corresponding to the partial match of: " .. matchingKey)
40104
40068
  return {matchingKey, value}
40105
40069
  end
40106
40070
  function ____exports.getReversedMap(self, map)
@@ -40134,6 +40098,8 @@ local ____random = require("src.functions.random")
40134
40098
  local getRandomFloat = ____random.getRandomFloat
40135
40099
  local ____rng = require("src.functions.rng")
40136
40100
  local getRandomSeed = ____rng.getRandomSeed
40101
+ local ____utils = require("src.functions.utils")
40102
+ local assertDefined = ____utils.assertDefined
40137
40103
  function ____exports.getRandomIndexFromWeightedArray(self, weightedArray, seedOrRNG)
40138
40104
  if seedOrRNG == nil then
40139
40105
  seedOrRNG = getRandomSeed(nil)
@@ -40165,9 +40131,11 @@ function ____exports.getRandomFromWeightedArray(self, weightedArray, seedOrRNG)
40165
40131
  end
40166
40132
  local randomIndex = ____exports.getRandomIndexFromWeightedArray(nil, weightedArray, seedOrRNG)
40167
40133
  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
40134
+ assertDefined(
40135
+ nil,
40136
+ randomElement,
40137
+ "Failed to get an element from a weighted array using a random index of: " .. tostring(randomIndex)
40138
+ )
40171
40139
  return randomElement[1]
40172
40140
  end
40173
40141
  return ____exports
@@ -40192,6 +40160,8 @@ local ____map = require("src.functions.map")
40192
40160
  local copyMap = ____map.copyMap
40193
40161
  local ____rng = require("src.functions.rng")
40194
40162
  local getRandomSeed = ____rng.getRandomSeed
40163
+ local ____utils = require("src.functions.utils")
40164
+ local assertDefined = ____utils.assertDefined
40195
40165
  local ____weighted = require("src.functions.weighted")
40196
40166
  local getRandomIndexFromWeightedArray = ____weighted.getRandomIndexFromWeightedArray
40197
40167
  local ____Feature = require("src.classes.private.Feature")
@@ -40228,17 +40198,21 @@ function CustomItemPools.prototype.getCustomItemPoolCollectible(self, itemPoolTy
40228
40198
  defaultItem = CollectibleType.NULL
40229
40199
  end
40230
40200
  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
40201
+ assertDefined(
40202
+ nil,
40203
+ customItemPool,
40204
+ "Failed to find the custom item pool of: " .. tostring(itemPoolTypeCustom)
40205
+ )
40234
40206
  if #customItemPool == 0 then
40235
40207
  return defaultItem
40236
40208
  end
40237
40209
  local randomIndex = getRandomIndexFromWeightedArray(nil, customItemPool, seedOrRNG)
40238
40210
  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
40211
+ assertDefined(
40212
+ nil,
40213
+ tuple,
40214
+ "Failed to get an element from a custom item pool using a random index of: " .. tostring(randomIndex)
40215
+ )
40242
40216
  if decrease then
40243
40217
  arrayRemoveIndexInPlace(nil, customItemPool, randomIndex)
40244
40218
  end
@@ -41568,6 +41542,8 @@ local ____stage = require("src.functions.stage")
41568
41542
  local setStage = ____stage.setStage
41569
41543
  local ____tstlClass = require("src.functions.tstlClass")
41570
41544
  local getTSTLClassName = ____tstlClass.getTSTLClassName
41545
+ local ____utils = require("src.functions.utils")
41546
+ local assertDefined = ____utils.assertDefined
41571
41547
  local ____vector = require("src.functions.vector")
41572
41548
  local isVector = ____vector.isVector
41573
41549
  local ____ReadonlySet = require("src.types.ReadonlySet")
@@ -41783,9 +41759,7 @@ function CustomTrapdoors.prototype.checkAllPlayersLayingDownComplete(self)
41783
41759
  v.run.state = StageTravelState.NONE
41784
41760
  self:logStateChanged()
41785
41761
  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
41762
+ assertDefined(nil, tstlClassName, "Failed to find get the class name for the custom trapdoor feature.")
41789
41763
  self.disableInputs:enableAllInputs(tstlClassName)
41790
41764
  end
41791
41765
  function CustomTrapdoors.prototype.drawBlackSprite(self)
@@ -41834,14 +41808,14 @@ function CustomTrapdoors.prototype.checkCustomTrapdoorPlayerTouched(self, gridEn
41834
41808
  do
41835
41809
  local player = playerEntity:ToPlayer()
41836
41810
  if player == nil then
41837
- goto __continue43
41811
+ goto __continue42
41838
41812
  end
41839
41813
  if not self.ponyDetection:isPlayerUsingPony(player) and not isChildPlayer(nil, player) and canPlayerInteractWithTrapdoor(nil, player) then
41840
41814
  self:playerTouchedCustomTrapdoor(gridEntity, trapdoorDescription, player)
41841
41815
  return
41842
41816
  end
41843
41817
  end
41844
- ::__continue43::
41818
+ ::__continue42::
41845
41819
  end
41846
41820
  end
41847
41821
  function CustomTrapdoors.prototype.playerTouchedCustomTrapdoor(self, gridEntity, trapdoorDescription, player)
@@ -41849,9 +41823,7 @@ function CustomTrapdoors.prototype.playerTouchedCustomTrapdoor(self, gridEntity,
41849
41823
  v.run.customTrapdoorActivated = trapdoorDescription
41850
41824
  self:logStateChanged()
41851
41825
  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
41826
+ assertDefined(nil, tstlClassName, "Failed to find get the class name for the custom trapdoor feature.")
41855
41827
  local whitelist = __TS__New(ReadonlySet, {ButtonAction.CONSOLE})
41856
41828
  self.disableInputs:disableAllInputsExceptFor(tstlClassName, whitelist)
41857
41829
  setPlayerAttributes(nil, player, gridEntity.Position)
@@ -42089,6 +42061,8 @@ local ____players = require("src.functions.players")
42089
42061
  local useActiveItemTemp = ____players.useActiveItemTemp
42090
42062
  local ____tstlClass = require("src.functions.tstlClass")
42091
42063
  local getTSTLClassName = ____tstlClass.getTSTLClassName
42064
+ local ____utils = require("src.functions.utils")
42065
+ local assertDefined = ____utils.assertDefined
42092
42066
  local ____ReadonlySet = require("src.types.ReadonlySet")
42093
42067
  local ReadonlySet = ____ReadonlySet.ReadonlySet
42094
42068
  local ____Feature = require("src.classes.private.Feature")
@@ -42186,9 +42160,7 @@ function Pause.prototype.pause(self)
42186
42160
  local firstPlayer = Isaac.GetPlayer()
42187
42161
  useActiveItemTemp(nil, firstPlayer, CollectibleType.PAUSE)
42188
42162
  local tstlClassName = getTSTLClassName(nil, self)
42189
- if tstlClassName == nil then
42190
- error("Failed to get the class name for the pause feature.")
42191
- end
42163
+ assertDefined(nil, tstlClassName, "Failed to get the class name for the pause feature.")
42192
42164
  local whitelist = __TS__New(ReadonlySet, {ButtonAction.MENU_CONFIRM, ButtonAction.CONSOLE})
42193
42165
  self.disableInputs:disableAllInputsExceptFor(tstlClassName, whitelist)
42194
42166
  for ____, player in ipairs(getAllPlayers(nil)) do
@@ -42206,9 +42178,7 @@ function Pause.prototype.unpause(self)
42206
42178
  v.run.isPseudoPaused = false
42207
42179
  v.run.shouldUnpause = true
42208
42180
  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
42181
+ assertDefined(nil, tstlClassName, "Failed to find get the class name for the pause feature.")
42212
42182
  self.disableInputs:enableAllInputs(tstlClassName)
42213
42183
  for ____, player in ipairs(getAllPlayers(nil)) do
42214
42184
  player.ControlsEnabled = true
@@ -42248,6 +42218,7 @@ local ____string = require("src.functions.string")
42248
42218
  local removeCharactersBefore = ____string.removeCharactersBefore
42249
42219
  local trimPrefix = ____string.trimPrefix
42250
42220
  local ____utils = require("src.functions.utils")
42221
+ local assertDefined = ____utils.assertDefined
42251
42222
  local eRange = ____utils.eRange
42252
42223
  local iRange = ____utils.iRange
42253
42224
  local ____ReadonlySet = require("src.types.ReadonlySet")
@@ -42276,9 +42247,7 @@ function spawnWallEntity(self, customStage, rng, isExtraWall)
42276
42247
  sprite:Load(ISAACSCRIPT_CUSTOM_STAGE_GFX_PATH .. "/wall-backdrop.anm2", false)
42277
42248
  local wallLayersArray = isExtraWall and ROOM_SHAPE_WALL_EXTRA_ANM2_LAYERS or ROOM_SHAPE_WALL_ANM2_LAYERS
42278
42249
  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
42250
+ assertDefined(nil, numWallLayers, "Failed to get the layers when creating the backdrop for custom stage: " .. customStage.name)
42282
42251
  if isLRoomShape(nil, roomShape) then
42283
42252
  local cornerPNGPath = getBackdropPNGPath(nil, customStage, BackdropKind.CORNER, rng)
42284
42253
  sprite:ReplaceSpritesheet(0, cornerPNGPath)
@@ -42348,21 +42317,21 @@ function spawnFloorEntity(self, customStage, rng)
42348
42317
  end
42349
42318
  function getNumFloorLayers(self, roomShape)
42350
42319
  repeat
42351
- local ____switch23 = roomShape
42352
- local ____cond23 = ____switch23 == RoomShape.SHAPE_1x1
42353
- if ____cond23 then
42320
+ local ____switch22 = roomShape
42321
+ local ____cond22 = ____switch22 == RoomShape.SHAPE_1x1
42322
+ if ____cond22 then
42354
42323
  do
42355
42324
  return 4
42356
42325
  end
42357
42326
  end
42358
- ____cond23 = ____cond23 or (____switch23 == RoomShape.SHAPE_1x2 or ____switch23 == RoomShape.SHAPE_2x1)
42359
- if ____cond23 then
42327
+ ____cond22 = ____cond22 or (____switch22 == RoomShape.SHAPE_1x2 or ____switch22 == RoomShape.SHAPE_2x1)
42328
+ if ____cond22 then
42360
42329
  do
42361
42330
  return 8
42362
42331
  end
42363
42332
  end
42364
- ____cond23 = ____cond23 or ____switch23 == RoomShape.SHAPE_2x2
42365
- if ____cond23 then
42333
+ ____cond22 = ____cond22 or ____switch22 == RoomShape.SHAPE_2x2
42334
+ if ____cond22 then
42366
42335
  do
42367
42336
  return 16
42368
42337
  end
@@ -43176,6 +43145,8 @@ local ____entities = require("src.functions.entities")
43176
43145
  local parseEntityTypeVariantString = ____entities.parseEntityTypeVariantString
43177
43146
  local ____set = require("src.functions.set")
43178
43147
  local copySet = ____set.copySet
43148
+ local ____utils = require("src.functions.utils")
43149
+ local assertDefined = ____utils.assertDefined
43179
43150
  local ____ReadonlyMap = require("src.types.ReadonlyMap")
43180
43151
  local ReadonlyMap = ____ReadonlyMap.ReadonlyMap
43181
43152
  local ____ReadonlySet = require("src.types.ReadonlySet")
@@ -43187,9 +43158,7 @@ function getAllBossesExcludingStoryBossesSet(self)
43187
43158
  local allBosses = {__TS__Spread(____exports.ALL_BOSSES_SET:values())}
43188
43159
  for ____, entityTypeVariantString in ipairs(allBosses) do
43189
43160
  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
43161
+ assertDefined(nil, tuple, "Failed to parse a boss tuple when constructing the story boss set.")
43193
43162
  local entityType, _variant = table.unpack(tuple)
43194
43163
  if STORY_BOSSES_SET:has(entityType) then
43195
43164
  allBossesExcludingStoryBossesSet:delete(entityTypeVariantString)
@@ -44728,6 +44697,8 @@ local ____stage = require("src.functions.stage")
44728
44697
  local setStage = ____stage.setStage
44729
44698
  local ____types = require("src.functions.types")
44730
44699
  local asNumber = ____types.asNumber
44700
+ local ____utils = require("src.functions.utils")
44701
+ local assertDefined = ____utils.assertDefined
44731
44702
  local ____Feature = require("src.classes.private.Feature")
44732
44703
  local Feature = ____Feature.Feature
44733
44704
  local ____backdrop = require("src.classes.features.other.customStages.backdrop")
@@ -44794,9 +44765,7 @@ function CustomStages.prototype.____constructor(self, customGridEntities, custom
44794
44765
  self.customStageCachedRoomData = __TS__New(Map)
44795
44766
  self.usingRedKey = false
44796
44767
  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
44768
+ assertDefined(nil, destinationName, "Failed to go to a custom stage since the custom trapdoors feature did not pass a destination name to the logic function.")
44800
44769
  local firstFloor = destinationStage == LevelStage.BASEMENT_1
44801
44770
  self:setCustomStage(destinationName, firstFloor)
44802
44771
  end
@@ -44959,10 +44928,10 @@ function CustomStages.prototype.setStageRoomsData(self, customStage, rng, verbos
44959
44928
  for ____, room in ipairs(getRoomsInsideGrid(nil)) do
44960
44929
  do
44961
44930
  if room.SafeGridIndex == startingRoomGridIndex then
44962
- goto __continue36
44931
+ goto __continue35
44963
44932
  end
44964
44933
  if room.Data == nil then
44965
- goto __continue36
44934
+ goto __continue35
44966
44935
  end
44967
44936
  local roomType = room.Data.Type
44968
44937
  local roomShapeMap = customStage.roomTypeMap:get(roomType)
@@ -44970,13 +44939,13 @@ function CustomStages.prototype.setStageRoomsData(self, customStage, rng, verbos
44970
44939
  if roomType == RoomType.DEFAULT then
44971
44940
  logError((((("Failed to find any custom rooms for RoomType." .. RoomType[roomType]) .. " (") .. tostring(roomType)) .. ") for custom stage: ") .. customStage.name)
44972
44941
  end
44973
- goto __continue36
44942
+ goto __continue35
44974
44943
  end
44975
44944
  local roomShape = room.Data.Shape
44976
44945
  local roomDoorSlotFlagMap = roomShapeMap:get(roomShape)
44977
44946
  if roomDoorSlotFlagMap == nil then
44978
44947
  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
44948
+ goto __continue35
44980
44949
  end
44981
44950
  local doorSlotFlags = room.Data.Doors
44982
44951
  local roomsMetadata = roomDoorSlotFlagMap:get(doorSlotFlags)
@@ -44986,13 +44955,13 @@ function CustomStages.prototype.setStageRoomsData(self, customStage, rng, verbos
44986
44955
  roomsMetadata = roomDoorSlotFlagMap:get(allDoorSlotFlags)
44987
44956
  if roomsMetadata == nil then
44988
44957
  logError((((((((("Failed to find any custom rooms for RoomType." .. RoomType[roomType]) .. " (") .. tostring(roomType)) .. ") + RoomShape.") .. RoomShape[roomShape]) .. " (") .. tostring(roomShape)) .. ") + all doors enabled for custom stage: ") .. customStage.name)
44989
- goto __continue36
44958
+ goto __continue35
44990
44959
  end
44991
44960
  end
44992
44961
  local randomRoom
44993
44962
  if roomType == RoomType.BOSS then
44994
44963
  if customStage.bossPool == nil then
44995
- goto __continue36
44964
+ goto __continue35
44996
44965
  end
44997
44966
  randomRoom = getRandomBossRoomFromPool(
44998
44967
  nil,
@@ -45015,13 +44984,13 @@ function CustomStages.prototype.setStageRoomsData(self, customStage, rng, verbos
45015
44984
  )
45016
44985
  if newRoomData == nil then
45017
44986
  logError((("Failed to get the room data for room variant " .. tostring(randomRoom.variant)) .. " for custom stage: ") .. customStage.name)
45018
- goto __continue36
44987
+ goto __continue35
45019
44988
  end
45020
44989
  self.customStageCachedRoomData:set(randomRoom.variant, newRoomData)
45021
44990
  end
45022
44991
  room.Data = newRoomData
45023
44992
  end
45024
- ::__continue36::
44993
+ ::__continue35::
45025
44994
  end
45026
44995
  end
45027
44996
  function CustomStages.prototype.setCustomStage(self, name, firstFloor, streakText, verbose)
@@ -45035,9 +45004,7 @@ function CustomStages.prototype.setCustomStage(self, name, firstFloor, streakTex
45035
45004
  verbose = false
45036
45005
  end
45037
45006
  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
45007
+ assertDefined(nil, customStage, ("Failed to set the custom stage of \"" .. name) .. "\" because it was not found in the custom stages map. (Try restarting IsaacScript / recompiling the mod / restarting the game, and try again. If that does not work, you probably forgot to define it in your \"tsconfig.json\" file.) See the website for more details on how to set up custom stages.")
45041
45008
  local level = game:GetLevel()
45042
45009
  local stage = level:GetStage()
45043
45010
  local seeds = game:GetSeeds()
@@ -46022,6 +45989,8 @@ local isLRoomShape = ____roomShape.isLRoomShape
46022
45989
  local ____rooms = require("src.functions.rooms")
46023
45990
  local inBossRoomOf = ____rooms.inBossRoomOf
46024
45991
  local inHomeCloset = ____rooms.inHomeCloset
45992
+ local ____utils = require("src.functions.utils")
45993
+ local assertDefined = ____utils.assertDefined
46025
45994
  function getVanillaWallGridIndexSetForRoomShape(self, roomShape)
46026
45995
  local corners = getRoomShapeCorners(nil, roomShape)
46027
45996
  local lRoom = isLRoomShape(nil, roomShape)
@@ -46253,9 +46222,11 @@ function ____exports.isVanillaWallGridIndex(self, gridIndex)
46253
46222
  wallGridIndexSet = MOTHER_ROOM_CORNERS_SET
46254
46223
  else
46255
46224
  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)) .. ")")
46225
+ assertDefined(
46226
+ nil,
46227
+ wallGridIndexSet,
46228
+ ((("Failed to find the wall grid index set for: RoomShape." .. RoomShape[roomShape]) .. " (") .. tostring(roomShape)) .. ")"
46229
+ )
46259
46230
  end
46260
46231
  return wallGridIndexSet:has(gridIndex)
46261
46232
  end
@@ -46351,11 +46322,14 @@ local ____exports = {}
46351
46322
  local getTotalWeightOfJSONObject, getJSONObjectWithChosenWeight
46352
46323
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
46353
46324
  local DoorSlotFlagZero = ____isaac_2Dtypescript_2Ddefinitions.DoorSlotFlagZero
46325
+ local RoomShape = ____isaac_2Dtypescript_2Ddefinitions.RoomShape
46354
46326
  local ____array = require("src.functions.array")
46355
46327
  local sumArray = ____array.sumArray
46356
46328
  local ____doors = require("src.functions.doors")
46357
46329
  local doorSlotToDoorSlotFlag = ____doors.doorSlotToDoorSlotFlag
46358
46330
  local getRoomShapeDoorSlot = ____doors.getRoomShapeDoorSlot
46331
+ local ____enums = require("src.functions.enums")
46332
+ local isEnumValue = ____enums.isEnumValue
46359
46333
  local ____flag = require("src.functions.flag")
46360
46334
  local addFlag = ____flag.addFlag
46361
46335
  local ____log = require("src.functions.log")
@@ -46364,15 +46338,19 @@ local ____random = require("src.functions.random")
46364
46338
  local getRandomFloat = ____random.getRandomFloat
46365
46339
  local ____rng = require("src.functions.rng")
46366
46340
  local getRandomSeed = ____rng.getRandomSeed
46341
+ local ____utils = require("src.functions.utils")
46342
+ local assertDefined = ____utils.assertDefined
46367
46343
  function getTotalWeightOfJSONObject(self, jsonOjectArray)
46368
46344
  local weights = __TS__ArrayMap(
46369
46345
  jsonOjectArray,
46370
46346
  function(____, jsonObject)
46371
46347
  local weightString = jsonObject["$"].weight
46372
46348
  local weight = tonumber(weightString)
46373
- if weight == nil then
46374
- error(("Failed to parse the weight of a JSON object: " .. tostring(weightString)) .. ".")
46375
- end
46349
+ assertDefined(
46350
+ nil,
46351
+ weight,
46352
+ ("Failed to parse the weight of a JSON object: " .. tostring(weightString)) .. "."
46353
+ )
46376
46354
  return weight
46377
46355
  end
46378
46356
  )
@@ -46383,9 +46361,11 @@ function getJSONObjectWithChosenWeight(self, jsonOjectArray, chosenWeight)
46383
46361
  for ____, jsonObject in ipairs(jsonOjectArray) do
46384
46362
  local weightString = jsonObject["$"].weight
46385
46363
  local weight = tonumber(weightString)
46386
- if weight == nil then
46387
- error("Failed to parse the weight of a JSON object: " .. tostring(weightString))
46388
- end
46364
+ assertDefined(
46365
+ nil,
46366
+ weight,
46367
+ "Failed to parse the weight of a JSON object: " .. tostring(weightString)
46368
+ )
46389
46369
  weightAccumulator = weightAccumulator + weight
46390
46370
  if weightAccumulator >= chosenWeight then
46391
46371
  return jsonObject
@@ -46396,8 +46376,9 @@ end
46396
46376
  function ____exports.getJSONRoomDoorSlotFlags(self, jsonRoom)
46397
46377
  local roomShapeString = jsonRoom["$"].shape
46398
46378
  local roomShapeNumber = tonumber(roomShapeString)
46399
- if roomShapeNumber == nil then
46400
- error("Failed to parse the \"shape\" field of a JSON room: " .. roomShapeString)
46379
+ assertDefined(nil, roomShapeNumber, "Failed to parse the \"shape\" field of a JSON room: " .. roomShapeString)
46380
+ if not isEnumValue(nil, roomShapeNumber, RoomShape) then
46381
+ error("Failed to parse the \"shape\" field of a JSON room since it was an invalid number: " .. tostring(roomShapeNumber))
46401
46382
  end
46402
46383
  local roomShape = roomShapeNumber
46403
46384
  local doorSlotFlags = DoorSlotFlagZero
@@ -46412,18 +46393,16 @@ function ____exports.getJSONRoomDoorSlotFlags(self, jsonRoom)
46412
46393
  end
46413
46394
  local xString = door["$"].x
46414
46395
  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
46396
+ assertDefined(nil, x, "Failed to parse the \"x\" field of a JSON room door: " .. xString)
46418
46397
  local yString = door["$"].y
46419
46398
  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
46399
+ assertDefined(nil, y, "Failed to parse the \"y\" field of a JSON room door: " .. yString)
46423
46400
  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
46401
+ assertDefined(
46402
+ nil,
46403
+ doorSlot,
46404
+ ((("Failed to retrieve the door slot for a JSON room door at coordinates: [" .. tostring(x)) .. ", ") .. tostring(y)) .. "]"
46405
+ )
46427
46406
  local doorSlotFlag = doorSlotToDoorSlotFlag(nil, doorSlot)
46428
46407
  doorSlotFlags = addFlag(nil, doorSlotFlags, doorSlotFlag)
46429
46408
  end
@@ -46474,9 +46453,11 @@ function ____exports.getRandomJSONEntity(self, jsonEntities, seedOrRNG, verbose)
46474
46453
  log("Randomly chose weight for JSON entity: " .. tostring(chosenWeight))
46475
46454
  end
46476
46455
  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
46456
+ assertDefined(
46457
+ nil,
46458
+ randomJSONEntity,
46459
+ "Failed to get a JSON entity with chosen weight: " .. tostring(chosenWeight)
46460
+ )
46480
46461
  return randomJSONEntity
46481
46462
  end
46482
46463
  function ____exports.getRandomJSONRoom(self, jsonRooms, seedOrRNG, verbose)
@@ -46495,9 +46476,11 @@ function ____exports.getRandomJSONRoom(self, jsonRooms, seedOrRNG, verbose)
46495
46476
  log("Randomly chose weight for JSON room: " .. tostring(chosenWeight))
46496
46477
  end
46497
46478
  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
46479
+ assertDefined(
46480
+ nil,
46481
+ randomJSONRoom,
46482
+ "Failed to get a JSON room with chosen weight: " .. tostring(chosenWeight)
46483
+ )
46501
46484
  return randomJSONRoom
46502
46485
  end
46503
46486
  return ____exports
@@ -47037,6 +47020,8 @@ local setRoomUncleared = ____rooms.setRoomUncleared
47037
47020
  local ____types = require("src.functions.types")
47038
47021
  local asCollectibleType = ____types.asCollectibleType
47039
47022
  local asNumber = ____types.asNumber
47023
+ local ____utils = require("src.functions.utils")
47024
+ local assertDefined = ____utils.assertDefined
47040
47025
  local ____ReadonlySet = require("src.types.ReadonlySet")
47041
47026
  local ReadonlySet = ____ReadonlySet.ReadonlySet
47042
47027
  local ____Feature = require("src.classes.private.Feature")
@@ -47190,30 +47175,28 @@ function DeployJSONRoom.prototype.spawnAllEntities(self, jsonRoom, rng, verbose)
47190
47175
  for ____, jsonSpawn in ipairs(jsonRoom.spawn) do
47191
47176
  local xString = jsonSpawn["$"].x
47192
47177
  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
47178
+ assertDefined(nil, x, "Failed to convert the following x coordinate to a number (for a spawn): " .. xString)
47196
47179
  local yString = jsonSpawn["$"].y
47197
47180
  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
47181
+ assertDefined(nil, y, "Failed to convert the following y coordinate to a number (for a spawn): " .. yString)
47201
47182
  local jsonEntity = getRandomJSONEntity(nil, jsonSpawn.entity)
47202
47183
  local entityTypeString = jsonEntity["$"].type
47203
47184
  local entityTypeNumber = tonumber(entityTypeString)
47204
- if entityTypeNumber == nil then
47205
- error("Failed to convert the entity type to a number: " .. entityTypeString)
47206
- end
47185
+ assertDefined(nil, entityTypeNumber, "Failed to convert the entity type to a number: " .. entityTypeString)
47207
47186
  local variantString = jsonEntity["$"].variant
47208
47187
  local variant = tonumber(variantString)
47209
- if variant == nil then
47210
- error("Failed to convert the entity variant to a number: " .. tostring(variant))
47211
- end
47188
+ assertDefined(
47189
+ nil,
47190
+ variant,
47191
+ "Failed to convert the entity variant to a number: " .. tostring(variant)
47192
+ )
47212
47193
  local subTypeString = jsonEntity["$"].subtype
47213
47194
  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
47195
+ assertDefined(
47196
+ nil,
47197
+ subType,
47198
+ "Failed to convert the entity sub-type to a number: " .. tostring(subType)
47199
+ )
47217
47200
  local isGridEntity = GRID_ENTITY_XML_TYPE_SET:has(entityTypeNumber)
47218
47201
  if isGridEntity then
47219
47202
  local gridEntityXMLType = entityTypeNumber
@@ -52153,6 +52136,8 @@ local log = ____log.log
52153
52136
  local ____tstlClass = require("src.functions.tstlClass")
52154
52137
  local getTSTLClassConstructor = ____tstlClass.getTSTLClassConstructor
52155
52138
  local getTSTLClassName = ____tstlClass.getTSTLClassName
52139
+ local ____utils = require("src.functions.utils")
52140
+ local assertDefined = ____utils.assertDefined
52156
52141
  function getExportedMethodsFromFeature(self, featureClass)
52157
52142
  local constructor = getTSTLClassConstructor(nil, featureClass)
52158
52143
  local exportedMethodNames = constructor[EXPORTED_METHOD_NAMES_KEY]
@@ -52260,9 +52245,7 @@ function ModUpgraded.prototype.logUsedFeatures(self)
52260
52245
  goto __continue19
52261
52246
  end
52262
52247
  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
52248
+ assertDefined(nil, modCallbackCustom, "Failed to convert an index on the callbacks object to a number.")
52266
52249
  log(((("- ModCallbackCustom." .. tostring(ModCallbackCustom[modCallbackCustom])) .. " (") .. tostring(modCallbackCustom)) .. ")")
52267
52250
  end
52268
52251
  ::__continue19::
@@ -52272,15 +52255,13 @@ function ModUpgraded.prototype.logUsedFeatures(self)
52272
52255
  local featureClass = ____value[2]
52273
52256
  do
52274
52257
  if featureClass.numConsumers == 0 then
52275
- goto __continue23
52258
+ goto __continue22
52276
52259
  end
52277
52260
  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
52261
+ assertDefined(nil, iscFeature, "Failed to convert an index on the features object to a number.")
52281
52262
  log(((("- ISCFeature." .. tostring(ISCFeature[iscFeature])) .. " (") .. tostring(iscFeature)) .. ")")
52282
52263
  end
52283
- ::__continue23::
52264
+ ::__continue22::
52284
52265
  end
52285
52266
  end
52286
52267
  function ModUpgraded.prototype.initFeature(self, feature)
@@ -52327,9 +52308,7 @@ function ModUpgraded.prototype.initFeature(self, feature)
52327
52308
  end
52328
52309
  if feature.v ~= nil then
52329
52310
  local className = getTSTLClassName(nil, feature)
52330
- if className == nil then
52331
- error("Failed to get the name of a feature.")
52332
- end
52311
+ assertDefined(nil, className, "Failed to get the name of a feature.")
52333
52312
  local saveDataManagerClass = self.features[ISCFeature.SAVE_DATA_MANAGER]
52334
52313
  saveDataManagerClass:saveDataManager(className, feature.v, feature.vConditionalFunc)
52335
52314
  end
@@ -52368,9 +52347,7 @@ function ModUpgraded.prototype.uninitFeature(self, feature)
52368
52347
  end
52369
52348
  if feature.v ~= nil then
52370
52349
  local className = getTSTLClassName(nil, feature)
52371
- if className == nil then
52372
- error("Failed to get the name of a feature.")
52373
- end
52350
+ assertDefined(nil, className, "Failed to get the name of a feature.")
52374
52351
  local saveDataManagerClass = self.features[ISCFeature.SAVE_DATA_MANAGER]
52375
52352
  saveDataManagerClass:saveDataManagerRemove(className)
52376
52353
  end
@@ -52398,6 +52375,8 @@ local ____types = require("src.functions.types")
52398
52375
  local isFunction = ____types.isFunction
52399
52376
  local isNumber = ____types.isNumber
52400
52377
  local isTable = ____types.isTable
52378
+ local ____utils = require("src.functions.utils")
52379
+ local assertDefined = ____utils.assertDefined
52401
52380
  function initDecoratedCallbacks(self, modFeature, constructor, tstlClassName, vanilla, init)
52402
52381
  local modFeatureConstructor = constructor
52403
52382
  local callbackTuplesKey = vanilla and ____exports.MOD_FEATURE_CALLBACKS_KEY or ____exports.MOD_FEATURE_CUSTOM_CALLBACKS_KEY
@@ -52528,9 +52507,7 @@ function initSaveDataManager(self, modFeature, tstlClassName, init)
52528
52507
  local mod = modFeature.mod
52529
52508
  local saveDataManagerMethodName = init and "saveDataManager" or "saveDataManagerRemove"
52530
52509
  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
52510
+ assertDefined(nil, saveDataManagerMethod, "Failed to initialize a mod feature class due to having a \"v\" object and not having the save data manager initialized. You must pass \"ISCFeature.SAVE_DATA_MANAGER\" to the \"upgradeMod\" function.")
52534
52511
  if type(saveDataManagerMethod) ~= "function" then
52535
52512
  error(("The \"" .. saveDataManagerMethodName) .. "\" property of the \"ModUpgraded\" object was not a function.")
52536
52513
  end
@@ -52567,13 +52544,9 @@ function ModFeature.prototype.init(self, init)
52567
52544
  end
52568
52545
  self.initialized = init
52569
52546
  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
52547
+ assertDefined(nil, constructor, "Failed to get the TSTL class constructor for a mod feature.")
52573
52548
  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
52549
+ assertDefined(nil, tstlClassName, "Failed to get the TSTL class name for a mod feature.")
52577
52550
  initDecoratedCallbacks(
52578
52551
  nil,
52579
52552
  self,
@@ -53464,6 +53437,8 @@ local getRoomDescriptor = ____roomData.getRoomDescriptor
53464
53437
  local getRoomGridIndex = ____roomData.getRoomGridIndex
53465
53438
  local ____rooms = require("src.functions.rooms")
53466
53439
  local getRoomsInsideGrid = ____rooms.getRoomsInsideGrid
53440
+ local ____utils = require("src.functions.utils")
53441
+ local assertDefined = ____utils.assertDefined
53467
53442
  function ____exports.getRoomDisplayFlags(self, roomGridIndex, minimapAPI)
53468
53443
  if minimapAPI == nil then
53469
53444
  minimapAPI = true
@@ -53476,9 +53451,11 @@ function ____exports.getRoomDisplayFlags(self, roomGridIndex, minimapAPI)
53476
53451
  return roomDescriptor.DisplayFlags
53477
53452
  end
53478
53453
  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
53454
+ assertDefined(
53455
+ nil,
53456
+ minimapAPIRoomDescriptor,
53457
+ "Failed to get the MinimapAPI room descriptor for the room at grid index: " .. tostring(roomGridIndex)
53458
+ )
53482
53459
  return minimapAPIRoomDescriptor:GetDisplayFlags()
53483
53460
  end
53484
53461
  function ____exports.setAllDisplayFlags(self, displayFlags)
@@ -53506,9 +53483,11 @@ function ____exports.setRoomDisplayFlags(self, roomGridIndex, displayFlags, upda
53506
53483
  end
53507
53484
  else
53508
53485
  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
53486
+ assertDefined(
53487
+ nil,
53488
+ minimapAPIRoomDescriptor,
53489
+ "Failed to get the MinimapAPI room descriptor for the room at grid index: " .. tostring(roomGridIndex)
53490
+ )
53512
53491
  minimapAPIRoomDescriptor:SetDisplayFlags(displayFlags)
53513
53492
  end
53514
53493
  end
@@ -53542,9 +53521,11 @@ function ____exports.hideRoomOnMinimap(self, roomGridIndex)
53542
53521
  ____exports.clearRoomDisplayFlags(nil, roomGridIndex)
53543
53522
  if MinimapAPI ~= nil then
53544
53523
  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
53524
+ assertDefined(
53525
+ nil,
53526
+ minimapAPIRoomDescriptor,
53527
+ "Failed to get the MinimapAPI room descriptor for the room at grid index: " .. tostring(roomGridIndex)
53528
+ )
53548
53529
  minimapAPIRoomDescriptor.Hidden = true
53549
53530
  end
53550
53531
  end