isaacscript-common 1.2.230 → 1.2.233

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 (41) hide show
  1. package/dist/callbacks/postCustomDoorEnter.lua +3 -1
  2. package/dist/constants.d.ts +2 -0
  3. package/dist/constants.lua +2 -0
  4. package/dist/features/deployJSONRoom.lua +8 -6
  5. package/dist/features/extraConsoleCommands/commands.lua +7 -6
  6. package/dist/features/playerInventory.d.ts +3 -0
  7. package/dist/functions/benchmark.d.ts +10 -0
  8. package/dist/functions/benchmark.lua +33 -0
  9. package/dist/functions/chargeBar.lua +6 -4
  10. package/dist/functions/familiars.lua +3 -1
  11. package/dist/functions/gridEntity.lua +1 -1
  12. package/dist/functions/input.lua +2 -2
  13. package/dist/functions/log.d.ts +1 -1
  14. package/dist/functions/log.lua +9 -3
  15. package/dist/functions/math.d.ts +10 -4
  16. package/dist/functions/math.lua +5 -1
  17. package/dist/functions/pocketItems.lua +1 -1
  18. package/dist/functions/roomData.d.ts +1 -1
  19. package/dist/functions/roomGrid.d.ts +31 -11
  20. package/dist/functions/roomGrid.lua +47 -15
  21. package/dist/functions/roomShape.d.ts +2 -0
  22. package/dist/functions/roomShape.lua +10 -0
  23. package/dist/functions/rooms.lua +1 -1
  24. package/dist/functions/spawnCollectible.lua +3 -1
  25. package/dist/functions/sprite.lua +4 -3
  26. package/dist/functions/ui.lua +5 -2
  27. package/dist/functions/vector.d.ts +3 -10
  28. package/dist/functions/vector.lua +11 -6
  29. package/dist/index.d.ts +1 -0
  30. package/dist/index.lua +8 -0
  31. package/dist/objects/LRoomShapeToRectangles.d.ts +13 -0
  32. package/dist/objects/LRoomShapeToRectangles.lua +32 -0
  33. package/dist/objects/directionToVector.lua +3 -1
  34. package/dist/objects/roomShapeBounds.lua +3 -1
  35. package/dist/objects/roomShapeToBottomRightPosition.lua +3 -1
  36. package/dist/objects/roomShapeToGridWidth.d.ts +4 -0
  37. package/dist/objects/roomShapeToGridWidth.lua +20 -0
  38. package/dist/objects/roomShapeToTopLeftPosition.lua +10 -8
  39. package/dist/sets/LRoomShapesSet.d.ts +2 -0
  40. package/dist/sets/LRoomShapesSet.lua +6 -0
  41. package/package.json +2 -2
@@ -6,6 +6,8 @@ local ____exports = {}
6
6
  local hasSubscriptions, postEffectUpdaterCustomEntity, doorChangedState, getAnimationForCustomDoor, postEffectRenderCustomEntity, isPlayerPastDoorThreshold, roomClearChange, getPositionOffset, POSITION_OFFSET_MULTIPLIER, v
7
7
  local ____cachedClasses = require("cachedClasses")
8
8
  local game = ____cachedClasses.game
9
+ local ____constants = require("constants")
10
+ local VectorZero = ____constants.VectorZero
9
11
  local ____ModCallbacksCustom = require("enums.ModCallbacksCustom")
10
12
  local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
11
13
  local ____exports = require("features.saveDataManager.exports")
@@ -185,7 +187,7 @@ function ____exports.spawnCustomDoor(self, effectVariant, doorSlot)
185
187
  effectVariant,
186
188
  0,
187
189
  position,
188
- Vector.Zero,
190
+ VectorZero,
189
191
  nil
190
192
  ):ToEffect()
191
193
  if effect == nil then
@@ -116,3 +116,5 @@ export declare const TRINKET_ID_MASK = 32767;
116
116
  * corner.
117
117
  */
118
118
  export declare const UI_HEART_WIDTH = 12;
119
+ export declare const VectorOne: ReadonlyVector;
120
+ export declare const VectorZero: ReadonlyVector;
@@ -37,4 +37,6 @@ ____exports.TAINTED_SAMSON_BERSERK_CHARGE_FROM_TAKING_DAMAGE = 10000
37
37
  ____exports.TRINKET_GOLDEN_FLAG = 32768
38
38
  ____exports.TRINKET_ID_MASK = 32767
39
39
  ____exports.UI_HEART_WIDTH = 12
40
+ ____exports.VectorOne = Vector(1, 1)
41
+ ____exports.VectorZero = Vector(0, 0)
40
42
  return ____exports
@@ -10,6 +10,8 @@ local ____cachedClasses = require("cachedClasses")
10
10
  local game = ____cachedClasses.game
11
11
  local ____DefaultMap = require("classes.DefaultMap")
12
12
  local DefaultMap = ____DefaultMap.DefaultMap
13
+ local ____constants = require("constants")
14
+ local VectorZero = ____constants.VectorZero
13
15
  local ____featuresInitialized = require("featuresInitialized")
14
16
  local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNotInitialized
15
17
  local ____entity = require("functions.entity")
@@ -39,7 +41,7 @@ local newRNG = ____rng.newRNG
39
41
  local ____roomData = require("functions.roomData")
40
42
  local getRoomListIndex = ____roomData.getRoomListIndex
41
43
  local ____roomGrid = require("functions.roomGrid")
42
- local gridToPos = ____roomGrid.gridToPos
44
+ local gridCoordinatesToWorldPosition = ____roomGrid.gridCoordinatesToWorldPosition
43
45
  local ____rooms = require("functions.rooms")
44
46
  local setRoomCleared = ____rooms.setRoomCleared
45
47
  local setRoomUncleared = ____rooms.setRoomUncleared
@@ -77,7 +79,7 @@ function respawnPersistentEntities(self)
77
79
  persistentEntity.variant,
78
80
  persistentEntity.subType,
79
81
  position,
80
- Vector.Zero,
82
+ VectorZero,
81
83
  nil
82
84
  )
83
85
  end
@@ -123,7 +125,7 @@ function fillRoomWithDecorations(self)
123
125
  local gridSize = room:GetGridSize()
124
126
  local roomListIndex = getRoomListIndex(nil)
125
127
  local decorationGridIndexes = v.level.roomToDecorationGridIndexesMap:getAndSetDefault(roomListIndex)
126
- for ____, gridIndex in ipairs(range(nil, 0, gridSize - 1)) do
128
+ for ____, gridIndex in ipairs(range(nil, gridSize - 1)) do
127
129
  do
128
130
  local existingGridEntity = room:GetGridEntity(gridIndex)
129
131
  if existingGridEntity ~= nil then
@@ -220,7 +222,7 @@ function spawnGridEntityForJSONRoom(self, xmlEntityType, xmlEntityVariant, x, y)
220
222
  return nil
221
223
  end
222
224
  local gridEntityType, variant = table.unpack(gridEntityTuple)
223
- local position = gridToPos(nil, x, y)
225
+ local position = gridCoordinatesToWorldPosition(nil, x, y)
224
226
  local gridIndex = room:GetGridIndex(position)
225
227
  local gridEntity = spawnGridEntityWithVariant(nil, gridEntityType, variant, gridIndex)
226
228
  if gridEntity == nil then
@@ -236,7 +238,7 @@ end
236
238
  function spawnNormalEntityForJSONRoom(self, entityType, variant, subType, x, y, rng)
237
239
  local room = game:GetRoom()
238
240
  local roomType = room:GetType()
239
- local position = gridToPos(nil, x, y)
241
+ local position = gridCoordinatesToWorldPosition(nil, x, y)
240
242
  local seed = rng:Next()
241
243
  local entity
242
244
  if entityType == EntityType.ENTITY_PICKUP and variant == 100 then
@@ -253,7 +255,7 @@ function spawnNormalEntityForJSONRoom(self, entityType, variant, subType, x, y,
253
255
  entityType,
254
256
  variant,
255
257
  position,
256
- Vector.Zero,
258
+ VectorZero,
257
259
  nil,
258
260
  subType,
259
261
  seed
@@ -10,6 +10,7 @@ local sfxManager = ____cachedClasses.sfxManager
10
10
  local ____constants = require("constants")
11
11
  local PILL_GIANT_FLAG = ____constants.PILL_GIANT_FLAG
12
12
  local TRINKET_GOLDEN_FLAG = ____constants.TRINKET_GOLDEN_FLAG
13
+ local VectorZero = ____constants.VectorZero
13
14
  local ____HealthType = require("enums.HealthType")
14
15
  local HealthType = ____HealthType.HealthType
15
16
  local ____cards = require("functions.cards")
@@ -42,7 +43,7 @@ local ____roomData = require("functions.roomData")
42
43
  local getRoomData = ____roomData.getRoomData
43
44
  local getRoomDescriptor = ____roomData.getRoomDescriptor
44
45
  local ____roomGrid = require("functions.roomGrid")
45
- local gridToPos = ____roomGrid.gridToPos
46
+ local gridCoordinatesToWorldPosition = ____roomGrid.gridCoordinatesToWorldPosition
46
47
  local ____rooms = require("functions.rooms")
47
48
  local changeRoom = ____rooms.changeRoom
48
49
  local getRoomGridIndexesForType = ____rooms.getRoomGridIndexesForType
@@ -374,13 +375,13 @@ function ____exports.cards(self)
374
375
  if cardType == Card.NUM_CARDS then
375
376
  return
376
377
  end
377
- local position = gridToPos(nil, x, y)
378
+ local position = gridCoordinatesToWorldPosition(nil, x, y)
378
379
  Isaac.Spawn(
379
380
  EntityType.ENTITY_PICKUP,
380
381
  300,
381
382
  cardType,
382
383
  position,
383
- Vector.Zero,
384
+ VectorZero,
384
385
  nil
385
386
  )
386
387
  cardType = cardType + 1
@@ -656,13 +657,13 @@ function ____exports.pills(self)
656
657
  end
657
658
  local horsePillColor = pillColor + PILL_GIANT_FLAG
658
659
  local subType = horse and horsePillColor or pillColor
659
- local position = gridToPos(nil, x, y)
660
+ local position = gridCoordinatesToWorldPosition(nil, x, y)
660
661
  Isaac.Spawn(
661
662
  EntityType.ENTITY_PICKUP,
662
663
  70,
663
664
  subType,
664
665
  position,
665
- Vector.Zero,
666
+ VectorZero,
666
667
  nil
667
668
  )
668
669
  pillColor = pillColor + 1
@@ -885,7 +886,7 @@ function ____exports.spawnGoldenTrinket(self, params)
885
886
  350,
886
887
  goldenTrinketType,
887
888
  centerPos,
888
- Vector.Zero,
889
+ VectorZero,
889
890
  nil
890
891
  )
891
892
  end
@@ -16,5 +16,8 @@ export declare function getPlayerInventory(player: EntityPlayer, includeActiveCo
16
16
  * Helper function to add a collectible to a player. Use this instead of the
17
17
  * `EntityPlayer.AddCollectible` method if you want the collectible that is added to be
18
18
  * automatically tracked by the player inventory tracker feature.
19
+ *
20
+ * You only need to use this function if you are using the inventory feature from the standard
21
+ * library.
19
22
  */
20
23
  export declare function addCollectible(player: EntityPlayer, collectibleType: CollectibleType, charge?: int, firstTimePickingUp?: boolean, activeSlot?: ActiveSlot, varData?: int): void;
@@ -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
@@ -1,6 +1,8 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  local ____exports = {}
3
3
  local getChargeBarClamp
4
+ local ____constants = require("constants")
5
+ local VectorZero = ____constants.VectorZero
4
6
  function getChargeBarClamp(self, charges, maxCharges)
5
7
  local meterMultiplier = 24 / maxCharges
6
8
  local meterClip = 26 - charges * meterMultiplier
@@ -32,11 +34,11 @@ function ____exports.newChargeBarSprites(self, maxCharges)
32
34
  }
33
35
  end
34
36
  function ____exports.renderChargeBar(self, sprites, position, normalCharges, batteryCharges)
35
- sprites.back:Render(position, Vector.Zero, Vector.Zero)
37
+ sprites.back:Render(position, VectorZero, VectorZero)
36
38
  local normalChargesClamp = getChargeBarClamp(nil, normalCharges, sprites.maxCharges)
37
- sprites.meter:Render(position, normalChargesClamp, Vector.Zero)
39
+ sprites.meter:Render(position, normalChargesClamp, VectorZero)
38
40
  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
+ sprites.meterBattery:Render(position, batteryChargesClamp, VectorZero)
42
+ sprites.lines:Render(position, VectorZero, VectorZero)
41
43
  end
42
44
  return ____exports
@@ -4,6 +4,8 @@ local __TS__ArrayPush = ____lualib.__TS__ArrayPush
4
4
  local ____exports = {}
5
5
  local ____cachedClasses = require("cachedClasses")
6
6
  local game = ____cachedClasses.game
7
+ local ____constants = require("constants")
8
+ local VectorZero = ____constants.VectorZero
7
9
  local ____familiarsThatShootPlayerTearsSet = require("sets.familiarsThatShootPlayerTearsSet")
8
10
  local FAMILIARS_THAT_SHOOT_PLAYER_TEARS_SET = ____familiarsThatShootPlayerTearsSet.FAMILIARS_THAT_SHOOT_PLAYER_TEARS_SET
9
11
  local ____array = require("functions.array")
@@ -59,7 +61,7 @@ function ____exports.checkFamiliar(self, player, collectibleType, numTargetFamil
59
61
  EntityType.ENTITY_FAMILIAR,
60
62
  familiarVariant,
61
63
  player.Position,
62
- Vector.Zero,
64
+ VectorZero,
63
65
  player,
64
66
  familiarSubTypeToUse,
65
67
  seed
@@ -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
@@ -64,7 +64,7 @@ export declare function logUseFlags(this: void, flags: int): void;
64
64
  * the Isaac API).
65
65
  */
66
66
  export declare function logUserdata(this: void, userdata: unknown): void;
67
- export declare function logVector(this: void, vector: Vector): void;
67
+ export declare function logVector(this: void, vector: Vector, round?: boolean): void;
68
68
  /**
69
69
  * Converts every `isaacscript-common` function that begins with "log" to a global function.
70
70
  * This is useful for printing out variables from the in-game debug console.
@@ -39,6 +39,8 @@ local ____trinkets = require("functions.trinkets")
39
39
  local getTrinketName = ____trinkets.getTrinketName
40
40
  local ____utils = require("functions.utils")
41
41
  local printConsole = ____utils.printConsole
42
+ local ____vector = require("functions.vector")
43
+ local vectorToString = ____vector.vectorToString
42
44
  function ____exports.getDebugPrependString(self, msg, numParentFunctions)
43
45
  if numParentFunctions == nil then
44
46
  numParentFunctions = 3
@@ -380,7 +382,7 @@ function ____exports.logSet(set)
380
382
  ____exports.log("The size of the set was: " .. tostring(set.size))
381
383
  end
382
384
  function ____exports.logSounds()
383
- for ____, soundEffect in ipairs(range(nil, 0, SoundEffect.NUM_SOUND_EFFECTS - 1)) do
385
+ for ____, soundEffect in ipairs(range(nil, SoundEffect.NUM_SOUND_EFFECTS - 1)) do
384
386
  if sfxManager:IsPlaying(soundEffect) then
385
387
  ____exports.log("Currently playing sound effect: " .. tostring(soundEffect))
386
388
  end
@@ -442,8 +444,12 @@ function ____exports.logUserdata(userdata)
442
444
  end
443
445
  ____exports.logTable(metatable)
444
446
  end
445
- function ____exports.logVector(vector)
446
- ____exports.log(((("Vector: (" .. tostring(vector.X)) .. ", ") .. tostring(vector.Y)) .. ")")
447
+ function ____exports.logVector(vector, round)
448
+ if round == nil then
449
+ round = false
450
+ end
451
+ local vectorString = vectorToString(nil, vector, round)
452
+ ____exports.log("Vector: " .. vectorString)
447
453
  end
448
454
  function ____exports.setLogFunctionsGlobal(self)
449
455
  local globals = _G
@@ -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
@@ -39,7 +39,7 @@ function ____exports.getCircleDiscretizedPoints(self, centerPos, radius, numPoin
39
39
  return positions
40
40
  end
41
41
  function ____exports.inRectangle(self, position, topLeft, bottomRight)
42
- return position.X >= topLeft.X and position.X <= bottomRight.X and position.Y <= topLeft.Y and position.Y >= bottomRight.Y
42
+ return position.X >= topLeft.X and position.X <= bottomRight.X and position.Y >= topLeft.Y and position.Y <= bottomRight.Y
43
43
  end
44
44
  function ____exports.isCircleIntersectingRectangle(self, circleCenter, circleRadius, rectangleTopLeft, rectangleBottomRight)
45
45
  local nearestX = math.max(
@@ -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
@@ -3,7 +3,7 @@
3
3
  * Alias for the `Level.GetCurrentRoomDesc` method. Use this to make it more clear what type of
4
4
  * `RoomDescriptor` object that you are retrieving.
5
5
  */
6
- export declare function getCurrentRoomDescriptorReadOnly(): RoomDescriptorReadOnly;
6
+ export declare function getCurrentRoomDescriptorReadOnly(): ReadonlyRoomDescriptor;
7
7
  /**
8
8
  * Helper function to get the set of allowed door slots for the room at the supplied grid index.
9
9
  * This corresponds to the doors that are enabled in the STB/XML file for the room.
@@ -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,58 @@
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 getRoomShapeBottomRightPosition = ____roomShape.getRoomShapeBottomRightPosition
10
+ local getRoomShapeTopLeftPosition = ____roomShape.getRoomShapeTopLeftPosition
11
+ local getRoomShapeWidth = ____roomShape.getRoomShapeWidth
12
+ local isLRoom = ____roomShape.isLRoom
13
+ function ____exports.gridPositionToWorldPosition(self, gridPosition)
14
+ local x = (gridPosition.X + 2) * 40
15
+ local y = (gridPosition.Y + 4) * 40
16
16
  return Vector(x, y)
17
17
  end
18
- function ____exports.worldToGridPos(self, worldPos)
18
+ function isValidGridPositionNormal(self, gridPosition, roomShape)
19
+ local topLeft = getRoomShapeTopLeftPosition(nil, roomShape)
20
+ local bottomRight = getRoomShapeBottomRightPosition(nil, roomShape)
21
+ return inRectangle(nil, gridPosition, topLeft, bottomRight)
22
+ end
23
+ function isValidGridPositionLRoom(self, gridPosition, roomShape)
24
+ local rectangles = L_ROOM_SHAPE_TO_RECTANGLES[roomShape]
25
+ if rectangles == nil then
26
+ return false
27
+ end
28
+ local verticalTopLeft, verticalBottomRight, horizontalTopLeft, horizontalBottomRight = table.unpack(rectangles)
29
+ return inRectangle(nil, gridPosition, verticalTopLeft, verticalBottomRight) and inRectangle(nil, gridPosition, horizontalTopLeft, horizontalBottomRight)
30
+ end
31
+ function ____exports.gridCoordinatesToWorldPosition(self, x, y)
32
+ local gridPosition = Vector(x, y)
33
+ return ____exports.gridPositionToWorldPosition(nil, gridPosition)
34
+ end
35
+ function ____exports.gridIndexToGridPosition(self, gridIndex, roomShape)
36
+ local gridWidth = getRoomShapeWidth(nil, roomShape)
37
+ local x = gridIndex % gridWidth - 1
38
+ local y = math.floor(gridIndex / gridWidth) - 1
39
+ return Vector(x, y)
40
+ end
41
+ function ____exports.isValidGridPosition(self, gridPosition, roomShape)
42
+ local ____isLRoom_result_0
43
+ if isLRoom(nil, roomShape) then
44
+ ____isLRoom_result_0 = isValidGridPositionLRoom(nil, gridPosition, roomShape)
45
+ else
46
+ ____isLRoom_result_0 = isValidGridPositionNormal(nil, gridPosition, roomShape)
47
+ end
48
+ return ____isLRoom_result_0
49
+ end
50
+ function ____exports.worldPositionToGridPosition(self, worldPos)
19
51
  local x = math.floor(worldPos.X / 40 - 2 + 0.5)
20
52
  local y = math.floor(worldPos.Y / 40 - 4 + 0.5)
21
53
  return Vector(x, y)
22
54
  end
23
- function ____exports.worldToGridPosFast(self, worldPos)
55
+ function ____exports.worldPositionToGridPositionFast(self, worldPos)
24
56
  local x = worldPos.X / 40 - 2
25
57
  local y = worldPos.Y / 40 - 4
26
58
  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
@@ -2,6 +2,8 @@
2
2
  local ____exports = {}
3
3
  local ____cachedClasses = require("cachedClasses")
4
4
  local game = ____cachedClasses.game
5
+ local ____constants = require("constants")
6
+ local VectorZero = ____constants.VectorZero
5
7
  local ____preventCollectibleRotate = require("features.preventCollectibleRotate")
6
8
  local preventCollectibleRotate = ____preventCollectibleRotate.preventCollectibleRotate
7
9
  local ____featuresInitialized = require("featuresInitialized")
@@ -29,7 +31,7 @@ function ____exports.spawnCollectible(self, collectibleType, position, seedOrRNG
29
31
  EntityType.ENTITY_PICKUP,
30
32
  100,
31
33
  position,
32
- Vector.Zero,
34
+ VectorZero,
33
35
  nil,
34
36
  collectibleType,
35
37
  seed
@@ -2,20 +2,21 @@
2
2
  local ____exports = {}
3
3
  local ____constants = require("constants")
4
4
  local EMPTY_PNG_PATH = ____constants.EMPTY_PNG_PATH
5
+ local VectorZero = ____constants.VectorZero
5
6
  local ____kColor = require("functions.kColor")
6
7
  local kColorEquals = ____kColor.kColorEquals
7
8
  local ____math = require("functions.math")
8
9
  local range = ____math.range
9
10
  function ____exports.texelEquals(self, sprite1, sprite2, position, layerID)
10
- local kColor1 = sprite1:GetTexel(position, Vector.Zero, 1, layerID)
11
- local kColor2 = sprite2:GetTexel(position, Vector.Zero, 1, layerID)
11
+ local kColor1 = sprite1:GetTexel(position, VectorZero, 1, layerID)
12
+ local kColor2 = sprite2:GetTexel(position, VectorZero, 1, layerID)
12
13
  return kColorEquals(nil, kColor1, kColor2)
13
14
  end
14
15
  function ____exports.clearSprite(self, sprite, ...)
15
16
  local layerIDs = {...}
16
17
  if #layerIDs == 0 then
17
18
  local numLayers = sprite:GetLayerCount()
18
- layerIDs = range(nil, 0, numLayers - 1)
19
+ layerIDs = range(nil, numLayers - 1)
19
20
  end
20
21
  for ____, layerID in ipairs(layerIDs) do
21
22
  sprite:ReplaceSpritesheet(layerID, EMPTY_PNG_PATH)
@@ -4,13 +4,16 @@ local ____cachedClasses = require("cachedClasses")
4
4
  local game = ____cachedClasses.game
5
5
  local ____constants = require("constants")
6
6
  local UI_HEART_WIDTH = ____constants.UI_HEART_WIDTH
7
+ local VectorZero = ____constants.VectorZero
8
+ local ____vector = require("functions.vector")
9
+ local copyVector = ____vector.copyVector
7
10
  function ____exports.getScreenBottomRightPos(self)
8
11
  local screenWidth = Isaac.GetScreenWidth()
9
12
  local screenHeight = Isaac.GetScreenHeight()
10
13
  return Vector(screenWidth, screenHeight)
11
14
  end
12
15
  function ____exports.getHUDOffsetVector(self)
13
- local defaultVector = Vector.Zero
16
+ local defaultVector = copyVector(nil, VectorZero)
14
17
  local hudOffset = math.floor(Options.HUDOffset * 10)
15
18
  if hudOffset < 1 or hudOffset > 10 then
16
19
  return defaultVector
@@ -70,7 +73,7 @@ function ____exports.getScreenCenterPos(self)
70
73
  return bottomRight / 2
71
74
  end
72
75
  function ____exports.getScreenTopLeftPos(self)
73
- return Vector.Zero
76
+ return copyVector(nil, VectorZero)
74
77
  end
75
78
  function ____exports.getScreenTopRightPos(self)
76
79
  local bottomRight = ____exports.getScreenBottomRightPos(nil)
@@ -19,16 +19,6 @@ interface CopyVectorReturn {
19
19
  export declare function copyVector<V extends Vector | SerializedVector, S extends SerializationType>(vector: V, serializationType: S): CopyVectorReturn[S];
20
20
  export declare function copyVector<V extends Vector | SerializedVector>(vector: V): CopyVectorReturn[SerializationType.NONE];
21
21
  export declare function directionToVector(direction: Direction): Vector;
22
- /**
23
- * Helper function to get a new vector of length 1. Using this is safer than using the `Vector.One`
24
- * variable because the variable can be overwritten or modified.
25
- */
26
- export declare function getOneVector(): Vector;
27
- /**
28
- * Helper function to get a new vector of length 0. Using this is safer than using the `Vector.Zero`
29
- * variable because the variable can be overwritten or modified.
30
- */
31
- export declare function getZeroVector(): Vector;
32
22
  /**
33
23
  * Used to determine is the given table is a serialized `Vector` object created by the save data
34
24
  * manager and/or the `deepCopy` function.
@@ -37,6 +27,9 @@ export declare function isSerializedVector(object: unknown): object is Serialize
37
27
  /** Helper function to check if something is an instantiated Vector object. */
38
28
  export declare function isVector(object: unknown): object is Vector;
39
29
  export declare function vectorEquals(vector1: Vector, vector2: Vector): boolean;
30
+ /** Helper function to get a new vector of length N. */
31
+ export declare function vectorN(n: int): Vector;
40
32
  /** Helper function for finding out which way a vector is pointing. */
41
33
  export declare function vectorToDirection(vector: Vector): Direction;
34
+ export declare function vectorToString(vector: Vector, round?: boolean): string;
42
35
  export {};
@@ -74,12 +74,6 @@ end
74
74
  function ____exports.directionToVector(self, direction)
75
75
  return DIRECTION_TO_VECTOR[direction]
76
76
  end
77
- function ____exports.getOneVector(self)
78
- return Vector(1, 1)
79
- end
80
- function ____exports.getZeroVector(self)
81
- return Vector(0, 0)
82
- end
83
77
  function ____exports.isSerializedVector(self, object)
84
78
  local objectType = type(object)
85
79
  if objectType ~= "table" then
@@ -95,6 +89,9 @@ end
95
89
  function ____exports.vectorEquals(self, vector1, vector2)
96
90
  return isaacAPIClassEquals(nil, vector1, vector2, KEYS)
97
91
  end
92
+ function ____exports.vectorN(self, n)
93
+ return Vector(n, n)
94
+ end
98
95
  function ____exports.vectorToDirection(self, vector)
99
96
  local degrees = vector:GetAngleDegrees()
100
97
  if degrees > -45 and degrees < 45 then
@@ -111,4 +108,12 @@ function ____exports.vectorToDirection(self, vector)
111
108
  end
112
109
  return Direction.NO_DIRECTION
113
110
  end
111
+ function ____exports.vectorToString(self, vector, round)
112
+ if round == nil then
113
+ round = false
114
+ end
115
+ local x = round and math.floor(vector.X + 0.5) or vector.X
116
+ local y = round and math.floor(vector.Y + 0.5) or vector.Y
117
+ return ((("(" .. tostring(x)) .. ", ") .. tostring(y)) .. ")"
118
+ end
114
119
  return ____exports
package/dist/index.d.ts CHANGED
@@ -29,6 +29,7 @@ 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";
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
@@ -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,32 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____exports = {}
3
+ local ____constants = require("constants")
4
+ local VectorZero = ____constants.VectorZero
5
+ local TWO_BY_TWO_BOTTOM_RIGHT = Vector(25, 13)
6
+ ____exports.L_ROOM_SHAPE_TO_RECTANGLES = {
7
+ [RoomShape.ROOMSHAPE_LTL] = {
8
+ Vector(13, 0),
9
+ Vector(25, 13),
10
+ Vector(0, 7),
11
+ TWO_BY_TWO_BOTTOM_RIGHT
12
+ },
13
+ [RoomShape.ROOMSHAPE_LTR] = {
14
+ VectorZero,
15
+ Vector(12, 13),
16
+ Vector(0, 7),
17
+ TWO_BY_TWO_BOTTOM_RIGHT
18
+ },
19
+ [RoomShape.ROOMSHAPE_LBL] = {
20
+ VectorZero,
21
+ Vector(25, 6),
22
+ Vector(13, 0),
23
+ TWO_BY_TWO_BOTTOM_RIGHT
24
+ },
25
+ [RoomShape.ROOMSHAPE_LBR] = {
26
+ VectorZero,
27
+ Vector(25, 6),
28
+ VectorZero,
29
+ Vector(12, 13)
30
+ }
31
+ }
32
+ return ____exports
@@ -1,7 +1,9 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  local ____exports = {}
3
+ local ____constants = require("constants")
4
+ local VectorZero = ____constants.VectorZero
3
5
  ____exports.DIRECTION_TO_VECTOR = {
4
- [Direction.NO_DIRECTION] = Vector.Zero,
6
+ [Direction.NO_DIRECTION] = VectorZero,
5
7
  [Direction.LEFT] = Vector(-1, 0),
6
8
  [Direction.UP] = Vector(0, -1),
7
9
  [Direction.RIGHT] = Vector(1, 0),
@@ -1,5 +1,7 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  local ____exports = {}
3
+ local ____constants = require("constants")
4
+ local VectorZero = ____constants.VectorZero
3
5
  local ____roomShapeVolumes = require("objects.roomShapeVolumes")
4
6
  local NARROW_CONTENTS_HEIGHT = ____roomShapeVolumes.NARROW_CONTENTS_HEIGHT
5
7
  local NARROW_CONTENTS_WIDTH = ____roomShapeVolumes.NARROW_CONTENTS_WIDTH
@@ -19,6 +21,6 @@ ____exports.ROOM_SHAPE_BOUNDS = {
19
21
  [RoomShape.ROOMSHAPE_LTR] = TWO_BY_TWO_BOUNDS,
20
22
  [RoomShape.ROOMSHAPE_LBL] = TWO_BY_TWO_BOUNDS,
21
23
  [RoomShape.ROOMSHAPE_LBR] = TWO_BY_TWO_BOUNDS,
22
- [RoomShape.NUM_ROOMSHAPES] = Vector.Zero
24
+ [RoomShape.NUM_ROOMSHAPES] = VectorZero
23
25
  }
24
26
  return ____exports
@@ -1,5 +1,7 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  local ____exports = {}
3
+ local ____constants = require("constants")
4
+ local VectorZero = ____constants.VectorZero
3
5
  local TWO_BY_TWO_BOTTOM_RIGHT_POSITION = Vector(25, 13)
4
6
  local ONE_BY_TWO_VERTICAL_BOTTOM_RIGHT_POSITION = Vector(12, 13)
5
7
  ____exports.ROOM_SHAPE_TO_BOTTOM_RIGHT_POSITION = {
@@ -15,6 +17,6 @@ ____exports.ROOM_SHAPE_TO_BOTTOM_RIGHT_POSITION = {
15
17
  [RoomShape.ROOMSHAPE_LTR] = TWO_BY_TWO_BOTTOM_RIGHT_POSITION,
16
18
  [RoomShape.ROOMSHAPE_LBL] = TWO_BY_TWO_BOTTOM_RIGHT_POSITION,
17
19
  [RoomShape.ROOMSHAPE_LBR] = ONE_BY_TWO_VERTICAL_BOTTOM_RIGHT_POSITION,
18
- [RoomShape.NUM_ROOMSHAPES] = Vector.Zero
20
+ [RoomShape.NUM_ROOMSHAPES] = VectorZero
19
21
  }
20
22
  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
@@ -1,20 +1,22 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  local ____exports = {}
3
+ local ____constants = require("constants")
4
+ local VectorZero = ____constants.VectorZero
3
5
  local NARROW_HORIZONTAL_TOP_LEFT_POSITION = Vector(0, 2)
4
6
  local NARROW_VERTICAL_TOP_LEFT_POSITION = Vector(4, 0)
5
7
  ____exports.ROOM_SHAPE_TO_TOP_LEFT_POSITION = {
6
- [RoomShape.ROOMSHAPE_1x1] = Vector.Zero,
8
+ [RoomShape.ROOMSHAPE_1x1] = VectorZero,
7
9
  [RoomShape.ROOMSHAPE_IH] = NARROW_HORIZONTAL_TOP_LEFT_POSITION,
8
10
  [RoomShape.ROOMSHAPE_IV] = NARROW_VERTICAL_TOP_LEFT_POSITION,
9
- [RoomShape.ROOMSHAPE_1x2] = Vector.Zero,
11
+ [RoomShape.ROOMSHAPE_1x2] = VectorZero,
10
12
  [RoomShape.ROOMSHAPE_IIV] = NARROW_VERTICAL_TOP_LEFT_POSITION,
11
- [RoomShape.ROOMSHAPE_2x1] = Vector.Zero,
13
+ [RoomShape.ROOMSHAPE_2x1] = VectorZero,
12
14
  [RoomShape.ROOMSHAPE_IIH] = NARROW_HORIZONTAL_TOP_LEFT_POSITION,
13
- [RoomShape.ROOMSHAPE_2x2] = Vector.Zero,
15
+ [RoomShape.ROOMSHAPE_2x2] = VectorZero,
14
16
  [RoomShape.ROOMSHAPE_LTL] = Vector(13, 0),
15
- [RoomShape.ROOMSHAPE_LTR] = Vector.Zero,
16
- [RoomShape.ROOMSHAPE_LBL] = Vector.Zero,
17
- [RoomShape.ROOMSHAPE_LBR] = Vector.Zero,
18
- [RoomShape.NUM_ROOMSHAPES] = Vector.Zero
17
+ [RoomShape.ROOMSHAPE_LTR] = VectorZero,
18
+ [RoomShape.ROOMSHAPE_LBL] = VectorZero,
19
+ [RoomShape.ROOMSHAPE_LBR] = VectorZero,
20
+ [RoomShape.NUM_ROOMSHAPES] = VectorZero
19
21
  }
20
22
  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.230",
3
+ "version": "1.2.233",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",
@@ -25,7 +25,7 @@
25
25
  "dist/**/*.d.ts"
26
26
  ],
27
27
  "devDependencies": {
28
- "isaac-typescript-definitions": "^1.0.385",
28
+ "isaac-typescript-definitions": "^1.0.386",
29
29
  "isaacscript-lint": "^1.0.95",
30
30
  "isaacscript-tsconfig": "^1.1.8",
31
31
  "typedoc": "^0.22.13",