isaacscript-common 2.0.10 → 2.0.13

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 (63) hide show
  1. package/dist/classes/DefaultMap.d.ts +2 -1
  2. package/dist/enums/ModCallbackCustom.d.ts +0 -3
  3. package/dist/features/deployJSONRoom.d.ts +16 -9
  4. package/dist/features/deployJSONRoom.lua +2 -2
  5. package/dist/features/disableInputs.d.ts +6 -6
  6. package/dist/features/disableSound.d.ts +2 -2
  7. package/dist/features/extraConsoleCommands/commands.d.ts +10 -9
  8. package/dist/features/runInNFrames.d.ts +2 -1
  9. package/dist/features/saveDataManager/exports.d.ts +8 -6
  10. package/dist/features/sirenHelpers.d.ts +1 -1
  11. package/dist/functions/array.d.ts +10 -9
  12. package/dist/functions/array.lua +1 -2
  13. package/dist/functions/benchmark.d.ts +1 -1
  14. package/dist/functions/cards.d.ts +7 -5
  15. package/dist/functions/cards.lua +2 -2
  16. package/dist/functions/charge.d.ts +6 -3
  17. package/dist/functions/collectibleCacheFlag.lua +1 -2
  18. package/dist/functions/collectibleSet.lua +2 -2
  19. package/dist/functions/collectibleTag.lua +2 -2
  20. package/dist/functions/collectibles.d.ts +9 -6
  21. package/dist/functions/color.d.ts +1 -1
  22. package/dist/functions/deepCopy.d.ts +2 -1
  23. package/dist/functions/entity.d.ts +9 -6
  24. package/dist/functions/entity.lua +1 -1
  25. package/dist/functions/entitySpecific.d.ts +20 -11
  26. package/dist/functions/enums.d.ts +11 -1
  27. package/dist/functions/enums.lua +14 -0
  28. package/dist/functions/familiars.d.ts +5 -5
  29. package/dist/functions/flag.d.ts +6 -2
  30. package/dist/functions/flying.d.ts +1 -1
  31. package/dist/functions/gridEntity.d.ts +13 -8
  32. package/dist/functions/gridEntity.lua +2 -1
  33. package/dist/functions/input.lua +2 -2
  34. package/dist/functions/kColor.d.ts +1 -1
  35. package/dist/functions/map.d.ts +2 -1
  36. package/dist/functions/math.d.ts +5 -16
  37. package/dist/functions/math.lua +5 -29
  38. package/dist/functions/npc.d.ts +2 -2
  39. package/dist/functions/pickups.d.ts +2 -2
  40. package/dist/functions/pills.d.ts +2 -1
  41. package/dist/functions/player.d.ts +2 -2
  42. package/dist/functions/playerIndex.d.ts +2 -1
  43. package/dist/functions/positionVelocity.d.ts +9 -5
  44. package/dist/functions/random.d.ts +7 -5
  45. package/dist/functions/rng.d.ts +1 -1
  46. package/dist/functions/rooms.d.ts +5 -4
  47. package/dist/functions/rooms.lua +2 -2
  48. package/dist/functions/set.d.ts +1 -1
  49. package/dist/functions/spawnCollectible.d.ts +4 -4
  50. package/dist/functions/sprite.lua +2 -2
  51. package/dist/functions/transformations.d.ts +2 -1
  52. package/dist/functions/trinketCacheFlag.lua +2 -2
  53. package/dist/functions/trinketGive.d.ts +1 -1
  54. package/dist/functions/trinketSet.lua +2 -2
  55. package/dist/functions/trinkets.d.ts +7 -4
  56. package/dist/functions/ui.d.ts +2 -2
  57. package/dist/functions/utils.d.ts +22 -2
  58. package/dist/functions/utils.lua +30 -0
  59. package/dist/functions/vector.d.ts +1 -1
  60. package/dist/types/CollectibleIndex.d.ts +2 -1
  61. package/dist/types/PlayerIndex.d.ts +2 -1
  62. package/dist/upgradeMod.d.ts +2 -4
  63. package/package.json +4 -3
@@ -3,7 +3,8 @@ import { EntityTypeNonNPC } from "../types/EntityTypeNonNPC";
3
3
  /**
4
4
  * Helper function to get all of the `EntityType.BOMB` in the room.
5
5
  *
6
- * Example:
6
+ * For example:
7
+ *
7
8
  * ```ts
8
9
  * // Make all of the bombs in the room invisible
9
10
  * for (const bomb of getBombs()) {
@@ -15,7 +16,8 @@ export declare function getBombs(bombVariant?: BombVariant | int, subType?: numb
15
16
  /**
16
17
  * Helper function to get all of the `EntityType.EFFECT` in the room.
17
18
  *
18
- * Example:
19
+ * For example:
20
+ *
19
21
  * ```ts
20
22
  * // Make all of the effects in the room invisible
21
23
  * for (const effect of getEffects()) {
@@ -27,7 +29,8 @@ export declare function getEffects(effectVariant?: EffectVariant | int, subType?
27
29
  /**
28
30
  * Helper function to get all of the familiars in the room.
29
31
  *
30
- * Example:
32
+ * For example:
33
+ *
31
34
  * ```ts
32
35
  * // Make all of the familiars in the room invisible
33
36
  * for (const familiar of getFamiliars()) {
@@ -39,7 +42,8 @@ export declare function getFamiliars(familiarVariant?: FamiliarVariant | int, su
39
42
  /**
40
43
  * Helper function to get all of the `EntityType.KNIFE` in the room.
41
44
  *
42
- * Example:
45
+ * For example:
46
+ *
43
47
  * ```ts
44
48
  * // Make all of the knives in the room invisible
45
49
  * for (const knife of getKnives()) {
@@ -51,7 +55,8 @@ export declare function getKnives(knifeVariant?: KnifeVariant | int, subType?: n
51
55
  /**
52
56
  * Helper function to get all of the `EntityType.LASER` in the room.
53
57
  *
54
- * Example:
58
+ * For example:
59
+ *
55
60
  * ```ts
56
61
  * // Make all of the lasers in the room invisible
57
62
  * for (const laser of getLasers()) {
@@ -65,7 +70,8 @@ export declare function getNPCs(entityType?: EntityType | int, variant?: int, su
65
70
  /**
66
71
  * Helper function to get all of the pickups in the room.
67
72
  *
68
- * Example:
73
+ * For example:
74
+ *
69
75
  * ```ts
70
76
  * // Make all of the pickups in the room invisible
71
77
  * for (const pickup of getPickups()) {
@@ -77,7 +83,8 @@ export declare function getPickups(pickupVariant?: PickupVariant | int, subType?
77
83
  /**
78
84
  * Helper function to get all of the `EntityType.PROJECTILE` in the room.
79
85
  *
80
- * Example:
86
+ * For example:
87
+ *
81
88
  * ```ts
82
89
  * // Make all of the projectiles in the room invisible
83
90
  * for (const projectile of getProjectiles()) {
@@ -89,7 +96,8 @@ export declare function getProjectiles(projectileVariant?: ProjectileVariant | i
89
96
  /**
90
97
  * Helper function to get all of the `EntityType.SLOT` in the room.
91
98
  *
92
- * Example:
99
+ * For example:
100
+ *
93
101
  * ```ts
94
102
  * // Make all of the slots in the room invisible
95
103
  * for (const slot of getSlots()) {
@@ -101,7 +109,8 @@ export declare function getSlots(slotVariant?: SlotVariant | int, subType?: numb
101
109
  /**
102
110
  * Helper function to get all of the `EntityType.TEAR` in the room.
103
111
  *
104
- * Example:
112
+ * For example:
113
+ *
105
114
  * ```ts
106
115
  * // Make all of the tears in the room invisible
107
116
  * for (const tear of getTears()) {
@@ -132,7 +141,7 @@ export declare function removeAllEffects(effectVariant?: EffectVariant | int, su
132
141
  * Helper function to remove all of the familiars in the room.
133
142
  *
134
143
  * @param familiarVariant Optional. If specified, will only remove familiars that match this
135
- * variant.
144
+ * variant.
136
145
  * @param subType Optional. If specified, will only remove familiars that match this sub-type.
137
146
  * @param cap Optional. If specified, will only remove the given amount of familiars.
138
147
  * @returns True if one or more familiars were removed, false otherwise.
@@ -176,7 +185,7 @@ export declare function removeAllPickups(pickupVariant?: PickupVariant | int, su
176
185
  * Helper function to remove all of the `EntityType.PROJECTILE` in the room.
177
186
  *
178
187
  * @param projectileVariant Optional. If specified, will only remove projectiles that match this
179
- * variant.
188
+ * variant.
180
189
  * @param subType Optional. If specified, will only remove projectiles that match this sub-type.
181
190
  * @param cap Optional. If specified, will only remove the given amount of projectiles.
182
191
  * @returns True if one or more projectiles were removed, false otherwise.
@@ -54,11 +54,21 @@ export declare function getEnumLength<T>(transpiledEnum: T): int;
54
54
  */
55
55
  export declare function getEnumValues<T>(transpiledEnum: T): Array<T[keyof T]>;
56
56
  export declare function getLastEnumValue<T>(transpiledEnum: T): T[keyof T];
57
+ /**
58
+ * Helper function to get a random value from the provided enum.
59
+ *
60
+ * @param transpiledEnum The enum to get the value from.
61
+ * @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
62
+ * `RNG.Next` method will be called. Default is `getRandomSeed()`.
63
+ * @param exceptions Optional. An array of elements to skip over if selected.
64
+ */
65
+ export declare function getRandomEnumValue<T>(transpiledEnum: T, seedOrRNG?: Seed | RNG, exceptions?: Array<T[keyof T]> | ReadonlyArray<T[keyof T]>): T[keyof T];
57
66
  /**
58
67
  * Helper function to check every value of a custom enum for -1. This is helpful as a run-time check
59
68
  * because many methods of the Isaac class return -1 if they fail.
60
69
  *
61
- * Example:
70
+ * For example:
71
+ *
62
72
  * ```ts
63
73
  * enum EntityTypeCustom {
64
74
  * FOO = Isaac.GetEntityTypeByName("Foo"),
@@ -2,6 +2,10 @@ local ____lualib = require("lualib_bundle")
2
2
  local __TS__ArraySort = ____lualib.__TS__ArraySort
3
3
  local __TS__ArrayMap = ____lualib.__TS__ArrayMap
4
4
  local ____exports = {}
5
+ local ____array = require("functions.array")
6
+ local getRandomArrayElement = ____array.getRandomArrayElement
7
+ local ____rng = require("functions.rng")
8
+ local getRandomSeed = ____rng.getRandomSeed
5
9
  function ____exports.getEnumEntries(self, transpiledEnum)
6
10
  local enumEntries = {}
7
11
  for key, value in pairs(transpiledEnum) do
@@ -59,6 +63,16 @@ function ____exports.getLastEnumValue(self, transpiledEnum)
59
63
  end
60
64
  return lastElement
61
65
  end
66
+ function ____exports.getRandomEnumValue(self, transpiledEnum, seedOrRNG, exceptions)
67
+ if seedOrRNG == nil then
68
+ seedOrRNG = getRandomSeed(nil)
69
+ end
70
+ if exceptions == nil then
71
+ exceptions = {}
72
+ end
73
+ local enumValues = ____exports.getEnumValues(nil, transpiledEnum)
74
+ return getRandomArrayElement(nil, enumValues, seedOrRNG, exceptions)
75
+ end
62
76
  function ____exports.validateCustomEnum(self, transpiledEnumName, transpiledEnum)
63
77
  for ____, ____value in ipairs(____exports.getEnumEntries(nil, transpiledEnum)) do
64
78
  local key = ____value[1]
@@ -22,11 +22,11 @@
22
22
  * @param player The player that owns the familiars.
23
23
  * @param collectibleType The collectible type of the collectible associated with this familiar.
24
24
  * @param targetCount The number of familiars that should exist. This function will add or remove
25
- * familiars until it matches the target count.
25
+ * familiars until it matches the target count.
26
26
  * @param familiarVariant The variant of the familiar to spawn or remove.
27
27
  * @param familiarSubType Optional. The sub-type of the familiar to spawn or remove. If not
28
- * specified, it will search for existing familiars of all sub-types, and spawn new familiars with a
29
- * sub-type of 0.
28
+ * specified, it will search for existing familiars of all sub-types, and
29
+ * spawn new familiars with a sub-type of 0.
30
30
  */
31
31
  export declare function checkFamiliar(player: EntityPlayer, collectibleType: int, targetCount: int, familiarVariant: int, familiarSubType?: int): void;
32
32
  /**
@@ -53,8 +53,8 @@ export declare function checkFamiliar(player: EntityPlayer, collectibleType: int
53
53
  * @param collectibleType The collectible type of the collectible associated with this familiar.
54
54
  * @param familiarVariant The variant of the familiar to spawn or remove.
55
55
  * @param familiarSubType Optional. The sub-type of the familiar to spawn or remove. If not
56
- * specified, it will search for existing familiars of all sub-types, and spawn new familiars with a
57
- * sub-type of 0.
56
+ * specified, it will search for existing familiars of all sub-types, and
57
+ * spawn new familiars with a sub-type of 0.
58
58
  */
59
59
  export declare function checkFamiliarFromCollectibles(player: EntityPlayer, collectibleType: int, familiarVariant: int, familiarSubType?: int): void;
60
60
  export declare function isFamiliarThatShootsPlayerTears(familiar: EntityFamiliar): boolean;
@@ -5,6 +5,7 @@ import { DamageFlag } from "isaac-typescript-definitions";
5
5
  * This is a variadic function, so pass as many flags as you want to add.
6
6
  *
7
7
  * Example 1:
8
+ *
8
9
  * ```ts
9
10
  * // Give the player spectral tears
10
11
  * const player = Isaac.GetPlayer();
@@ -12,6 +13,7 @@ import { DamageFlag } from "isaac-typescript-definitions";
12
13
  * ```
13
14
  *
14
15
  * Example 2:
16
+ *
15
17
  * ```ts
16
18
  * // Give the player spectral and homing tears
17
19
  * const player = Isaac.GetPlayer();
@@ -51,7 +53,8 @@ export declare function getFlagName<T extends BitFlag | BitFlag128>(flag: BitFla
51
53
  * This is a variadic function, so pass as many flags as you want to check for. If passed multiple
52
54
  * flags, it will only return true if all of the flags are set.
53
55
  *
54
- * Example:
56
+ * For example:
57
+ *
55
58
  * ```ts
56
59
  * const player = Isaac.GetPlayer();
57
60
  * if (hasFlag(player.TearFlags, TearFlags.TEAR_SPECTRAL) {
@@ -81,7 +84,8 @@ export declare function isSelfDamage(damageFlags: DamageFlag | BitFlags<DamageFl
81
84
  *
82
85
  * This is a variadic function, so pass as many flags as you want to remove.
83
86
  *
84
- * Example:
87
+ * For example:
88
+ *
85
89
  * ```ts
86
90
  * // Remove spectral tears from the player, if present
87
91
  * const player = Isaac.GetPlayer();
@@ -7,7 +7,7 @@ import { CollectibleType } from "isaac-typescript-definitions";
7
7
  * Vessel should be checked for via the `hasFlyingTemporaryEffect` function.
8
8
  *
9
9
  * @param pruneConditionalItems Whether or not collectibles that only grant flight conditionally
10
- * should be included in the set (like Empty Vessel).
10
+ * should be included in the set (like Empty Vessel).
11
11
  */
12
12
  export declare function getFlyingCollectibles(pruneConditionalItems: boolean): Set<CollectibleType | int>;
13
13
  /**
@@ -19,14 +19,16 @@ export declare function getCollidingEntitiesWithGridEntity(gridEntity: GridEntit
19
19
  * Use this function with no arguments to get every grid entity, or specify a variadic amount of
20
20
  * arguments to match specific grid entity types.
21
21
  *
22
- * Example:
22
+ * For example:
23
+ *
23
24
  * ```ts
24
25
  * for (const gridEntity of getGridEntities()) {
25
26
  * print(gridEntity.GetType())
26
27
  * }
27
28
  * ```
28
29
  *
29
- * Example:
30
+ * For example:
31
+ *
30
32
  * ```ts
31
33
  * const rocks = getGridEntities(
32
34
  * GridEntityType.ROCK,
@@ -77,7 +79,8 @@ export declare function isPostBossVoidPortal(gridEntity: GridEntity): boolean;
77
79
  * Helper function to all grid entities in the room except for ones matching the grid entity types
78
80
  * provided.
79
81
  *
80
- * Example:
82
+ * For example:
83
+ *
81
84
  * ```ts
82
85
  * removeAllGridEntitiesExceptFor(
83
86
  * GridEntityType.WALL,
@@ -92,7 +95,8 @@ export declare function removeAllGridExcept(...gridEntityTypes: GridEntityType[]
92
95
  * Helper function to remove all of the grid entities in the room that match the grid entity types
93
96
  * provided.
94
97
  *
95
- * Example:
98
+ * For example:
99
+ *
96
100
  * ```ts
97
101
  * removeAllMatchingGridEntities(
98
102
  * GridEntityType.ROCK,
@@ -109,10 +113,11 @@ export declare function removeAllMatchingGridEntities(...gridEntityType: GridEnt
109
113
  *
110
114
  * @param gridEntity The grid entity to remove.
111
115
  * @param updateRoom Optional. Whether or not to update the room after the grid entity is removed.
112
- * Default is true. This is generally a good idea because if the room is not updated, you will be
113
- * unable to spawn another grid entity on the same tile until a frame has passed. However, doing
114
- * this is expensive, since it involves a call to `Isaac.GetRoomEntities`, so set it to false if you
115
- * need to invoke this function multiple times.
116
+ * Default is true. This is generally a good idea because if the room is not
117
+ * updated, you will be unable to spawn another grid entity on the same tile until
118
+ * a frame has passed. However, doing this is expensive, since it involves a call
119
+ * to `Isaac.GetRoomEntities`, so set it to false if you need to invoke this
120
+ * function multiple times.
116
121
  */
117
122
  export declare function removeGrid(gridEntity: GridEntity, updateRoom?: boolean): void;
118
123
  /**
@@ -26,12 +26,13 @@ local ____roomShapeToTopLeftWallGridIndexMap = require("maps.roomShapeToTopLeftW
26
26
  local DEFAULT_TOP_LEFT_WALL_GRID_INDEX = ____roomShapeToTopLeftWallGridIndexMap.DEFAULT_TOP_LEFT_WALL_GRID_INDEX
27
27
  local ROOM_SHAPE_TO_TOP_LEFT_WALL_GRID_INDEX_MAP = ____roomShapeToTopLeftWallGridIndexMap.ROOM_SHAPE_TO_TOP_LEFT_WALL_GRID_INDEX_MAP
28
28
  local ____math = require("functions.math")
29
- local erange = ____math.erange
30
29
  local isCircleIntersectingRectangle = ____math.isCircleIntersectingRectangle
31
30
  local ____rooms = require("functions.rooms")
32
31
  local roomUpdateSafe = ____rooms.roomUpdateSafe
33
32
  local ____sprite = require("functions.sprite")
34
33
  local clearSprite = ____sprite.clearSprite
34
+ local ____utils = require("functions.utils")
35
+ local erange = ____utils.erange
35
36
  local ____vector = require("functions.vector")
36
37
  local isVector = ____vector.isVector
37
38
  function getAllGridEntities(self)
@@ -10,12 +10,12 @@ local ControllerIndex = ____isaac_2Dtypescript_2Ddefinitions.ControllerIndex
10
10
  local Keyboard = ____isaac_2Dtypescript_2Ddefinitions.Keyboard
11
11
  local ____constants = require("constants")
12
12
  local MAX_NUM_INPUTS = ____constants.MAX_NUM_INPUTS
13
- local ____math = require("functions.math")
14
- local erange = ____math.erange
15
13
  local ____set = require("functions.set")
16
14
  local copySet = ____set.copySet
17
15
  local ____string = require("functions.string")
18
16
  local trimPrefix = ____string.trimPrefix
17
+ local ____utils = require("functions.utils")
18
+ local erange = ____utils.erange
19
19
  local MODIFIER_KEYS = {
20
20
  Keyboard.LEFT_SHIFT,
21
21
  Keyboard.LEFT_CONTROL,
@@ -13,7 +13,7 @@ interface CopyKColorReturn {
13
13
  * Helper function to copy a `KColor` object.
14
14
  *
15
15
  * @param kColor The KColor object to copy. In the case of deserialization, this will actually be a
16
- * Lua table instead of an instantiated KColor class.
16
+ * Lua table instead of an instantiated KColor class.
17
17
  * @param serializationType Default is `SerializationType.NONE`.
18
18
  */
19
19
  export declare function copyKColor<K extends KColor | SerializedKColor, S extends SerializationType>(kColor: K, serializationType: S): CopyKColorReturn[S];
@@ -5,7 +5,8 @@ export declare function copyMap<K, V>(oldMap: Map<K, V>): Map<K, V>;
5
5
  * purposes of this function, both search text and map keys are converted to lowercase before
6
6
  * attempting to find a match.
7
7
  *
8
- * Example:
8
+ * For example:
9
+ *
9
10
  * ```ts
10
11
  * const map = new <string, number>Map([
11
12
  * ["foo", 123],
@@ -1,13 +1,11 @@
1
1
  import { Direction } from "isaac-typescript-definitions";
2
2
  /**
3
- * Helper function to return an array with the elements from start to end. It is inclusive at the
4
- * start and exclusive at the end. (The "e" stands for exclusive.)
3
+ * Helper function to normalize an integer.
5
4
  *
6
- * For example, `erange(1, 3)` will return `[1, 2]`.
7
- *
8
- * If only one argument is specified, then it will assume that the start is 0.
5
+ * - If `x` is less than `min`, then it will be clamped to `min`.
6
+ * - If `x` is greater than `max`, then it will be clamped to `max`.
9
7
  */
10
- export declare function erange(start: int, end?: int): int[];
8
+ export declare function clamp(x: int, min: int, max: int): int;
11
9
  export declare function getAngleDifference(angle1: float, angle2: float): float;
12
10
  /**
13
11
  * Helper function to get an array of equidistant points on the circumference around a circle.
@@ -19,7 +17,7 @@ export declare function getAngleDifference(angle1: float, angle2: float): float;
19
17
  * @param xMultiplier An optional multiplier to get the points around an oval. Default is 1.
20
18
  * @param yMultiplier An optional multiplier to get the points around an oval. Default is 1.
21
19
  * @param initialDirection By default, the first point on the circle will be on the top center, but
22
- * this can be optionally changed by specifying this argument.
20
+ * this can be optionally changed by specifying this argument.
23
21
  */
24
22
  export declare function getCircleDiscretizedPoints(centerPos: Vector, radius: float, numPoints: int, xMultiplier?: number, yMultiplier?: number, initialDirection?: Direction): Vector[];
25
23
  /**
@@ -29,15 +27,6 @@ export declare function getCircleDiscretizedPoints(centerPos: Vector, radius: fl
29
27
  * the rectangle.
30
28
  */
31
29
  export declare function inRectangle(position: Vector, topLeft: Vector, bottomRight: Vector): boolean;
32
- /**
33
- * Helper function to return an array with the elements from start to end, inclusive. (The "i"
34
- * stands for inclusive.)
35
- *
36
- * For example, `irange(1, 3)` will return `[1, 2, 3]`.
37
- *
38
- * If only one argument is specified, then it will assume that the start is 0.
39
- */
40
- export declare function irange(start: int, end?: int): int[];
41
30
  /**
42
31
  * From: https://www.geeksforgeeks.org/check-if-any-point-overlaps-the-given-circle-and-rectangle/
43
32
  */
@@ -3,20 +3,11 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitio
3
3
  local Direction = ____isaac_2Dtypescript_2Ddefinitions.Direction
4
4
  local ____direction = require("functions.direction")
5
5
  local directionToVector = ____direction.directionToVector
6
- function ____exports.erange(self, start, ____end)
7
- if ____end == nil then
8
- ____end = start
9
- start = 0
10
- end
11
- local array = {}
12
- do
13
- local i = start
14
- while i < ____end do
15
- array[#array + 1] = i
16
- i = i + 1
17
- end
18
- end
19
- return array
6
+ function ____exports.clamp(self, x, min, max)
7
+ return math.max(
8
+ min,
9
+ math.min(x, max)
10
+ )
20
11
  end
21
12
  function ____exports.getAngleDifference(self, angle1, angle2)
22
13
  local subtractedAngle = angle1 - angle2
@@ -51,21 +42,6 @@ end
51
42
  function ____exports.inRectangle(self, position, topLeft, bottomRight)
52
43
  return position.X >= topLeft.X and position.X <= bottomRight.X and position.Y >= topLeft.Y and position.Y <= bottomRight.Y
53
44
  end
54
- function ____exports.irange(self, start, ____end)
55
- if ____end == nil then
56
- ____end = start
57
- start = 0
58
- end
59
- local array = {}
60
- do
61
- local i = start
62
- while i <= ____end do
63
- array[#array + 1] = i
64
- i = i + 1
65
- end
66
- end
67
- return array
68
- end
69
45
  function ____exports.isCircleIntersectingRectangle(self, circleCenter, circleRadius, rectangleTopLeft, rectangleBottomRight)
70
46
  local nearestX = math.max(
71
47
  rectangleTopLeft.X,
@@ -7,9 +7,9 @@ import { EntityType, ProjectilesMode } from "isaac-typescript-definitions";
7
7
  * @param position The staring position of the projectile.
8
8
  * @param velocity The starting velocity of the projectile.
9
9
  * @param projectilesMode The mode of the projectile. Optional. Default is
10
- * `ProjectilesMode.ONE_PROJECTILE`.
10
+ * `ProjectilesMode.ONE_PROJECTILE`.
11
11
  * @param projectileParams The parameters of the projectile. Optional. Default is
12
- * `ProjectileParams()`.
12
+ * `ProjectileParams()`.
13
13
  * @returns The fired projectile.
14
14
  */
15
15
  export declare function fireProjectiles(npc: EntityNPC, position: Vector, velocity: Vector, projectilesMode?: ProjectilesMode, projectileParams?: ProjectileParams): EntityProjectile[];
@@ -54,7 +54,7 @@ export declare function removeAllCoins(coinSubType?: CoinSubType | int, cap?: in
54
54
  * Helper function to remove all of the collectibles in the room.
55
55
  *
56
56
  * @param collectibleType Optional. If specified, will only remove collectibles that match this
57
- * collectible type.
57
+ * collectible type.
58
58
  * @param cap Optional. If specified, will only remove the given amount of collectibles.
59
59
  * @returns True if one or more collectibles were removed, false otherwise.
60
60
  */
@@ -95,7 +95,7 @@ export declare function removeAllSacks(sackSubType?: SackSubType | int, cap?: in
95
95
  * Helper function to remove all of the trinkets in the room.
96
96
  *
97
97
  * @param trinketType Optional. If specified, will only remove trinkets that match this trinket
98
- * type.
98
+ * type.
99
99
  * @param cap Optional. If specified, will only remove the given amount of trinkets.
100
100
  * @returns True if one or more trinkets were removed, false otherwise.
101
101
  */
@@ -27,7 +27,8 @@ export declare function getPillEffectClass(pillEffect: PillEffect | int): ItemCo
27
27
  /**
28
28
  * Helper function to get a pill effect name from a PillEffect enum value.
29
29
  *
30
- * Example:
30
+ * For example:
31
+ *
31
32
  * ```ts
32
33
  * const pillEffect = PillEffect.BAD_GAS;
33
34
  * const pillEffectName = getPillEffectName(pillEffect); // trinketName is "Bad Gas"
@@ -28,7 +28,7 @@ export declare function anyPlayerHasTrinket(trinketType: TrinketType | int): boo
28
28
  */
29
29
  export declare function anyPlayerIs(...matchingCharacters: Array<PlayerType | int>): boolean;
30
30
  /**
31
- * Helper function to determine if a player will destroy a rock/pot/skull/etc. if they walk over it.
31
+ * Helper function to determine if a player will destroy a rock/pot/skull if they walk over it.
32
32
  *
33
33
  * The following situations allow for this to be true:
34
34
  * - the player has Leo (collectible 302)
@@ -268,7 +268,7 @@ export declare function removeTrinketCostume(player: EntityPlayer, trinketType:
268
268
  * @param collectibleType The collectible type of the item to give.
269
269
  * @param activeSlot The slot to set.
270
270
  * @param charge Optional. The argument of charges to set. If not specified, the item will be set
271
- * with maximum charges.
271
+ * with maximum charges.
272
272
  * @param keepInPools Optional. Whether or not to remove the item from pools. Default is false.
273
273
  */
274
274
  export declare function setActiveItem(player: EntityPlayer, collectibleType: CollectibleType, activeSlot: ActiveSlot, charge?: int, keepInPools?: boolean): void;
@@ -51,7 +51,8 @@ export declare function getPlayerIndexVanilla(playerToFind: EntityPlayer): int |
51
51
  * If this is not desired, use the `getAllPlayers` helper function instead.
52
52
  *
53
53
  * @param performCharacterExclusions Whether or not to exclude characters that are not directly
54
- * controlled by the player (i.e. Esau & Tainted Soul). Default is false.
54
+ * controlled by the player (i.e. Esau & Tainted Soul). Default is
55
+ * false.
55
56
  */
56
57
  export declare function getPlayers(performCharacterExclusions?: boolean): EntityPlayer[];
57
58
  /**
@@ -10,7 +10,7 @@ export declare function anyPlayerCloserThan(position: Vector, distance: float):
10
10
  * specific situations.
11
11
  *
12
12
  * @param startingPosition The position to start searching from. If this position is not overlapping
13
- * with anything, then it will be returned.
13
+ * with anything, then it will be returned.
14
14
  * @param avoidActiveEntities Optional. Default is false.
15
15
  */
16
16
  export declare function findFreePosition(startingPosition: Vector, avoidActiveEntities?: boolean): Vector;
@@ -20,7 +20,8 @@ export declare function findFreePosition(startingPosition: Vector, avoidActiveEn
20
20
  * This is useful for rewinding entity positions at a later time. Also see `setEntityPositions`.
21
21
  *
22
22
  * @param entities Optional. If provided, will only get the positions of the provided entities. Use
23
- * this with cached entities to avoid invoking the `Isaac.GetRoomEntities` method multiple times.
23
+ * this with cached entities to avoid invoking the `Isaac.GetRoomEntities` method
24
+ * multiple times.
24
25
  */
25
26
  export declare function getEntityPositions(entities?: Entity[]): Map<PtrHash, Vector>;
26
27
  /**
@@ -29,7 +30,8 @@ export declare function getEntityPositions(entities?: Entity[]): Map<PtrHash, Ve
29
30
  * This is useful for rewinding entity velocities at a later time. Also see `setEntityVelocities`.
30
31
  *
31
32
  * @param entities Optional. If provided, will only get the velocities of the provided entities. Use
32
- * this with cached entities to avoid invoking the `Isaac.GetRoomEntities` method multiple times.
33
+ * this with cached entities to avoid invoking the `Isaac.GetRoomEntities` method
34
+ * multiple times.
33
35
  */
34
36
  export declare function getEntityVelocities(entities?: Entity[]): Map<PtrHash, Vector>;
35
37
  /**
@@ -42,7 +44,8 @@ export declare function getEntityVelocities(entities?: Entity[]): Map<PtrHash, V
42
44
  *
43
45
  * @param entityPositions The map providing the positions for every entity.
44
46
  * @param entities Optional. If provided, will only set the positions of the provided entities. Use
45
- * this with cached entities to avoid invoking the `Isaac.GetRoomEntities` method multiple times.
47
+ * this with cached entities to avoid invoking the `Isaac.GetRoomEntities` method
48
+ * multiple times.
46
49
  */
47
50
  export declare function setEntityPositions(entityPositions: Map<PtrHash, Vector>, entities?: Entity[]): void;
48
51
  /**
@@ -55,6 +58,7 @@ export declare function setEntityPositions(entityPositions: Map<PtrHash, Vector>
55
58
  *
56
59
  * @param entityVelocities The map providing the velocities for every entity.
57
60
  * @param entities Optional. If provided, will only set the velocities of the provided entities. Use
58
- * this with cached entities to avoid invoking the `Isaac.GetRoomEntities` method multiple times.
61
+ * this with cached entities to avoid invoking the `Isaac.GetRoomEntities` method
62
+ * multiple times.
59
63
  */
60
64
  export declare function setEntityVelocities(entityVelocities: Map<PtrHash, Vector>, entities?: Entity[]): void;
@@ -4,13 +4,14 @@
4
4
  * high end. (This is because the `RNG.RandomFloat` method will never return a value of exactly 1.)
5
5
  *
6
6
  * @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
7
- * `RNG.Next` method will be called. Default is `getRandomSeed()`.
7
+ * `RNG.Next` method will be called. Default is `getRandomSeed()`.
8
8
  */
9
9
  export declare function getRandom(seedOrRNG?: Seed | RNG): float;
10
10
  /**
11
11
  * This returns a random float between min and max.
12
12
  *
13
- * Example:
13
+ * For example:
14
+ *
14
15
  * ```ts
15
16
  * const realNumberBetweenOneAndThree = getRandomFloat(1, 3);
16
17
  * ```
@@ -18,7 +19,7 @@ export declare function getRandom(seedOrRNG?: Seed | RNG): float;
18
19
  * @param min The lower bound for the random number (inclusive).
19
20
  * @param max The upper bound for the random number (exclusive).
20
21
  * @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
21
- * `RNG.Next` method will be called. Default is `getRandomSeed()`.
22
+ * `RNG.Next` method will be called. Default is `getRandomSeed()`.
22
23
  */
23
24
  export declare function getRandomFloat(min: int, max: int, seedOrRNG?: Seed | RNG): float;
24
25
  /**
@@ -27,7 +28,8 @@ export declare function getRandomFloat(min: int, max: int, seedOrRNG?: Seed | RN
27
28
  * Note that this function will invoke the `Next` method on the `RNG` object before returning the
28
29
  * random number.
29
30
  *
30
- * Example:
31
+ * For example:
32
+ *
31
33
  * ```ts
32
34
  * const oneTwoOrThree = getRandomInt(1, 3);
33
35
  * ```
@@ -35,6 +37,6 @@ export declare function getRandomFloat(min: int, max: int, seedOrRNG?: Seed | RN
35
37
  * @param min The lower bound for the random number (inclusive).
36
38
  * @param max The upper bound for the random number (inclusive).
37
39
  * @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
38
- * `RNG.Next` method will be called. Default is `getRandomSeed()`.
40
+ * `RNG.Next` method will be called. Default is `getRandomSeed()`.
39
41
  */
40
42
  export declare function getRandomInt(min: int, max: int, seedOrRNG?: Seed | RNG): int;
@@ -13,7 +13,7 @@ interface CopyRNGReturn {
13
13
  * Helper function to copy an `RNG` object.
14
14
  *
15
15
  * @param rng The RNG object to copy. In the case of deserialization, this will actually be a Lua
16
- * table instead of an instantiated RNG class.
16
+ * table instead of an instantiated RNG class.
17
17
  * @param serializationType Default is `SerializationType.NONE`.
18
18
  */
19
19
  export declare function copyRNG<R extends RNG | SerializedRNG, S extends SerializationType>(rng: R, serializationType: S): CopyRNGReturn[S];
@@ -41,8 +41,9 @@ export declare function getRoomTypeName(roomType: RoomType): string;
41
41
  * the list.
42
42
  *
43
43
  * @param includeExtraDimensionalRooms Optional. On some floors (e.g. Downpour 2, Mines 2),
44
- * extra-dimensional rooms are automatically be generated and can be seen when you iterate over the
45
- * `RoomList`. Default is false.
44
+ * extra-dimensional rooms are automatically be generated and
45
+ * can be seen when you iterate over the `RoomList`. Default is
46
+ * false.
46
47
  */
47
48
  export declare function getRooms(includeExtraDimensionalRooms?: boolean): RoomDescriptor[];
48
49
  /**
@@ -113,8 +114,8 @@ export declare function inStartingRoom(): boolean;
113
114
  * This function will only check rooms in the current dimension.
114
115
  *
115
116
  * @param onlyCheckRoomTypes Optional. A whitelist of room types. If specified, room types not in
116
- * the array will be ignored. If not specified, then all rooms will be checked. Undefined by
117
- * default.
117
+ * the array will be ignored. If not specified, then all rooms will be
118
+ * checked. Undefined by default.
118
119
  */
119
120
  export declare function isAllRoomsClear(onlyCheckRoomTypes?: RoomType[]): boolean;
120
121
  export declare function isDoorSlotValidAtGridIndex(doorSlot: DoorSlot, roomGridIndex: int): boolean;
@@ -39,8 +39,6 @@ local ____entity = require("functions.entity")
39
39
  local getEntities = ____entity.getEntities
40
40
  local ____flag = require("functions.flag")
41
41
  local hasFlag = ____flag.hasFlag
42
- local ____math = require("functions.math")
43
- local erange = ____math.erange
44
42
  local ____positionVelocity = require("functions.positionVelocity")
45
43
  local getEntityPositions = ____positionVelocity.getEntityPositions
46
44
  local getEntityVelocities = ____positionVelocity.getEntityVelocities
@@ -58,6 +56,8 @@ local getRoomStageID = ____roomData.getRoomStageID
58
56
  local getRoomSubType = ____roomData.getRoomSubType
59
57
  local ____roomShape = require("functions.roomShape")
60
58
  local getGridIndexDelta = ____roomShape.getGridIndexDelta
59
+ local ____utils = require("functions.utils")
60
+ local erange = ____utils.erange
61
61
  function ____exports.getRooms(self, includeExtraDimensionalRooms)
62
62
  if includeExtraDimensionalRooms == nil then
63
63
  includeExtraDimensionalRooms = false