isaacscript-common 4.5.2 → 4.7.0

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 (68) hide show
  1. package/constants.d.ts +0 -3
  2. package/constantsFirstLast.d.ts +0 -3
  3. package/features/characterHealthConversion.d.ts +6 -0
  4. package/features/characterStats.d.ts +5 -0
  5. package/features/deployJSONRoom.lua +2 -4
  6. package/features/disableAllSound.d.ts +0 -3
  7. package/features/runInNFrames.d.ts +38 -4
  8. package/features/runInNFrames.lua +90 -19
  9. package/functions/array.d.ts +30 -1
  10. package/functions/array.lua +84 -5
  11. package/functions/bitwise.d.ts +17 -0
  12. package/functions/bitwise.lua +41 -0
  13. package/functions/color.d.ts +1 -1
  14. package/functions/doors.d.ts +6 -0
  15. package/functions/doors.lua +23 -2
  16. package/functions/gridEntity.d.ts +12 -0
  17. package/functions/gridEntity.lua +15 -2
  18. package/functions/kColor.d.ts +1 -1
  19. package/functions/log.d.ts +2 -2
  20. package/functions/rng.d.ts +1 -1
  21. package/functions/rng.lua +5 -0
  22. package/functions/roomShape.d.ts +2 -2
  23. package/functions/rooms.d.ts +1 -0
  24. package/functions/rooms.lua +1 -0
  25. package/functions/set.d.ts +17 -0
  26. package/functions/set.lua +24 -0
  27. package/functions/stage.d.ts +6 -1
  28. package/functions/stage.lua +7 -0
  29. package/functions/vector.d.ts +1 -1
  30. package/index.d.ts +0 -1
  31. package/index.lua +0 -8
  32. package/initFeatures.lua +0 -3
  33. package/maps/roomTypeMap.lua +0 -1
  34. package/objects/doorSlotToDoorSlotFlag.d.ts +4 -0
  35. package/objects/doorSlotToDoorSlotFlag.lua +17 -0
  36. package/objects/roomShapeBounds.d.ts +1 -1
  37. package/objects/roomShapeBounds.lua +8 -8
  38. package/objects/roomShapeLayoutSizes.d.ts +1 -1
  39. package/objects/roomShapeLayoutSizes.lua +4 -4
  40. package/objects/roomTypeGotoPrefixes.d.ts +4 -0
  41. package/objects/roomTypeGotoPrefixes.lua +35 -0
  42. package/objects/roomTypeNames.lua +0 -1
  43. package/package.json +2 -2
  44. package/types/CollectibleIndex.d.ts +1 -1
  45. package/types/PickingUpItem.d.ts +3 -3
  46. package/types/PickingUpItem.lua +3 -3
  47. package/types/PlayerIndex.d.ts +1 -1
  48. package/types/private/IsaacAPIClass.d.ts +1 -1
  49. package/types/private/SerializedIsaacAPIClass.d.ts +1 -1
  50. package/types/private/TSTLClass.d.ts +1 -1
  51. package/enums/StageTravelEntityState.d.ts +0 -4
  52. package/enums/StageTravelEntityState.lua +0 -7
  53. package/enums/StageTravelState.d.ts +0 -6
  54. package/enums/StageTravelState.lua +0 -11
  55. package/features/customTrapdoor/constants.d.ts +0 -5
  56. package/features/customTrapdoor/constants.lua +0 -7
  57. package/features/customTrapdoor/exports.d.ts +0 -37
  58. package/features/customTrapdoor/exports.lua +0 -124
  59. package/features/customTrapdoor/init.d.ts +0 -1
  60. package/features/customTrapdoor/init.lua +0 -11
  61. package/features/customTrapdoor/stageTravel.d.ts +0 -0
  62. package/features/customTrapdoor/stageTravel.lua +0 -0
  63. package/features/customTrapdoor/trapdoor.d.ts +0 -0
  64. package/features/customTrapdoor/trapdoor.lua +0 -0
  65. package/features/customTrapdoor/v.d.ts +0 -14
  66. package/features/customTrapdoor/v.lua +0 -16
  67. package/interfaces/StageTravelEntityDescription.d.ts +0 -5
  68. package/interfaces/StageTravelEntityDescription.lua +0 -2
@@ -1,5 +1,7 @@
1
1
  local ____lualib = require("lualib_bundle")
2
2
  local Set = ____lualib.Set
3
+ local __TS__Spread = ____lualib.__TS__Spread
4
+ local __TS__ArrayMap = ____lualib.__TS__ArrayMap
3
5
  local __TS__New = ____lualib.__TS__New
4
6
  local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
5
7
  local __TS__ArrayFind = ____lualib.__TS__ArrayFind
@@ -18,14 +20,20 @@ local DEFAULT_DOOR_SLOT = ____doorSlotFlagToDoorSlot.DEFAULT_DOOR_SLOT
18
20
  local DOOR_SLOT_FLAG_TO_DOOR_SLOT = ____doorSlotFlagToDoorSlot.DOOR_SLOT_FLAG_TO_DOOR_SLOT
19
21
  local ____doorSlotToDirection = require("objects.doorSlotToDirection")
20
22
  local DOOR_SLOT_TO_DIRECTION = ____doorSlotToDirection.DOOR_SLOT_TO_DIRECTION
23
+ local ____doorSlotToDoorSlotFlag = require("objects.doorSlotToDoorSlotFlag")
24
+ local DOOR_SLOT_TO_DOOR_SLOT_FLAG = ____doorSlotToDoorSlotFlag.DOOR_SLOT_TO_DOOR_SLOT_FLAG
21
25
  local ____oppositeDoorSlots = require("objects.oppositeDoorSlots")
22
26
  local OPPOSITE_DOOR_SLOTS = ____oppositeDoorSlots.OPPOSITE_DOOR_SLOTS
23
27
  local ____roomShapeToDoorSlots = require("objects.roomShapeToDoorSlots")
24
28
  local ROOM_SHAPE_TO_DOOR_SLOTS = ____roomShapeToDoorSlots.ROOM_SHAPE_TO_DOOR_SLOTS
29
+ local ____bitwise = require("functions.bitwise")
30
+ local arrayToBitFlags = ____bitwise.arrayToBitFlags
25
31
  local ____direction = require("functions.direction")
26
32
  local directionToVector = ____direction.directionToVector
27
33
  local ____enums = require("functions.enums")
28
34
  local getEnumValues = ____enums.getEnumValues
35
+ local ____tstlClass = require("functions.tstlClass")
36
+ local isTSTLSet = ____tstlClass.isTSTLSet
29
37
  function ____exports.doorSlotToDirection(self, doorSlot)
30
38
  return DOOR_SLOT_TO_DIRECTION[doorSlot]
31
39
  end
@@ -52,13 +60,13 @@ function ____exports.getDoors(self, ...)
52
60
  do
53
61
  local door = room:GetDoor(doorSlot)
54
62
  if door == nil then
55
- goto __continue15
63
+ goto __continue18
56
64
  end
57
65
  if roomTypesSet.size == 0 or roomTypesSet:has(door.TargetRoomType) then
58
66
  doors[#doors + 1] = door
59
67
  end
60
68
  end
61
- ::__continue15::
69
+ ::__continue18::
62
70
  end
63
71
  return doors
64
72
  end
@@ -101,6 +109,9 @@ function ____exports.doorSlotFlagToDoorSlot(self, doorSlotFlag)
101
109
  local doorSlot = DOOR_SLOT_FLAG_TO_DOOR_SLOT[doorSlotFlag]
102
110
  return doorSlot == nil and DEFAULT_DOOR_SLOT or doorSlot
103
111
  end
112
+ function ____exports.doorSlotToDoorSlotFlag(self, doorSlot)
113
+ return DOOR_SLOT_TO_DOOR_SLOT_FLAG[doorSlot]
114
+ end
104
115
  function ____exports.getAngelRoomDoor(self)
105
116
  local angelRoomDoors = ____exports.getDoors(nil, RoomType.ANGEL)
106
117
  local ____temp_0
@@ -142,6 +153,16 @@ function ____exports.getDoorEnterPosition(self, door)
142
153
  local offset = ____exports.getDoorEnterPositionOffset(nil, door.Slot)
143
154
  return door.Position + offset
144
155
  end
156
+ --- Helper function to convert an array of door slots or a set of door slots to the resulting bit
157
+ -- flag number.
158
+ function ____exports.getDoorSlotFlags(self, doorSlots)
159
+ local doorSlotArray = isTSTLSet(nil, doorSlots) and ({__TS__Spread(doorSlots:values())}) or doorSlots
160
+ local doorSlotFlagArray = __TS__ArrayMap(
161
+ doorSlotArray,
162
+ function(____, doorSlot) return ____exports.doorSlotToDoorSlotFlag(nil, doorSlot) end
163
+ )
164
+ return arrayToBitFlags(nil, doorSlotFlagArray)
165
+ end
145
166
  --- Helper function to get the possible door slots that can exist for a given room shape.
146
167
  function ____exports.getDoorSlotsForRoomShape(self, roomShape)
147
168
  return ROOM_SHAPE_TO_DOOR_SLOTS[roomShape]
@@ -5,6 +5,12 @@ import { GridEntityType, GridEntityXMLType } from "isaac-typescript-definitions"
5
5
  * 1000.0 in a room XML file, but `GridEntityType.ROCK` is equal to 2.
6
6
  */
7
7
  export declare function convertXMLGridEntityType(gridEntityXMLType: GridEntityXMLType, gridEntityXMLVariant: int): [GridEntityType, int] | undefined;
8
+ /**
9
+ * Helper function to get every legal grid index for the current room.
10
+ *
11
+ * Under the hood, this uses the `Room.GetGridSize` method.
12
+ */
13
+ export declare function getAllGridIndexes(): int[];
8
14
  /**
9
15
  * Gets the entities that have a hitbox that overlaps with any part of the square that the grid
10
16
  * entity is on.
@@ -79,6 +85,9 @@ export declare function isPostBossVoidPortal(gridEntity: GridEntity): boolean;
79
85
  * Helper function to all grid entities in the room except for ones matching the grid entity types
80
86
  * provided.
81
87
  *
88
+ * Note that this function will automatically update the room. (This means that you can spawn new
89
+ * grid entities on the same tile on the same frame, if needed.)
90
+ *
82
91
  * For example:
83
92
  *
84
93
  * ```ts
@@ -95,6 +104,9 @@ export declare function removeAllGridExcept(...gridEntityTypes: GridEntityType[]
95
104
  * Helper function to remove all of the grid entities in the room that match the grid entity types
96
105
  * provided.
97
106
  *
107
+ * Note that this function will automatically update the room. (This means that you can spawn new
108
+ * grid entities on the same tile on the same frame, if needed.)
109
+ *
98
110
  * For example:
99
111
  *
100
112
  * ```ts
@@ -32,11 +32,18 @@ local ____utils = require("functions.utils")
32
32
  local erange = ____utils.erange
33
33
  local ____vector = require("functions.vector")
34
34
  local isVector = ____vector.isVector
35
- function getAllGridEntities(self)
35
+ --- Helper function to get every legal grid index for the current room.
36
+ --
37
+ -- Under the hood, this uses the `Room.GetGridSize` method.
38
+ function ____exports.getAllGridIndexes(self)
36
39
  local room = game:GetRoom()
37
40
  local gridSize = room:GetGridSize()
41
+ return erange(nil, gridSize)
42
+ end
43
+ function getAllGridEntities(self)
44
+ local room = game:GetRoom()
38
45
  local gridEntities = {}
39
- for ____, gridIndex in ipairs(erange(nil, gridSize)) do
46
+ for ____, gridIndex in ipairs(____exports.getAllGridIndexes(nil)) do
40
47
  local gridEntity = room:GetGridEntity(gridIndex)
41
48
  if gridEntity ~= nil then
42
49
  gridEntities[#gridEntities + 1] = gridEntity
@@ -277,6 +284,9 @@ end
277
284
  --- Helper function to all grid entities in the room except for ones matching the grid entity types
278
285
  -- provided.
279
286
  --
287
+ -- Note that this function will automatically update the room. (This means that you can spawn new
288
+ -- grid entities on the same tile on the same frame, if needed.)
289
+ --
280
290
  -- For example:
281
291
  --
282
292
  -- ```ts
@@ -307,6 +317,9 @@ end
307
317
  --- Helper function to remove all of the grid entities in the room that match the grid entity types
308
318
  -- provided.
309
319
  --
320
+ -- Note that this function will automatically update the room. (This means that you can spawn new
321
+ -- grid entities on the same tile on the same frame, if needed.)
322
+ --
310
323
  -- For example:
311
324
  --
312
325
  -- ```ts
@@ -2,7 +2,7 @@
2
2
  /// <reference types="typescript-to-lua/language-extensions" />
3
3
  import { SerializationType } from "../enums/SerializationType";
4
4
  declare type SerializedKColor = LuaTable<string, unknown> & {
5
- readonly __serializedKColorBrand: unique symbol;
5
+ readonly __serializedKColorBrand: symbol;
6
6
  };
7
7
  interface CopyKColorReturn {
8
8
  [SerializationType.NONE]: KColor;
@@ -11,7 +11,7 @@ export declare function getDebugPrependString(msg: string, numParentFunctions?:
11
11
  * function will also prepend the function name and the line number before the string.
12
12
  */
13
13
  export declare function log(this: void, msg: string): void;
14
- export declare function logArray<T>(this: void, array: T[]): void;
14
+ export declare function logArray<T>(this: void, array: T[] | readonly T[]): void;
15
15
  export declare function logColor(this: void, color: Color): void;
16
16
  /** Helper function for printing out every damage flag that is turned on. Useful when debugging. */
17
17
  export declare function logDamageFlags(this: void, flags: DamageFlag | BitFlags<DamageFlag>): void;
@@ -56,7 +56,7 @@ export declare function logRoom(this: void): void;
56
56
  * particular run.
57
57
  */
58
58
  export declare function logSeedEffects(this: void): void;
59
- export declare function logSet(this: void, set: Set<AnyNotNil>): void;
59
+ export declare function logSet(this: void, set: Set<AnyNotNil> | ReadonlySet<AnyNotNil>): void;
60
60
  /** Helper function for logging every sound effect that is currently playing. */
61
61
  export declare function logSounds(this: void): void;
62
62
  /**
@@ -3,7 +3,7 @@
3
3
  /// <reference types="typescript-to-lua/language-extensions" />
4
4
  import { SerializationType } from "../enums/SerializationType";
5
5
  declare type SerializedRNG = LuaTable<string, unknown> & {
6
- readonly __serializedRNGBrand: unique symbol;
6
+ readonly __serializedRNGBrand: symbol;
7
7
  };
8
8
  interface CopyRNGReturn {
9
9
  [SerializationType.NONE]: RNG;
package/functions/rng.lua CHANGED
@@ -122,11 +122,16 @@ function ____exports.setAllRNGToSeed(self, object, seed)
122
122
  if not isTable(nil, object) then
123
123
  error("Failed to iterate over the object containing RNG objects since the type of the provided object was: " .. __TS__TypeOf(object))
124
124
  end
125
+ local setAtLeastOneSeed = false
125
126
  for _key, value in pairs(object) do
126
127
  if ____exports.isRNG(nil, value) then
127
128
  ____exports.setSeed(nil, value, seed)
129
+ setAtLeastOneSeed = true
128
130
  end
129
131
  end
132
+ if not setAtLeastOneSeed then
133
+ error(("Failed to set all RNG objects to seed " .. tostring(seed)) .. " because the parent object did not contain any RNG objects.")
134
+ end
130
135
  end
131
136
  --- Helper function to iterate over the provided object and set the seed for all of the values that
132
137
  -- are RNG objects equal to the start seed for the current run.
@@ -17,14 +17,14 @@ export declare function getRoomShapeBottomRightPosition(roomShape: RoomShape): V
17
17
  * Helper function to get the bounds of a room shape, which are a box representing its contents.
18
18
  * This does not include the tiles that the walls are on. L rooms use the same bounds as a 2x2 room.
19
19
  */
20
- export declare function getRoomShapeBounds(roomShape: RoomShape): Vector;
20
+ export declare function getRoomShapeBounds(roomShape: RoomShape): readonly [width: int, height: int];
21
21
  /**
22
22
  * Helper function to get the dimensions of a room shape's layout. This is NOT the size of the
23
23
  * room's actual contents! For that, use the `getRoomShapeBounds` function.
24
24
  *
25
25
  * For example, a horizontal narrow room has a layout size of equal to that of a 1x1 room.
26
26
  */
27
- export declare function getRoomShapeLayoutSize(roomShape: RoomShape): Vector;
27
+ export declare function getRoomShapeLayoutSize(roomShape: RoomShape): readonly [width: int, height: int];
28
28
  /**
29
29
  * Helper function to get the grid position of the top-left tile of a given room shape.
30
30
  *
@@ -9,6 +9,7 @@ export declare function changeRoom(roomGridIndex: int): void;
9
9
  * Helper function to get an array with every valid `Dimension` (not including `Dimension.CURRENT`).
10
10
  */
11
11
  export declare function getAllDimensions(): Dimension[];
12
+ /** Helper function to get the grid index for every room on the entire floor. */
12
13
  export declare function getAllRoomGridIndexes(): int[];
13
14
  /**
14
15
  * Helper function to get the current dimension. Most of the time, this will be `Dimension.MAIN`,
@@ -123,6 +123,7 @@ end
123
123
  function ____exports.getAllDimensions(self)
124
124
  return erange(nil, NUM_DIMENSIONS)
125
125
  end
126
+ --- Helper function to get the grid index for every room on the entire floor.
126
127
  function ____exports.getAllRoomGridIndexes(self)
127
128
  local rooms = ____exports.getRooms(nil)
128
129
  return __TS__ArrayMap(
@@ -31,6 +31,23 @@ export declare function deleteSetsFromSet<T>(mainSet: Set<T>, ...setsToRemove: A
31
31
  * @param exceptions Optional. An array of elements to skip over if selected.
32
32
  */
33
33
  export declare function getRandomSetElement<T>(set: Set<T> | ReadonlySet<T>, seedOrRNG?: Seed | RNG, exceptions?: T[] | readonly T[]): T;
34
+ /**
35
+ * Helper function to get all possible combinations of the given set. This includes the combination
36
+ * of an empty set.
37
+ *
38
+ * For example, if this function is provided a set containing 1, 2, and 3, then it will return an
39
+ * array containing the following sets:
40
+ *
41
+ * - []
42
+ * - [1]
43
+ * - [2]
44
+ * - [3]
45
+ * - [1, 2]
46
+ * - [1, 3]
47
+ * - [2, 3]
48
+ * - [1, 2, 3]
49
+ */
50
+ export declare function getSetCombinations<T>(set: Set<T> | ReadonlySet<T>): ReadonlyArray<ReadonlySet<T>>;
34
51
  /**
35
52
  * Helper function to get a sorted array based on the contents of a set.
36
53
  *
package/functions/set.lua CHANGED
@@ -2,10 +2,12 @@ local ____lualib = require("lualib_bundle")
2
2
  local Set = ____lualib.Set
3
3
  local __TS__Iterator = ____lualib.__TS__Iterator
4
4
  local __TS__New = ____lualib.__TS__New
5
+ local __TS__ArrayMap = ____lualib.__TS__ArrayMap
5
6
  local __TS__Spread = ____lualib.__TS__Spread
6
7
  local __TS__ArraySort = ____lualib.__TS__ArraySort
7
8
  local ____exports = {}
8
9
  local ____array = require("functions.array")
10
+ local getArrayCombinations = ____array.getArrayCombinations
9
11
  local getRandomArrayElement = ____array.getRandomArrayElement
10
12
  local ____rng = require("functions.rng")
11
13
  local getRandomSeed = ____rng.getRandomSeed
@@ -80,4 +82,26 @@ function ____exports.getRandomSetElement(self, set, seedOrRNG, exceptions)
80
82
  local array = ____exports.getSortedSetValues(nil, set)
81
83
  return getRandomArrayElement(nil, array, seedOrRNG, exceptions)
82
84
  end
85
+ --- Helper function to get all possible combinations of the given set. This includes the combination
86
+ -- of an empty set.
87
+ --
88
+ -- For example, if this function is provided a set containing 1, 2, and 3, then it will return an
89
+ -- array containing the following sets:
90
+ --
91
+ -- - []
92
+ -- - [1]
93
+ -- - [2]
94
+ -- - [3]
95
+ -- - [1, 2]
96
+ -- - [1, 3]
97
+ -- - [2, 3]
98
+ -- - [1, 2, 3]
99
+ function ____exports.getSetCombinations(self, set)
100
+ local values = ____exports.getSortedSetValues(nil, set)
101
+ local combinations = getArrayCombinations(nil, values)
102
+ return __TS__ArrayMap(
103
+ combinations,
104
+ function(____, array) return __TS__New(Set, array) end
105
+ )
106
+ end
83
107
  return ____exports
@@ -1,4 +1,4 @@
1
- import { LevelStage, StageType } from "isaac-typescript-definitions";
1
+ import { LevelStage, RoomType, StageType } from "isaac-typescript-definitions";
2
2
  /**
3
3
  * Helper function that calculates what the stage type should be for the provided stage. This
4
4
  * emulates what the game's internal code does.
@@ -15,6 +15,11 @@ export declare function calculateStageTypeRepentance(stage: LevelStage): StageTy
15
15
  * consider Downpour 2 to have a stage of 3.
16
16
  */
17
17
  export declare function getEffectiveStage(): int;
18
+ /**
19
+ * Helper function to get the prefix to use with the "goto" console command that would correspond to
20
+ * the provided room type.
21
+ */
22
+ export declare function getGotoCommandPrefix(roomType: RoomType): string;
18
23
  /** Alias for the `Level.GetStage` method. */
19
24
  export declare function getStage(): LevelStage;
20
25
  /** Alias for the `Level.GetStageType` method. */
@@ -4,6 +4,8 @@ local LevelStage = ____isaac_2Dtypescript_2Ddefinitions.LevelStage
4
4
  local StageType = ____isaac_2Dtypescript_2Ddefinitions.StageType
5
5
  local ____cachedClasses = require("cachedClasses")
6
6
  local game = ____cachedClasses.game
7
+ local ____roomTypeGotoPrefixes = require("objects.roomTypeGotoPrefixes")
8
+ local ROOM_TYPE_GOTO_PREFIXES = ____roomTypeGotoPrefixes.ROOM_TYPE_GOTO_PREFIXES
7
9
  local ____stageTypeSuffixes = require("objects.stageTypeSuffixes")
8
10
  local STAGE_TYPE_SUFFIXES = ____stageTypeSuffixes.STAGE_TYPE_SUFFIXES
9
11
  local ____stageTypeToLetter = require("objects.stageTypeToLetter")
@@ -62,6 +64,11 @@ function ____exports.getEffectiveStage(self)
62
64
  end
63
65
  return stage
64
66
  end
67
+ --- Helper function to get the prefix to use with the "goto" console command that would correspond to
68
+ -- the provided room type.
69
+ function ____exports.getGotoCommandPrefix(self, roomType)
70
+ return ROOM_TYPE_GOTO_PREFIXES[roomType]
71
+ end
65
72
  --- Alias for the `Level.GetStage` method.
66
73
  function ____exports.getStage(self)
67
74
  local level = game:GetLevel()
@@ -2,7 +2,7 @@
2
2
  import { Direction } from "isaac-typescript-definitions";
3
3
  import { SerializationType } from "../enums/SerializationType";
4
4
  declare type SerializedVector = LuaTable<string, unknown> & {
5
- readonly __serializedVectorBrand: unique symbol;
5
+ readonly __serializedVectorBrand: symbol;
6
6
  };
7
7
  interface CopyVectorReturn {
8
8
  [SerializationType.NONE]: Vector;
package/index.d.ts CHANGED
@@ -12,7 +12,6 @@ export * from "./enums/SerializationType";
12
12
  export { ConversionHeartSubType, registerCharacterHealthConversion, } from "./features/characterHealthConversion";
13
13
  export { registerCharacterStats } from "./features/characterStats";
14
14
  export { getCollectibleItemPoolType } from "./features/collectibleItemPoolType";
15
- export * from "./features/customTrapdoor/exports";
16
15
  export * from "./features/debugDisplay/exports";
17
16
  export { deployJSONRoom, deployRandomJSONRoom, emptyRoom, } from "./features/deployJSONRoom";
18
17
  export { disableAllSound, enableAllSound } from "./features/disableAllSound";
package/index.lua CHANGED
@@ -100,14 +100,6 @@ do
100
100
  local getCollectibleItemPoolType = ____collectibleItemPoolType.getCollectibleItemPoolType
101
101
  ____exports.getCollectibleItemPoolType = getCollectibleItemPoolType
102
102
  end
103
- do
104
- local ____export = require("features.customTrapdoor.exports")
105
- for ____exportKey, ____exportValue in pairs(____export) do
106
- if ____exportKey ~= "default" then
107
- ____exports[____exportKey] = ____exportValue
108
- end
109
- end
110
- end
111
103
  do
112
104
  local ____export = require("features.debugDisplay.exports")
113
105
  for ____exportKey, ____exportValue in pairs(____export) do
package/initFeatures.lua CHANGED
@@ -5,8 +5,6 @@ local ____characterStats = require("features.characterStats")
5
5
  local characterStatsInit = ____characterStats.characterStatsInit
6
6
  local ____collectibleItemPoolType = require("features.collectibleItemPoolType")
7
7
  local collectibleItemPoolTypeInit = ____collectibleItemPoolType.collectibleItemPoolTypeInit
8
- local ____init = require("features.customTrapdoor.init")
9
- local stageTravelInit = ____init.stageTravelInit
10
8
  local ____deployJSONRoom = require("features.deployJSONRoom")
11
9
  local deployJSONRoomInit = ____deployJSONRoom.deployJSONRoomInit
12
10
  local ____disableAllSound = require("features.disableAllSound")
@@ -60,7 +58,6 @@ function ____exports.initFeaturesMinor(self, mod)
60
58
  roomClearFrameInit(nil, mod)
61
59
  sirenHelpersInit(nil, mod)
62
60
  stageHistoryInit(nil, mod)
63
- stageTravelInit(nil)
64
61
  taintedLazarusPlayersInit(nil, mod)
65
62
  end
66
63
  return ____exports
@@ -6,7 +6,6 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitio
6
6
  local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
7
7
  --- Maps room type names to room types.
8
8
  ____exports.ROOM_TYPE_MAP = __TS__New(Map, {
9
- {"null", RoomType.NULL},
10
9
  {"default", RoomType.DEFAULT},
11
10
  {"shop", RoomType.SHOP},
12
11
  {"error", RoomType.ERROR},
@@ -0,0 +1,4 @@
1
+ import { DoorSlot, DoorSlotFlag } from "isaac-typescript-definitions";
2
+ export declare const DOOR_SLOT_TO_DOOR_SLOT_FLAG: {
3
+ readonly [key in DoorSlot]: DoorSlotFlag;
4
+ };
@@ -0,0 +1,17 @@
1
+ local ____exports = {}
2
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
3
+ local DoorSlot = ____isaac_2Dtypescript_2Ddefinitions.DoorSlot
4
+ local DoorSlotFlag = ____isaac_2Dtypescript_2Ddefinitions.DoorSlotFlag
5
+ local DoorSlotFlagZero = ____isaac_2Dtypescript_2Ddefinitions.DoorSlotFlagZero
6
+ ____exports.DOOR_SLOT_TO_DOOR_SLOT_FLAG = {
7
+ [DoorSlot.NO_DOOR_SLOT] = DoorSlotFlagZero,
8
+ [DoorSlot.LEFT_0] = DoorSlotFlag.LEFT_0,
9
+ [DoorSlot.UP_0] = DoorSlotFlag.UP_0,
10
+ [DoorSlot.RIGHT_0] = DoorSlotFlag.RIGHT_0,
11
+ [DoorSlot.DOWN_0] = DoorSlotFlag.DOWN_0,
12
+ [DoorSlot.LEFT_1] = DoorSlotFlag.LEFT_1,
13
+ [DoorSlot.UP_1] = DoorSlotFlag.UP_1,
14
+ [DoorSlot.RIGHT_1] = DoorSlotFlag.RIGHT_1,
15
+ [DoorSlot.DOWN_1] = DoorSlotFlag.DOWN_1
16
+ }
17
+ return ____exports
@@ -4,5 +4,5 @@ import { RoomShape } from "isaac-typescript-definitions";
4
4
  * rooms use the same bounds as a 2x2 room.
5
5
  */
6
6
  export declare const ROOM_SHAPE_BOUNDS: {
7
- readonly [key in RoomShape]: Vector;
7
+ readonly [key in RoomShape]: readonly [width: int, height: int];
8
8
  };
@@ -6,17 +6,17 @@ local NARROW_CONTENTS_HEIGHT = ____roomShapeVolumes.NARROW_CONTENTS_HEIGHT
6
6
  local NARROW_CONTENTS_WIDTH = ____roomShapeVolumes.NARROW_CONTENTS_WIDTH
7
7
  local ONE_BY_ONE_CONTENTS_HEIGHT = ____roomShapeVolumes.ONE_BY_ONE_CONTENTS_HEIGHT
8
8
  local ONE_BY_ONE_CONTENTS_WIDTH = ____roomShapeVolumes.ONE_BY_ONE_CONTENTS_WIDTH
9
- local TWO_BY_TWO_BOUNDS = Vector(ONE_BY_ONE_CONTENTS_WIDTH * 2, ONE_BY_ONE_CONTENTS_HEIGHT * 2)
9
+ local TWO_BY_TWO_BOUNDS = {ONE_BY_ONE_CONTENTS_WIDTH * 2, ONE_BY_ONE_CONTENTS_HEIGHT * 2}
10
10
  --- The size of a room shape's contents. This does not include the tiles that the walls are on. L
11
11
  -- rooms use the same bounds as a 2x2 room.
12
12
  ____exports.ROOM_SHAPE_BOUNDS = {
13
- [RoomShape.SHAPE_1x1] = Vector(ONE_BY_ONE_CONTENTS_WIDTH, ONE_BY_ONE_CONTENTS_HEIGHT),
14
- [RoomShape.IH] = Vector(ONE_BY_ONE_CONTENTS_WIDTH, NARROW_CONTENTS_HEIGHT),
15
- [RoomShape.IV] = Vector(NARROW_CONTENTS_WIDTH, ONE_BY_ONE_CONTENTS_HEIGHT),
16
- [RoomShape.SHAPE_1x2] = Vector(ONE_BY_ONE_CONTENTS_WIDTH, ONE_BY_ONE_CONTENTS_HEIGHT * 2),
17
- [RoomShape.IIV] = Vector(NARROW_CONTENTS_WIDTH, ONE_BY_ONE_CONTENTS_HEIGHT * 2),
18
- [RoomShape.SHAPE_2x1] = Vector(ONE_BY_ONE_CONTENTS_WIDTH * 2, ONE_BY_ONE_CONTENTS_HEIGHT),
19
- [RoomShape.IIH] = Vector(ONE_BY_ONE_CONTENTS_WIDTH * 2, NARROW_CONTENTS_HEIGHT),
13
+ [RoomShape.SHAPE_1x1] = {ONE_BY_ONE_CONTENTS_WIDTH, ONE_BY_ONE_CONTENTS_HEIGHT},
14
+ [RoomShape.IH] = {ONE_BY_ONE_CONTENTS_WIDTH, NARROW_CONTENTS_HEIGHT},
15
+ [RoomShape.IV] = {NARROW_CONTENTS_WIDTH, ONE_BY_ONE_CONTENTS_HEIGHT},
16
+ [RoomShape.SHAPE_1x2] = {ONE_BY_ONE_CONTENTS_WIDTH, ONE_BY_ONE_CONTENTS_HEIGHT * 2},
17
+ [RoomShape.IIV] = {NARROW_CONTENTS_WIDTH, ONE_BY_ONE_CONTENTS_HEIGHT * 2},
18
+ [RoomShape.SHAPE_2x1] = {ONE_BY_ONE_CONTENTS_WIDTH * 2, ONE_BY_ONE_CONTENTS_HEIGHT},
19
+ [RoomShape.IIH] = {ONE_BY_ONE_CONTENTS_WIDTH * 2, NARROW_CONTENTS_HEIGHT},
20
20
  [RoomShape.SHAPE_2x2] = TWO_BY_TWO_BOUNDS,
21
21
  [RoomShape.LTL] = TWO_BY_TWO_BOUNDS,
22
22
  [RoomShape.LTR] = TWO_BY_TWO_BOUNDS,
@@ -6,5 +6,5 @@ import { RoomShape } from "isaac-typescript-definitions";
6
6
  * For example, a horizontal narrow room has a layout size of equal to that of a 1x1 room.
7
7
  */
8
8
  export declare const ROOM_SHAPE_LAYOUT_SIZES: {
9
- readonly [key in RoomShape]: Vector;
9
+ readonly [key in RoomShape]: readonly [width: int, height: int];
10
10
  };
@@ -4,10 +4,10 @@ local RoomShape = ____isaac_2Dtypescript_2Ddefinitions.RoomShape
4
4
  local ____roomShapeVolumes = require("objects.roomShapeVolumes")
5
5
  local ONE_BY_ONE_CONTENTS_HEIGHT = ____roomShapeVolumes.ONE_BY_ONE_CONTENTS_HEIGHT
6
6
  local ONE_BY_ONE_CONTENTS_WIDTH = ____roomShapeVolumes.ONE_BY_ONE_CONTENTS_WIDTH
7
- local ONE_BY_ONE_LAYOUT_SIZE = Vector(ONE_BY_ONE_CONTENTS_WIDTH, ONE_BY_ONE_CONTENTS_HEIGHT)
8
- local TWO_BY_ONE_VERTICAL_LAYOUT_SIZE = Vector(ONE_BY_ONE_CONTENTS_WIDTH, ONE_BY_ONE_CONTENTS_HEIGHT * 2)
9
- local TWO_BY_ONE_HORIZONTAL_LAYOUT_SIZE = Vector(ONE_BY_ONE_CONTENTS_WIDTH * 2, ONE_BY_ONE_CONTENTS_HEIGHT)
10
- local TWO_BY_TWO_LAYOUT_SIZE = Vector(ONE_BY_ONE_CONTENTS_WIDTH * 2, ONE_BY_ONE_CONTENTS_HEIGHT * 2)
7
+ local ONE_BY_ONE_LAYOUT_SIZE = {ONE_BY_ONE_CONTENTS_WIDTH, ONE_BY_ONE_CONTENTS_HEIGHT}
8
+ local TWO_BY_ONE_VERTICAL_LAYOUT_SIZE = {ONE_BY_ONE_CONTENTS_WIDTH, ONE_BY_ONE_CONTENTS_HEIGHT * 2}
9
+ local TWO_BY_ONE_HORIZONTAL_LAYOUT_SIZE = {ONE_BY_ONE_CONTENTS_WIDTH * 2, ONE_BY_ONE_CONTENTS_HEIGHT}
10
+ local TWO_BY_TWO_LAYOUT_SIZE = {ONE_BY_ONE_CONTENTS_WIDTH * 2, ONE_BY_ONE_CONTENTS_HEIGHT * 2}
11
11
  --- The dimensions of a room shape's layout. This is NOT the size of the room's actual contents! For
12
12
  -- that, use `ROOM_SHAPE_BOUNDS`.
13
13
  --
@@ -0,0 +1,4 @@
1
+ import { RoomType } from "isaac-typescript-definitions";
2
+ export declare const ROOM_TYPE_GOTO_PREFIXES: {
3
+ readonly [key in RoomType]: string;
4
+ };
@@ -0,0 +1,35 @@
1
+ local ____exports = {}
2
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
3
+ local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
4
+ ____exports.ROOM_TYPE_GOTO_PREFIXES = {
5
+ [RoomType.DEFAULT] = "d.",
6
+ [RoomType.SHOP] = "s.shop.",
7
+ [RoomType.ERROR] = "s.error.",
8
+ [RoomType.TREASURE] = "s.treasure.",
9
+ [RoomType.BOSS] = "s.boss.",
10
+ [RoomType.MINI_BOSS] = "s.miniboss.",
11
+ [RoomType.SECRET] = "s.secret.",
12
+ [RoomType.SUPER_SECRET] = "s.supersecret.",
13
+ [RoomType.ARCADE] = "s.arcade.",
14
+ [RoomType.CURSE] = "s.curse.",
15
+ [RoomType.CHALLENGE] = "s.challenge.",
16
+ [RoomType.LIBRARY] = "s.library.",
17
+ [RoomType.SACRIFICE] = "s.sacrifice.",
18
+ [RoomType.DEVIL] = "s.devil.",
19
+ [RoomType.ANGEL] = "s.angel.",
20
+ [RoomType.DUNGEON] = "s.itemdungeon.",
21
+ [RoomType.BOSS_RUSH] = "s.bossrush.",
22
+ [RoomType.CLEAN_BEDROOM] = "s.isaacs.",
23
+ [RoomType.DIRTY_BEDROOM] = "s.barren.",
24
+ [RoomType.CHEST] = "s.chest.",
25
+ [RoomType.DICE] = "s.dice.",
26
+ [RoomType.BLACK_MARKET] = "s.blackmarket.",
27
+ [RoomType.GREED_EXIT] = "s.greedexit.",
28
+ [RoomType.PLANETARIUM] = "s.planetarium.",
29
+ [RoomType.TELEPORTER] = "s.teleporter.",
30
+ [RoomType.TELEPORTER_EXIT] = "s.teleporterexit.",
31
+ [RoomType.SECRET_EXIT] = "s.secretexit.",
32
+ [RoomType.BLUE] = "s.blue.",
33
+ [RoomType.ULTRA_SECRET] = "s.ultrasecret."
34
+ }
35
+ return ____exports
@@ -3,7 +3,6 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitio
3
3
  local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
4
4
  ____exports.DEFAULT_ROOM_TYPE_NAME = "Unknown"
5
5
  ____exports.ROOM_TYPE_NAMES = {
6
- [RoomType.NULL] = "null room",
7
6
  [RoomType.DEFAULT] = "default room",
8
7
  [RoomType.SHOP] = "shop",
9
8
  [RoomType.ERROR] = "I AM ERROR Room",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "4.5.2",
3
+ "version": "4.7.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -22,6 +22,6 @@
22
22
  "main": "index",
23
23
  "types": "index.d.ts",
24
24
  "dependencies": {
25
- "isaac-typescript-definitions": "^3.0.13"
25
+ "isaac-typescript-definitions": "^3.0.15"
26
26
  }
27
27
  }
@@ -12,5 +12,5 @@
12
12
  * This type is branded for extra type safety.
13
13
  */
14
14
  export declare type CollectibleIndex = string & {
15
- readonly __collectibleIndexBrand: unique symbol;
15
+ readonly __collectibleIndexBrand: symbol;
16
16
  };
@@ -27,8 +27,8 @@ export interface PickingUpItemTrinket {
27
27
  subType: TrinketType;
28
28
  }
29
29
  /** Helper function to narrow the type of `PickingUpItem`. */
30
- export declare function pickingUpItemIsNull(pickingUpItem: PickingUpItem): pickingUpItem is PickingUpItemTrinket;
30
+ export declare function isPickingUpItemNull(pickingUpItem: PickingUpItem): pickingUpItem is PickingUpItemTrinket;
31
31
  /** Helper function to narrow the type of `PickingUpItem`. */
32
- export declare function pickingUpItemIsCollectible(pickingUpItem: PickingUpItem): pickingUpItem is PickingUpItemCollectible;
32
+ export declare function isPickingUpItemCollectible(pickingUpItem: PickingUpItem): pickingUpItem is PickingUpItemCollectible;
33
33
  /** Helper function to narrow the type of `PickingUpItem`. */
34
- export declare function pickingUpItemIsTrinket(pickingUpItem: PickingUpItem): pickingUpItem is PickingUpItemTrinket;
34
+ export declare function isPickingUpItemTrinket(pickingUpItem: PickingUpItem): pickingUpItem is PickingUpItemTrinket;
@@ -20,15 +20,15 @@ function ____exports.resetPickingUpItem(self, pickingUpItem)
20
20
  end
21
21
  local COLLECTIBLE_ITEM_TYPES = __TS__New(Set, {ItemType.PASSIVE, ItemType.ACTIVE, ItemType.FAMILIAR})
22
22
  --- Helper function to narrow the type of `PickingUpItem`.
23
- function ____exports.pickingUpItemIsNull(self, pickingUpItem)
23
+ function ____exports.isPickingUpItemNull(self, pickingUpItem)
24
24
  return pickingUpItem.itemType == ItemType.NULL
25
25
  end
26
26
  --- Helper function to narrow the type of `PickingUpItem`.
27
- function ____exports.pickingUpItemIsCollectible(self, pickingUpItem)
27
+ function ____exports.isPickingUpItemCollectible(self, pickingUpItem)
28
28
  return COLLECTIBLE_ITEM_TYPES:has(pickingUpItem.itemType)
29
29
  end
30
30
  --- Helper function to narrow the type of `PickingUpItem`.
31
- function ____exports.pickingUpItemIsTrinket(self, pickingUpItem)
31
+ function ____exports.isPickingUpItemTrinket(self, pickingUpItem)
32
32
  return pickingUpItem.itemType == ItemType.TRINKET
33
33
  end
34
34
  return ____exports
@@ -12,5 +12,5 @@
12
12
  * This type is branded for extra type safety.
13
13
  */
14
14
  export declare type PlayerIndex = int & {
15
- readonly __playerIndexBrand: unique symbol;
15
+ readonly __playerIndexBrand: symbol;
16
16
  };
@@ -1,4 +1,4 @@
1
1
  /// <reference types="typescript-to-lua/language-extensions" />
2
2
  export declare type IsaacAPIClass = LuaTable<string, unknown> & {
3
- readonly __isaacAPIClassBrand: unique symbol;
3
+ readonly __isaacAPIClassBrand: symbol;
4
4
  };
@@ -1,4 +1,4 @@
1
1
  /// <reference types="typescript-to-lua/language-extensions" />
2
2
  export declare type SerializedIsaacAPIClass = LuaTable<string, unknown> & {
3
- readonly __serializedIsaacAPIClassBrand: unique symbol;
3
+ readonly __serializedIsaacAPIClassBrand: symbol;
4
4
  };
@@ -1,4 +1,4 @@
1
1
  /// <reference types="typescript-to-lua/language-extensions" />
2
2
  export declare type TSTLClass = LuaTable<AnyNotNil, unknown> & {
3
- readonly __tstlClassBrand: unique symbol;
3
+ readonly __tstlClassBrand: symbol;
4
4
  };
@@ -1,4 +0,0 @@
1
- export declare enum StageTravelEntityState {
2
- OPEN = 0,
3
- CLOSED = 1
4
- }