isaacscript-common 80.2.2 → 80.2.4

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 (69) hide show
  1. package/dist/classes/ModUpgraded.d.ts.map +1 -1
  2. package/dist/classes/ModUpgraded.lua +18 -8
  3. package/dist/classes/features/other/DeployJSONRoom.lua +11 -10
  4. package/dist/classes/features/other/ModdedElementDetection.d.ts +0 -4
  5. package/dist/classes/features/other/ModdedElementDetection.d.ts.map +1 -1
  6. package/dist/classes/features/other/ModdedElementDetection.lua +12 -12
  7. package/dist/classes/features/other/extraConsoleCommands/commands.d.ts +1 -1
  8. package/dist/classes/features/other/extraConsoleCommands/commands.d.ts.map +1 -1
  9. package/dist/classes/features/other/extraConsoleCommands/commands.lua +104 -102
  10. package/dist/classes/features/other/extraConsoleCommands/subroutines.d.ts.map +1 -1
  11. package/dist/classes/features/other/extraConsoleCommands/subroutines.lua +6 -4
  12. package/dist/core/constantsFirstLast.d.ts +4 -26
  13. package/dist/core/constantsFirstLast.d.ts.map +1 -1
  14. package/dist/core/constantsFirstLast.lua +0 -18
  15. package/dist/functions/cards.d.ts +1 -0
  16. package/dist/functions/cards.d.ts.map +1 -1
  17. package/dist/functions/cards.lua +7 -0
  18. package/dist/functions/collectibles.d.ts +7 -3
  19. package/dist/functions/collectibles.d.ts.map +1 -1
  20. package/dist/functions/collectibles.lua +9 -3
  21. package/dist/functions/doors.d.ts.map +1 -1
  22. package/dist/functions/doors.lua +14 -4
  23. package/dist/functions/entities.d.ts.map +1 -1
  24. package/dist/functions/entities.lua +19 -30
  25. package/dist/functions/gridEntities.d.ts.map +1 -1
  26. package/dist/functions/gridEntities.lua +8 -13
  27. package/dist/functions/jsonRoom.d.ts.map +1 -1
  28. package/dist/functions/jsonRoom.lua +13 -5
  29. package/dist/functions/pills.d.ts +1 -0
  30. package/dist/functions/pills.d.ts.map +1 -1
  31. package/dist/functions/pills.lua +6 -0
  32. package/dist/functions/run.d.ts +1 -2
  33. package/dist/functions/run.d.ts.map +1 -1
  34. package/dist/functions/run.lua +2 -3
  35. package/dist/functions/string.d.ts.map +1 -1
  36. package/dist/functions/string.lua +5 -3
  37. package/dist/functions/table.d.ts +3 -2
  38. package/dist/functions/table.d.ts.map +1 -1
  39. package/dist/functions/table.lua +3 -2
  40. package/dist/functions/trinkets.d.ts +1 -0
  41. package/dist/functions/trinkets.d.ts.map +1 -1
  42. package/dist/functions/trinkets.lua +6 -0
  43. package/dist/functions/types.d.ts +9 -0
  44. package/dist/functions/types.d.ts.map +1 -1
  45. package/dist/functions/types.lua +17 -0
  46. package/dist/index.rollup.d.ts +29 -34
  47. package/dist/isaacscript-common.lua +270 -221
  48. package/dist/lualib_bundle.lua +5 -0
  49. package/dist/objects/itemPoolTypeToCollectibleTypesSet.lua +4 -3
  50. package/package.json +2 -2
  51. package/src/classes/ModUpgraded.ts +18 -4
  52. package/src/classes/features/other/DeployJSONRoom.ts +11 -11
  53. package/src/classes/features/other/ModdedElementDetection.ts +4 -6
  54. package/src/classes/features/other/extraConsoleCommands/commands.ts +124 -118
  55. package/src/classes/features/other/extraConsoleCommands/subroutines.ts +5 -4
  56. package/src/core/constantsFirstLast.ts +3 -37
  57. package/src/functions/cards.ts +7 -0
  58. package/src/functions/collectibles.ts +11 -6
  59. package/src/functions/doors.ts +8 -3
  60. package/src/functions/entities.ts +40 -19
  61. package/src/functions/gridEntities.ts +15 -5
  62. package/src/functions/jsonRoom.ts +18 -5
  63. package/src/functions/pills.ts +7 -1
  64. package/src/functions/run.ts +6 -4
  65. package/src/functions/string.ts +4 -3
  66. package/src/functions/table.ts +3 -2
  67. package/src/functions/trinkets.ts +9 -1
  68. package/src/functions/types.ts +25 -0
  69. package/src/objects/itemPoolTypeToCollectibleTypesSet.ts +4 -4
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 80.2.1
3
+ isaacscript-common 80.2.3
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -1518,6 +1518,10 @@ local function __TS__NumberIsFinite(value)
1518
1518
  return type(value) == "number" and value == value and value ~= math.huge and value ~= -math.huge
1519
1519
  end
1520
1520
 
1521
+ local function __TS__NumberIsInteger(value)
1522
+ return __TS__NumberIsFinite(value) and math.floor(value) == value
1523
+ end
1524
+
1521
1525
  local function __TS__NumberIsNaN(value)
1522
1526
  return value ~= value
1523
1527
  end
@@ -2619,6 +2623,7 @@ return {
2619
2623
  __TS__New = __TS__New,
2620
2624
  __TS__Number = __TS__Number,
2621
2625
  __TS__NumberIsFinite = __TS__NumberIsFinite,
2626
+ __TS__NumberIsInteger = __TS__NumberIsInteger,
2622
2627
  __TS__NumberIsNaN = __TS__NumberIsNaN,
2623
2628
  __TS__ParseInt = __TS__ParseInt,
2624
2629
  __TS__ParseFloat = __TS__ParseFloat,
@@ -17147,6 +17152,23 @@ end
17147
17152
  function ____exports.isUserdata(self, variable)
17148
17153
  return type(variable) == "userdata"
17149
17154
  end
17155
+ --- Helper function to convert a string to an integer. Returns undefined if the string is not an
17156
+ -- integer.
17157
+ --
17158
+ -- Under the hood, this uses the built-in `tonumber` and `math.floor` functions.
17159
+ --
17160
+ -- This is named `parseIntSafe` in order to match the helper function in `isaacscript-common-ts`.
17161
+ function ____exports.parseIntSafe(self, ____string)
17162
+ if not ____exports.isString(nil, ____string) then
17163
+ return nil
17164
+ end
17165
+ local number = tonumber(____string)
17166
+ if number == nil then
17167
+ return nil
17168
+ end
17169
+ local flooredNumber = math.floor(number)
17170
+ return number == flooredNumber and flooredNumber or nil
17171
+ end
17150
17172
  return ____exports
17151
17173
  end,
17152
17174
  ["functions.sort"] = function(...)
@@ -17936,6 +17958,8 @@ local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
17936
17958
  local __TS__StringSlice = ____lualib.__TS__StringSlice
17937
17959
  local __TS__StringEndsWith = ____lualib.__TS__StringEndsWith
17938
17960
  local ____exports = {}
17961
+ local ____types = require("functions.types")
17962
+ local parseIntSafe = ____types.parseIntSafe
17939
17963
  local ____utils = require("functions.utils")
17940
17964
  local assertDefined = ____utils.assertDefined
17941
17965
  --- Helper function to get the closest value from an array of strings based on partial search text.
@@ -18049,9 +18073,9 @@ function ____exports.parseSemanticVersion(self, versionString)
18049
18073
  if majorVersionString == nil or minorVersionString == nil or patchVersionString == nil then
18050
18074
  return nil
18051
18075
  end
18052
- local majorVersion = tonumber(majorVersionString)
18053
- local minorVersion = tonumber(minorVersionString)
18054
- local patchVersion = tonumber(patchVersionString)
18076
+ local majorVersion = parseIntSafe(nil, majorVersionString)
18077
+ local minorVersion = parseIntSafe(nil, minorVersionString)
18078
+ local patchVersion = parseIntSafe(nil, patchVersionString)
18055
18079
  if majorVersion == nil or minorVersion == nil or patchVersion == nil then
18056
18080
  return nil
18057
18081
  end
@@ -18292,8 +18316,9 @@ function ____exports.getBooleansFromTable(self, luaMap, objectName, ...)
18292
18316
  end
18293
18317
  return booleans
18294
18318
  end
18295
- --- Helper function to safely get number values from specific keys on a Lua table. Will throw an
18296
- -- error if the specific value does not exist on the table or if it cannot be converted to a number.
18319
+ --- Helper function to safely get number values from specific keys on a Lua table. If the values are
18320
+ -- strings, they will be converted to numbers. Will throw an error if the specific value does not
18321
+ -- exist on the table or if it cannot be converted to a number.
18297
18322
  --
18298
18323
  -- This function is variadic, meaning that you can specify N arguments to get N values.
18299
18324
  function ____exports.getNumbersFromTable(self, luaMap, objectName, ...)
@@ -20107,11 +20132,9 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescri
20107
20132
  local CardType = ____isaac_2Dtypescript_2Ddefinitions.CardType
20108
20133
  local Challenge = ____isaac_2Dtypescript_2Ddefinitions.Challenge
20109
20134
  local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
20110
- local LevelStage = ____isaac_2Dtypescript_2Ddefinitions.LevelStage
20111
20135
  local PillColor = ____isaac_2Dtypescript_2Ddefinitions.PillColor
20112
20136
  local PillEffect = ____isaac_2Dtypescript_2Ddefinitions.PillEffect
20113
20137
  local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
20114
- local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
20115
20138
  local TrinketType = ____isaac_2Dtypescript_2Ddefinitions.TrinketType
20116
20139
  local ____enums = require("functions.enums")
20117
20140
  local getEnumLength = ____enums.getEnumLength
@@ -20139,20 +20162,12 @@ ____exports.NUM_VANILLA_TRINKET_TYPES = getEnumLength(nil, TrinketType) - 1
20139
20162
  --- Equal to `Card.FOOL`.
20140
20163
  ____exports.FIRST_CARD_TYPE = CardType.FOOL
20141
20164
  --- Calculated from the `CardType` enum.
20142
- --
20143
- -- Note that this could be calculated from the length of the enum, because card types are
20144
- -- contiguous. However, we instead get the highest enum value to be safer and to make the code more
20145
- -- consistent with collectibles and trinkets.
20146
20165
  ____exports.LAST_VANILLA_CARD_TYPE = getHighestEnumValue(nil, CardType)
20147
20166
  --- Calculated from the `Card` enum. `Card.NULL` is not included.
20148
20167
  ____exports.NUM_VANILLA_CARD_TYPES = getEnumLength(nil, CardType) - 1
20149
20168
  --- Equal to `PillEffect.BAD_GAS`.
20150
20169
  ____exports.FIRST_PILL_EFFECT = PillEffect.BAD_GAS
20151
20170
  --- Calculated from the `PillEffect` enum.
20152
- --
20153
- -- Note that this could be calculated from the length of the enum, because pill effects are
20154
- -- contiguous. However, we instead get the highest enum value to be safer and to make the code more
20155
- -- consistent with collectibles and trinkets.
20156
20171
  ____exports.LAST_VANILLA_PILL_EFFECT = getHighestEnumValue(nil, PillEffect)
20157
20172
  --- Calculated from the `PillEffect` enum. (There is no `PillEffect.NULL` in the custom enum, so we
20158
20173
  -- do not have to subtract one here.)
@@ -20175,15 +20190,7 @@ ____exports.NUM_NORMAL_PILL_COLORS = #iRange(nil, ____exports.FIRST_PILL_COLOR,
20175
20190
  --- Equal to `PlayerType.ISAAC`.
20176
20191
  ____exports.FIRST_CHARACTER = PlayerType.ISAAC
20177
20192
  --- Calculated from the `PlayerType` enum.
20178
- --
20179
- -- Note that this could be calculated from the length of the enum, because characters are
20180
- -- contiguous. However, we instead get the highest enum value to be safer and to make the code more
20181
- -- consistent with collectibles and trinkets.
20182
20193
  ____exports.LAST_VANILLA_CHARACTER = getHighestEnumValue(nil, PlayerType)
20183
- ____exports.FIRST_ROOM_TYPE = RoomType.DEFAULT
20184
- ____exports.LAST_ROOM_TYPE = getHighestEnumValue(nil, RoomType)
20185
- ____exports.FIRST_STAGE = LevelStage.BASEMENT_1
20186
- ____exports.LAST_STAGE = getHighestEnumValue(nil, LevelStage)
20187
20194
  --- Calculated from the `Challenge` enum. `Challenge.NULL` is not included.
20188
20195
  ____exports.NUM_VANILLA_CHALLENGES = getEnumLength(nil, Challenge) - 1
20189
20196
  return ____exports
@@ -23574,10 +23581,14 @@ local ____bitwise = require("functions.bitwise")
23574
23581
  local arrayToBitFlags = ____bitwise.arrayToBitFlags
23575
23582
  local ____direction = require("functions.direction")
23576
23583
  local directionToVector = ____direction.directionToVector
23584
+ local ____enums = require("functions.enums")
23585
+ local isEnumValue = ____enums.isEnumValue
23577
23586
  local ____flag = require("functions.flag")
23578
23587
  local hasFlag = ____flag.hasFlag
23579
23588
  local ____tstlClass = require("functions.tstlClass")
23580
23589
  local isTSTLSet = ____tstlClass.isTSTLSet
23590
+ local ____types = require("functions.types")
23591
+ local parseIntSafe = ____types.parseIntSafe
23581
23592
  function ____exports.doorSlotToDirection(self, doorSlot)
23582
23593
  return DOOR_SLOT_TO_DIRECTION[doorSlot]
23583
23594
  end
@@ -23836,11 +23847,17 @@ function ____exports.getRoomShapeDoorSlot(self, roomShape, x, y)
23836
23847
  for ____, ____value in ipairs(__TS__ObjectEntries(doorSlotCoordinates)) do
23837
23848
  local doorSlotString = ____value[1]
23838
23849
  local coordinates = ____value[2]
23839
- local doorSlot = tonumber(doorSlotString)
23840
- local doorX, doorY = table.unpack(coordinates)
23841
- if x == doorX and y == doorY then
23842
- return doorSlot
23850
+ do
23851
+ local doorSlot = parseIntSafe(nil, doorSlotString)
23852
+ if doorSlot == nil or not isEnumValue(nil, doorSlot, DoorSlot) then
23853
+ goto __continue40
23854
+ end
23855
+ local doorX, doorY = table.unpack(coordinates)
23856
+ if x == doorX and y == doorY then
23857
+ return doorSlot
23858
+ end
23843
23859
  end
23860
+ ::__continue40::
23844
23861
  end
23845
23862
  return nil
23846
23863
  end
@@ -26788,6 +26805,7 @@ local isTSTLSet = ____tstlClass.isTSTLSet
26788
26805
  local ____types = require("functions.types")
26789
26806
  local asNPCState = ____types.asNPCState
26790
26807
  local isPrimitive = ____types.isPrimitive
26808
+ local parseIntSafe = ____types.parseIntSafe
26791
26809
  local ____utils = require("functions.utils")
26792
26810
  local assertDefined = ____utils.assertDefined
26793
26811
  local ____vector = require("functions.vector")
@@ -26967,24 +26985,15 @@ function ____exports.getConstituentsFromEntityID(self, entityID)
26967
26985
  error("Failed to get the constituents from entity ID: " .. entityID)
26968
26986
  end
26969
26987
  local entityTypeString, variantString, subTypeString = table.unpack(parts)
26970
- local entityType = tonumber(entityTypeString)
26971
- assertDefined(
26972
- nil,
26973
- entityType,
26974
- "Failed to convert the entity type to a number: " .. tostring(entityTypeString)
26975
- )
26976
- local variant = tonumber(variantString)
26977
- assertDefined(
26978
- nil,
26979
- variant,
26980
- "Failed to convert the entity variant to a number: " .. tostring(variantString)
26981
- )
26982
- local subType = tonumber(subTypeString)
26983
- assertDefined(
26984
- nil,
26985
- subType,
26986
- "Failed to convert the entity sub-type to a number: " .. tostring(subTypeString)
26987
- )
26988
+ assertDefined(nil, entityTypeString, "Failed to get the first constituent from an entity ID: " .. entityID)
26989
+ assertDefined(nil, variantString, "Failed to get the second constituent from an entity ID: " .. entityID)
26990
+ assertDefined(nil, subTypeString, "Failed to get the third constituent from an entity ID: " .. entityID)
26991
+ local entityType = parseIntSafe(nil, entityTypeString)
26992
+ assertDefined(nil, entityType, "Failed to convert the entity type to an integer: " .. entityTypeString)
26993
+ local variant = parseIntSafe(nil, variantString)
26994
+ assertDefined(nil, variant, "Failed to convert the entity variant to an integer: " .. variantString)
26995
+ local subType = parseIntSafe(nil, subTypeString)
26996
+ assertDefined(nil, subType, "Failed to convert the entity sub-type to an integer: " .. subTypeString)
26988
26997
  return {entityType, variant, subType}
26989
26998
  end
26990
26999
  --- Helper function to get all of the entities in the room or all of the entities that match a
@@ -27193,16 +27202,13 @@ function ____exports.parseEntityID(self, entityID)
27193
27202
  return nil
27194
27203
  end
27195
27204
  local entityTypeString, variantString, subTypeString = table.unpack(entityIDArray)
27196
- local entityType = tonumber(entityTypeString)
27197
- if entityType == nil then
27205
+ if entityTypeString == nil or variantString == nil or subTypeString == nil then
27198
27206
  return nil
27199
27207
  end
27200
- local variant = tonumber(variantString)
27201
- if variant == nil then
27202
- return nil
27203
- end
27204
- local subType = tonumber(subTypeString)
27205
- if subType == nil then
27208
+ local entityType = parseIntSafe(nil, entityTypeString)
27209
+ local variant = parseIntSafe(nil, variantString)
27210
+ local subType = parseIntSafe(nil, subTypeString)
27211
+ if entityType == nil or variant == nil or subType == nil then
27206
27212
  return nil
27207
27213
  end
27208
27214
  return {entityType, variant, subType}
@@ -27219,12 +27225,12 @@ function ____exports.parseEntityTypeVariantString(self, entityTypeVariantString)
27219
27225
  return nil
27220
27226
  end
27221
27227
  local entityTypeString, variantString = table.unpack(entityTypeVariantArray)
27222
- local entityType = tonumber(entityTypeString)
27223
- if entityType == nil then
27228
+ if entityTypeString == nil or variantString == nil then
27224
27229
  return nil
27225
27230
  end
27226
- local variant = tonumber(variantString)
27227
- if variant == nil then
27231
+ local entityType = parseIntSafe(nil, entityTypeString)
27232
+ local variant = parseIntSafe(nil, variantString)
27233
+ if entityType == nil or variant == nil then
27228
27234
  return nil
27229
27235
  end
27230
27236
  return {entityType, variant}
@@ -27481,6 +27487,7 @@ local ____sprites = require("functions.sprites")
27481
27487
  local clearSprite = ____sprites.clearSprite
27482
27488
  local spriteEquals = ____sprites.spriteEquals
27483
27489
  local ____types = require("functions.types")
27490
+ local asCollectibleType = ____types.asCollectibleType
27484
27491
  local isInteger = ____types.isInteger
27485
27492
  local ____utils = require("functions.utils")
27486
27493
  local assertDefined = ____utils.assertDefined
@@ -27705,8 +27712,12 @@ function ____exports.getCollectibleGfxFilename(self, collectibleOrCollectibleTyp
27705
27712
  end
27706
27713
  return itemConfigItem.GfxFileName
27707
27714
  end
27708
- --- Helper function to get the initial amount of charges that a collectible has. Returns 0 if the
27709
- -- provided collectible type was not valid.
27715
+ --- Helper function to get the initial amount of charges that a collectible has. In most cases, when
27716
+ -- picking up an active collectible for the first time, it will be fully charged, which corresponds
27717
+ -- to an `InitCharge` value of -1. However, in some cases, this may be different. For example,
27718
+ -- Eden's Soul starts without any charges, so it has an `InitCharge` value of 0.
27719
+ --
27720
+ -- This function returns 0 if the provided collectible type was not valid.
27710
27721
  function ____exports.getCollectibleInitCharge(self, collectibleOrCollectibleType)
27711
27722
  local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "getCollectibleInitCharge")
27712
27723
  local itemConfigItem = itemConfig:GetCollectible(collectibleType)
@@ -27858,7 +27869,8 @@ function ____exports.isSingleUseCollectible(self, collectibleType)
27858
27869
  return SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES_SET:has(collectibleType)
27859
27870
  end
27860
27871
  function ____exports.isValidCollectibleType(self, collectibleType)
27861
- local itemConfigItem = itemConfig:GetCollectible(collectibleType)
27872
+ local potentialCollectibleType = asCollectibleType(nil, collectibleType)
27873
+ local itemConfigItem = itemConfig:GetCollectible(potentialCollectibleType)
27862
27874
  return itemConfigItem ~= nil
27863
27875
  end
27864
27876
  --- Helper function to generate a new sprite based on a collectible. If the provided collectible type
@@ -33166,6 +33178,7 @@ local ____rooms = require("functions.rooms")
33166
33178
  local roomUpdateSafe = ____rooms.roomUpdateSafe
33167
33179
  local ____types = require("functions.types")
33168
33180
  local isInteger = ____types.isInteger
33181
+ local parseIntSafe = ____types.parseIntSafe
33169
33182
  local ____utils = require("functions.utils")
33170
33183
  local assertDefined = ____utils.assertDefined
33171
33184
  local eRange = ____utils.eRange
@@ -33668,21 +33681,15 @@ end
33668
33681
  function ____exports.getConstituentsFromGridEntityID(self, gridEntityID)
33669
33682
  local parts = __TS__StringSplit(gridEntityID, ".")
33670
33683
  if #parts ~= 2 then
33671
- error("Failed to get the constituents from grid entity ID: " .. gridEntityID)
33684
+ error("Failed to get the constituents from a grid entity ID: " .. gridEntityID)
33672
33685
  end
33673
33686
  local gridEntityTypeString, variantString = table.unpack(parts)
33674
- local gridEntityType = tonumber(gridEntityTypeString)
33675
- assertDefined(
33676
- nil,
33677
- gridEntityType,
33678
- "Failed to convert the grid entity type to a number: " .. tostring(gridEntityTypeString)
33679
- )
33680
- local variant = tonumber(variantString)
33681
- assertDefined(
33682
- nil,
33683
- variant,
33684
- "Failed to convert the grid entity variant to a number: " .. tostring(variantString)
33685
- )
33687
+ assertDefined(nil, gridEntityTypeString, "Failed to get the first constituent from a grid entity ID: " .. gridEntityID)
33688
+ assertDefined(nil, variantString, "Failed to get the second constituent from a grid entity ID: " .. gridEntityID)
33689
+ local gridEntityType = parseIntSafe(nil, gridEntityTypeString)
33690
+ assertDefined(nil, gridEntityType, "Failed to convert the grid entity type to a number: " .. gridEntityTypeString)
33691
+ local variant = parseIntSafe(nil, variantString)
33692
+ assertDefined(nil, variant, "Failed to convert the grid entity variant to an integer: " .. variantString)
33686
33693
  return {gridEntityType, variant}
33687
33694
  end
33688
33695
  --- Helper function to get every grid entity in the current room.
@@ -36561,6 +36568,7 @@ local ____sprites = require("functions.sprites")
36561
36568
  local clearSprite = ____sprites.clearSprite
36562
36569
  local ____types = require("functions.types")
36563
36570
  local asNumber = ____types.asNumber
36571
+ local asTrinketType = ____types.asTrinketType
36564
36572
  function ____exports.isGoldenTrinketType(self, trinketType)
36565
36573
  return asNumber(nil, trinketType) > GOLDEN_TRINKET_ADJUSTMENT
36566
36574
  end
@@ -36663,6 +36671,11 @@ end
36663
36671
  function ____exports.isModdedTrinketType(self, trinketType)
36664
36672
  return not ____exports.isVanillaTrinketType(nil, trinketType)
36665
36673
  end
36674
+ function ____exports.isValidTrinketType(self, trinketType)
36675
+ local potentialTrinketType = asTrinketType(nil, trinketType)
36676
+ local itemConfigItem = itemConfig:GetTrinket(potentialTrinketType)
36677
+ return itemConfigItem ~= nil
36678
+ end
36666
36679
  --- Helper function to generate a new sprite based on a collectible. If the provided collectible type
36667
36680
  -- is invalid, a sprite with a Curse of the Blind question mark will be returned.
36668
36681
  function ____exports.newTrinketSprite(self, trinketType)
@@ -38591,6 +38604,7 @@ local PILL_EFFECT_TYPES = ____pillEffectTypes.PILL_EFFECT_TYPES
38591
38604
  local ____types = require("functions.types")
38592
38605
  local asNumber = ____types.asNumber
38593
38606
  local asPillColor = ____types.asPillColor
38607
+ local asPillEffect = ____types.asPillEffect
38594
38608
  local ____utils = require("functions.utils")
38595
38609
  local iRange = ____utils.iRange
38596
38610
  --- Helper function to see if the given pill color is a horse pill.
@@ -38713,6 +38727,11 @@ end
38713
38727
  function ____exports.isModdedPillEffect(self, pillEffect)
38714
38728
  return not ____exports.isVanillaPillEffect(nil, pillEffect)
38715
38729
  end
38730
+ function ____exports.isValidPillEffect(self, pillEffect)
38731
+ local potentialPillEffect = asPillEffect(nil, pillEffect)
38732
+ local itemConfigPillEffect = itemConfig:GetPillEffect(potentialPillEffect)
38733
+ return itemConfigPillEffect ~= nil
38734
+ end
38716
38735
  return ____exports
38717
38736
  end,
38718
38737
  ["interfaces.PocketItemDescription"] = function(...)
@@ -40244,13 +40263,12 @@ local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
40244
40263
  local ____exports = {}
40245
40264
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.index")
40246
40265
  local Challenge = ____isaac_2Dtypescript_2Ddefinitions.Challenge
40266
+ local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
40247
40267
  local SeedEffect = ____isaac_2Dtypescript_2Ddefinitions.SeedEffect
40248
40268
  local ____cachedEnumValues = require("arrays.cachedEnumValues")
40249
40269
  local SEED_EFFECTS = ____cachedEnumValues.SEED_EFFECTS
40250
40270
  local ____cachedClasses = require("core.cachedClasses")
40251
40271
  local game = ____cachedClasses.game
40252
- local ____constantsFirstLast = require("core.constantsFirstLast")
40253
- local FIRST_CHARACTER = ____constantsFirstLast.FIRST_CHARACTER
40254
40272
  local ____characters = require("functions.characters")
40255
40273
  local getCharacterName = ____characters.getCharacterName
40256
40274
  local ____log = require("functions.log")
@@ -40314,7 +40332,7 @@ function ____exports.restart(self, character)
40314
40332
  Isaac.ExecuteCommand(command)
40315
40333
  return
40316
40334
  end
40317
- if character < FIRST_CHARACTER then
40335
+ if character < PlayerType.ISAAC then
40318
40336
  error(("Restarting as a character of " .. tostring(character)) .. " would crash the game.")
40319
40337
  end
40320
40338
  local command = "restart " .. tostring(character)
@@ -44095,6 +44113,8 @@ local ____itemConfigCardTypesForCards = require("sets.itemConfigCardTypesForCard
44095
44113
  local ITEM_CONFIG_CARD_TYPES_FOR_CARDS = ____itemConfigCardTypesForCards.ITEM_CONFIG_CARD_TYPES_FOR_CARDS
44096
44114
  local ____flag = require("functions.flag")
44097
44115
  local addFlag = ____flag.addFlag
44116
+ local ____types = require("functions.types")
44117
+ local asCardType = ____types.asCardType
44098
44118
  function ____exports.isVanillaCardType(self, cardType)
44099
44119
  return cardType <= LAST_VANILLA_CARD_TYPE
44100
44120
  end
@@ -44204,6 +44224,11 @@ end
44204
44224
  function ____exports.isTarotCard(self, cardType)
44205
44225
  return ____exports.isCardType(nil, cardType, ItemConfigCardType.TAROT)
44206
44226
  end
44227
+ function ____exports.isValidCardType(self, cardType)
44228
+ local potentialCardType = asCardType(nil, cardType)
44229
+ local itemConfigCard = itemConfig:GetCard(potentialCardType)
44230
+ return itemConfigCard ~= nil
44231
+ end
44207
44232
  --- Helper function to use a card without showing an animation and without the announcer voice
44208
44233
  -- playing.
44209
44234
  function ____exports.useCardTemp(self, player, cardType)
@@ -44453,10 +44478,10 @@ local ____decorators = require("decorators")
44453
44478
  local Exported = ____decorators.Exported
44454
44479
  local ____Feature = require("classes.private.Feature")
44455
44480
  local Feature = ____Feature.Feature
44456
- ____exports.FIRST_MODDED_COLLECTIBLE_TYPE = LAST_VANILLA_COLLECTIBLE_TYPE + 1
44457
- ____exports.FIRST_MODDED_TRINKET_TYPE = LAST_VANILLA_TRINKET_TYPE + 1
44458
- ____exports.FIRST_MODDED_CARD_TYPE = LAST_VANILLA_CARD_TYPE + 1
44459
- ____exports.FIRST_MODDED_PILL_EFFECT = LAST_VANILLA_PILL_EFFECT + 1
44481
+ local FIRST_MODDED_COLLECTIBLE_TYPE = LAST_VANILLA_COLLECTIBLE_TYPE + 1
44482
+ local FIRST_MODDED_TRINKET_TYPE = LAST_VANILLA_TRINKET_TYPE + 1
44483
+ local FIRST_MODDED_CARD_TYPE = LAST_VANILLA_CARD_TYPE + 1
44484
+ local FIRST_MODDED_PILL_EFFECT = LAST_VANILLA_PILL_EFFECT + 1
44460
44485
  --- Mods can add extra things to the game (e.g. collectibles, trinkets, and so on). Since mods load
44461
44486
  -- in alphabetical order, the total number of things can't be properly be known until at least one
44462
44487
  -- callback fires (which indicates that all mods have been loaded).
@@ -44484,12 +44509,12 @@ function ModdedElementDetection.prototype.errorIfNoCallbacksFired(self, constant
44484
44509
  end
44485
44510
  function ModdedElementDetection.prototype.getFirstModdedCollectibleType(self)
44486
44511
  self:errorIfNoCallbacksFired("collectible")
44487
- local itemConfigItem = itemConfig:GetCollectible(____exports.FIRST_MODDED_COLLECTIBLE_TYPE)
44512
+ local itemConfigItem = itemConfig:GetCollectible(FIRST_MODDED_COLLECTIBLE_TYPE)
44488
44513
  local ____temp_0
44489
44514
  if itemConfigItem == nil then
44490
44515
  ____temp_0 = nil
44491
44516
  else
44492
- ____temp_0 = ____exports.FIRST_MODDED_COLLECTIBLE_TYPE
44517
+ ____temp_0 = FIRST_MODDED_COLLECTIBLE_TYPE
44493
44518
  end
44494
44519
  return ____temp_0
44495
44520
  end
@@ -44511,12 +44536,12 @@ end
44511
44536
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getNumModdedCollectibleTypes", true)
44512
44537
  function ModdedElementDetection.prototype.getFirstModdedTrinketType(self)
44513
44538
  self:errorIfNoCallbacksFired("trinket")
44514
- local itemConfigItem = itemConfig:GetTrinket(____exports.FIRST_MODDED_TRINKET_TYPE)
44539
+ local itemConfigItem = itemConfig:GetTrinket(FIRST_MODDED_TRINKET_TYPE)
44515
44540
  local ____temp_1
44516
44541
  if itemConfigItem == nil then
44517
44542
  ____temp_1 = nil
44518
44543
  else
44519
- ____temp_1 = ____exports.FIRST_MODDED_TRINKET_TYPE
44544
+ ____temp_1 = FIRST_MODDED_TRINKET_TYPE
44520
44545
  end
44521
44546
  return ____temp_1
44522
44547
  end
@@ -44538,12 +44563,12 @@ end
44538
44563
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getNumModdedTrinketTypes", true)
44539
44564
  function ModdedElementDetection.prototype.getFirstModdedCardType(self)
44540
44565
  self:errorIfNoCallbacksFired("card")
44541
- local itemConfigCard = itemConfig:GetCard(____exports.FIRST_MODDED_CARD_TYPE)
44566
+ local itemConfigCard = itemConfig:GetCard(FIRST_MODDED_CARD_TYPE)
44542
44567
  local ____temp_2
44543
44568
  if itemConfigCard == nil then
44544
44569
  ____temp_2 = nil
44545
44570
  else
44546
- ____temp_2 = ____exports.FIRST_MODDED_CARD_TYPE
44571
+ ____temp_2 = FIRST_MODDED_CARD_TYPE
44547
44572
  end
44548
44573
  return ____temp_2
44549
44574
  end
@@ -44565,12 +44590,12 @@ end
44565
44590
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getNumModdedCardTypes", true)
44566
44591
  function ModdedElementDetection.prototype.getFirstModdedPillEffect(self)
44567
44592
  self:errorIfNoCallbacksFired("pill")
44568
- local itemConfigPillEffect = itemConfig:GetPillEffect(____exports.FIRST_MODDED_PILL_EFFECT)
44593
+ local itemConfigPillEffect = itemConfig:GetPillEffect(FIRST_MODDED_PILL_EFFECT)
44569
44594
  local ____temp_3
44570
44595
  if itemConfigPillEffect == nil then
44571
44596
  ____temp_3 = nil
44572
44597
  else
44573
- ____temp_3 = ____exports.FIRST_MODDED_PILL_EFFECT
44598
+ ____temp_3 = FIRST_MODDED_PILL_EFFECT
44574
44599
  end
44575
44600
  return ____temp_3
44576
44601
  end
@@ -53967,6 +53992,8 @@ local ____log = require("functions.log")
53967
53992
  local log = ____log.log
53968
53993
  local ____random = require("functions.random")
53969
53994
  local getRandomFloat = ____random.getRandomFloat
53995
+ local ____types = require("functions.types")
53996
+ local parseIntSafe = ____types.parseIntSafe
53970
53997
  local ____utils = require("functions.utils")
53971
53998
  local assertDefined = ____utils.assertDefined
53972
53999
  function getTotalWeightOfJSONObject(self, jsonOjectArray)
@@ -54008,7 +54035,7 @@ end
54008
54035
  -- (A JSON room is an XML file converted to JSON so that it can be directly imported into your mod.)
54009
54036
  function ____exports.getJSONRoomDoorSlotFlags(self, jsonRoom)
54010
54037
  local roomShapeString = jsonRoom["$"].shape
54011
- local roomShape = tonumber(roomShapeString)
54038
+ local roomShape = parseIntSafe(nil, roomShapeString)
54012
54039
  assertDefined(nil, roomShape, "Failed to parse the \"shape\" field of a JSON room: " .. roomShapeString)
54013
54040
  if not isEnumValue(nil, roomShape, RoomShape) then
54014
54041
  error("Failed to parse the \"shape\" field of a JSON room since it was an invalid number: " .. tostring(roomShape))
@@ -54024,10 +54051,10 @@ function ____exports.getJSONRoomDoorSlotFlags(self, jsonRoom)
54024
54051
  goto __continue4
54025
54052
  end
54026
54053
  local xString = door["$"].x
54027
- local x = tonumber(xString)
54054
+ local x = parseIntSafe(nil, xString)
54028
54055
  assertDefined(nil, x, "Failed to parse the \"x\" field of a JSON room door: " .. xString)
54029
54056
  local yString = door["$"].y
54030
- local y = tonumber(yString)
54057
+ local y = parseIntSafe(nil, yString)
54031
54058
  assertDefined(nil, y, "Failed to parse the \"y\" field of a JSON room door: " .. yString)
54032
54059
  local doorSlot = getRoomShapeDoorSlot(nil, roomShape, x, y)
54033
54060
  assertDefined(
@@ -54054,7 +54081,10 @@ function ____exports.getJSONRoomOfVariant(self, jsonRooms, variant)
54054
54081
  jsonRooms,
54055
54082
  function(____, jsonRoom)
54056
54083
  local roomVariantString = jsonRoom["$"].variant
54057
- local roomVariant = tonumber(roomVariantString)
54084
+ local roomVariant = parseIntSafe(nil, roomVariantString)
54085
+ if roomVariant == nil then
54086
+ error("Failed to convert a JSON room variant to an integer: " .. roomVariantString)
54087
+ end
54058
54088
  return roomVariant == variant
54059
54089
  end
54060
54090
  )
@@ -54077,7 +54107,10 @@ function ____exports.getJSONRoomsOfSubType(self, jsonRooms, subType)
54077
54107
  jsonRooms,
54078
54108
  function(____, jsonRoom)
54079
54109
  local roomSubTypeString = jsonRoom["$"].subtype
54080
- local roomSubType = tonumber(roomSubTypeString)
54110
+ local roomSubType = parseIntSafe(nil, roomSubTypeString)
54111
+ if roomSubType == nil then
54112
+ error("Failed to convert a JSON room sub-type to an integer: " .. roomSubTypeString)
54113
+ end
54081
54114
  return roomSubType == subType
54082
54115
  end
54083
54116
  )
@@ -54603,6 +54636,7 @@ local ____spawnCollectible = require("functions.spawnCollectible")
54603
54636
  local spawnCollectible = ____spawnCollectible.spawnCollectible
54604
54637
  local ____types = require("functions.types")
54605
54638
  local asCollectibleType = ____types.asCollectibleType
54639
+ local parseIntSafe = ____types.parseIntSafe
54606
54640
  local ____utils = require("functions.utils")
54607
54641
  local assertDefined = ____utils.assertDefined
54608
54642
  local ____ReadonlySet = require("types.ReadonlySet")
@@ -54756,28 +54790,28 @@ function DeployJSONRoom.prototype.spawnAllEntities(self, jsonRoom, rng, verbose)
54756
54790
  local shouldUnclearRoom = false
54757
54791
  for ____, jsonSpawn in ipairs(jsonRoom.spawn) do
54758
54792
  local xString = jsonSpawn["$"].x
54759
- local x = tonumber(xString)
54760
- assertDefined(nil, x, "Failed to convert the following x coordinate to a number (for a spawn): " .. xString)
54793
+ local x = parseIntSafe(nil, xString)
54794
+ assertDefined(nil, x, "Failed to convert the following x coordinate to an integer (for a spawn): " .. xString)
54761
54795
  local yString = jsonSpawn["$"].y
54762
- local y = tonumber(yString)
54763
- assertDefined(nil, y, "Failed to convert the following y coordinate to a number (for a spawn): " .. yString)
54796
+ local y = parseIntSafe(nil, yString)
54797
+ assertDefined(nil, y, "Failed to convert the following y coordinate to an integer (for a spawn): " .. yString)
54764
54798
  local jsonEntity = getRandomJSONEntity(nil, jsonSpawn.entity, rng)
54765
54799
  local entityTypeString = jsonEntity["$"].type
54766
- local entityTypeNumber = tonumber(entityTypeString)
54767
- assertDefined(nil, entityTypeNumber, "Failed to convert the entity type to a number: " .. entityTypeString)
54800
+ local entityTypeNumber = parseIntSafe(nil, entityTypeString)
54801
+ assertDefined(nil, entityTypeNumber, "Failed to convert the entity type to an integer: " .. entityTypeString)
54768
54802
  local variantString = jsonEntity["$"].variant
54769
- local variant = tonumber(variantString)
54803
+ local variant = parseIntSafe(nil, variantString)
54770
54804
  assertDefined(
54771
54805
  nil,
54772
54806
  variant,
54773
- "Failed to convert the entity variant to a number: " .. tostring(variant)
54807
+ "Failed to convert the entity variant to an integer: " .. tostring(variant)
54774
54808
  )
54775
54809
  local subTypeString = jsonEntity["$"].subtype
54776
- local subType = tonumber(subTypeString)
54810
+ local subType = parseIntSafe(nil, subTypeString)
54777
54811
  assertDefined(
54778
54812
  nil,
54779
54813
  subType,
54780
- "Failed to convert the entity sub-type to a number: " .. tostring(subType)
54814
+ "Failed to convert the entity sub-type to an integer: " .. tostring(subType)
54781
54815
  )
54782
54816
  local isGridEntity = GRID_ENTITY_XML_TYPE_SET:has(entityTypeNumber)
54783
54817
  if isGridEntity then
@@ -57982,6 +58016,7 @@ local ITEM_POOL_TYPE_VALUES = ____cachedEnumValues.ITEM_POOL_TYPE_VALUES
57982
58016
  local itemPoolsJSON = require("data.itempools")
57983
58017
  local ____types = require("functions.types")
57984
58018
  local asCollectibleType = ____types.asCollectibleType
58019
+ local parseIntSafe = ____types.parseIntSafe
57985
58020
  local ____itemPoolTypeToItemPoolName = require("maps.itemPoolTypeToItemPoolName")
57986
58021
  local ITEM_POOL_TYPE_TO_ITEM_POOL_NAME = ____itemPoolTypeToItemPoolName.ITEM_POOL_TYPE_TO_ITEM_POOL_NAME
57987
58022
  function getItemPoolJSON(self, itemPoolType)
@@ -58001,11 +58036,11 @@ ____exports.ITEM_POOL_TYPE_TO_COLLECTIBLE_TYPES_SET = (function()
58001
58036
  else
58002
58037
  local collectibleTypesSet = __TS__New(Set)
58003
58038
  for ____, itemPoolJSONElement in ipairs(itemPoolJSON.Item) do
58004
- local collectibleTypeNumber = tonumber(itemPoolJSONElement["$"].Id)
58005
- if collectibleTypeNumber == nil then
58039
+ local collectibleTypeInt = parseIntSafe(nil, itemPoolJSONElement["$"].Id)
58040
+ if collectibleTypeInt == nil then
58006
58041
  error("Failed to parse a collectible type in the \"itempools.json\" file: " .. itemPoolJSONElement["$"].Id)
58007
58042
  end
58008
- local collectibleType = asCollectibleType(nil, collectibleTypeNumber)
58043
+ local collectibleType = asCollectibleType(nil, collectibleTypeInt)
58009
58044
  collectibleTypesSet:add(collectibleType)
58010
58045
  end
58011
58046
  itemPoolTypeToCollectibleTypes[itemPoolType] = collectibleTypesSet
@@ -59857,13 +59892,15 @@ local getRoomData = ____roomData.getRoomData
59857
59892
  local getRoomDescriptor = ____roomData.getRoomDescriptor
59858
59893
  local ____rooms = require("functions.rooms")
59859
59894
  local changeRoom = ____rooms.changeRoom
59895
+ local ____types = require("functions.types")
59896
+ local parseIntSafe = ____types.parseIntSafe
59860
59897
  local ____roomTypeNames = require("objects.roomTypeNames")
59861
59898
  local ROOM_TYPE_NAMES = ____roomTypeNames.ROOM_TYPE_NAMES
59862
59899
  local DEFAULT_MOVE_UNITS = 0.5
59863
59900
  function ____exports.addHeart(self, params, healthType)
59864
59901
  local numHearts = healthType == HealthType.MAX_HEARTS and 2 or 1
59865
59902
  if params ~= "" then
59866
- local num = tonumber(params)
59903
+ local num = parseIntSafe(nil, params)
59867
59904
  if num == nil then
59868
59905
  print("That is an invalid amount of hearts to add.")
59869
59906
  return
@@ -59894,7 +59931,7 @@ end
59894
59931
  function ____exports.listEntities(self, params, includeBackgroundEffects)
59895
59932
  local entityTypeFilter
59896
59933
  if params ~= "" then
59897
- entityTypeFilter = tonumber(params)
59934
+ entityTypeFilter = parseIntSafe(nil, params)
59898
59935
  if entityTypeFilter == nil then
59899
59936
  print("That is an invalid entity type to filter by.")
59900
59937
  return
@@ -59906,7 +59943,7 @@ end
59906
59943
  function ____exports.listGridEntities(self, params, includeWalls)
59907
59944
  local gridEntityTypeFilter
59908
59945
  if params ~= "" then
59909
- gridEntityTypeFilter = tonumber(params)
59946
+ gridEntityTypeFilter = parseIntSafe(nil, params)
59910
59947
  if gridEntityTypeFilter == nil then
59911
59948
  print("That is an invalid grid entity type to filter by.")
59912
59949
  return
@@ -59918,7 +59955,7 @@ end
59918
59955
  function ____exports.movePlayer(self, params, direction)
59919
59956
  local amount = DEFAULT_MOVE_UNITS
59920
59957
  if params ~= "" then
59921
- local num = tonumber(params)
59958
+ local num = parseIntSafe(nil, params)
59922
59959
  if num == nil then
59923
59960
  print("That is an invalid amount of units to move.")
59924
59961
  return
@@ -59999,7 +60036,6 @@ return ____exports
59999
60036
  local ____lualib = require("lualib_bundle")
60000
60037
  local __TS__StringSplit = ____lualib.__TS__StringSplit
60001
60038
  local __TS__ArrayFind = ____lualib.__TS__ArrayFind
60002
- local __TS__ArrayIncludes = ____lualib.__TS__ArrayIncludes
60003
60039
  local ____exports = {}
60004
60040
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.index")
60005
60041
  local ActiveSlot = ____isaac_2Dtypescript_2Ddefinitions.ActiveSlot
@@ -60014,10 +60050,11 @@ local GridEntityType = ____isaac_2Dtypescript_2Ddefinitions.GridEntityType
60014
60050
  local GridRoom = ____isaac_2Dtypescript_2Ddefinitions.GridRoom
60015
60051
  local LevelStage = ____isaac_2Dtypescript_2Ddefinitions.LevelStage
60016
60052
  local PillColor = ____isaac_2Dtypescript_2Ddefinitions.PillColor
60053
+ local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
60017
60054
  local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
60055
+ local SoundEffect = ____isaac_2Dtypescript_2Ddefinitions.SoundEffect
60018
60056
  local StageType = ____isaac_2Dtypescript_2Ddefinitions.StageType
60019
60057
  local ____cachedEnumValues = require("arrays.cachedEnumValues")
60020
- local ACTIVE_SLOT_VALUES = ____cachedEnumValues.ACTIVE_SLOT_VALUES
60021
60058
  local GRID_ENTITY_TYPE_VALUES = ____cachedEnumValues.GRID_ENTITY_TYPE_VALUES
60022
60059
  local ____cachedClasses = require("core.cachedClasses")
60023
60060
  local game = ____cachedClasses.game
@@ -60028,21 +60065,14 @@ local MAX_LEVEL_GRID_INDEX = ____constants.MAX_LEVEL_GRID_INDEX
60028
60065
  local MAX_NUM_FAMILIARS = ____constants.MAX_NUM_FAMILIARS
60029
60066
  local ____constantsFirstLast = require("core.constantsFirstLast")
60030
60067
  local FIRST_CARD_TYPE = ____constantsFirstLast.FIRST_CARD_TYPE
60031
- local FIRST_CHARACTER = ____constantsFirstLast.FIRST_CHARACTER
60032
60068
  local FIRST_HORSE_PILL_COLOR = ____constantsFirstLast.FIRST_HORSE_PILL_COLOR
60033
60069
  local FIRST_PILL_COLOR = ____constantsFirstLast.FIRST_PILL_COLOR
60034
- local FIRST_PILL_EFFECT = ____constantsFirstLast.FIRST_PILL_EFFECT
60035
- local FIRST_ROOM_TYPE = ____constantsFirstLast.FIRST_ROOM_TYPE
60036
- local FIRST_STAGE = ____constantsFirstLast.FIRST_STAGE
60037
- local LAST_ROOM_TYPE = ____constantsFirstLast.LAST_ROOM_TYPE
60038
- local LAST_STAGE = ____constantsFirstLast.LAST_STAGE
60039
60070
  local LAST_VANILLA_CARD_TYPE = ____constantsFirstLast.LAST_VANILLA_CARD_TYPE
60040
- local LAST_VANILLA_CHARACTER = ____constantsFirstLast.LAST_VANILLA_CHARACTER
60041
- local LAST_VANILLA_PILL_EFFECT = ____constantsFirstLast.LAST_VANILLA_PILL_EFFECT
60042
60071
  local ____HealthType = require("enums.HealthType")
60043
60072
  local HealthType = ____HealthType.HealthType
60044
60073
  local ____cards = require("functions.cards")
60045
60074
  local getCardName = ____cards.getCardName
60075
+ local isValidCardType = ____cards.isValidCardType
60046
60076
  local ____characters = require("functions.characters")
60047
60077
  local getCharacterName = ____characters.getCharacterName
60048
60078
  local ____charge = require("functions.charge")
@@ -60056,6 +60086,8 @@ local ____deepCopyTests = require("functions.deepCopyTests")
60056
60086
  local runDeepCopyTests = ____deepCopyTests.runDeepCopyTests
60057
60087
  local ____entitiesSpecific = require("functions.entitiesSpecific")
60058
60088
  local getNPCs = ____entitiesSpecific.getNPCs
60089
+ local ____enums = require("functions.enums")
60090
+ local isEnumValue = ____enums.isEnumValue
60059
60091
  local ____flag = require("functions.flag")
60060
60092
  local addFlag = ____flag.addFlag
60061
60093
  local ____gridEntities = require("functions.gridEntities")
@@ -60076,6 +60108,7 @@ local spawnPill = ____pickupsSpecific.spawnPill
60076
60108
  local spawnTrinketFunction = ____pickupsSpecific.spawnTrinket
60077
60109
  local ____pills = require("functions.pills")
60078
60110
  local getPillEffectName = ____pills.getPillEffectName
60111
+ local isValidPillEffect = ____pills.isValidPillEffect
60079
60112
  local ____playerCollectibles = require("functions.playerCollectibles")
60080
60113
  local addCollectibleCostume = ____playerCollectibles.addCollectibleCostume
60081
60114
  local removeCollectibleCostume = ____playerCollectibles.removeCollectibleCostume
@@ -60105,9 +60138,9 @@ local ____string = require("functions.string")
60105
60138
  local getMapPartialMatch = ____string.getMapPartialMatch
60106
60139
  local ____trinkets = require("functions.trinkets")
60107
60140
  local getGoldenTrinketType = ____trinkets.getGoldenTrinketType
60141
+ local isValidTrinketType = ____trinkets.isValidTrinketType
60108
60142
  local ____types = require("functions.types")
60109
- local asCollectibleType = ____types.asCollectibleType
60110
- local asTrinketType = ____types.asTrinketType
60143
+ local parseIntSafe = ____types.parseIntSafe
60111
60144
  local ____utils = require("functions.utils")
60112
60145
  local iRange = ____utils.iRange
60113
60146
  local ____cardNameToTypeMap = require("maps.cardNameToTypeMap")
@@ -60203,9 +60236,9 @@ end
60203
60236
  function ____exports.poopMana(self, params)
60204
60237
  local charges = 1
60205
60238
  if params ~= "" then
60206
- local num = tonumber(params)
60239
+ local num = parseIntSafe(nil, params)
60207
60240
  if num == nil then
60208
- print("That is an invalid amount of mana to add.")
60241
+ print("Invalid mana amount: " .. tostring(num))
60209
60242
  return
60210
60243
  end
60211
60244
  charges = num
@@ -60218,9 +60251,9 @@ end
60218
60251
  -- For example:
60219
60252
  -- - sound 1 - Plays the 1-Up sound effect.
60220
60253
  function ____exports.sound(self, params)
60221
- local soundEffect = tonumber(params)
60222
- if soundEffect == nil then
60223
- print("That is an invalid sound effect ID.")
60254
+ local soundEffect = parseIntSafe(nil, params)
60255
+ if soundEffect == nil or not isEnumValue(nil, soundEffect, SoundEffect) then
60256
+ print(("Invalid sound effect ID: " .. tostring(soundEffect)) .. ".")
60224
60257
  return
60225
60258
  end
60226
60259
  sfxManager:Play(soundEffect)
@@ -60241,9 +60274,9 @@ function ____exports.spawnCollectible(self, params)
60241
60274
  print("You must specify the collectible name or the number corresponding to the collectible type.")
60242
60275
  return
60243
60276
  end
60244
- local collectibleTypeNumber = tonumber(params)
60277
+ local num = parseIntSafe(nil, params)
60245
60278
  local collectibleType
60246
- if collectibleTypeNumber == nil then
60279
+ if num == nil then
60247
60280
  local match = getMapPartialMatch(nil, params, COLLECTIBLE_NAME_TO_TYPE_MAP)
60248
60281
  if match == nil then
60249
60282
  print("Unknown collectible: " .. params)
@@ -60251,7 +60284,10 @@ function ____exports.spawnCollectible(self, params)
60251
60284
  end
60252
60285
  collectibleType = match[2]
60253
60286
  else
60254
- collectibleType = asCollectibleType(nil, collectibleTypeNumber)
60287
+ if not isValidCollectibleType(nil, num) then
60288
+ print("Invalid collectible type: " .. tostring(num))
60289
+ end
60290
+ collectibleType = num
60255
60291
  end
60256
60292
  local roomClass = game:GetRoom()
60257
60293
  local centerPos = roomClass:GetCenterPos()
@@ -60283,9 +60319,9 @@ function ____exports.spawnTrinket(self, params, golden)
60283
60319
  print("You must specify the name or number corresponding to the trinket type.")
60284
60320
  return
60285
60321
  end
60286
- local trinketTypeNumber = tonumber(params)
60322
+ local num = parseIntSafe(nil, params)
60287
60323
  local trinketType
60288
- if trinketTypeNumber == nil then
60324
+ if num == nil then
60289
60325
  local match = getMapPartialMatch(nil, params, TRINKET_NAME_TO_TYPE_MAP)
60290
60326
  if match == nil then
60291
60327
  print("Unknown trinket: " .. params)
@@ -60293,7 +60329,11 @@ function ____exports.spawnTrinket(self, params, golden)
60293
60329
  end
60294
60330
  trinketType = match[2]
60295
60331
  else
60296
- trinketType = asTrinketType(nil, trinketTypeNumber)
60332
+ if not isValidTrinketType(nil, num) then
60333
+ print("Invalid trinket type: " .. tostring(num))
60334
+ return
60335
+ end
60336
+ trinketType = num
60297
60337
  end
60298
60338
  local roomClass = game:GetRoom()
60299
60339
  local centerPos = roomClass:GetCenterPos()
@@ -60325,17 +60365,20 @@ function ____exports.spawnTrinketAt(self, params, golden)
60325
60365
  print("You must specify the number corresponding to the trinket type and the number corresponding to the grid tile location.")
60326
60366
  return
60327
60367
  end
60328
- local trinketTypeNumber = tonumber(args[1])
60329
- if trinketTypeNumber == nil or trinketTypeNumber < 0 then
60330
- print("Failed to parse the trinket type of: " .. tostring(args[1]))
60368
+ local trinketTypeString, gridIndexString = table.unpack(args)
60369
+ if trinketTypeString == nil or gridIndexString == nil then
60370
+ return
60371
+ end
60372
+ local trinketType = parseIntSafe(nil, trinketTypeString)
60373
+ if trinketType == nil or not isValidTrinketType(nil, trinketType) then
60374
+ print("Invalid trinket type: " .. trinketTypeString)
60331
60375
  return
60332
60376
  end
60333
- local gridIndex = tonumber(args[2])
60377
+ local gridIndex = parseIntSafe(nil, gridIndexString)
60334
60378
  if gridIndex == nil or gridIndex < 0 then
60335
60379
  print("Failed to parse the grid index of: " .. tostring(args[2]))
60336
60380
  return
60337
60381
  end
60338
- local trinketType = asTrinketType(nil, trinketTypeNumber)
60339
60382
  local goldenTrinketType = getGoldenTrinketType(nil, trinketType)
60340
60383
  local trinketTypeToSpawn = golden and goldenTrinketType or trinketType
60341
60384
  spawnTrinketFunction(nil, trinketTypeToSpawn, gridIndex)
@@ -60356,24 +60399,23 @@ function ____exports.addCharges(self, params)
60356
60399
  end
60357
60400
  local args = __TS__StringSplit(params, " ")
60358
60401
  if #args ~= 1 and #args ~= 2 then
60359
- print("That is an invalid amount of arguments.")
60402
+ print("Invalid amount of arguments: " .. tostring(#args))
60360
60403
  return
60361
60404
  end
60362
60405
  local activeSlotString, numChargeString = table.unpack(args)
60363
- local activeSlot = tonumber(activeSlotString)
60364
- if activeSlot == nil then
60365
- print("The provided slot number is invalid: " .. tostring(activeSlotString))
60406
+ if activeSlotString == nil then
60366
60407
  return
60367
60408
  end
60368
- if activeSlot < ActiveSlot.PRIMARY or activeSlot > ActiveSlot.POCKET_SINGLE_USE then
60369
- print("The provided slot number is invalid: " .. tostring(activeSlot))
60409
+ local activeSlot = parseIntSafe(nil, activeSlotString)
60410
+ if activeSlot == nil or not isEnumValue(nil, activeSlot, ActiveSlot) then
60411
+ print("Invalid slot number: " .. tostring(activeSlot))
60370
60412
  return
60371
60413
  end
60372
60414
  local numCharges = 1
60373
60415
  if numChargeString ~= nil then
60374
- local numChargesAttempt = tonumber(numChargeString)
60416
+ local numChargesAttempt = parseIntSafe(nil, numChargeString)
60375
60417
  if numChargesAttempt == nil then
60376
- print("The provided charge amount is invalid: " .. numChargeString)
60418
+ print("Invalid charge amount: " .. numChargeString)
60377
60419
  return
60378
60420
  end
60379
60421
  numCharges = numChargesAttempt
@@ -60425,9 +60467,9 @@ end
60425
60467
  function ____exports.bloodCharges(self, params)
60426
60468
  local charges = 1
60427
60469
  if params ~= "" then
60428
- local num = tonumber(params)
60470
+ local num = parseIntSafe(nil, params)
60429
60471
  if num == nil then
60430
- print("That is an invalid amount of charges to add.")
60472
+ print("Invalid charge amount: " .. tostring(num))
60431
60473
  return
60432
60474
  end
60433
60475
  charges = num
@@ -60444,9 +60486,9 @@ end
60444
60486
  function ____exports.bomb(self, params)
60445
60487
  local numBombs = 1
60446
60488
  if params ~= "" then
60447
- local num = tonumber(params)
60489
+ local num = parseIntSafe(nil, params)
60448
60490
  if num == nil then
60449
- print("That is an invalid amount of bombs to add.")
60491
+ print("Invalid bomb amount: " .. tostring(num))
60450
60492
  return
60451
60493
  end
60452
60494
  numBombs = num
@@ -60459,9 +60501,9 @@ end
60459
60501
  function ____exports.bombs(self, params)
60460
60502
  local numBombs = 99
60461
60503
  if params ~= "" then
60462
- local num = tonumber(params)
60504
+ local num = parseIntSafe(nil, params)
60463
60505
  if num == nil then
60464
- print("That is an invalid amount of bombs to add.")
60506
+ print("Invalid bomb amount: " .. tostring(num))
60465
60507
  return
60466
60508
  end
60467
60509
  numBombs = num
@@ -60491,7 +60533,7 @@ end
60491
60533
  function ____exports.brokenHearts(self, params)
60492
60534
  addHeart(nil, params, HealthType.BROKEN)
60493
60535
  end
60494
- --- Gives the specified card. Accepts either the card sub-type or the partial name of the card.
60536
+ --- Gives the specified card. Accepts either the card type or the partial name of the card.
60495
60537
  --
60496
60538
  -- For example:
60497
60539
  -- - card 5 - Gives The Emperor.
@@ -60502,7 +60544,7 @@ function ____exports.card(self, params)
60502
60544
  return
60503
60545
  end
60504
60546
  local cardType
60505
- local num = tonumber(params)
60547
+ local num = parseIntSafe(nil, params)
60506
60548
  if num == nil then
60507
60549
  local match = getMapPartialMatch(nil, params, CARD_NAME_TO_TYPE_MAP)
60508
60550
  if match == nil then
@@ -60511,8 +60553,8 @@ function ____exports.card(self, params)
60511
60553
  end
60512
60554
  cardType = match[2]
60513
60555
  else
60514
- if num < FIRST_CARD_TYPE or num > LAST_VANILLA_CARD_TYPE then
60515
- print("Invalid card sub-type: " .. tostring(num))
60556
+ if not isValidCardType(nil, num) then
60557
+ print("Invalid card type: " .. tostring(num))
60516
60558
  return
60517
60559
  end
60518
60560
  cardType = num
@@ -60559,7 +60601,7 @@ function ____exports.character(self, params)
60559
60601
  return
60560
60602
  end
60561
60603
  local playerType
60562
- local num = tonumber(params)
60604
+ local num = parseIntSafe(nil, params)
60563
60605
  if num == nil then
60564
60606
  local match = getMapPartialMatch(nil, params, CHARACTER_NAME_TO_TYPE_MAP)
60565
60607
  if match == nil then
@@ -60568,7 +60610,7 @@ function ____exports.character(self, params)
60568
60610
  end
60569
60611
  playerType = match[2]
60570
60612
  else
60571
- if num < FIRST_CHARACTER or num > LAST_VANILLA_CHARACTER then
60613
+ if not isEnumValue(nil, num, PlayerType) or num == PlayerType.POSSESSOR then
60572
60614
  print("Invalid character number: " .. tostring(num))
60573
60615
  return
60574
60616
  end
@@ -60591,9 +60633,9 @@ end
60591
60633
  function ____exports.coin(self, params)
60592
60634
  local numCoins = 1
60593
60635
  if params ~= "" then
60594
- local num = tonumber(params)
60636
+ local num = parseIntSafe(nil, params)
60595
60637
  if num == nil then
60596
- print("That is an invalid amount of coins to add.")
60638
+ print("Invalid coin amount: " .. tostring(num))
60597
60639
  return
60598
60640
  end
60599
60641
  numCoins = num
@@ -60606,9 +60648,9 @@ end
60606
60648
  function ____exports.coins(self, params)
60607
60649
  local numCoins = 999
60608
60650
  if params ~= "" then
60609
- local num = tonumber(params)
60651
+ local num = parseIntSafe(nil, params)
60610
60652
  if num == nil then
60611
- print("That is an invalid amount of coins to add.")
60653
+ print("Invalid coin amount: " .. tostring(num))
60612
60654
  return
60613
60655
  end
60614
60656
  numCoins = num
@@ -60651,7 +60693,7 @@ function ____exports.damage(self, params)
60651
60693
  if params ~= "" then
60652
60694
  local num = tonumber(params)
60653
60695
  if num == nil then
60654
- print("The provided damage amount is invalid: " .. params)
60696
+ print("Invalid damage amount: " .. params)
60655
60697
  return
60656
60698
  end
60657
60699
  v.persistent.damageAmount = num
@@ -60747,9 +60789,9 @@ end
60747
60789
  function ____exports.getCharge(self, params)
60748
60790
  local activeSlot = ActiveSlot.PRIMARY
60749
60791
  if params ~= "" then
60750
- local num = tonumber(params)
60751
- if num == nil then
60752
- print("The provided slot number is invalid: " .. params)
60792
+ local num = parseIntSafe(nil, params)
60793
+ if num == nil or not isEnumValue(nil, num, ActiveSlot) then
60794
+ print("Invalid slot number: " .. params)
60753
60795
  return
60754
60796
  end
60755
60797
  activeSlot = num
@@ -60775,9 +60817,9 @@ end
60775
60817
  function ____exports.gigaBomb(self, params)
60776
60818
  local numBombs = 1
60777
60819
  if params ~= "" then
60778
- local num = tonumber(params)
60820
+ local num = parseIntSafe(nil, params)
60779
60821
  if num == nil then
60780
- print("That is an invalid amount of Giga Bombs to add.")
60822
+ print("Invalid Giga Bomb amount: " .. tostring(num))
60781
60823
  return
60782
60824
  end
60783
60825
  numBombs = num
@@ -60856,9 +60898,9 @@ end
60856
60898
  function ____exports.key(self, params)
60857
60899
  local numKeys = 1
60858
60900
  if params ~= "" then
60859
- local num = tonumber(params)
60901
+ local num = parseIntSafe(nil, params)
60860
60902
  if num == nil then
60861
- print("That is an invalid amount of keys to add.")
60903
+ print("Invalid key amount: " .. tostring(num))
60862
60904
  return
60863
60905
  end
60864
60906
  numKeys = num
@@ -60871,9 +60913,9 @@ end
60871
60913
  function ____exports.keys(self, params)
60872
60914
  local numKeys = 99
60873
60915
  if params ~= "" then
60874
- local num = tonumber(params)
60916
+ local num = parseIntSafe(nil, params)
60875
60917
  if num == nil then
60876
- print("That is an invalid amount of keys to add.")
60918
+ print("Invalid key amount: " .. tostring(num))
60877
60919
  return
60878
60920
  end
60879
60921
  numKeys = num
@@ -60983,7 +61025,7 @@ function ____exports.pill(self, params)
60983
61025
  return
60984
61026
  end
60985
61027
  local pillEffect
60986
- local num = tonumber(params)
61028
+ local num = parseIntSafe(nil, params)
60987
61029
  if num == nil then
60988
61030
  local match = getMapPartialMatch(nil, params, PILL_NAME_TO_EFFECT_MAP)
60989
61031
  if match == nil then
@@ -60992,7 +61034,7 @@ function ____exports.pill(self, params)
60992
61034
  end
60993
61035
  pillEffect = match[2]
60994
61036
  else
60995
- if num < FIRST_PILL_EFFECT or num > LAST_VANILLA_PILL_EFFECT then
61037
+ if not isValidPillEffect(nil, num) then
60996
61038
  print("Invalid pill effect ID: " .. tostring(num))
60997
61039
  return
60998
61040
  end
@@ -61054,13 +61096,9 @@ function ____exports.pocket(self, params)
61054
61096
  print("You must supply a collectible type to put as the pocket item.")
61055
61097
  return
61056
61098
  end
61057
- local collectibleType = tonumber(params)
61058
- if collectibleType == nil then
61059
- print("That is an invalid collectible type.")
61060
- return
61061
- end
61062
- if not isValidCollectibleType(nil, collectibleType) then
61063
- print("That is an invalid collectible type.")
61099
+ local collectibleType = parseIntSafe(nil, params)
61100
+ if collectibleType == nil or not isValidCollectibleType(nil, collectibleType) then
61101
+ print("Invalid collectible type: " .. tostring(collectibleType))
61064
61102
  return
61065
61103
  end
61066
61104
  local player = Isaac.GetPlayer()
@@ -61128,13 +61166,9 @@ function ____exports.s(self, params)
61128
61166
  stageString = params
61129
61167
  stageTypeLetter = ""
61130
61168
  end
61131
- local stage = tonumber(stageString)
61132
- if stage == nil then
61133
- print("That is an invalid stage number: " .. tostring(stage))
61134
- return
61135
- end
61136
- if stage < FIRST_STAGE or stage > LAST_STAGE then
61137
- print(((("Invalid stage number; must be between " .. tostring(FIRST_STAGE)) .. " and ") .. tostring(LAST_STAGE)) .. ".")
61169
+ local stage = parseIntSafe(nil, stageString)
61170
+ if stage == nil or not isEnumValue(nil, stage, StageType) then
61171
+ print("Invalid stage number: " .. tostring(stage))
61138
61172
  return
61139
61173
  end
61140
61174
  Isaac.ExecuteCommand(("stage " .. tostring(stage)) .. stageTypeLetter)
@@ -61176,26 +61210,25 @@ function ____exports.setCharges(self, params)
61176
61210
  return
61177
61211
  end
61178
61212
  if #args ~= 2 then
61179
- print("That is an invalid amount of arguments.")
61213
+ print("Invalid amount of arguments: " .. tostring(#args))
61180
61214
  return
61181
61215
  end
61182
61216
  local activeSlotString, chargeString = table.unpack(args)
61183
- local activeSlot = tonumber(activeSlotString)
61184
- if activeSlot == nil then
61185
- print("The provided slot number is invalid: " .. tostring(activeSlotString))
61217
+ if activeSlotString == nil or chargeString == nil then
61186
61218
  return
61187
61219
  end
61188
- if not __TS__ArrayIncludes(ACTIVE_SLOT_VALUES, activeSlot) then
61189
- print("The provided slot number is invalid: " .. tostring(activeSlot))
61220
+ local activeSlot = parseIntSafe(nil, activeSlotString)
61221
+ if activeSlot == nil or not isEnumValue(nil, activeSlot, ActiveSlot) then
61222
+ print("Invalid slot number: " .. activeSlotString)
61190
61223
  return
61191
61224
  end
61192
- local chargeNum = tonumber(chargeString)
61225
+ local chargeNum = parseIntSafe(nil, chargeString)
61193
61226
  if chargeNum == nil then
61194
- print("The provided charge amount is invalid: " .. tostring(chargeString))
61227
+ print("Invalid charge amount: " .. chargeString)
61195
61228
  return
61196
61229
  end
61197
61230
  if chargeNum < 0 then
61198
- print("The provided charge amount is invalid: " .. tostring(chargeNum))
61231
+ print("Invalid charge amount: " .. tostring(chargeNum))
61199
61232
  return
61200
61233
  end
61201
61234
  local player = Isaac.GetPlayer()
@@ -61216,14 +61249,17 @@ function ____exports.setPosition(self, params)
61216
61249
  return
61217
61250
  end
61218
61251
  local xString, yString = table.unpack(args)
61219
- local x = tonumber(xString)
61252
+ if xString == nil or yString == nil then
61253
+ return
61254
+ end
61255
+ local x = parseIntSafe(nil, xString)
61220
61256
  if x == nil then
61221
- print("That is an invalid x value: " .. tostring(xString))
61257
+ print("Invalid x value: " .. xString)
61222
61258
  return
61223
61259
  end
61224
- local y = tonumber(yString)
61260
+ local y = parseIntSafe(nil, yString)
61225
61261
  if y == nil then
61226
- print("That is an invalid y value: " .. tostring(yString))
61262
+ print("Invalid y value: " .. yString)
61227
61263
  return
61228
61264
  end
61229
61265
  local player = Isaac.GetPlayer()
@@ -61244,9 +61280,9 @@ end
61244
61280
  function ____exports.soulCharges(self, params)
61245
61281
  local charges = 1
61246
61282
  if params ~= "" then
61247
- local num = tonumber(params)
61283
+ local num = parseIntSafe(nil, params)
61248
61284
  if num == nil then
61249
- print("That is an invalid amount of charges to add.")
61285
+ print("Invalid charges amount: " .. tostring(num))
61250
61286
  return
61251
61287
  end
61252
61288
  charges = num
@@ -61291,17 +61327,20 @@ function ____exports.spawnCollectibleAt(self, params)
61291
61327
  print("You must specify the number corresponding to the collectible type and the number corresponding to the grid tile location.")
61292
61328
  return
61293
61329
  end
61294
- local collectibleTypeNumber = tonumber(args[1])
61295
- if collectibleTypeNumber == nil or collectibleTypeNumber < 0 then
61296
- print("Failed to parse the collectible type of: " .. tostring(args[1]))
61330
+ local collectibleTypeString, gridIndexString = table.unpack(args)
61331
+ if collectibleTypeString == nil or gridIndexString == nil then
61297
61332
  return
61298
61333
  end
61299
- local gridIndex = tonumber(args[2])
61334
+ local collectibleType = parseIntSafe(nil, collectibleTypeString)
61335
+ if collectibleType == nil or not isValidCollectibleType(nil, collectibleType) then
61336
+ print("Invalid collectible type: " .. tostring(args[1]))
61337
+ return
61338
+ end
61339
+ local gridIndex = parseIntSafe(nil, gridIndexString)
61300
61340
  if gridIndex == nil or gridIndex < 0 then
61301
61341
  print("Failed to parse the grid index of: " .. tostring(args[2]))
61302
61342
  return
61303
61343
  end
61304
- local collectibleType = asCollectibleType(nil, collectibleTypeNumber)
61305
61344
  spawnCollectibleFunc(nil, collectibleType, gridIndex, nil)
61306
61345
  end
61307
61346
  --- Alias for the `spawnGoldenTrinket` command.
@@ -61321,7 +61360,7 @@ function ____exports.speed(self, params)
61321
61360
  if params ~= "" then
61322
61361
  local num = tonumber(params)
61323
61362
  if num == nil then
61324
- print("The provided speed amount is invalid: " .. params)
61363
+ print("Invalid speed amount: " .. params)
61325
61364
  return
61326
61365
  end
61327
61366
  v.persistent.damageAmount = num
@@ -61355,7 +61394,7 @@ function ____exports.tears(self, params)
61355
61394
  if params ~= "" then
61356
61395
  local num = tonumber(params)
61357
61396
  if num == nil then
61358
- print("The provided tear delay amount is invalid: " .. params)
61397
+ print("Invalid tear delay amount: " .. params)
61359
61398
  return
61360
61399
  end
61361
61400
  v.persistent.tearsAmount = num
@@ -61416,7 +61455,7 @@ function ____exports.warp(self, params)
61416
61455
  return
61417
61456
  end
61418
61457
  local roomType
61419
- local num = tonumber(params)
61458
+ local num = parseIntSafe(nil, params)
61420
61459
  if num == nil then
61421
61460
  local match = getMapPartialMatch(nil, params, ROOM_NAME_TO_TYPE_MAP)
61422
61461
  if match == nil then
@@ -61425,7 +61464,7 @@ function ____exports.warp(self, params)
61425
61464
  end
61426
61465
  roomType = match[2]
61427
61466
  else
61428
- if num < FIRST_ROOM_TYPE or num > LAST_ROOM_TYPE then
61467
+ if not isEnumValue(nil, num, RoomType) then
61429
61468
  print("Invalid room type: " .. tostring(num))
61430
61469
  return
61431
61470
  end
@@ -63406,12 +63445,16 @@ local getFeatures = ____features.getFeatures
63406
63445
  local ____debugFunctions = require("functions.debugFunctions")
63407
63446
  local getElapsedTimeSince = ____debugFunctions.getElapsedTimeSince
63408
63447
  local getTime = ____debugFunctions.getTime
63448
+ local ____enums = require("functions.enums")
63449
+ local isEnumValue = ____enums.isEnumValue
63409
63450
  local ____log = require("functions.log")
63410
63451
  local getParentFunctionDescription = ____log.getParentFunctionDescription
63411
63452
  local log = ____log.log
63412
63453
  local ____tstlClass = require("functions.tstlClass")
63413
63454
  local getTSTLClassConstructor = ____tstlClass.getTSTLClassConstructor
63414
63455
  local getTSTLClassName = ____tstlClass.getTSTLClassName
63456
+ local ____types = require("functions.types")
63457
+ local parseIntSafe = ____types.parseIntSafe
63415
63458
  local ____utils = require("functions.utils")
63416
63459
  local assertDefined = ____utils.assertDefined
63417
63460
  function getExportedMethodsFromFeature(self, featureClass)
@@ -63530,9 +63573,12 @@ function ModUpgraded.prototype.logUsedFeatures(self)
63530
63573
  if callbackClass.numConsumers == 0 then
63531
63574
  goto __continue19
63532
63575
  end
63533
- local modCallbackCustom = tonumber(modCallbackCustomString)
63534
- assertDefined(nil, modCallbackCustom, "Failed to convert an index on the callbacks object to a number.")
63535
- log(((("- ModCallbackCustom." .. tostring(ModCallbackCustom[modCallbackCustom])) .. " (") .. tostring(modCallbackCustom)) .. ")")
63576
+ local modCallbackCustom = parseIntSafe(nil, modCallbackCustomString)
63577
+ assertDefined(nil, modCallbackCustom, ("Failed to convert the string \"" .. modCallbackCustomString) .. "\" representing a \"ModCallbackCustom\" value to a number.")
63578
+ if not isEnumValue(nil, modCallbackCustom, ModCallbackCustom) then
63579
+ error(("Failed to convert the number " .. tostring(modCallbackCustom)) .. " to a \"ModCallbackCustom\" value.")
63580
+ end
63581
+ log(((("- ModCallbackCustom." .. ModCallbackCustom[modCallbackCustom]) .. " (") .. tostring(modCallbackCustom)) .. ")")
63536
63582
  end
63537
63583
  ::__continue19::
63538
63584
  end
@@ -63541,13 +63587,16 @@ function ModUpgraded.prototype.logUsedFeatures(self)
63541
63587
  local featureClass = ____value[2]
63542
63588
  do
63543
63589
  if featureClass.numConsumers == 0 then
63544
- goto __continue22
63590
+ goto __continue23
63591
+ end
63592
+ local iscFeature = parseIntSafe(nil, iscFeatureString)
63593
+ assertDefined(nil, iscFeature, ("Failed to convert the string \"" .. iscFeatureString) .. "\" representing a \"ISCFeature\" value to a number.")
63594
+ if not isEnumValue(nil, iscFeature, ISCFeature) then
63595
+ error(("Failed to convert the number " .. tostring(iscFeature)) .. " to a \"ISCFeature\" value.")
63545
63596
  end
63546
- local iscFeature = tonumber(iscFeatureString)
63547
- assertDefined(nil, iscFeature, "Failed to convert an index on the features object to a number.")
63548
- log(((("- ISCFeature." .. tostring(ISCFeature[iscFeature])) .. " (") .. tostring(iscFeature)) .. ")")
63597
+ log(((("- ISCFeature." .. ISCFeature[iscFeature]) .. " (") .. tostring(iscFeature)) .. ")")
63549
63598
  end
63550
- ::__continue22::
63599
+ ::__continue23::
63551
63600
  end
63552
63601
  end
63553
63602
  function ModUpgraded.prototype.initFeature(self, feature)