isaacscript-common 1.2.229 → 1.2.232

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.
@@ -39,7 +39,7 @@ local newRNG = ____rng.newRNG
39
39
  local ____roomData = require("functions.roomData")
40
40
  local getRoomListIndex = ____roomData.getRoomListIndex
41
41
  local ____roomGrid = require("functions.roomGrid")
42
- local gridToPos = ____roomGrid.gridToPos
42
+ local gridCoordinatesToWorldPosition = ____roomGrid.gridCoordinatesToWorldPosition
43
43
  local ____rooms = require("functions.rooms")
44
44
  local setRoomCleared = ____rooms.setRoomCleared
45
45
  local setRoomUncleared = ____rooms.setRoomUncleared
@@ -123,7 +123,7 @@ function fillRoomWithDecorations(self)
123
123
  local gridSize = room:GetGridSize()
124
124
  local roomListIndex = getRoomListIndex(nil)
125
125
  local decorationGridIndexes = v.level.roomToDecorationGridIndexesMap:getAndSetDefault(roomListIndex)
126
- for ____, gridIndex in ipairs(range(nil, 0, gridSize - 1)) do
126
+ for ____, gridIndex in ipairs(range(nil, gridSize - 1)) do
127
127
  do
128
128
  local existingGridEntity = room:GetGridEntity(gridIndex)
129
129
  if existingGridEntity ~= nil then
@@ -220,7 +220,7 @@ function spawnGridEntityForJSONRoom(self, xmlEntityType, xmlEntityVariant, x, y)
220
220
  return nil
221
221
  end
222
222
  local gridEntityType, variant = table.unpack(gridEntityTuple)
223
- local position = gridToPos(nil, x, y)
223
+ local position = gridCoordinatesToWorldPosition(nil, x, y)
224
224
  local gridIndex = room:GetGridIndex(position)
225
225
  local gridEntity = spawnGridEntityWithVariant(nil, gridEntityType, variant, gridIndex)
226
226
  if gridEntity == nil then
@@ -236,7 +236,7 @@ end
236
236
  function spawnNormalEntityForJSONRoom(self, entityType, variant, subType, x, y, rng)
237
237
  local room = game:GetRoom()
238
238
  local roomType = room:GetType()
239
- local position = gridToPos(nil, x, y)
239
+ local position = gridCoordinatesToWorldPosition(nil, x, y)
240
240
  local seed = rng:Next()
241
241
  local entity
242
242
  if entityType == EntityType.ENTITY_PICKUP and variant == 100 then
@@ -42,7 +42,7 @@ local ____roomData = require("functions.roomData")
42
42
  local getRoomData = ____roomData.getRoomData
43
43
  local getRoomDescriptor = ____roomData.getRoomDescriptor
44
44
  local ____roomGrid = require("functions.roomGrid")
45
- local gridToPos = ____roomGrid.gridToPos
45
+ local gridCoordinatesToWorldPosition = ____roomGrid.gridCoordinatesToWorldPosition
46
46
  local ____rooms = require("functions.rooms")
47
47
  local changeRoom = ____rooms.changeRoom
48
48
  local getRoomGridIndexesForType = ____rooms.getRoomGridIndexesForType
@@ -374,7 +374,7 @@ function ____exports.cards(self)
374
374
  if cardType == Card.NUM_CARDS then
375
375
  return
376
376
  end
377
- local position = gridToPos(nil, x, y)
377
+ local position = gridCoordinatesToWorldPosition(nil, x, y)
378
378
  Isaac.Spawn(
379
379
  EntityType.ENTITY_PICKUP,
380
380
  300,
@@ -656,7 +656,7 @@ function ____exports.pills(self)
656
656
  end
657
657
  local horsePillColor = pillColor + PILL_GIANT_FLAG
658
658
  local subType = horse and horsePillColor or pillColor
659
- local position = gridToPos(nil, x, y)
659
+ local position = gridCoordinatesToWorldPosition(nil, x, y)
660
660
  Isaac.Spawn(
661
661
  EntityType.ENTITY_PICKUP,
662
662
  70,
@@ -0,0 +1,10 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ /**
3
+ * Helper function to benchmark the performance of a function.
4
+ *
5
+ * This function is variadic, which means that you can supply as many as you want to benchmark.
6
+ *
7
+ * @returns An array containing the average time in milliseconds for each function. (This will also
8
+ * be printed to the log.)
9
+ */
10
+ export declare function benchmark(numTrials: int, ...functions: Array<() => void>): int[];
@@ -0,0 +1,33 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__ArrayPush = ____lualib.__TS__ArrayPush
3
+ local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
4
+ local ____exports = {}
5
+ local ____log = require("functions.log")
6
+ local log = ____log.log
7
+ function ____exports.benchmark(self, numTrials, ...)
8
+ local functions = {...}
9
+ log(((("Benchmarking " .. tostring(#functions)) .. " function(s) with ") .. tostring(numTrials)) .. " trials.")
10
+ local averages = {}
11
+ __TS__ArrayForEach(
12
+ functions,
13
+ function(____, func, i)
14
+ local totalTimeMilliseconds = 0
15
+ do
16
+ local j = 0
17
+ while j < numTrials do
18
+ local startTimeMilliseconds = Isaac.GetTime()
19
+ func(nil)
20
+ local endTimeMilliseconds = Isaac.GetTime()
21
+ local elapsedTimeMilliseconds = endTimeMilliseconds - startTimeMilliseconds
22
+ totalTimeMilliseconds = totalTimeMilliseconds + elapsedTimeMilliseconds
23
+ j = j + 1
24
+ end
25
+ end
26
+ local averageTimeMilliseconds = totalTimeMilliseconds / numTrials
27
+ log(((("The average time of function " .. tostring(i)) .. " is: ") .. tostring(averageTimeMilliseconds)) .. " milliseconds")
28
+ __TS__ArrayPush(averages, averageTimeMilliseconds)
29
+ end
30
+ )
31
+ return averages
32
+ end
33
+ return ____exports
@@ -0,0 +1,19 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ /** A collection of the four sprites necessary in order to render a charge bar. */
3
+ export interface ChargeBarSprites {
4
+ back: Sprite;
5
+ meter: Sprite;
6
+ meterBattery: Sprite;
7
+ lines: Sprite;
8
+ maxCharges: int;
9
+ }
10
+ /**
11
+ * Constructor for a `ChargeBarSprites` object. For more information, see the `renderChargeBar`
12
+ * helper function.
13
+ */
14
+ export declare function newChargeBarSprites(maxCharges: int): ChargeBarSprites;
15
+ /**
16
+ * Helper function to render a charge bar on the screen. First, call the `newChargeBarSprites`
17
+ * function to initialize the sprites, and then call this function on every render frame.
18
+ */
19
+ export declare function renderChargeBar(sprites: ChargeBarSprites, position: Vector, normalCharges: int, batteryCharges: int): void;
@@ -0,0 +1,42 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____exports = {}
3
+ local getChargeBarClamp
4
+ function getChargeBarClamp(self, charges, maxCharges)
5
+ local meterMultiplier = 24 / maxCharges
6
+ local meterClip = 26 - charges * meterMultiplier
7
+ return Vector(0, meterClip)
8
+ end
9
+ local CHARGE_BAR_ANM2 = "gfx/ui/ui_chargebar.anm2"
10
+ function ____exports.newChargeBarSprites(self, maxCharges)
11
+ local back = Sprite()
12
+ back:Load(CHARGE_BAR_ANM2, true)
13
+ back:Play("BarEmpty", true)
14
+ local meter = Sprite()
15
+ meter:Load(CHARGE_BAR_ANM2, true)
16
+ meter:Play("BarFull", true)
17
+ local meterBattery = Sprite()
18
+ meterBattery:Load(CHARGE_BAR_ANM2, true)
19
+ meterBattery:Play("BarFull", true)
20
+ local lines = Sprite()
21
+ lines:Load(CHARGE_BAR_ANM2, true)
22
+ lines:Play(
23
+ "BarOverlay" .. tostring(maxCharges),
24
+ true
25
+ )
26
+ return {
27
+ back = back,
28
+ meter = meter,
29
+ meterBattery = meterBattery,
30
+ lines = lines,
31
+ maxCharges = maxCharges
32
+ }
33
+ end
34
+ function ____exports.renderChargeBar(self, sprites, position, normalCharges, batteryCharges)
35
+ sprites.back:Render(position, Vector.Zero, Vector.Zero)
36
+ local normalChargesClamp = getChargeBarClamp(nil, normalCharges, sprites.maxCharges)
37
+ sprites.meter:Render(position, normalChargesClamp, Vector.Zero)
38
+ local batteryChargesClamp = getChargeBarClamp(nil, batteryCharges, sprites.maxCharges)
39
+ sprites.meterBattery:Render(position, batteryChargesClamp, Vector.Zero)
40
+ sprites.lines:Render(position, Vector.Zero, Vector.Zero)
41
+ end
42
+ return ____exports
@@ -29,7 +29,7 @@ function getAllGridEntities(self)
29
29
  local room = game:GetRoom()
30
30
  local gridSize = room:GetGridSize()
31
31
  local gridEntities = {}
32
- for ____, gridIndex in ipairs(range(nil, 0, gridSize - 1)) do
32
+ for ____, gridIndex in ipairs(range(nil, gridSize - 1)) do
33
33
  local gridEntity = room:GetGridEntity(gridIndex)
34
34
  if gridEntity ~= nil then
35
35
  __TS__ArrayPush(gridEntities, gridEntity)
@@ -84,14 +84,14 @@ function ____exports.getShootActions(self)
84
84
  return copySet(nil, SHOOTING_ACTIONS_SET)
85
85
  end
86
86
  function ____exports.isActionPressedOnAnyInput(self, buttonAction)
87
- local validInputs = range(nil, 0, MAX_NUM_INPUTS - 1)
87
+ local validInputs = range(nil, MAX_NUM_INPUTS - 1)
88
88
  return __TS__ArraySome(
89
89
  validInputs,
90
90
  function(____, input) return Input.IsActionPressed(buttonAction, input) end
91
91
  )
92
92
  end
93
93
  function ____exports.isActionTriggeredOnAnyInput(self, buttonAction)
94
- local validInputs = range(nil, 0, MAX_NUM_INPUTS - 1)
94
+ local validInputs = range(nil, MAX_NUM_INPUTS - 1)
95
95
  return __TS__ArraySome(
96
96
  validInputs,
97
97
  function(____, input) return Input.IsActionTriggered(buttonAction, input) end
@@ -380,7 +380,7 @@ function ____exports.logSet(set)
380
380
  ____exports.log("The size of the set was: " .. tostring(set.size))
381
381
  end
382
382
  function ____exports.logSounds()
383
- for ____, soundEffect in ipairs(range(nil, 0, SoundEffect.NUM_SOUND_EFFECTS - 1)) do
383
+ for ____, soundEffect in ipairs(range(nil, SoundEffect.NUM_SOUND_EFFECTS - 1)) do
384
384
  if sfxManager:IsPlaying(soundEffect) then
385
385
  ____exports.log("Currently playing sound effect: " .. tostring(soundEffect))
386
386
  end
@@ -15,8 +15,10 @@ export declare function getAngleDifference(angle1: float, angle2: float): float;
15
15
  */
16
16
  export declare function getCircleDiscretizedPoints(centerPos: Vector, radius: float, numPoints: int, xMultiplier?: number, yMultiplier?: number, initialDirection?: Direction): Vector[];
17
17
  /**
18
- * Helper function to check if a given position is within a given rectangle. This is an inclusive
19
- * check, meaning that it will return true if the position is on the border of the rectangle.
18
+ * Helper function to check if a given position is within a given rectangle.
19
+ *
20
+ * This is an inclusive check, meaning that it will return true if the position is on the border of
21
+ * the rectangle.
20
22
  */
21
23
  export declare function inRectangle(position: Vector, topLeft: Vector, bottomRight: Vector): boolean;
22
24
  /**
@@ -27,8 +29,12 @@ export declare function isEven(num: int): boolean;
27
29
  export declare function isOdd(num: int): boolean;
28
30
  export declare function lerp(a: number, b: number, pos: float): number;
29
31
  export declare function lerpAngleDegrees(aStart: number, aEnd: number, percent: float): number;
30
- /** Helper function to return an array with the elements from start to end, inclusive. */
31
- export declare function range(start: int, end: int): int[];
32
+ /**
33
+ * Helper function to return an array with the elements from start to end, inclusive.
34
+ *
35
+ * If only one argument is specified, then it will assume that the start is 0.
36
+ */
37
+ export declare function range(start: int, end?: int): int[];
32
38
  /**
33
39
  * If rounding fails, this function returns 0.
34
40
  * From: http://lua-users.org/wiki/SimpleRound
@@ -67,6 +67,10 @@ function ____exports.lerpAngleDegrees(self, aStart, aEnd, percent)
67
67
  return aStart + ____exports.getAngleDifference(nil, aStart, aEnd) * percent
68
68
  end
69
69
  function ____exports.range(self, start, ____end)
70
+ if ____end == nil then
71
+ ____end = start
72
+ start = 0
73
+ end
70
74
  local array = {}
71
75
  do
72
76
  local i = start
@@ -20,7 +20,7 @@ function ____exports.getPocketItems(self, player)
20
20
  local pocketItems = {}
21
21
  local pocketItemIdentified = false
22
22
  local pocketItem2Identified = false
23
- for ____, slot in ipairs(range(nil, 0, MAX_PLAYER_POCKET_ITEM_SLOTS - 1)) do
23
+ for ____, slot in ipairs(range(nil, MAX_PLAYER_POCKET_ITEM_SLOTS - 1)) do
24
24
  local card = player:GetCard(slot)
25
25
  local pillColor = player:GetPill(slot)
26
26
  if card ~= Card.CARD_NULL then
@@ -1,20 +1,40 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  /**
3
- * Helper function to convert a room X and Y coordinate to a position.
3
+ * Helper function to convert grid coordinates to a world position `Vector`.
4
4
  *
5
- * For example, the coordinates of 0, 0 are equal to `Vector(80, 160)`.
5
+ * For example, the coordinates of (0, 0) are equal to `Vector(80, 160)`.
6
+ */
7
+ export declare function gridCoordinatesToWorldPosition(x: int, y: int): Vector;
8
+ /**
9
+ * Helper function to convert a grid index to a grid position.
6
10
  *
7
- * This function will crash the game if it is called in the menu, because it needs to access the
8
- * current room's grid width.
11
+ * For example, in a 1x1 room, grid index 0 is equal to "Vector(-1, -1) and grid index 16 is equal
12
+ * to "Vector(0, 0)".
9
13
  */
10
- export declare function gridToPos(x: int, y: int): Vector;
11
- /** Helper function to convert a grid position `Vector` to a world position `Vector`. */
12
- export declare function gridToWorldPos(gridPos: Vector): Vector;
13
- /** Helper function to convert a world position `Vector` to a grid position `Vector`. */
14
- export declare function worldToGridPos(worldPos: Vector): Vector;
14
+ export declare function gridIndexToGridPosition(gridIndex: int, roomShape: RoomShape): Vector;
15
+ /**
16
+ * Helper function to convert a grid position `Vector` to a world position `Vector`.
17
+ *
18
+ * For example, the coordinates of (0, 0) are equal to `Vector(80, 160)`.
19
+ */
20
+ export declare function gridPositionToWorldPosition(gridPosition: Vector): Vector;
21
+ /**
22
+ * Test if a grid position is actually in the given `RoomShape`
23
+ *
24
+ * In this context, the grid position of the top-left wall is "Vector(-1, -1)".
25
+ */
26
+ export declare function isValidGridPosition(gridPosition: Vector, roomShape: RoomShape): boolean;
27
+ /**
28
+ * Helper function to convert a world position `Vector` to a grid position `Vector`.
29
+ *
30
+ * In this context, the grid position of the top-left wall is "Vector(-1, -1)".
31
+ */
32
+ export declare function worldPositionToGridPosition(worldPos: Vector): Vector;
15
33
  /**
16
34
  * Helper function to convert a world position `Vector` to a grid position `Vector`.
17
35
  *
18
- * This is similar to the `worldToGridPos` position, but the values are not rounded.
36
+ * In this context, the grid position of the top-left wall is "Vector(-1, -1)".
37
+ *
38
+ * This is similar to the `worldPositionToGridPosition` function, but the values are not rounded.
19
39
  */
20
- export declare function worldToGridPosFast(worldPos: Vector): Vector;
40
+ export declare function worldPositionToGridPositionFast(worldPos: Vector): Vector;
@@ -1,26 +1,57 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  local ____exports = {}
3
- local ____cachedClasses = require("cachedClasses")
4
- local game = ____cachedClasses.game
5
- function ____exports.gridToPos(self, x, y)
6
- local room = game:GetRoom()
7
- local gridWidth = room:GetGridWidth()
8
- x = x + 1
9
- y = y + 1
10
- local gridIndex = y * gridWidth + x
11
- return room:GetGridPosition(gridIndex)
12
- end
13
- function ____exports.gridToWorldPos(self, gridPos)
14
- local x = (gridPos.X + 2) * 40
15
- local y = (gridPos.Y + 4) * 40
3
+ local isValidGridPositionNormal, isValidGridPositionLRoom
4
+ local ____LRoomShapeToRectangles = require("objects.LRoomShapeToRectangles")
5
+ local L_ROOM_SHAPE_TO_RECTANGLES = ____LRoomShapeToRectangles.L_ROOM_SHAPE_TO_RECTANGLES
6
+ local ____math = require("functions.math")
7
+ local inRectangle = ____math.inRectangle
8
+ local ____roomShape = require("functions.roomShape")
9
+ local getRoomShapeTopLeftPosition = ____roomShape.getRoomShapeTopLeftPosition
10
+ local getRoomShapeWidth = ____roomShape.getRoomShapeWidth
11
+ local isLRoom = ____roomShape.isLRoom
12
+ function ____exports.gridPositionToWorldPosition(self, gridPosition)
13
+ local x = (gridPosition.X + 2) * 40
14
+ local y = (gridPosition.Y + 4) * 40
16
15
  return Vector(x, y)
17
16
  end
18
- function ____exports.worldToGridPos(self, worldPos)
17
+ function isValidGridPositionNormal(self, gridPosition, roomShape)
18
+ local topLeft = getRoomShapeTopLeftPosition(nil, roomShape)
19
+ local bottomRight = getRoomShapeTopLeftPosition(nil, roomShape)
20
+ return inRectangle(nil, gridPosition, topLeft, bottomRight)
21
+ end
22
+ function isValidGridPositionLRoom(self, gridPosition, roomShape)
23
+ local rectangles = L_ROOM_SHAPE_TO_RECTANGLES[roomShape]
24
+ if rectangles == nil then
25
+ return false
26
+ end
27
+ local verticalTopLeft, verticalBottomRight, horizontalTopLeft, horizontalBottomRight = table.unpack(rectangles)
28
+ return inRectangle(nil, gridPosition, verticalTopLeft, verticalBottomRight) and inRectangle(nil, gridPosition, horizontalTopLeft, horizontalBottomRight)
29
+ end
30
+ function ____exports.gridCoordinatesToWorldPosition(self, x, y)
31
+ local gridPosition = Vector(x, y)
32
+ return ____exports.gridPositionToWorldPosition(nil, gridPosition)
33
+ end
34
+ function ____exports.gridIndexToGridPosition(self, gridIndex, roomShape)
35
+ local gridWidth = getRoomShapeWidth(nil, roomShape)
36
+ local x = gridIndex % gridWidth - 1
37
+ local y = math.floor(gridIndex / gridWidth) - 1
38
+ return Vector(x, y)
39
+ end
40
+ function ____exports.isValidGridPosition(self, gridPosition, roomShape)
41
+ local ____isLRoom_result_0
42
+ if isLRoom(nil, roomShape) then
43
+ ____isLRoom_result_0 = isValidGridPositionLRoom(nil, gridPosition, roomShape)
44
+ else
45
+ ____isLRoom_result_0 = isValidGridPositionNormal(nil, gridPosition, roomShape)
46
+ end
47
+ return ____isLRoom_result_0
48
+ end
49
+ function ____exports.worldPositionToGridPosition(self, worldPos)
19
50
  local x = math.floor(worldPos.X / 40 - 2 + 0.5)
20
51
  local y = math.floor(worldPos.Y / 40 - 4 + 0.5)
21
52
  return Vector(x, y)
22
53
  end
23
- function ____exports.worldToGridPosFast(self, worldPos)
54
+ function ____exports.worldPositionToGridPositionFast(self, worldPos)
24
55
  local x = worldPos.X / 40 - 2
25
56
  local y = worldPos.Y / 40 - 4
26
57
  return Vector(x, y)
@@ -39,3 +39,5 @@ export declare function getRoomShapeTopLeftPosition(roomShape: RoomShape): Vecto
39
39
  * (This cannot be directly calculated from the bounds since L rooms are a special case.)
40
40
  */
41
41
  export declare function getRoomShapeVolume(roomShape: RoomShape): int;
42
+ export declare function getRoomShapeWidth(roomShape: RoomShape): int;
43
+ export declare function isLRoom(roomShape: RoomShape): boolean;
@@ -9,10 +9,14 @@ local ____roomShapeToBottomRightPosition = require("objects.roomShapeToBottomRig
9
9
  local ROOM_SHAPE_TO_BOTTOM_RIGHT_POSITION = ____roomShapeToBottomRightPosition.ROOM_SHAPE_TO_BOTTOM_RIGHT_POSITION
10
10
  local ____roomShapeToDoorSlotsToGridIndexDelta = require("objects.roomShapeToDoorSlotsToGridIndexDelta")
11
11
  local ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA = ____roomShapeToDoorSlotsToGridIndexDelta.ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA
12
+ local ____roomShapeToGridWidth = require("objects.roomShapeToGridWidth")
13
+ local ROOM_SHAPE_TO_GRID_WIDTH = ____roomShapeToGridWidth.ROOM_SHAPE_TO_GRID_WIDTH
12
14
  local ____roomShapeToTopLeftPosition = require("objects.roomShapeToTopLeftPosition")
13
15
  local ROOM_SHAPE_TO_TOP_LEFT_POSITION = ____roomShapeToTopLeftPosition.ROOM_SHAPE_TO_TOP_LEFT_POSITION
14
16
  local ____roomShapeVolumes = require("objects.roomShapeVolumes")
15
17
  local ROOM_SHAPE_VOLUMES = ____roomShapeVolumes.ROOM_SHAPE_VOLUMES
18
+ local ____LRoomShapesSet = require("sets.LRoomShapesSet")
19
+ local L_ROOM_SHAPES_SET = ____LRoomShapesSet.L_ROOM_SHAPES_SET
16
20
  function ____exports.getGridIndexDelta(self, roomShape, doorSlot)
17
21
  local doorSlotToGridIndexMap = ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA[roomShape]
18
22
  return doorSlotToGridIndexMap:get(doorSlot)
@@ -32,4 +36,10 @@ end
32
36
  function ____exports.getRoomShapeVolume(self, roomShape)
33
37
  return ROOM_SHAPE_VOLUMES[roomShape]
34
38
  end
39
+ function ____exports.getRoomShapeWidth(self, roomShape)
40
+ return ROOM_SHAPE_TO_GRID_WIDTH[roomShape]
41
+ end
42
+ function ____exports.isLRoom(self, roomShape)
43
+ return L_ROOM_SHAPES_SET:has(roomShape)
44
+ end
35
45
  return ____exports
@@ -105,7 +105,7 @@ function ____exports.getCurrentDimension(self)
105
105
  local startingRoomGridIndex = level:GetStartingRoomIndex()
106
106
  local startingRoomDescription = level:GetRoomByIdx(startingRoomGridIndex, -1)
107
107
  local startingRoomHash = GetPtrHash(startingRoomDescription)
108
- for ____, dimension in ipairs(range(nil, 0, NUM_DIMENSIONS - 1)) do
108
+ for ____, dimension in ipairs(range(nil, NUM_DIMENSIONS - 1)) do
109
109
  local dimensionRoomDescription = level:GetRoomByIdx(startingRoomGridIndex, dimension)
110
110
  local dimensionRoomHash = GetPtrHash(dimensionRoomDescription)
111
111
  if dimensionRoomHash == startingRoomHash then
@@ -15,7 +15,7 @@ function ____exports.clearSprite(self, sprite, ...)
15
15
  local layerIDs = {...}
16
16
  if #layerIDs == 0 then
17
17
  local numLayers = sprite:GetLayerCount()
18
- layerIDs = range(nil, 0, numLayers - 1)
18
+ layerIDs = range(nil, numLayers - 1)
19
19
  end
20
20
  for ____, layerID in ipairs(layerIDs) do
21
21
  sprite:ReplaceSpritesheet(layerID, EMPTY_PNG_PATH)
package/dist/index.d.ts CHANGED
@@ -29,12 +29,14 @@ export * from "./features/saveDataManager/exports";
29
29
  export { hasSirenStolenFamiliar, setFamiliarNoSirenSteal, } from "./features/sirenHelpers";
30
30
  export { getTaintedLazarusSubPlayer } from "./features/taintedLazarusPlayers";
31
31
  export * from "./functions/array";
32
+ export * from "./functions/benchmark";
32
33
  export * from "./functions/bitwise";
33
34
  export * from "./functions/cacheFlag";
34
35
  export * from "./functions/cards";
35
36
  export * from "./functions/challenges";
36
37
  export * from "./functions/character";
37
38
  export * from "./functions/charge";
39
+ export * from "./functions/chargeBar";
38
40
  export * from "./functions/collectibleCacheFlag";
39
41
  export * from "./functions/collectibles";
40
42
  export * from "./functions/collectibleSet";
package/dist/index.lua CHANGED
@@ -241,6 +241,14 @@ do
241
241
  end
242
242
  end
243
243
  end
244
+ do
245
+ local ____export = require("functions.benchmark")
246
+ for ____exportKey, ____exportValue in pairs(____export) do
247
+ if ____exportKey ~= "default" then
248
+ ____exports[____exportKey] = ____exportValue
249
+ end
250
+ end
251
+ end
244
252
  do
245
253
  local ____export = require("functions.bitwise")
246
254
  for ____exportKey, ____exportValue in pairs(____export) do
@@ -289,6 +297,14 @@ do
289
297
  end
290
298
  end
291
299
  end
300
+ do
301
+ local ____export = require("functions.chargeBar")
302
+ for ____exportKey, ____exportValue in pairs(____export) do
303
+ if ____exportKey ~= "default" then
304
+ ____exports[____exportKey] = ____exportValue
305
+ end
306
+ end
307
+ end
292
308
  do
293
309
  local ____export = require("functions.collectibleCacheFlag")
294
310
  for ____exportKey, ____exportValue in pairs(____export) do
@@ -0,0 +1,13 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ /**
3
+ * "Vector(0, 0)" corresponds to the top left tile of a room, not including the walls. (The top-left
4
+ * wall would be at "Vector(-1, -1)".)
5
+ */
6
+ export declare const L_ROOM_SHAPE_TO_RECTANGLES: {
7
+ [key in RoomShape]?: [
8
+ verticalTopLeft: Vector,
9
+ verticalBottomRight: Vector,
10
+ horizontalTopLeft: Vector,
11
+ horizontalBottomRight: Vector
12
+ ];
13
+ };
@@ -0,0 +1,30 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____exports = {}
3
+ local TWO_BY_TWO_BOTTOM_RIGHT = Vector(25, 13)
4
+ ____exports.L_ROOM_SHAPE_TO_RECTANGLES = {
5
+ [RoomShape.ROOMSHAPE_LTL] = {
6
+ Vector(13, 0),
7
+ Vector(25, 13),
8
+ Vector(0, 7),
9
+ TWO_BY_TWO_BOTTOM_RIGHT
10
+ },
11
+ [RoomShape.ROOMSHAPE_LTR] = {
12
+ Vector.Zero,
13
+ Vector(12, 13),
14
+ Vector(0, 7),
15
+ TWO_BY_TWO_BOTTOM_RIGHT
16
+ },
17
+ [RoomShape.ROOMSHAPE_LBL] = {
18
+ Vector.Zero,
19
+ Vector(25, 6),
20
+ Vector(13, 0),
21
+ TWO_BY_TWO_BOTTOM_RIGHT
22
+ },
23
+ [RoomShape.ROOMSHAPE_LBR] = {
24
+ Vector.Zero,
25
+ Vector(25, 6),
26
+ Vector.Zero,
27
+ Vector(12, 13)
28
+ }
29
+ }
30
+ return ____exports
@@ -0,0 +1,4 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare const ROOM_SHAPE_TO_GRID_WIDTH: {
3
+ readonly [key in RoomShape]: int;
4
+ };
@@ -0,0 +1,20 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____exports = {}
3
+ local ONE_BY_ONE_WIDTH = 15
4
+ local TWO_BY_ONE_WIDTH = 28
5
+ ____exports.ROOM_SHAPE_TO_GRID_WIDTH = {
6
+ [RoomShape.ROOMSHAPE_1x1] = ONE_BY_ONE_WIDTH,
7
+ [RoomShape.ROOMSHAPE_IH] = ONE_BY_ONE_WIDTH,
8
+ [RoomShape.ROOMSHAPE_IV] = ONE_BY_ONE_WIDTH,
9
+ [RoomShape.ROOMSHAPE_1x2] = ONE_BY_ONE_WIDTH,
10
+ [RoomShape.ROOMSHAPE_IIV] = ONE_BY_ONE_WIDTH,
11
+ [RoomShape.ROOMSHAPE_2x1] = TWO_BY_ONE_WIDTH,
12
+ [RoomShape.ROOMSHAPE_IIH] = TWO_BY_ONE_WIDTH,
13
+ [RoomShape.ROOMSHAPE_2x2] = TWO_BY_ONE_WIDTH,
14
+ [RoomShape.ROOMSHAPE_LTL] = TWO_BY_ONE_WIDTH,
15
+ [RoomShape.ROOMSHAPE_LTR] = TWO_BY_ONE_WIDTH,
16
+ [RoomShape.ROOMSHAPE_LBL] = TWO_BY_ONE_WIDTH,
17
+ [RoomShape.ROOMSHAPE_LBR] = TWO_BY_ONE_WIDTH,
18
+ [RoomShape.NUM_ROOMSHAPES] = 0
19
+ }
20
+ return ____exports
@@ -0,0 +1,2 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare const L_ROOM_SHAPES_SET: ReadonlySet<RoomShape>;
@@ -0,0 +1,6 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local Set = ____lualib.Set
3
+ local __TS__New = ____lualib.__TS__New
4
+ local ____exports = {}
5
+ ____exports.L_ROOM_SHAPES_SET = __TS__New(Set, {RoomShape.ROOMSHAPE_LTL, RoomShape.ROOMSHAPE_LTR, RoomShape.ROOMSHAPE_LBL, RoomShape.ROOMSHAPE_LBR})
6
+ return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.229",
3
+ "version": "1.2.232",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",