isaacscript-common 1.0.488 → 1.0.492

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 (130) hide show
  1. package/README.md +2 -0
  2. package/dist/callbacks/itemPickup.lua +2 -6
  3. package/dist/callbacks/postBombInitLate.lua +6 -8
  4. package/dist/callbacks/postCursedTeleport.lua +8 -10
  5. package/dist/callbacks/postEffectInitLate.lua +6 -8
  6. package/dist/callbacks/postEsauJr.lua +2 -4
  7. package/dist/callbacks/postFamiliarInitLate.lua +6 -8
  8. package/dist/callbacks/postFlip.lua +2 -4
  9. package/dist/callbacks/postGridEntity.lua +8 -18
  10. package/dist/callbacks/postKnifeInitLate.lua +6 -8
  11. package/dist/callbacks/postLaserInitLate.lua +6 -8
  12. package/dist/callbacks/postNPCInitLate.lua +6 -8
  13. package/dist/callbacks/postPickupCollect.lua +1 -5
  14. package/dist/callbacks/postPickupInitLate.lua +6 -8
  15. package/dist/callbacks/postPlayerChangeHealth.lua +9 -13
  16. package/dist/callbacks/postPlayerChangeType.lua +1 -5
  17. package/dist/callbacks/postPlayerFatalDamage.lua +2 -2
  18. package/dist/callbacks/postPlayerInitLate.lua +1 -5
  19. package/dist/callbacks/postPlayerReordered.lua +1 -1
  20. package/dist/callbacks/postProjectileInitLate.lua +6 -8
  21. package/dist/callbacks/postPurchase.lua +10 -14
  22. package/dist/callbacks/postSacrifice.lua +3 -3
  23. package/dist/callbacks/postSlotInitUpdate.lua +3 -11
  24. package/dist/callbacks/postSlotRenderBroken.lua +2 -8
  25. package/dist/callbacks/postTearInitLate.lua +6 -8
  26. package/dist/callbacks/postTransformation.lua +1 -5
  27. package/dist/callbacks/reorderedCallbacks.lua +4 -4
  28. package/dist/callbacks/subscriptions/postBombInitLate.lua +3 -3
  29. package/dist/callbacks/subscriptions/postCursedTeleport.lua +1 -1
  30. package/dist/callbacks/subscriptions/postCustomRevive.lua +3 -3
  31. package/dist/callbacks/subscriptions/postEffectInitLate.lua +3 -3
  32. package/dist/callbacks/subscriptions/postEsauJr.lua +1 -1
  33. package/dist/callbacks/subscriptions/postFamiliarInitLate.lua +3 -3
  34. package/dist/callbacks/subscriptions/postFirstEsauJr.lua +1 -1
  35. package/dist/callbacks/subscriptions/postFirstFlip.lua +1 -1
  36. package/dist/callbacks/subscriptions/postFlip.lua +1 -1
  37. package/dist/callbacks/subscriptions/postGameStartedReordered.lua +1 -1
  38. package/dist/callbacks/subscriptions/postGridEntityInit.lua +3 -3
  39. package/dist/callbacks/subscriptions/postGridEntityRemove.lua +3 -3
  40. package/dist/callbacks/subscriptions/postGridEntityUpdate.lua +3 -3
  41. package/dist/callbacks/subscriptions/postItemPickup.lua +5 -5
  42. package/dist/callbacks/subscriptions/postKnifeInitLate.lua +3 -3
  43. package/dist/callbacks/subscriptions/postLaserInitLate.lua +3 -3
  44. package/dist/callbacks/subscriptions/postNPCInitLate.lua +3 -3
  45. package/dist/callbacks/subscriptions/postNewLevelReordered.lua +1 -1
  46. package/dist/callbacks/subscriptions/postNewRoomReordered.lua +1 -1
  47. package/dist/callbacks/subscriptions/postPickupCollect.lua +3 -3
  48. package/dist/callbacks/subscriptions/postPickupInitLate.lua +3 -3
  49. package/dist/callbacks/subscriptions/postPlayerChangeHealth.lua +3 -3
  50. package/dist/callbacks/subscriptions/postPlayerChangeType.lua +1 -1
  51. package/dist/callbacks/subscriptions/postPlayerFatalDamage.lua +3 -3
  52. package/dist/callbacks/subscriptions/postPlayerInitLate.lua +3 -3
  53. package/dist/callbacks/subscriptions/postPlayerInitReordered.lua +3 -3
  54. package/dist/callbacks/subscriptions/postPlayerRenderReordered.lua +3 -3
  55. package/dist/callbacks/subscriptions/postPlayerUpdateReordered.lua +3 -3
  56. package/dist/callbacks/subscriptions/postProjectileInitLate.lua +3 -3
  57. package/dist/callbacks/subscriptions/postPurchase.lua +8 -2
  58. package/dist/callbacks/subscriptions/postSacrifice.lua +1 -1
  59. package/dist/callbacks/subscriptions/postSlotDestroyed.lua +3 -3
  60. package/dist/callbacks/subscriptions/postSlotInit.lua +3 -3
  61. package/dist/callbacks/subscriptions/postSlotRender.lua +3 -3
  62. package/dist/callbacks/subscriptions/postSlotUpdate.lua +3 -3
  63. package/dist/callbacks/subscriptions/postTearInitLate.lua +3 -3
  64. package/dist/callbacks/subscriptions/postTransformation.lua +3 -3
  65. package/dist/callbacks/subscriptions/preCustomRevive.lua +1 -1
  66. package/dist/callbacks/subscriptions/preItemPickup.lua +5 -5
  67. package/dist/constants.d.ts +9 -0
  68. package/dist/constants.lua +41 -4
  69. package/dist/features/deployJSONRoom.lua +90 -61
  70. package/dist/features/disableInputs.lua +9 -3
  71. package/dist/features/forgottenSwitch.lua +1 -1
  72. package/dist/features/getCollectibleItemPoolType.lua +10 -14
  73. package/dist/features/preventCollectibleRotate.lua +3 -9
  74. package/dist/features/saveDataManager/load.lua +2 -6
  75. package/dist/features/saveDataManager/main.lua +1 -1
  76. package/dist/features/saveDataManager/merge.lua +2 -4
  77. package/dist/features/sirenHelpers.lua +5 -5
  78. package/dist/functions/array.lua +5 -7
  79. package/dist/functions/bitwise.lua +1 -1
  80. package/dist/functions/cards.d.ts +2 -2
  81. package/dist/functions/charge.lua +10 -12
  82. package/dist/functions/collectibles.d.ts +23 -2
  83. package/dist/functions/collectibles.lua +26 -21
  84. package/dist/functions/color.lua +9 -1
  85. package/dist/functions/deepCopy.lua +45 -25
  86. package/dist/functions/deepCopyTests.lua +12 -20
  87. package/dist/functions/doors.lua +7 -19
  88. package/dist/functions/entity.lua +7 -1
  89. package/dist/functions/flag.lua +1 -1
  90. package/dist/functions/gridEntity.lua +13 -8
  91. package/dist/functions/input.lua +14 -18
  92. package/dist/functions/jsonRoom.lua +3 -9
  93. package/dist/functions/language.lua +9 -1
  94. package/dist/functions/log.lua +18 -46
  95. package/dist/functions/math.lua +15 -17
  96. package/dist/functions/npc.lua +15 -17
  97. package/dist/functions/pickups.lua +14 -1
  98. package/dist/functions/pills.d.ts +1 -1
  99. package/dist/functions/player.d.ts +12 -0
  100. package/dist/functions/player.lua +45 -59
  101. package/dist/functions/playerHealth.lua +19 -9
  102. package/dist/functions/pocketItems.lua +4 -4
  103. package/dist/functions/random.lua +2 -2
  104. package/dist/functions/revive.lua +4 -4
  105. package/dist/functions/rooms.lua +13 -17
  106. package/dist/functions/spawnCollectible.lua +10 -2
  107. package/dist/functions/sprite.lua +2 -2
  108. package/dist/functions/stage.lua +6 -6
  109. package/dist/functions/tears.lua +1 -1
  110. package/dist/functions/transformations.lua +4 -10
  111. package/dist/functions/trinketGive.lua +2 -2
  112. package/dist/functions/trinkets.d.ts +6 -2
  113. package/dist/functions/trinkets.lua +3 -5
  114. package/dist/functions/ui.lua +3 -3
  115. package/dist/functions/util.lua +4 -8
  116. package/dist/functions/vector.lua +8 -8
  117. package/dist/lualib_bundle.lua +603 -555
  118. package/dist/maps/cardDescriptionMap.lua +99 -1
  119. package/dist/maps/cardNameMap.lua +99 -1
  120. package/dist/maps/collectibleDescriptionMap.lua +722 -1
  121. package/dist/maps/collectibleNameMap.lua +722 -1
  122. package/dist/maps/gridEntityXMLMap.lua +36 -1
  123. package/dist/maps/pillEffectNameMap.lua +52 -1
  124. package/dist/maps/roomTypeToItemPoolMap.lua +15 -1
  125. package/dist/maps/transformationMap.lua +19 -12
  126. package/dist/maps/trinketDescriptionMap.lua +190 -1
  127. package/dist/maps/trinketNameMap.lua +190 -1
  128. package/dist/sets/cards.lua +98 -2
  129. package/dist/types/ModUpgraded.lua +82 -166
  130. package/package.json +5 -5
@@ -9,26 +9,20 @@ local ____util = require("functions.util")
9
9
  local copySet = ____util.copySet
10
10
  function ____exports.getPlayerNumTransformationCollectibles(self, player, playerForm)
11
11
  if TRANSFORMATIONS_NOT_BASED_ON_ITEMS:has(playerForm) then
12
- error(
13
- ("The transformation of " .. tostring(playerForm)) .. " cannot be tracked by this function."
14
- )
12
+ error(("The transformation of " .. tostring(playerForm)) .. " cannot be tracked by this function.")
15
13
  end
16
14
  local itemsForTransformation = TRANSFORMATION_TO_ITEMS_MAP:get(playerForm)
17
15
  if itemsForTransformation == nil then
18
- error(
19
- ("The transformation of " .. tostring(playerForm)) .. " is not a valid value of the PlayerForm enum."
20
- )
16
+ error(("The transformation of " .. tostring(playerForm)) .. " is not a valid value of the PlayerForm enum.")
21
17
  end
22
18
  local numCollectibles = 0
23
- for ____, collectibleType in __TS__Iterator(
24
- itemsForTransformation:values()
25
- ) do
19
+ for ____, collectibleType in __TS__Iterator(itemsForTransformation:values()) do
26
20
  numCollectibles = numCollectibles + player:GetCollectibleNum(collectibleType)
27
21
  end
28
22
  return numCollectibles
29
23
  end
30
24
  function ____exports.getTransformationsForItem(self, collectibleType)
31
25
  local transformations = ITEM_TO_TRANSFORMATION_MAP:get(collectibleType)
32
- return ((transformations == nil) and __TS__New(Set)) or copySet(nil, transformations)
26
+ return transformations == nil and __TS__New(Set) or copySet(nil, transformations)
33
27
  end
34
28
  return ____exports
@@ -14,11 +14,11 @@ function ____exports.temporarilyRemoveTrinkets(self, player, trinketType)
14
14
  numTrinkets = numTrinkets + 1
15
15
  end
16
16
  local numSmeltedTrinkets = numTrinkets
17
- local trinketWasInSlot1 = (trinket1 == trinketType) or ((trinket1 + GOLDEN_TRINKET_SHIFT) == trinketType)
17
+ local trinketWasInSlot1 = trinket1 == trinketType or trinket1 + GOLDEN_TRINKET_SHIFT == trinketType
18
18
  if trinketWasInSlot1 then
19
19
  numSmeltedTrinkets = numSmeltedTrinkets - 1
20
20
  end
21
- local trinketWasInSlot2 = (trinket2 == trinketType) or ((trinket2 + GOLDEN_TRINKET_SHIFT) == trinketType)
21
+ local trinketWasInSlot2 = trinket2 == trinketType or trinket2 + GOLDEN_TRINKET_SHIFT == trinketType
22
22
  if trinketWasInSlot2 then
23
23
  numSmeltedTrinkets = numSmeltedTrinkets - 1
24
24
  end
@@ -16,10 +16,14 @@ export declare function getMaxTrinketID(): int;
16
16
  export declare function getOpenTrinketSlot(player: EntityPlayer): int | undefined;
17
17
  /** Helper function to get all of the trinket entities in the room. */
18
18
  export declare function getTrinkets(matchingSubType?: number): EntityPickup[];
19
- /** This is a helper function to get a trinket description from a TrinketType. */
19
+ /**
20
+ * Helper function to get the in-game description for a trinket. Returns "Unknown" if the provided
21
+ * trinket type was not valid.
22
+ */
20
23
  export declare function getTrinketDescription(trinketType: TrinketType | int): string;
21
24
  /**
22
- * This is a helper function to get a trinket name from a TrinketType.
25
+ * Helper function to get the name of a trinket. Returns "Unknown" if the provided trinket type is
26
+ * not valid.
23
27
  *
24
28
  * Example:
25
29
  * ```
@@ -16,17 +16,15 @@ function ____exports.getOpenTrinketSlot(self, player)
16
16
  local trinket0 = player:GetTrinket(0)
17
17
  local trinket1 = player:GetTrinket(1)
18
18
  if maxTrinkets == 1 then
19
- return ((trinket0 == TrinketType.TRINKET_NULL) and 0) or nil
19
+ return trinket0 == TrinketType.TRINKET_NULL and 0 or nil
20
20
  end
21
21
  if maxTrinkets == 2 then
22
22
  if trinket0 == TrinketType.TRINKET_NULL then
23
23
  return 0
24
24
  end
25
- return ((trinket1 == TrinketType.TRINKET_NULL) and 1) or nil
25
+ return trinket1 == TrinketType.TRINKET_NULL and 1 or nil
26
26
  end
27
- error(
28
- "The player has an unknown number of trinket slots: " .. tostring(maxTrinkets)
29
- )
27
+ error("The player has an unknown number of trinket slots: " .. tostring(maxTrinkets))
30
28
  return nil
31
29
  end
32
30
  function ____exports.getTrinkets(self, matchingSubType)
@@ -16,14 +16,14 @@ function ____exports.getHeartsUIWidth(self)
16
16
  local soulHearts = player:GetSoulHearts()
17
17
  local boneHearts = player:GetBoneHearts()
18
18
  local extraLives = player:GetExtraLives()
19
- local combinedHearts = (maxHearts + soulHearts) + (boneHearts * 2)
19
+ local combinedHearts = maxHearts + soulHearts + boneHearts * 2
20
20
  if combinedHearts > 12 then
21
21
  combinedHearts = 12
22
22
  end
23
23
  if curses == LevelCurse.CURSE_OF_THE_UNKNOWN then
24
24
  combinedHearts = 2
25
25
  end
26
- local width = (combinedHearts / 2) * UI_HEART_WIDTH
26
+ local width = combinedHearts / 2 * UI_HEART_WIDTH
27
27
  if extraLives > 9 then
28
28
  width = width + 20
29
29
  if player:HasCollectible(CollectibleType.COLLECTIBLE_GUPPYS_COLLAR) then
@@ -40,7 +40,7 @@ end
40
40
  function ____exports.getHUDOffsetVector(self)
41
41
  local defaultVector = Vector.Zero
42
42
  local hudOffset = math.floor(Options.HUDOffset * 10)
43
- if (hudOffset < 1) or (hudOffset > 10) then
43
+ if hudOffset < 1 or hudOffset > 10 then
44
44
  return defaultVector
45
45
  end
46
46
  local x = hudOffset * 2
@@ -4,9 +4,7 @@ local ____exports = {}
4
4
  local HEX_STRING_LENGTH = 6
5
5
  function ____exports.copySet(self, oldSet)
6
6
  local newSet = __TS__New(Set)
7
- for ____, value in __TS__Iterator(
8
- oldSet:values()
9
- ) do
7
+ for ____, value in __TS__Iterator(oldSet:values()) do
10
8
  newSet:add(value)
11
9
  end
12
10
  return newSet
@@ -25,9 +23,7 @@ end
25
23
  function ____exports.hexToKColor(self, hexString, alpha)
26
24
  hexString = __TS__StringReplace(hexString, "#", "")
27
25
  if #hexString ~= HEX_STRING_LENGTH then
28
- error(
29
- ("Hex strings must be of length " .. tostring(HEX_STRING_LENGTH)) .. "."
30
- )
26
+ error(("Hex strings must be of length " .. tostring(HEX_STRING_LENGTH)) .. ".")
31
27
  end
32
28
  local rString = __TS__StringSubstr(hexString, 0, 2)
33
29
  local R = tonumber("0x" .. rString)
@@ -49,14 +45,14 @@ function ____exports.hexToKColor(self, hexString, alpha)
49
45
  end
50
46
  function ____exports.isGreedMode(self)
51
47
  local game = Game()
52
- return (game.Difficulty == Difficulty.DIFFICULTY_GREED) or (game.Difficulty == Difficulty.DIFFICULTY_GREEDIER)
48
+ return game.Difficulty == Difficulty.DIFFICULTY_GREED or game.Difficulty == Difficulty.DIFFICULTY_GREEDIER
53
49
  end
54
50
  function ____exports.onSetSeed(self)
55
51
  local game = Game()
56
52
  local seeds = game:GetSeeds()
57
53
  local customRun = seeds:IsCustomRun()
58
54
  local challenge = Isaac.GetChallenge()
59
- return (challenge == Challenge.CHALLENGE_NULL) and customRun
55
+ return challenge == Challenge.CHALLENGE_NULL and customRun
60
56
  end
61
57
  function ____exports.printConsole(self, msg)
62
58
  Isaac.ConsoleOutput(msg .. "\n")
@@ -14,25 +14,25 @@ function ____exports.directionToVector(self, direction)
14
14
  return Vector(0, 1)
15
15
  end
16
16
  end
17
- ____cond4 = ____cond4 or (____switch4 == Direction.LEFT)
17
+ ____cond4 = ____cond4 or ____switch4 == Direction.LEFT
18
18
  if ____cond4 then
19
19
  do
20
20
  return Vector(-1, 0)
21
21
  end
22
22
  end
23
- ____cond4 = ____cond4 or (____switch4 == Direction.RIGHT)
23
+ ____cond4 = ____cond4 or ____switch4 == Direction.RIGHT
24
24
  if ____cond4 then
25
25
  do
26
26
  return Vector(1, 0)
27
27
  end
28
28
  end
29
- ____cond4 = ____cond4 or (____switch4 == Direction.UP)
29
+ ____cond4 = ____cond4 or ____switch4 == Direction.UP
30
30
  if ____cond4 then
31
31
  do
32
32
  return Vector(0, -1)
33
33
  end
34
34
  end
35
- ____cond4 = ____cond4 or (____switch4 == Direction.NO_DIRECTION)
35
+ ____cond4 = ____cond4 or ____switch4 == Direction.NO_DIRECTION
36
36
  if ____cond4 then
37
37
  do
38
38
  return Vector.Zero
@@ -66,16 +66,16 @@ function ____exports.isVector(self, object)
66
66
  end
67
67
  function ____exports.vectorToDirection(self, vector)
68
68
  local degrees = vector:GetAngleDegrees()
69
- if (degrees > -45) and (degrees < 45) then
69
+ if degrees > -45 and degrees < 45 then
70
70
  return Direction.RIGHT
71
71
  end
72
- if (degrees >= 45) and (degrees <= 135) then
72
+ if degrees >= 45 and degrees <= 135 then
73
73
  return Direction.DOWN
74
74
  end
75
- if (degrees <= -45) and (degrees >= -135) then
75
+ if degrees <= -45 and degrees >= -135 then
76
76
  return Direction.UP
77
77
  end
78
- if (degrees > 135) or (degrees < -135) then
78
+ if degrees > 135 or degrees < -135 then
79
79
  return Direction.LEFT
80
80
  end
81
81
  return Direction.NO_DIRECTION