isaacscript-common 1.2.174 → 1.2.177

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 (204) hide show
  1. package/dist/callbacks/itemPickup.lua +0 -1
  2. package/dist/callbacks/postBombInitLate.lua +0 -1
  3. package/dist/callbacks/postBoneSwing.lua +0 -1
  4. package/dist/callbacks/postCursedTeleport.lua +0 -1
  5. package/dist/callbacks/postCustomDoorEnter.lua +0 -1
  6. package/dist/callbacks/postEffectInitLate.lua +0 -1
  7. package/dist/callbacks/postEsauJr.lua +0 -1
  8. package/dist/callbacks/postFamiliarInitLate.lua +0 -1
  9. package/dist/callbacks/postFlip.lua +0 -1
  10. package/dist/callbacks/postGridEntity.lua +0 -1
  11. package/dist/callbacks/postGridEntityCollision.lua +0 -1
  12. package/dist/callbacks/postKnifeInitLate.lua +0 -1
  13. package/dist/callbacks/postLaserInitLate.lua +0 -1
  14. package/dist/callbacks/postNPCInitLate.lua +0 -1
  15. package/dist/callbacks/postPickupCollect.lua +0 -1
  16. package/dist/callbacks/postPickupInitLate.lua +0 -1
  17. package/dist/callbacks/postPlayerChangeHealth.lua +0 -1
  18. package/dist/callbacks/postPlayerChangeType.lua +0 -1
  19. package/dist/callbacks/postPlayerFatalDamage.lua +0 -1
  20. package/dist/callbacks/postPlayerInitLate.lua +0 -1
  21. package/dist/callbacks/postPlayerReordered.lua +0 -1
  22. package/dist/callbacks/postProjectileInitLate.lua +0 -1
  23. package/dist/callbacks/postPurchase.lua +0 -1
  24. package/dist/callbacks/postSlotInitUpdate.lua +0 -1
  25. package/dist/callbacks/postSlotRender.lua +0 -1
  26. package/dist/callbacks/postTearInitLate.lua +0 -1
  27. package/dist/callbacks/postTearInitVeryLate.lua +0 -1
  28. package/dist/callbacks/postTransformation.lua +0 -1
  29. package/dist/callbacks/postTrinketBreak.lua +0 -1
  30. package/dist/callbacks/preNewLevel.lua +0 -1
  31. package/dist/callbacks/subscriptions/postBombInitLate.lua +0 -1
  32. package/dist/callbacks/subscriptions/postBoneSwing.lua +0 -1
  33. package/dist/callbacks/subscriptions/postCursedTeleport.lua +0 -1
  34. package/dist/callbacks/subscriptions/postCustomDoorEnter.lua +0 -1
  35. package/dist/callbacks/subscriptions/postCustomRevive.lua +0 -1
  36. package/dist/callbacks/subscriptions/postEffectInitLate.lua +0 -1
  37. package/dist/callbacks/subscriptions/postEsauJr.lua +0 -1
  38. package/dist/callbacks/subscriptions/postFamiliarInitLate.lua +0 -1
  39. package/dist/callbacks/subscriptions/postFirstEsauJr.lua +0 -1
  40. package/dist/callbacks/subscriptions/postFirstFlip.lua +0 -1
  41. package/dist/callbacks/subscriptions/postFlip.lua +0 -1
  42. package/dist/callbacks/subscriptions/postGameStartedReordered.lua +0 -1
  43. package/dist/callbacks/subscriptions/postGridEntityBroken.lua +0 -1
  44. package/dist/callbacks/subscriptions/postGridEntityCollision.lua +0 -1
  45. package/dist/callbacks/subscriptions/postGridEntityInit.lua +0 -1
  46. package/dist/callbacks/subscriptions/postGridEntityRemove.lua +0 -1
  47. package/dist/callbacks/subscriptions/postGridEntityStateChange.lua +0 -1
  48. package/dist/callbacks/subscriptions/postGridEntityUpdate.lua +0 -1
  49. package/dist/callbacks/subscriptions/postItemPickup.lua +0 -1
  50. package/dist/callbacks/subscriptions/postKnifeInitLate.lua +0 -1
  51. package/dist/callbacks/subscriptions/postLaserInitLate.lua +0 -1
  52. package/dist/callbacks/subscriptions/postNPCInitLate.lua +0 -1
  53. package/dist/callbacks/subscriptions/postNewLevelReordered.lua +0 -1
  54. package/dist/callbacks/subscriptions/postNewRoomEarly.lua +0 -1
  55. package/dist/callbacks/subscriptions/postNewRoomReordered.lua +0 -1
  56. package/dist/callbacks/subscriptions/postPEffectUpdateReordered.lua +0 -1
  57. package/dist/callbacks/subscriptions/postPickupCollect.lua +0 -1
  58. package/dist/callbacks/subscriptions/postPickupInitLate.lua +0 -1
  59. package/dist/callbacks/subscriptions/postPlayerChangeHealth.lua +0 -1
  60. package/dist/callbacks/subscriptions/postPlayerChangeType.lua +0 -1
  61. package/dist/callbacks/subscriptions/postPlayerFatalDamage.lua +0 -1
  62. package/dist/callbacks/subscriptions/postPlayerInitLate.lua +0 -1
  63. package/dist/callbacks/subscriptions/postPlayerInitReordered.lua +0 -1
  64. package/dist/callbacks/subscriptions/postPlayerRenderReordered.lua +0 -1
  65. package/dist/callbacks/subscriptions/postPlayerUpdateReordered.lua +0 -1
  66. package/dist/callbacks/subscriptions/postProjectileInitLate.lua +0 -1
  67. package/dist/callbacks/subscriptions/postPurchase.lua +0 -1
  68. package/dist/callbacks/subscriptions/postSacrifice.lua +0 -1
  69. package/dist/callbacks/subscriptions/postSlotAnimationChanged.lua +0 -1
  70. package/dist/callbacks/subscriptions/postSlotDestroyed.lua +0 -1
  71. package/dist/callbacks/subscriptions/postSlotInit.lua +0 -1
  72. package/dist/callbacks/subscriptions/postSlotRender.lua +0 -1
  73. package/dist/callbacks/subscriptions/postSlotUpdate.lua +0 -1
  74. package/dist/callbacks/subscriptions/postTearInitLate.lua +0 -1
  75. package/dist/callbacks/subscriptions/postTearInitVeryLate.lua +0 -1
  76. package/dist/callbacks/subscriptions/postTransformation.lua +0 -1
  77. package/dist/callbacks/subscriptions/postTrinketBreak.lua +0 -1
  78. package/dist/callbacks/subscriptions/preBerserkDeath.lua +0 -1
  79. package/dist/callbacks/subscriptions/preCustomRevive.lua +0 -1
  80. package/dist/callbacks/subscriptions/preItemPickup.lua +0 -1
  81. package/dist/callbacks/subscriptions/preNewLevel.lua +0 -1
  82. package/dist/callbacks/subscriptions/roomClearChange.lua +0 -1
  83. package/dist/classes/DefaultMap.lua +0 -1
  84. package/dist/classes/ModUpgraded.lua +0 -1
  85. package/dist/classes/null.d.ts +6 -7
  86. package/dist/classes/null.lua +5 -6
  87. package/dist/constants.d.ts +10 -10
  88. package/dist/constants.lua +3 -4
  89. package/dist/enums/private/SerializationBrand.lua +0 -1
  90. package/dist/features/collectiblesSeen.d.ts +6 -0
  91. package/dist/features/collectiblesSeen.lua +42 -0
  92. package/dist/features/deployJSONRoom.lua +2 -2
  93. package/dist/features/disableInputs.lua +0 -1
  94. package/dist/features/disableSound.lua +0 -1
  95. package/dist/features/extraConsoleCommands/commands.d.ts +11 -11
  96. package/dist/features/extraConsoleCommands/commands.lua +23 -23
  97. package/dist/features/extraConsoleCommands/init.lua +6 -7
  98. package/dist/features/getCollectibleItemPoolType.lua +0 -1
  99. package/dist/features/isPonyActive.lua +0 -1
  100. package/dist/features/playerInventory.d.ts +10 -2
  101. package/dist/features/playerInventory.lua +51 -16
  102. package/dist/features/preventCollectibleRotate.lua +0 -1
  103. package/dist/features/runInNFrames.lua +0 -1
  104. package/dist/features/saveDataManager/constants.d.ts +1 -1
  105. package/dist/features/saveDataManager/constants.lua +1 -1
  106. package/dist/features/saveDataManager/exports.d.ts +6 -6
  107. package/dist/features/saveDataManager/exports.lua +4 -5
  108. package/dist/features/saveDataManager/load.lua +0 -1
  109. package/dist/features/saveDataManager/main.lua +0 -1
  110. package/dist/features/saveDataManager/maps.lua +0 -1
  111. package/dist/features/saveDataManager/merge.lua +5 -4
  112. package/dist/features/saveDataManager/save.lua +0 -1
  113. package/dist/features/sirenHelpers.lua +0 -1
  114. package/dist/features/taintedLazarusPlayers.lua +0 -1
  115. package/dist/featuresInitialized.d.ts +1 -1
  116. package/dist/featuresInitialized.lua +3 -3
  117. package/dist/functions/array.d.ts +39 -39
  118. package/dist/functions/array.lua +79 -80
  119. package/dist/functions/cards.d.ts +3 -3
  120. package/dist/functions/cards.lua +7 -8
  121. package/dist/functions/charge.d.ts +11 -11
  122. package/dist/functions/charge.lua +13 -13
  123. package/dist/functions/collectibleCacheFlag.lua +0 -1
  124. package/dist/functions/collectibleSet.lua +0 -1
  125. package/dist/functions/collectibles.d.ts +53 -15
  126. package/dist/functions/collectibles.lua +44 -21
  127. package/dist/functions/color.d.ts +2 -2
  128. package/dist/functions/color.lua +6 -6
  129. package/dist/functions/deepCopy.d.ts +0 -3
  130. package/dist/functions/deepCopy.lua +5 -23
  131. package/dist/functions/deepCopyTests.lua +0 -1
  132. package/dist/functions/doors.d.ts +8 -8
  133. package/dist/functions/doors.lua +16 -17
  134. package/dist/functions/entity.d.ts +13 -14
  135. package/dist/functions/entity.lua +27 -35
  136. package/dist/functions/entitySpecific.lua +0 -1
  137. package/dist/functions/familiars.lua +0 -1
  138. package/dist/functions/flying.lua +1 -2
  139. package/dist/functions/globals.lua +0 -1
  140. package/dist/functions/gridEntity.d.ts +1 -1
  141. package/dist/functions/gridEntity.lua +5 -6
  142. package/dist/functions/input.lua +0 -1
  143. package/dist/functions/jsonHelpers.d.ts +7 -7
  144. package/dist/functions/jsonHelpers.lua +10 -11
  145. package/dist/functions/jsonRoom.lua +0 -1
  146. package/dist/functions/log.d.ts +21 -21
  147. package/dist/functions/log.lua +75 -75
  148. package/dist/functions/map.lua +0 -1
  149. package/dist/functions/math.d.ts +1 -1
  150. package/dist/functions/math.lua +3 -4
  151. package/dist/functions/npc.lua +0 -1
  152. package/dist/functions/pickups.lua +0 -1
  153. package/dist/functions/player.d.ts +6 -8
  154. package/dist/functions/player.lua +22 -30
  155. package/dist/functions/playerDataStructures.lua +0 -1
  156. package/dist/functions/playerHealth.d.ts +1 -1
  157. package/dist/functions/playerHealth.lua +20 -21
  158. package/dist/functions/pocketItems.lua +0 -1
  159. package/dist/functions/positionVelocity.d.ts +3 -0
  160. package/dist/functions/positionVelocity.lua +19 -6
  161. package/dist/functions/random.d.ts +7 -7
  162. package/dist/functions/revive.d.ts +5 -5
  163. package/dist/functions/revive.lua +8 -8
  164. package/dist/functions/roomData.d.ts +96 -0
  165. package/dist/functions/roomData.lua +57 -0
  166. package/dist/functions/rooms.d.ts +1 -96
  167. package/dist/functions/rooms.lua +30 -76
  168. package/dist/functions/set.d.ts +2 -2
  169. package/dist/functions/set.lua +7 -8
  170. package/dist/functions/string.lua +0 -1
  171. package/dist/functions/transformations.lua +0 -1
  172. package/dist/functions/trinketCacheFlag.d.ts +4 -4
  173. package/dist/functions/trinketCacheFlag.lua +3 -3
  174. package/dist/functions/trinketGive.d.ts +7 -7
  175. package/dist/functions/trinketGive.lua +27 -27
  176. package/dist/functions/trinketSet.lua +0 -1
  177. package/dist/functions/trinkets.d.ts +2 -2
  178. package/dist/functions/trinkets.lua +6 -6
  179. package/dist/functions/ui.d.ts +13 -13
  180. package/dist/functions/ui.lua +28 -28
  181. package/dist/functions/utils.d.ts +6 -0
  182. package/dist/functions/utils.lua +7 -1
  183. package/dist/functions/vector.d.ts +2 -0
  184. package/dist/functions/vector.lua +13 -0
  185. package/dist/index.d.ts +3 -0
  186. package/dist/index.lua +13 -0
  187. package/dist/lualib_bundle.lua +83 -49
  188. package/dist/maps/cardMap.lua +0 -1
  189. package/dist/maps/characterMap.lua +0 -1
  190. package/dist/maps/collectibleDescriptionMap.lua +0 -1
  191. package/dist/maps/collectibleNameMap.lua +0 -1
  192. package/dist/maps/gridEntityTypeToBrokenStateMap.lua +0 -1
  193. package/dist/maps/gridEntityXMLMap.lua +0 -1
  194. package/dist/maps/pillEffectMap.lua +0 -1
  195. package/dist/maps/roomShapeToTopLeftWallGridIndexMap.d.ts +1 -1
  196. package/dist/maps/roomShapeToTopLeftWallGridIndexMap.lua +1 -2
  197. package/dist/maps/roomTypeMap.lua +0 -1
  198. package/dist/maps/trinketDescriptionMap.lua +0 -1
  199. package/dist/maps/trinketNameMap.lua +0 -1
  200. package/dist/patchErrorFunctions.lua +0 -1
  201. package/dist/types/CollectibleIndex.d.ts +15 -0
  202. package/dist/types/CollectibleIndex.lua +3 -0
  203. package/dist/upgradeMod.lua +3 -1
  204. package/package.json +3 -3
@@ -1,4 +1,3 @@
1
- --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
1
  local ____lualib = require("lualib_bundle")
3
2
  local __TS__StringTrim = ____lualib.__TS__StringTrim
4
3
  local ____exports = {}
@@ -1,4 +1,3 @@
1
- --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
1
  local ____lualib = require("lualib_bundle")
3
2
  local Map = ____lualib.Map
4
3
  local ____exports = {}
@@ -1,4 +1,3 @@
1
- --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
1
  local ____lualib = require("lualib_bundle")
3
2
  local Map = ____lualib.Map
4
3
  local __TS__New = ____lualib.__TS__New
@@ -1,4 +1,3 @@
1
- --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
1
  local ____lualib = require("lualib_bundle")
3
2
  local Map = ____lualib.Map
4
3
  local __TS__InstanceOf = ____lualib.__TS__InstanceOf
@@ -13,14 +12,16 @@ local SerializationType = ____SerializationType.SerializationType
13
12
  local ____array = require("functions.array")
14
13
  local isArray = ____array.isArray
15
14
  local ____deepCopy = require("functions.deepCopy")
16
- local addTraversalDescription = ____deepCopy.addTraversalDescription
17
15
  local deepCopy = ____deepCopy.deepCopy
18
- local deserializeVector = ____deepCopy.deserializeVector
19
16
  local isSerializedVector = ____deepCopy.isSerializedVector
20
17
  local ____log = require("functions.log")
21
18
  local log = ____log.log
22
19
  local ____table = require("functions.table")
23
20
  local clearTable = ____table.clearTable
21
+ local ____utils = require("functions.utils")
22
+ local getTraversalDescription = ____utils.getTraversalDescription
23
+ local ____vector = require("functions.vector")
24
+ local deserializeVector = ____vector.deserializeVector
24
25
  local ____constants = require("features.saveDataManager.constants")
25
26
  local SAVE_DATA_MANAGER_DEBUG = ____constants.SAVE_DATA_MANAGER_DEBUG
26
27
  function ____exports.merge(self, oldObject, newTable, traversalDescription)
@@ -110,7 +111,7 @@ function mergeTable(self, oldTable, newTable, traversalDescription)
110
111
  oldValue = {}
111
112
  oldTable[key] = oldValue
112
113
  end
113
- traversalDescription = addTraversalDescription(nil, key, traversalDescription)
114
+ traversalDescription = getTraversalDescription(nil, key, traversalDescription)
114
115
  ____exports.merge(nil, oldValue, value, traversalDescription)
115
116
  else
116
117
  if SAVE_DATA_MANAGER_DEBUG then
@@ -1,4 +1,3 @@
1
- --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
1
  local ____lualib = require("lualib_bundle")
3
2
  local Map = ____lualib.Map
4
3
  local __TS__ObjectKeys = ____lualib.__TS__ObjectKeys
@@ -1,4 +1,3 @@
1
- --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
1
  local ____lualib = require("lualib_bundle")
3
2
  local __TS__ArrayPush = ____lualib.__TS__ArrayPush
4
3
  local __TS__ArrayFind = ____lualib.__TS__ArrayFind
@@ -1,4 +1,3 @@
1
- --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
1
  local ____lualib = require("lualib_bundle")
3
2
  local Map = ____lualib.Map
4
3
  local __TS__New = ____lualib.__TS__New
@@ -1 +1 @@
1
- export declare function errorIfFeaturesNotInitialized(featureName: string): void;
1
+ export {};
@@ -4,12 +4,12 @@ local featuresInitialized = false
4
4
  function ____exports.areFeaturesInitialized(self)
5
5
  return featuresInitialized
6
6
  end
7
- function ____exports.setFeaturesInitialized(self)
8
- featuresInitialized = true
9
- end
10
7
  function ____exports.errorIfFeaturesNotInitialized(self, featureName)
11
8
  if not ____exports.areFeaturesInitialized(nil) then
12
9
  error(("The " .. featureName) .. " is not initialized. You must first upgrade your mod object by calling the \"upgradeMod\" function.")
13
10
  end
14
11
  end
12
+ function ____exports.setFeaturesInitialized(self)
13
+ featuresInitialized = true
14
+ end
15
15
  return ____exports
@@ -4,6 +4,22 @@
4
4
  * only performs a shallow comparison.
5
5
  */
6
6
  export declare function arrayEquals<T>(array1: T[] | readonly T[], array2: T[] | readonly T[]): boolean;
7
+ /**
8
+ * Shallow copies and removes the specified element(s) from the array. Returns the copied array. If
9
+ * the specified element(s) are not found in the array, it will simply return a shallow copy of the
10
+ * array.
11
+ *
12
+ * This function is variadic, meaning that you can specify N arguments to remove N elements.
13
+ */
14
+ export declare function arrayRemove<T>(originalArray: T[] | readonly T[], ...elementsToRemove: T[]): T[];
15
+ /**
16
+ * Removes the specified element(s) from the array. If the specified element(s) are not found in the
17
+ * array, this function will do nothing. Returns whether or not one or more elements were removed.
18
+ *
19
+ * This function is variadic, meaning that you can specify N arguments to remove N elements.
20
+ */
21
+ export declare function arrayRemoveInPlace<T>(array: T[], ...elementsToRemove: T[]): boolean;
22
+ export declare function arrayToString<T>(array: T[]): string;
7
23
  /**
8
24
  * Helper function to combine two or more arrays. Returns a new array that is the composition of all
9
25
  * of the specified arrays.
@@ -23,45 +39,6 @@ export declare function copyArray<T>(oldArray: T[] | readonly T[], numElements?:
23
39
  export declare function emptyArray<T>(array: T[]): void;
24
40
  /** Helper function to return the last element of an array. */
25
41
  export declare function getLastElement<T>(array: T[]): T;
26
- /**
27
- * Initializes an array with all elements containing the specified default value.
28
- *
29
- * Example:
30
- * ```
31
- * const playerTransformations = initArray(false, PlayerForm.NUM_PLAYER_FORMS - 1);
32
- * ```
33
- */
34
- export declare function initArray<T>(defaultValue: T, size: int): T[];
35
- export declare function isArrayInArray<T>(arrayToMatch: T[] | readonly T[], parentArray: Array<T[] | readonly T[]>): boolean;
36
- /**
37
- * Shallow copies and shuffles the array using the Fisher-Yates algorithm. Returns the copied array.
38
- *
39
- * From: https://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array
40
- */
41
- export declare function shuffleArray<T>(originalArray: T[] | readonly T[], seed?: Seed): T[];
42
- /**
43
- * Shuffles the provided array in-place using the Fisher-Yates algorithm.
44
- *
45
- * From: https://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array
46
- */
47
- export declare function shuffleArrayInPlace<T>(array: T[], seed?: Seed): void;
48
- export declare function sumArray(array: number[] | readonly number[]): number;
49
- export declare function arrayToString<T>(array: T[]): string;
50
- /**
51
- * Shallow copies and removes the specified element(s) from the array. Returns the copied array. If
52
- * the specified element(s) are not found in the array, it will simply return a shallow copy of the
53
- * array.
54
- *
55
- * This function is variadic, meaning that you can specify N arguments to remove N elements.
56
- */
57
- export declare function arrayRemove<T>(originalArray: T[] | readonly T[], ...elementsToRemove: T[]): T[];
58
- /**
59
- * Removes the specified element(s) from the array. If the specified element(s) are not found in the
60
- * array, this function will do nothing. Returns whether or not one or more elements were removed.
61
- *
62
- * This function is variadic, meaning that you can specify N arguments to remove N elements.
63
- */
64
- export declare function arrayRemoveInPlace<T>(array: T[], ...elementsToRemove: T[]): boolean;
65
42
  /**
66
43
  * Helper function to get a random element from the provided array.
67
44
  *
@@ -80,6 +57,15 @@ export declare function getRandomArrayElement<T>(array: T[] | readonly T[], seed
80
57
  */
81
58
  export declare function getRandomArrayElementAndRemove<T>(array: T[], seed?: Seed, exceptions?: T[] | readonly T[]): T;
82
59
  export declare function getRandomArrayIndex<T>(array: T[] | readonly T[], seed?: Seed): int;
60
+ /**
61
+ * Initializes an array with all elements containing the specified default value.
62
+ *
63
+ * Example:
64
+ * ```
65
+ * const playerTransformations = initArray(false, PlayerForm.NUM_PLAYER_FORMS - 1);
66
+ * ```
67
+ */
68
+ export declare function initArray<T>(defaultValue: T, size: int): T[];
83
69
  /**
84
70
  * Since Lua uses tables for every non-primitive data structure, it is non-trivial to determine if a
85
71
  * particular table is being used as an array. isArray returns true if:
@@ -88,3 +74,17 @@ export declare function getRandomArrayIndex<T>(array: T[] | readonly T[], seed?:
88
74
  * - the table has no keys (i.e. an "empty" table)
89
75
  */
90
76
  export declare function isArray(thing: unknown): boolean;
77
+ export declare function isArrayInArray<T>(arrayToMatch: T[] | readonly T[], parentArray: Array<T[] | readonly T[]>): boolean;
78
+ /**
79
+ * Shallow copies and shuffles the array using the Fisher-Yates algorithm. Returns the copied array.
80
+ *
81
+ * From: https://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array
82
+ */
83
+ export declare function shuffleArray<T>(originalArray: T[] | readonly T[], seed?: Seed): T[];
84
+ /**
85
+ * Shuffles the provided array in-place using the Fisher-Yates algorithm.
86
+ *
87
+ * From: https://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array
88
+ */
89
+ export declare function shuffleArrayInPlace<T>(array: T[], seed?: Seed): void;
90
+ export declare function sumArray(array: number[] | readonly number[]): number;
@@ -1,20 +1,28 @@
1
- --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
1
  local ____lualib = require("lualib_bundle")
3
2
  local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
3
+ local Set = ____lualib.Set
4
+ local __TS__New = ____lualib.__TS__New
4
5
  local __TS__ArrayPush = ____lualib.__TS__ArrayPush
6
+ local __TS__ArrayIndexOf = ____lualib.__TS__ArrayIndexOf
5
7
  local __TS__ArraySplice = ____lualib.__TS__ArraySplice
8
+ local __TS__ArrayMap = ____lualib.__TS__ArrayMap
6
9
  local __TS__ArraySome = ____lualib.__TS__ArraySome
7
10
  local __TS__ArrayReduce = ____lualib.__TS__ArrayReduce
8
- local __TS__ArrayMap = ____lualib.__TS__ArrayMap
9
- local Set = ____lualib.Set
10
- local __TS__New = ____lualib.__TS__New
11
- local __TS__ArrayIndexOf = ____lualib.__TS__ArrayIndexOf
12
11
  local ____exports = {}
13
12
  local ____random = require("functions.random")
14
13
  local getRandomInt = ____random.getRandomInt
15
14
  local nextSeed = ____random.nextSeed
16
15
  local ____utils = require("functions.utils")
17
16
  local ____repeat = ____utils["repeat"]
17
+ function ____exports.getRandomArrayIndex(self, array, seed)
18
+ if seed == nil then
19
+ seed = Random()
20
+ end
21
+ if #array == 0 then
22
+ error("Failed to get a random array index since the provided array is empty.")
23
+ end
24
+ return getRandomInt(nil, 0, #array - 1, seed)
25
+ end
18
26
  function ____exports.shuffleArrayInPlace(self, array, seed)
19
27
  if seed == nil then
20
28
  seed = Random()
@@ -30,15 +38,6 @@ function ____exports.shuffleArrayInPlace(self, array, seed)
30
38
  array[randomIndex + 1] = ____temp_0[2]
31
39
  end
32
40
  end
33
- function ____exports.getRandomArrayIndex(self, array, seed)
34
- if seed == nil then
35
- seed = Random()
36
- end
37
- if #array == 0 then
38
- error("Failed to get a random array index since the provided array is empty.")
39
- end
40
- return getRandomInt(nil, 0, #array - 1, seed)
41
- end
42
41
  function ____exports.arrayEquals(self, array1, array2)
43
42
  if #array1 ~= #array2 then
44
43
  return false
@@ -51,6 +50,40 @@ function ____exports.arrayEquals(self, array1, array2)
51
50
  end
52
51
  )
53
52
  end
53
+ function ____exports.arrayRemove(self, originalArray, ...)
54
+ local elementsToRemove = {...}
55
+ local elementsToRemoveSet = __TS__New(Set, elementsToRemove)
56
+ local array = {}
57
+ for ____, element in ipairs(originalArray) do
58
+ if not elementsToRemoveSet:has(element) then
59
+ __TS__ArrayPush(array, element)
60
+ end
61
+ end
62
+ return array
63
+ end
64
+ function ____exports.arrayRemoveInPlace(self, array, ...)
65
+ local elementsToRemove = {...}
66
+ local removedOneOrMoreElements = false
67
+ for ____, element in ipairs(elementsToRemove) do
68
+ local index = __TS__ArrayIndexOf(array, element)
69
+ if index > -1 then
70
+ removedOneOrMoreElements = true
71
+ __TS__ArraySplice(array, index, 1)
72
+ end
73
+ end
74
+ return removedOneOrMoreElements
75
+ end
76
+ function ____exports.arrayToString(self, array)
77
+ if #array == 0 then
78
+ return "[]"
79
+ end
80
+ local strings = __TS__ArrayMap(
81
+ array,
82
+ function(____, element) return tostring(element) end
83
+ )
84
+ local commaSeparatedStrings = table.concat(strings, ", " or ",")
85
+ return ("[" .. commaSeparatedStrings) .. "]"
86
+ end
54
87
  function ____exports.combineArrays(self, ...)
55
88
  local arrays = {...}
56
89
  local elements = {}
@@ -82,72 +115,6 @@ end
82
115
  function ____exports.getLastElement(self, array)
83
116
  return array[#array]
84
117
  end
85
- function ____exports.initArray(self, defaultValue, size)
86
- local array = {}
87
- ____repeat(
88
- nil,
89
- size,
90
- function()
91
- __TS__ArrayPush(array, defaultValue)
92
- end
93
- )
94
- return array
95
- end
96
- function ____exports.isArrayInArray(self, arrayToMatch, parentArray)
97
- return __TS__ArraySome(
98
- parentArray,
99
- function(____, element) return ____exports.arrayEquals(nil, element, arrayToMatch) end
100
- )
101
- end
102
- function ____exports.shuffleArray(self, originalArray, seed)
103
- if seed == nil then
104
- seed = Random()
105
- end
106
- local array = ____exports.copyArray(nil, originalArray)
107
- ____exports.shuffleArrayInPlace(nil, array, seed)
108
- return array
109
- end
110
- function ____exports.sumArray(self, array)
111
- return __TS__ArrayReduce(
112
- array,
113
- function(____, accumulator, element) return accumulator + element end,
114
- 0
115
- )
116
- end
117
- function ____exports.arrayToString(self, array)
118
- if #array == 0 then
119
- return "[]"
120
- end
121
- local strings = __TS__ArrayMap(
122
- array,
123
- function(____, element) return tostring(element) end
124
- )
125
- local commaSeparatedStrings = table.concat(strings, ", " or ",")
126
- return ("[" .. commaSeparatedStrings) .. "]"
127
- end
128
- function ____exports.arrayRemove(self, originalArray, ...)
129
- local elementsToRemove = {...}
130
- local elementsToRemoveSet = __TS__New(Set, elementsToRemove)
131
- local array = {}
132
- for ____, element in ipairs(originalArray) do
133
- if not elementsToRemoveSet:has(element) then
134
- __TS__ArrayPush(array, element)
135
- end
136
- end
137
- return array
138
- end
139
- function ____exports.arrayRemoveInPlace(self, array, ...)
140
- local elementsToRemove = {...}
141
- local removedOneOrMoreElements = false
142
- for ____, element in ipairs(elementsToRemove) do
143
- local index = __TS__ArrayIndexOf(array, element)
144
- if index > -1 then
145
- removedOneOrMoreElements = true
146
- __TS__ArraySplice(array, index, 1)
147
- end
148
- end
149
- return removedOneOrMoreElements
150
- end
151
118
  function ____exports.getRandomArrayElement(self, array, seed, exceptions)
152
119
  if seed == nil then
153
120
  seed = Random()
@@ -177,6 +144,17 @@ function ____exports.getRandomArrayElementAndRemove(self, array, seed, exception
177
144
  ____exports.arrayRemoveInPlace(nil, array, randomArrayElement)
178
145
  return randomArrayElement
179
146
  end
147
+ function ____exports.initArray(self, defaultValue, size)
148
+ local array = {}
149
+ ____repeat(
150
+ nil,
151
+ size,
152
+ function()
153
+ __TS__ArrayPush(array, defaultValue)
154
+ end
155
+ )
156
+ return array
157
+ end
180
158
  function ____exports.isArray(self, thing)
181
159
  if type(thing) ~= "table" then
182
160
  return false
@@ -208,4 +186,25 @@ function ____exports.isArray(self, thing)
208
186
  end
209
187
  return true
210
188
  end
189
+ function ____exports.isArrayInArray(self, arrayToMatch, parentArray)
190
+ return __TS__ArraySome(
191
+ parentArray,
192
+ function(____, element) return ____exports.arrayEquals(nil, element, arrayToMatch) end
193
+ )
194
+ end
195
+ function ____exports.shuffleArray(self, originalArray, seed)
196
+ if seed == nil then
197
+ seed = Random()
198
+ end
199
+ local array = ____exports.copyArray(nil, originalArray)
200
+ ____exports.shuffleArrayInPlace(nil, array, seed)
201
+ return array
202
+ end
203
+ function ____exports.sumArray(self, array)
204
+ return __TS__ArrayReduce(
205
+ array,
206
+ function(____, accumulator, element) return accumulator + element end,
207
+ 0
208
+ )
209
+ end
211
210
  return ____exports
@@ -20,6 +20,7 @@ export declare function getCardDescription(card: Card | int): string;
20
20
  * ```
21
21
  */
22
22
  export declare function getCardName(card: Card | int): string;
23
+ export declare function getCardType(card: Card | int): CardType;
23
24
  /**
24
25
  * Helper function to get a set of cards matching the type. Also see the [[`CardType`]] enum.
25
26
  *
@@ -27,7 +28,6 @@ export declare function getCardName(card: Card | int): string;
27
28
  * containing cards that match any of the specified types.
28
29
  */
29
30
  export declare function getCardsOfType(...cardTypes: CardType[]): Set<Card>;
30
- export declare function getCardType(card: Card | int): CardType;
31
31
  /**
32
32
  * Helper function to get the final card sub-type in the game.
33
33
  *
@@ -75,8 +75,6 @@ export declare function isCardType(card: Card, cardType: CardType): boolean;
75
75
  export declare function isModdedCard(card: Card): boolean;
76
76
  /** Returns true for cards that have `CardType.OBJECT`. */
77
77
  export declare function isPocketItemObject(card: Card): boolean;
78
- /** Returns true for cards that have `CardType.TAROT`. */
79
- export declare function isTarotCard(card: Card): boolean;
80
78
  /** Returns true for cards that have `CardType.TAROT_REVERSE`. */
81
79
  export declare function isReverseTarotCard(card: Card): boolean;
82
80
  /** Returns true for cards that have `CardType.RUNE`. */
@@ -85,3 +83,5 @@ export declare function isRune(card: Card): boolean;
85
83
  export declare function isSpecialCard(card: Card): boolean;
86
84
  /** Returns true for cards that have `CardType.SUIT`. */
87
85
  export declare function isSuitCard(card: Card): boolean;
86
+ /** Returns true for cards that have `CardType.TAROT`. */
87
+ export declare function isTarotCard(card: Card): boolean;
@@ -1,4 +1,3 @@
1
- --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
1
  local ____lualib = require("lualib_bundle")
3
2
  local Map = ____lualib.Map
4
3
  local __TS__New = ____lualib.__TS__New
@@ -51,6 +50,10 @@ function initCardObjects(self)
51
50
  )
52
51
  addSetsToSet(nil, CARD_SET, cards)
53
52
  end
53
+ function ____exports.getCardType(self, card)
54
+ local cardType = CARD_TYPES[card]
55
+ return cardType == nil and DEFAULT_CARD_TYPE or cardType
56
+ end
54
57
  function ____exports.getCardsOfType(self, ...)
55
58
  local cardTypes = {...}
56
59
  if CARD_TYPE_TO_CARDS_MAP.size == 0 then
@@ -68,10 +71,6 @@ function ____exports.getCardsOfType(self, ...)
68
71
  end
69
72
  return matchingCards
70
73
  end
71
- function ____exports.getCardType(self, card)
72
- local cardType = CARD_TYPES[card]
73
- return cardType == nil and DEFAULT_CARD_TYPE or cardType
74
- end
75
74
  function ____exports.getMaxCards(self)
76
75
  return itemConfig:GetCards().Size - 1
77
76
  end
@@ -141,9 +140,6 @@ end
141
140
  function ____exports.isPocketItemObject(self, card)
142
141
  return ____exports.isCardType(nil, card, CardType.OBJECT)
143
142
  end
144
- function ____exports.isTarotCard(self, card)
145
- return ____exports.isCardType(nil, card, CardType.TAROT)
146
- end
147
143
  function ____exports.isReverseTarotCard(self, card)
148
144
  return ____exports.isCardType(nil, card, CardType.TAROT_REVERSE)
149
145
  end
@@ -156,4 +152,7 @@ end
156
152
  function ____exports.isSuitCard(self, card)
157
153
  return ____exports.isCardType(nil, card, CardType.SUIT)
158
154
  end
155
+ function ____exports.isTarotCard(self, card)
156
+ return ____exports.isCardType(nil, card, CardType.TAROT)
157
+ end
159
158
  return ____exports
@@ -1,20 +1,21 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  /**
3
- * Helper function to add a charge to every player's active item, emulating what happens when a room
4
- * is cleared.
3
+ * Helper function to add a charge to a player's active item, emulating what happens when a room is
4
+ * cleared.
5
5
  *
6
6
  * This function will take the following things into account:
7
7
  * - L rooms and 2x2 rooms granting a double charge
8
8
  * - The Battery
9
9
  * - AAA Battery
10
10
  *
11
+ * @param player The player to grant the charges to.
11
12
  * @param ignoreBigRoomDoubleCharge Optional. If set to true, it will treat the current room as a
12
13
  * 1x1 room for the purposes of calculating how much charge to grant. Default is false.
13
14
  */
14
- export declare function addRoomClearCharges(ignoreBigRoomDoubleCharge?: boolean): void;
15
+ export declare function addRoomClearCharge(player: EntityPlayer, ignoreBigRoomDoubleCharge?: boolean): void;
15
16
  /**
16
- * Helper function to add a charge to a player's active item, emulating what happens when a room is
17
- * cleared.
17
+ * Helper function to add a charge to one of a player's active items, emulating what happens when a
18
+ * room is cleared.
18
19
  *
19
20
  * This function will take the following things into account:
20
21
  * - L rooms and 2x2 rooms granting a double charge
@@ -22,25 +23,24 @@ export declare function addRoomClearCharges(ignoreBigRoomDoubleCharge?: boolean)
22
23
  * - AAA Battery
23
24
  *
24
25
  * @param player The player to grant the charges to.
26
+ * @param activeSlot The active item slot to grant the charges to.
25
27
  * @param ignoreBigRoomDoubleCharge Optional. If set to true, it will treat the current room as a
26
28
  * 1x1 room for the purposes of calculating how much charge to grant. Default is false.
27
29
  */
28
- export declare function addRoomClearCharge(player: EntityPlayer, ignoreBigRoomDoubleCharge?: boolean): void;
30
+ export declare function addRoomClearChargeToSlot(player: EntityPlayer, activeSlot: ActiveSlot, ignoreBigRoomDoubleCharge?: boolean): void;
29
31
  /**
30
- * Helper function to add a charge to one of a player's active items, emulating what happens when a
31
- * room is cleared.
32
+ * Helper function to add a charge to every player's active item, emulating what happens when a room
33
+ * is cleared.
32
34
  *
33
35
  * This function will take the following things into account:
34
36
  * - L rooms and 2x2 rooms granting a double charge
35
37
  * - The Battery
36
38
  * - AAA Battery
37
39
  *
38
- * @param player The player to grant the charges to.
39
- * @param activeSlot The active item slot to grant the charges to.
40
40
  * @param ignoreBigRoomDoubleCharge Optional. If set to true, it will treat the current room as a
41
41
  * 1x1 room for the purposes of calculating how much charge to grant. Default is false.
42
42
  */
43
- export declare function addRoomClearChargeToSlot(player: EntityPlayer, activeSlot: ActiveSlot, ignoreBigRoomDoubleCharge?: boolean): void;
43
+ export declare function addRoomClearCharges(ignoreBigRoomDoubleCharge?: boolean): void;
44
44
  /**
45
45
  * Helper function to get the combined normal charge and the battery charge for the player's active
46
46
  * item. This is useful because you have to add these two values together when setting the active
@@ -8,14 +8,6 @@ local ____collectibles = require("functions.collectibles")
8
8
  local getCollectibleMaxCharges = ____collectibles.getCollectibleMaxCharges
9
9
  local ____player = require("functions.player")
10
10
  local getPlayers = ____player.getPlayers
11
- function ____exports.addRoomClearCharge(self, player, ignoreBigRoomDoubleCharge)
12
- if ignoreBigRoomDoubleCharge == nil then
13
- ignoreBigRoomDoubleCharge = false
14
- end
15
- for ____, activeSlot in ipairs({ActiveSlot.SLOT_PRIMARY, ActiveSlot.SLOT_SECONDARY, ActiveSlot.SLOT_POCKET}) do
16
- ____exports.addRoomClearChargeToSlot(nil, player, activeSlot, ignoreBigRoomDoubleCharge)
17
- end
18
- end
19
11
  function ____exports.addRoomClearChargeToSlot(self, player, activeSlot, ignoreBigRoomDoubleCharge)
20
12
  if ignoreBigRoomDoubleCharge == nil then
21
13
  ignoreBigRoomDoubleCharge = false
@@ -60,11 +52,6 @@ function getNumChargesToAdd(self, player, activeSlot, ignoreBigRoomDoubleCharge)
60
52
  end
61
53
  return 1
62
54
  end
63
- function ____exports.getTotalCharge(self, player, activeSlot)
64
- local activeCharge = player:GetActiveCharge(activeSlot)
65
- local batteryCharge = player:GetBatteryCharge(activeSlot)
66
- return activeCharge + batteryCharge
67
- end
68
55
  function getNumChargesWithAAAModifier(self, player, activeSlot, chargesToAdd)
69
56
  local activeItem = player:GetActiveItem(activeSlot)
70
57
  local activeCharge = player:GetActiveCharge(activeSlot)
@@ -83,6 +70,11 @@ function getNumChargesWithAAAModifier(self, player, activeSlot, chargesToAdd)
83
70
  end
84
71
  return chargesToAdd
85
72
  end
73
+ function ____exports.getTotalCharge(self, player, activeSlot)
74
+ local activeCharge = player:GetActiveCharge(activeSlot)
75
+ local batteryCharge = player:GetBatteryCharge(activeSlot)
76
+ return activeCharge + batteryCharge
77
+ end
86
78
  function ____exports.playChargeSoundEffect(self, player, activeSlot)
87
79
  for ____, soundEffect in ipairs({SoundEffect.SOUND_BATTERYCHARGE, SoundEffect.SOUND_BEEP}) do
88
80
  sfxManager:Stop(soundEffect)
@@ -101,6 +93,14 @@ function shouldPlayFullRechargeSound(self, player, activeSlot)
101
93
  end
102
94
  return not player:NeedsCharge(activeSlot) or activeCharge == maxCharges and batteryCharge == 0
103
95
  end
96
+ function ____exports.addRoomClearCharge(self, player, ignoreBigRoomDoubleCharge)
97
+ if ignoreBigRoomDoubleCharge == nil then
98
+ ignoreBigRoomDoubleCharge = false
99
+ end
100
+ for ____, activeSlot in ipairs({ActiveSlot.SLOT_PRIMARY, ActiveSlot.SLOT_SECONDARY, ActiveSlot.SLOT_POCKET}) do
101
+ ____exports.addRoomClearChargeToSlot(nil, player, activeSlot, ignoreBigRoomDoubleCharge)
102
+ end
103
+ end
104
104
  function ____exports.addRoomClearCharges(self, ignoreBigRoomDoubleCharge)
105
105
  if ignoreBigRoomDoubleCharge == nil then
106
106
  ignoreBigRoomDoubleCharge = false
@@ -1,4 +1,3 @@
1
- --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
1
  local ____lualib = require("lualib_bundle")
3
2
  local Map = ____lualib.Map
4
3
  local __TS__New = ____lualib.__TS__New
@@ -1,4 +1,3 @@
1
- --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
1
  local ____lualib = require("lualib_bundle")
3
2
  local Set = ____lualib.Set
4
3
  local __TS__New = ____lualib.__TS__New