isaacscript-common 6.20.1 → 6.22.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 (122) hide show
  1. package/dist/constants.d.ts +6 -0
  2. package/dist/constants.d.ts.map +1 -1
  3. package/dist/constants.lua +4 -0
  4. package/dist/constantsFirstLast.d.ts +2 -2
  5. package/dist/constantsFirstLast.lua +2 -2
  6. package/dist/enums/RockAltType.d.ts +12 -1
  7. package/dist/enums/RockAltType.d.ts.map +1 -1
  8. package/dist/enums/RockAltType.lua +4 -2
  9. package/dist/enums/private/StageTravelState.d.ts +4 -3
  10. package/dist/enums/private/StageTravelState.d.ts.map +1 -1
  11. package/dist/enums/private/StageTravelState.lua +6 -4
  12. package/dist/features/customStage/backdrop.d.ts.map +1 -1
  13. package/dist/features/customStage/backdrop.lua +3 -2
  14. package/dist/features/customStage/customStageConstants.d.ts +11 -0
  15. package/dist/features/customStage/customStageConstants.d.ts.map +1 -1
  16. package/dist/features/customStage/customStageConstants.lua +10 -0
  17. package/dist/features/customStage/customStageGridEntities.d.ts +1 -0
  18. package/dist/features/customStage/customStageGridEntities.d.ts.map +1 -1
  19. package/dist/features/customStage/customStageGridEntities.lua +65 -23
  20. package/dist/features/customStage/exports.d.ts +17 -3
  21. package/dist/features/customStage/exports.d.ts.map +1 -1
  22. package/dist/features/customStage/exports.lua +65 -46
  23. package/dist/features/customStage/init.d.ts.map +1 -1
  24. package/dist/features/customStage/init.lua +7 -12
  25. package/dist/features/customStage/shadows.d.ts.map +1 -1
  26. package/dist/features/customStage/shadows.lua +2 -1
  27. package/dist/features/customStage/streakText.d.ts +0 -7
  28. package/dist/features/customStage/streakText.d.ts.map +1 -1
  29. package/dist/features/customStage/streakText.lua +52 -85
  30. package/dist/features/customStage/v.d.ts +13 -0
  31. package/dist/features/customStage/v.d.ts.map +1 -1
  32. package/dist/features/customStage/v.lua +6 -1
  33. package/dist/features/customStage/versusScreen.d.ts.map +1 -1
  34. package/dist/features/customStage/versusScreen.lua +32 -1
  35. package/dist/features/customTrapdoor/blackSprite.d.ts.map +1 -1
  36. package/dist/features/customTrapdoor/blackSprite.lua +2 -1
  37. package/dist/features/customTrapdoor/customTrapdoorConstants.d.ts +4 -0
  38. package/dist/features/customTrapdoor/customTrapdoorConstants.d.ts.map +1 -1
  39. package/dist/features/customTrapdoor/exports.d.ts +11 -7
  40. package/dist/features/customTrapdoor/exports.d.ts.map +1 -1
  41. package/dist/features/customTrapdoor/exports.lua +6 -5
  42. package/dist/features/customTrapdoor/init.d.ts.map +1 -1
  43. package/dist/features/customTrapdoor/init.lua +35 -20
  44. package/dist/features/customTrapdoor/touched.lua +1 -1
  45. package/dist/features/customTrapdoor/v.d.ts +2 -2
  46. package/dist/features/customTrapdoor/v.d.ts.map +1 -1
  47. package/dist/features/extraConsoleCommands/commandsSubroutines.d.ts.map +1 -1
  48. package/dist/features/extraConsoleCommands/commandsSubroutines.lua +3 -3
  49. package/dist/features/playerInventory.d.ts +7 -0
  50. package/dist/features/playerInventory.d.ts.map +1 -1
  51. package/dist/features/playerInventory.lua +7 -0
  52. package/dist/features/saveDataManager/exports.d.ts +3 -0
  53. package/dist/features/saveDataManager/exports.d.ts.map +1 -1
  54. package/dist/features/saveDataManager/exports.lua +3 -0
  55. package/dist/functions/collectibleSet.d.ts +1 -1
  56. package/dist/functions/collectibleSet.lua +1 -1
  57. package/dist/functions/doors.d.ts +10 -0
  58. package/dist/functions/doors.d.ts.map +1 -1
  59. package/dist/functions/doors.lua +6 -0
  60. package/dist/functions/levelGrid.lua +1 -1
  61. package/dist/functions/log.d.ts +1 -15
  62. package/dist/functions/log.d.ts.map +1 -1
  63. package/dist/functions/log.lua +3 -218
  64. package/dist/functions/logEntities.d.ts +16 -0
  65. package/dist/functions/logEntities.d.ts.map +1 -0
  66. package/dist/functions/logEntities.lua +220 -0
  67. package/dist/functions/rockAlt.d.ts +6 -5
  68. package/dist/functions/rockAlt.d.ts.map +1 -1
  69. package/dist/functions/rockAlt.lua +147 -18
  70. package/dist/functions/roomData.d.ts +1 -1
  71. package/dist/functions/roomData.d.ts.map +1 -1
  72. package/dist/functions/roomTransition.d.ts +26 -0
  73. package/dist/functions/roomTransition.d.ts.map +1 -0
  74. package/dist/functions/roomTransition.lua +75 -0
  75. package/dist/functions/rooms.d.ts +36 -35
  76. package/dist/functions/rooms.d.ts.map +1 -1
  77. package/dist/functions/rooms.lua +94 -99
  78. package/dist/index.d.ts +1 -0
  79. package/dist/index.d.ts.map +1 -1
  80. package/dist/index.lua +8 -0
  81. package/dist/interfaces/private/CustomTrapdoorDescription.d.ts +2 -2
  82. package/dist/interfaces/private/CustomTrapdoorDescription.d.ts.map +1 -1
  83. package/dist/objects/backdropTypeToRockAltType.lua +3 -3
  84. package/dist/types/TrapdoorDestination.d.ts +3 -0
  85. package/dist/types/TrapdoorDestination.d.ts.map +1 -0
  86. package/dist/types/TrapdoorDestination.lua +2 -0
  87. package/package.json +2 -2
  88. package/src/constants.ts +6 -0
  89. package/src/constantsFirstLast.ts +2 -2
  90. package/src/enums/RockAltType.ts +14 -1
  91. package/src/enums/private/StageTravelState.ts +2 -1
  92. package/src/features/customStage/backdrop.ts +2 -1
  93. package/src/features/customStage/customStageConstants.ts +16 -0
  94. package/src/features/customStage/customStageGridEntities.ts +61 -0
  95. package/src/features/customStage/exports.ts +81 -42
  96. package/src/features/customStage/init.ts +7 -18
  97. package/src/features/customStage/shadows.ts +2 -1
  98. package/src/features/customStage/streakText.ts +59 -96
  99. package/src/features/customStage/v.ts +17 -0
  100. package/src/features/customStage/versusScreen.ts +29 -0
  101. package/src/features/customTrapdoor/blackSprite.ts +6 -1
  102. package/src/features/customTrapdoor/customTrapdoorConstants.ts +4 -0
  103. package/src/features/customTrapdoor/exports.ts +8 -6
  104. package/src/features/customTrapdoor/init.ts +55 -23
  105. package/src/features/customTrapdoor/touched.ts +4 -1
  106. package/src/features/customTrapdoor/v.ts +2 -5
  107. package/src/features/extraConsoleCommands/commandsSubroutines.ts +4 -1
  108. package/src/features/playerInventory.ts +7 -0
  109. package/src/features/saveDataManager/exports.ts +3 -0
  110. package/src/functions/collectibleSet.ts +1 -1
  111. package/src/functions/doors.ts +10 -0
  112. package/src/functions/levelGrid.ts +1 -1
  113. package/src/functions/log.ts +1 -279
  114. package/src/functions/logEntities.ts +276 -0
  115. package/src/functions/rockAlt.ts +147 -19
  116. package/src/functions/roomData.ts +1 -1
  117. package/src/functions/roomTransition.ts +78 -0
  118. package/src/functions/rooms.ts +104 -107
  119. package/src/index.ts +1 -0
  120. package/src/interfaces/private/CustomTrapdoorDescription.ts +2 -2
  121. package/src/objects/backdropTypeToRockAltType.ts +3 -3
  122. package/src/types/TrapdoorDestination.ts +5 -0
@@ -1,8 +1,12 @@
1
1
  local ____lualib = require("lualib_bundle")
2
+ local __TS__SparseArrayNew = ____lualib.__TS__SparseArrayNew
3
+ local __TS__SparseArrayPush = ____lualib.__TS__SparseArrayPush
4
+ local __TS__SparseArraySpread = ____lualib.__TS__SparseArraySpread
2
5
  local Map = ____lualib.Map
3
6
  local __TS__New = ____lualib.__TS__New
4
7
  local __TS__Spread = ____lualib.__TS__Spread
5
8
  local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
9
+ local __TS__ArrayMap = ____lualib.__TS__ArrayMap
6
10
  local __TS__StringIncludes = ____lualib.__TS__StringIncludes
7
11
  local Set = ____lualib.Set
8
12
  local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
@@ -10,15 +14,12 @@ local ____exports = {}
10
14
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
11
15
  local AngelRoomSubType = ____isaac_2Dtypescript_2Ddefinitions.AngelRoomSubType
12
16
  local Dimension = ____isaac_2Dtypescript_2Ddefinitions.Dimension
13
- local Direction = ____isaac_2Dtypescript_2Ddefinitions.Direction
14
17
  local DoorSlot = ____isaac_2Dtypescript_2Ddefinitions.DoorSlot
15
18
  local DungeonSubType = ____isaac_2Dtypescript_2Ddefinitions.DungeonSubType
16
19
  local GridRoom = ____isaac_2Dtypescript_2Ddefinitions.GridRoom
17
20
  local HomeRoomSubType = ____isaac_2Dtypescript_2Ddefinitions.HomeRoomSubType
18
- local LevelCurse = ____isaac_2Dtypescript_2Ddefinitions.LevelCurse
19
21
  local RoomDescriptorFlag = ____isaac_2Dtypescript_2Ddefinitions.RoomDescriptorFlag
20
22
  local RoomShape = ____isaac_2Dtypescript_2Ddefinitions.RoomShape
21
- local RoomTransitionAnim = ____isaac_2Dtypescript_2Ddefinitions.RoomTransitionAnim
22
23
  local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
23
24
  local SoundEffect = ____isaac_2Dtypescript_2Ddefinitions.SoundEffect
24
25
  local StageID = ____isaac_2Dtypescript_2Ddefinitions.StageID
@@ -27,12 +28,11 @@ local game = ____cachedClasses.game
27
28
  local sfxManager = ____cachedClasses.sfxManager
28
29
  local ____constants = require("constants")
29
30
  local MAX_LEVEL_GRID_INDEX = ____constants.MAX_LEVEL_GRID_INDEX
31
+ local NUM_DIMENSIONS = ____constants.NUM_DIMENSIONS
30
32
  local ____roomTypeNames = require("objects.roomTypeNames")
31
33
  local ROOM_TYPE_NAMES = ____roomTypeNames.ROOM_TYPE_NAMES
32
34
  local ____mineShaftRoomSubTypesSet = require("sets.mineShaftRoomSubTypesSet")
33
35
  local MINE_SHAFT_ROOM_SUB_TYPE_SET = ____mineShaftRoomSubTypesSet.MINE_SHAFT_ROOM_SUB_TYPE_SET
34
- local ____curses = require("functions.curses")
35
- local hasCurse = ____curses.hasCurse
36
36
  local ____dimensions = require("functions.dimensions")
37
37
  local inDimension = ____dimensions.inDimension
38
38
  local ____doors = require("functions.doors")
@@ -51,109 +51,85 @@ local setEntityPositions = ____positionVelocity.setEntityPositions
51
51
  local setEntityVelocities = ____positionVelocity.setEntityVelocities
52
52
  local ____roomData = require("functions.roomData")
53
53
  local getRoomData = ____roomData.getRoomData
54
+ local getRoomDescriptor = ____roomData.getRoomDescriptor
54
55
  local getRoomDescriptorReadOnly = ____roomData.getRoomDescriptorReadOnly
55
56
  local getRoomGridIndex = ____roomData.getRoomGridIndex
56
57
  local getRoomName = ____roomData.getRoomName
57
58
  local getRoomStageID = ____roomData.getRoomStageID
58
59
  local getRoomSubType = ____roomData.getRoomSubType
60
+ local ____roomTransition = require("functions.roomTransition")
61
+ local reloadRoom = ____roomTransition.reloadRoom
59
62
  local ____stage = require("functions.stage")
60
63
  local getGotoCommand = ____stage.getGotoCommand
61
64
  local ____utils = require("functions.utils")
65
+ local erange = ____utils.erange
62
66
  local irange = ____utils.irange
63
- --- Helper function to get the room descriptor for every room on the level. This includes off-grid
64
- -- rooms, such as the Devil Room. (Off-grid rooms will only be included if they the data exists,
65
- -- which only usually happens once they have been visited at least once.)
67
+ --- Helper function to get a read-only copy of the room descriptor for every room on the level. This
68
+ -- includes off-grid rooms, such as the Devil Room, and extra-dimensional rooms, if they are
69
+ -- generated and exist.
66
70
  --
67
- -- Under the hood, this function uses the `Level.GetRooms` method to accomplish this. Rooms without
68
- -- data are assumed to be non-existent and are not added to the list.
71
+ -- Room descriptors without any data are assumed to be non-existent and are not included.
69
72
  --
70
- -- @param includeExtraDimensionalRooms Optional. On some floors (e.g. Downpour 2, Mines 2),
71
- -- extra-dimensional rooms are automatically generated and can be
72
- -- seen when you iterate over the `RoomList`. Default is false.
73
- function ____exports.getRooms(self, includeExtraDimensionalRooms)
74
- if includeExtraDimensionalRooms == nil then
75
- includeExtraDimensionalRooms = false
76
- end
73
+ -- Under the hood, this is performed by iterating over the `RoomList` from the `Level.GetRooms`
74
+ -- method. This is the best way to see if off-grid rooms have been initialized, since it is possible
75
+ -- for mods to insert room data at non-official negative room grid indexes.
76
+ function ____exports.getReadOnlyRooms(self)
77
77
  local level = game:GetLevel()
78
78
  local roomList = level:GetRooms()
79
- --- Indexed by room safe grid index. We use a map to avoid adding extra dimensional rooms.
80
- local roomsMap = __TS__New(Map)
79
+ local readOnlyRoomDescriptors = {}
81
80
  do
82
81
  local i = 0
83
82
  while i < roomList.Size do
84
- do
85
- local roomDescriptor = roomList:Get(i)
86
- if roomDescriptor == nil or roomDescriptor.Data == nil then
87
- goto __continue10
88
- end
89
- if not includeExtraDimensionalRooms and roomsMap:has(roomDescriptor.SafeGridIndex) then
90
- goto __continue10
91
- end
92
- roomsMap:set(roomDescriptor.SafeGridIndex, roomDescriptor)
83
+ local readOnlyRoomDescriptor = roomList:Get(i)
84
+ if readOnlyRoomDescriptor ~= nil and readOnlyRoomDescriptor.Data ~= nil then
85
+ readOnlyRoomDescriptors[#readOnlyRoomDescriptors + 1] = readOnlyRoomDescriptor
93
86
  end
94
- ::__continue10::
95
87
  i = i + 1
96
88
  end
97
89
  end
98
- return {__TS__Spread(roomsMap:values())}
90
+ return readOnlyRoomDescriptors
99
91
  end
100
- --- Helper function to get the room descriptor for every room on the level except for rooms that are
101
- -- not on the grid.
92
+ --- Helper function to get the room descriptor for every room on the level that is on the grid. (For
93
+ -- example, Devil Rooms are excluded.)
102
94
  --
103
- -- Under the hood, this function uses the `Level.GetRooms` method to accomplish this. Rooms without
104
- -- data are assumed to be non-existent and are not added to the list.
95
+ -- Room descriptors without any data are assumed to be non-existent and are not included.
105
96
  --
106
97
  -- @param includeExtraDimensionalRooms Optional. On some floors (e.g. Downpour 2, Mines 2),
107
- -- extra-dimensional rooms are automatically be generated and can be
108
- -- seen when you iterate over the `RoomList`. Default is false.
98
+ -- extra-dimensional rooms are automatically be generated. Default
99
+ -- is false.
109
100
  function ____exports.getRoomsInGrid(self, includeExtraDimensionalRooms)
110
101
  if includeExtraDimensionalRooms == nil then
111
102
  includeExtraDimensionalRooms = false
112
103
  end
113
- local rooms = ____exports.getRooms(nil, includeExtraDimensionalRooms)
114
- return __TS__ArrayFilter(
115
- rooms,
116
- function(____, roomDescriptor) return roomDescriptor.SafeGridIndex >= 0 end
117
- )
118
- end
119
- --- Helper function to change the current room. It can be used for both teleportation and "normal"
120
- -- room transitions, depending on what is passed for the `direction` and `roomTransitionAnim`
121
- -- arguments.
122
- --
123
- -- Use this function instead of invoking the `Game.StartRoomTransition` method directly so that:
124
- -- - you do not forget to set `Level.LeaveDoor` property
125
- -- - to prevent crashing on invalid room grid indexes
126
- -- - to automatically handle Curse of the Maze
127
- --
128
- -- @param roomGridIndex The room grid index of the destination room.
129
- -- @param direction Optional. Default is `Direction.NO_DIRECTION`.
130
- -- @param roomTransitionAnim Optional. Default is `RoomTransitionAnim.TELEPORT`.
131
- -- @param force Optional. Whether to temporarily disable Curse of the Maze. Default is false. If set
132
- -- to false, then this function may not go to the provided room grid index.
133
- function ____exports.teleport(self, roomGridIndex, direction, roomTransitionAnim, force)
134
- if direction == nil then
135
- direction = Direction.NO_DIRECTION
136
- end
137
- if roomTransitionAnim == nil then
138
- roomTransitionAnim = RoomTransitionAnim.TELEPORT
139
- end
140
- if force == nil then
141
- force = false
142
- end
143
104
  local level = game:GetLevel()
144
- local shouldTempDisableCurse = force and hasCurse(nil, LevelCurse.MAZE)
145
- if shouldTempDisableCurse then
146
- level:RemoveCurses(LevelCurse.MAZE)
147
- end
148
- local roomData = getRoomData(nil, roomGridIndex)
149
- if roomData == nil then
150
- error(("Failed to change the room to grid index " .. tostring(roomGridIndex)) .. " because that room does not exist.")
151
- end
152
- level.LeaveDoor = DoorSlot.NO_DOOR_SLOT
153
- game:StartRoomTransition(roomGridIndex, direction, roomTransitionAnim)
154
- if shouldTempDisableCurse then
155
- level:AddCurse(LevelCurse.MAZE, false)
105
+ local dimensions = includeExtraDimensionalRooms and erange(nil, NUM_DIMENSIONS) or ({Dimension.CURRENT})
106
+ --- We use a map instead of an array because room shapes occupy more than one room grid index.
107
+ local roomDescriptorMap = __TS__New(Map)
108
+ for ____, dimension in ipairs(dimensions) do
109
+ for ____, roomGridIndex in ipairs(irange(nil, MAX_LEVEL_GRID_INDEX)) do
110
+ local roomDescriptor = level:GetRoomByIdx(roomGridIndex, dimension)
111
+ if roomDescriptor.Data ~= nil then
112
+ local ptrHash = GetPtrHash(roomDescriptor)
113
+ roomDescriptorMap:set(ptrHash, roomDescriptor)
114
+ end
115
+ end
156
116
  end
117
+ return {__TS__Spread(roomDescriptorMap:values())}
118
+ end
119
+ --- Helper function to get the room descriptor for every room on the level that is outside of the
120
+ -- grid (like a Devil Room).
121
+ --
122
+ -- Room descriptors without any data are assumed to be non-existent and are not included.
123
+ function ____exports.getRoomsOutsideGrid(self)
124
+ local readOnlyRooms = ____exports.getReadOnlyRooms(nil)
125
+ local readOnlyRoomsOffGrid = __TS__ArrayFilter(
126
+ readOnlyRooms,
127
+ function(____, readOnlyRoomDescriptor) return readOnlyRoomDescriptor.SafeGridIndex < 0 end
128
+ )
129
+ return __TS__ArrayMap(
130
+ readOnlyRoomsOffGrid,
131
+ function(____, readOnlyRoomDescriptor) return getRoomDescriptor(nil, readOnlyRoomDescriptor.SafeGridIndex) end
132
+ )
157
133
  end
158
134
  --- Helper function for quickly switching to a new room without playing a particular animation. Use
159
135
  -- this helper function over invoking the `Game.ChangeRoom` method directly to ensure that you do
@@ -200,14 +176,7 @@ function ____exports.getRoomDataForTypeVariant(self, roomType, roomVariant, canc
200
176
  Isaac.ExecuteCommand(command)
201
177
  local newRoomData = getRoomData(nil, GridRoom.DEBUG)
202
178
  if cancelRoomTransition then
203
- local roomGridIndex = getRoomGridIndex(nil)
204
- ____exports.teleport(
205
- nil,
206
- roomGridIndex,
207
- Direction.NO_DIRECTION,
208
- RoomTransitionAnim.FADE,
209
- true
210
- )
179
+ reloadRoom(nil)
211
180
  end
212
181
  return newRoomData
213
182
  end
@@ -226,13 +195,34 @@ end
226
195
  function ____exports.getRoomTypeName(self, roomType)
227
196
  return ROOM_TYPE_NAMES[roomType]
228
197
  end
198
+ --- Helper function to get the room descriptor for every room on the level. This includes off-grid
199
+ -- rooms, such as the Devil Room.
200
+ --
201
+ -- Room descriptors without any data are assumed to be non-existent and are not included.
202
+ --
203
+ -- - If you want just the rooms inside of the grid, use the `getRoomsInGrid` helper function.
204
+ -- - If you want just the rooms outside of the grid, use the `getRoomsOutsideGrid` helper function.
205
+ --
206
+ -- @param includeExtraDimensionalRooms Optional. On some floors (e.g. Downpour 2, Mines 2),
207
+ -- extra-dimensional rooms are automatically generated. Default is
208
+ -- false.
209
+ function ____exports.getRooms(self, includeExtraDimensionalRooms)
210
+ if includeExtraDimensionalRooms == nil then
211
+ includeExtraDimensionalRooms = false
212
+ end
213
+ local roomsInGrid = ____exports.getRoomsInGrid(nil, includeExtraDimensionalRooms)
214
+ local roomsOutsideGrid = ____exports.getRoomsOutsideGrid(nil)
215
+ local ____array_0 = __TS__SparseArrayNew(table.unpack(roomsInGrid))
216
+ __TS__SparseArrayPush(
217
+ ____array_0,
218
+ table.unpack(roomsOutsideGrid)
219
+ )
220
+ return {__TS__SparseArraySpread(____array_0)}
221
+ end
229
222
  --- Helper function to get the room descriptor for every room on the level in a specific dimension.
230
223
  -- This will not include any off-grid rooms, such as the Devil Room.
231
224
  --
232
- -- Under the hood, this function uses the `Level.GetRooms` method to accomplish this. Rooms without
233
- -- data are assumed to be non-existent and are not added to the list.
234
- --
235
- -- @returns A map of room ListIndex to RoomDescriptor.
225
+ -- Room descriptors without any data are assumed to be non-existent and are not included.
236
226
  function ____exports.getRoomsOfDimension(self, dimension)
237
227
  local level = game:GetLevel()
238
228
  --- We use a map instead of an array because room shapes occupy more than one room grid index.
@@ -240,7 +230,8 @@ function ____exports.getRoomsOfDimension(self, dimension)
240
230
  for ____, roomGridIndex in ipairs(irange(nil, MAX_LEVEL_GRID_INDEX)) do
241
231
  local roomDescriptor = level:GetRoomByIdx(roomGridIndex, dimension)
242
232
  if roomDescriptor.Data ~= nil then
243
- roomsMap:set(roomDescriptor.ListIndex, roomDescriptor)
233
+ local ptrHash = GetPtrHash(roomDescriptor)
234
+ roomsMap:set(ptrHash, roomDescriptor)
244
235
  end
245
236
  end
246
237
  return {__TS__Spread(roomsMap:values())}
@@ -352,20 +343,20 @@ function ____exports.inStartingRoom(self)
352
343
  end
353
344
  --- Helper function to loop through every room on the floor and see if it has been cleared.
354
345
  --
355
- -- This function will only check rooms in the current dimension.
346
+ -- This function will only check rooms inside the gird and inside the current dimension.
356
347
  --
357
348
  -- @param onlyCheckRoomTypes Optional. A whitelist of room types. If specified, room types not in
358
349
  -- the array will be ignored. If not specified, then all rooms will be
359
350
  -- checked. Undefined by default.
360
351
  function ____exports.isAllRoomsClear(self, onlyCheckRoomTypes)
361
- local ____temp_0
352
+ local ____temp_1
362
353
  if onlyCheckRoomTypes == nil then
363
- ____temp_0 = nil
354
+ ____temp_1 = nil
364
355
  else
365
- ____temp_0 = __TS__New(Set, onlyCheckRoomTypes)
356
+ ____temp_1 = __TS__New(Set, onlyCheckRoomTypes)
366
357
  end
367
- local roomTypeWhitelist = ____temp_0
368
- local rooms = ____exports.getRooms(nil)
358
+ local roomTypeWhitelist = ____temp_1
359
+ local rooms = ____exports.getRoomsInGrid(nil)
369
360
  local matchingRooms = roomTypeWhitelist == nil and rooms or __TS__ArrayFilter(
370
361
  rooms,
371
362
  function(____, roomDescriptor) return roomDescriptor.Data ~= nil and roomTypeWhitelist:has(roomDescriptor.Data.Type) end
@@ -388,6 +379,10 @@ function ____exports.roomUpdateSafe(self)
388
379
  setEntityPositions(nil, entityPositions, entities)
389
380
  setEntityVelocities(nil, entityVelocities, entities)
390
381
  end
382
+ --- Helper function to set the backdrop of the current room.
383
+ function ____exports.setBackdrop(self, backdropType)
384
+ game:ShowHallucination(0, backdropType)
385
+ end
391
386
  --- Helper function to convert an uncleared room to a cleared room in the `POST_NEW_ROOM` callback.
392
387
  -- This is useful because if enemies are removed in this callback, a room drop will be awarded and
393
388
  -- the doors will start closed and then open.
@@ -401,12 +396,12 @@ function ____exports.setRoomCleared(self)
401
396
  for ____, door in ipairs(getDoors(nil)) do
402
397
  do
403
398
  if isHiddenSecretRoomDoor(nil, door) then
404
- goto __continue40
399
+ goto __continue48
405
400
  end
406
401
  openDoorFast(nil, door)
407
402
  door.ExtraVisible = false
408
403
  end
409
- ::__continue40::
404
+ ::__continue48::
410
405
  end
411
406
  sfxManager:Stop(SoundEffect.DOOR_HEAVY_OPEN)
412
407
  game:ShakeScreen(0)
package/dist/index.d.ts CHANGED
@@ -84,6 +84,7 @@ export * from "./functions/language";
84
84
  export * from "./functions/level";
85
85
  export * from "./functions/levelGrid";
86
86
  export * from "./functions/log";
87
+ export * from "./functions/logEntities";
87
88
  export * from "./functions/map";
88
89
  export * from "./functions/math";
89
90
  export * from "./functions/mergeTests";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,OAAO,EACL,cAAc,EACd,eAAe,GAChB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,0BAA0B,GAC3B,MAAM,gCAAgC,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,OAAO,EACL,sBAAsB,EACtB,iCAAiC,GAClC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EACL,sBAAsB,IAAI,gBAAgB,EAC1C,qBAAqB,IAAI,eAAe,GACzC,MAAM,6BAA6B,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,SAAS,GACV,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,4BAA4B,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AAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yCAAyC,CAAC;AACxD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oCAAoC,CAAC;AACnD,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC"}
package/dist/index.lua CHANGED
@@ -670,6 +670,14 @@ do
670
670
  end
671
671
  end
672
672
  end
673
+ do
674
+ local ____export = require("functions.logEntities")
675
+ for ____exportKey, ____exportValue in pairs(____export) do
676
+ if ____exportKey ~= "default" then
677
+ ____exports[____exportKey] = ____exportValue
678
+ end
679
+ end
680
+ end
673
681
  do
674
682
  local ____export = require("functions.map")
675
683
  for ____exportKey, ____exportValue in pairs(____export) do
@@ -1,7 +1,7 @@
1
- import { LevelStage, StageType } from "isaac-typescript-definitions";
1
+ import { TrapdoorDestination } from "../../types/TrapdoorDestination";
2
2
  export interface CustomTrapdoorDescription {
3
3
  open: boolean;
4
- destination: [stage: LevelStage, stageType: StageType] | string;
4
+ destination: TrapdoorDestination;
5
5
  firstSpawn: boolean;
6
6
  }
7
7
  //# sourceMappingURL=CustomTrapdoorDescription.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomTrapdoorDescription.d.ts","sourceRoot":"","sources":["../../../src/interfaces/private/CustomTrapdoorDescription.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAErE,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,OAAO,CAAC;IACd,WAAW,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,CAAC,GAAG,MAAM,CAAC;IAChE,UAAU,EAAE,OAAO,CAAC;CACrB"}
1
+ {"version":3,"file":"CustomTrapdoorDescription.d.ts","sourceRoot":"","sources":["../../../src/interfaces/private/CustomTrapdoorDescription.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,OAAO,CAAC;IACd,WAAW,EAAE,mBAAmB,CAAC;IACjC,UAAU,EAAE,OAAO,CAAC;CACrB"}
@@ -35,12 +35,12 @@ ____exports.BACKDROP_TYPE_TO_ROCK_ALT_TYPE = {
35
35
  [BackdropType.GREED_SHOP] = RockAltType.URN,
36
36
  [BackdropType.DUNGEON] = RockAltType.URN,
37
37
  [BackdropType.SACRIFICE] = RockAltType.SKULL,
38
- [BackdropType.DOWNPOUR] = RockAltType.BUCKET,
38
+ [BackdropType.DOWNPOUR] = RockAltType.BUCKET_DOWNPOUR,
39
39
  [BackdropType.MINES] = RockAltType.MUSHROOM,
40
40
  [BackdropType.MAUSOLEUM] = RockAltType.SKULL,
41
41
  [BackdropType.CORPSE] = RockAltType.POLYP,
42
42
  [BackdropType.PLANETARIUM] = RockAltType.URN,
43
- [BackdropType.DOWNPOUR_ENTRANCE] = RockAltType.BUCKET,
43
+ [BackdropType.DOWNPOUR_ENTRANCE] = RockAltType.BUCKET_DOWNPOUR,
44
44
  [BackdropType.MINES_ENTRANCE] = RockAltType.MUSHROOM,
45
45
  [BackdropType.MAUSOLEUM_ENTRANCE] = RockAltType.SKULL,
46
46
  [BackdropType.CORPSE_ENTRANCE] = RockAltType.SKULL,
@@ -49,7 +49,7 @@ ____exports.BACKDROP_TYPE_TO_ROCK_ALT_TYPE = {
49
49
  [BackdropType.MAUSOLEUM_4] = RockAltType.SKULL,
50
50
  [BackdropType.CORPSE_2] = RockAltType.POLYP,
51
51
  [BackdropType.CORPSE_3] = RockAltType.POLYP,
52
- [BackdropType.DROSS] = RockAltType.BUCKET,
52
+ [BackdropType.DROSS] = RockAltType.BUCKET_DROSS,
53
53
  [BackdropType.ASHPIT] = RockAltType.MUSHROOM,
54
54
  [BackdropType.GEHENNA] = RockAltType.SKULL,
55
55
  [BackdropType.MORTIS] = RockAltType.POLYP,
@@ -0,0 +1,3 @@
1
+ import { LevelStage, StageType } from "isaac-typescript-definitions";
2
+ export declare type TrapdoorDestination = [stage: LevelStage, stageType: StageType] | [customStageName: string, floorNum: int];
3
+ //# sourceMappingURL=TrapdoorDestination.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TrapdoorDestination.d.ts","sourceRoot":"","sources":["../../src/types/TrapdoorDestination.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAErE,oBAAY,mBAAmB,GAC3B,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,CAAC,GACzC,CAAC,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ local ____exports = {}
2
+ return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "6.20.1",
3
+ "version": "6.22.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -22,6 +22,6 @@
22
22
  "main": "dist/index",
23
23
  "types": "dist/index.d.ts",
24
24
  "dependencies": {
25
- "isaac-typescript-definitions": "^3.1.1"
25
+ "isaac-typescript-definitions": "^3.1.4"
26
26
  }
27
27
  }
package/src/constants.ts CHANGED
@@ -9,6 +9,12 @@ import { NUM_NORMAL_PILL_COLORS } from "./constantsFirstLast";
9
9
  import { getEnumLength } from "./functions/enums";
10
10
  import { addFlag } from "./functions/flag";
11
11
 
12
+ /**
13
+ * The combination of the following flags:
14
+ * - `DisplayFlag.VISIBLE` (1 << 0)
15
+ * - `DisplayFlag.SHADOW` (1 << 1)
16
+ * - `DisplayFlag.SHOW_ICON` (1 << 2)
17
+ */
12
18
  export const ALL_DISPLAY_FLAGS = addFlag(
13
19
  DisplayFlag.VISIBLE,
14
20
  DisplayFlag.SHADOW,
@@ -21,8 +21,8 @@ export const FIRST_COLLECTIBLE_TYPE = CollectibleType.SAD_ONION;
21
21
  /**
22
22
  * Will change depending on how many modded collectibles there are.
23
23
  *
24
- * Equal to `itemConfig.GetCollectibles().Size - 1`. (`Size` includes invalid collectibles. We
25
- * subtract one to account for `CollectibleType.NULL`.)
24
+ * Equal to `itemConfig.GetCollectibles().Size - 1`. (`Size` includes invalid collectibles, like
25
+ * 666. We subtract one to account for `CollectibleType.NULL`.)
26
26
  */
27
27
  export const LAST_COLLECTIBLE_TYPE = (itemConfig.GetCollectibles().Size -
28
28
  1) as CollectibleType;
@@ -3,5 +3,18 @@ export enum RockAltType {
3
3
  MUSHROOM,
4
4
  SKULL,
5
5
  POLYP,
6
- BUCKET,
6
+
7
+ /**
8
+ * Destroying buckets in Downpour give different outcomes than in Dross.
9
+ *
10
+ * See: https://bindingofisaacrebirth.fandom.com/wiki/Rocks#Buckets
11
+ */
12
+ BUCKET_DOWNPOUR,
13
+
14
+ /**
15
+ * Destroying buckets in Dross give different outcomes than in Downpour.
16
+ *
17
+ * See: https://bindingofisaacrebirth.fandom.com/wiki/Rocks#Buckets
18
+ */
19
+ BUCKET_DROSS,
7
20
  }
@@ -2,7 +2,8 @@ export enum StageTravelState {
2
2
  NONE,
3
3
  PLAYERS_JUMPING_DOWN,
4
4
  PIXELATION_TO_BLACK,
5
- PAUSING_ON_BLACK,
5
+ WAITING_FOR_FIRST_PIXELATION_TO_END,
6
+ WAITING_FOR_SECOND_PIXELATION_TO_GET_HALF_WAY,
6
7
  PIXELATION_TO_ROOM,
7
8
  PLAYERS_LAYING_DOWN,
8
9
  }
@@ -83,6 +83,7 @@ const N_FLOOR_ANM2_LAYERS: readonly int[] = [18, 19];
83
83
  * time passes, like most other effects.
84
84
  */
85
85
  const BACKDROP_EFFECT_VARIANT = EffectVariant.LADDER;
86
+ const BACKDROP_EFFECT_SUBTYPE = 101;
86
87
 
87
88
  const BACKDROP_ROOM_TYPE_SET: ReadonlySet<RoomType> = new Set([
88
89
  RoomType.DEFAULT,
@@ -132,7 +133,7 @@ function spawnWallEntity(
132
133
  // does this. (`EntityFlag.RENDER_WALL` is intended for this purpose.)
133
134
  const wallEffect = spawnEffectWithSeed(
134
135
  BACKDROP_EFFECT_VARIANT,
135
- 0,
136
+ BACKDROP_EFFECT_SUBTYPE,
136
137
  VectorZero,
137
138
  1 as Seed,
138
139
  );
@@ -1 +1,17 @@
1
1
  export const ISAACSCRIPT_CUSTOM_STAGE_GFX_PATH = "gfx/isaacscript-custom-stage";
2
+
3
+ /** Corresponds to "ui_streak.anm2". */
4
+ export enum UIStreakAnimation {
5
+ NONE,
6
+ TEXT,
7
+ TEXT_STAY,
8
+ }
9
+
10
+ /** Corresponds to "ui_streak.anm2". */
11
+ export const UI_STREAK_ANIMATION_END_FRAMES: {
12
+ readonly [key in UIStreakAnimation]: int;
13
+ } = {
14
+ [UIStreakAnimation.NONE]: 0,
15
+ [UIStreakAnimation.TEXT]: 69,
16
+ [UIStreakAnimation.TEXT_STAY]: 1,
17
+ } as const;
@@ -1,18 +1,26 @@
1
1
  import {
2
2
  CollectibleType,
3
3
  EntityType,
4
+ GridEntityType,
5
+ LevelStage,
4
6
  TrinketType,
5
7
  } from "isaac-typescript-definitions";
6
8
  import { DecorationVariant } from "../../enums/DecorationVariant";
7
9
  import { removeEntities } from "../../functions/entities";
8
10
  import { getNPCs } from "../../functions/entitiesSpecific";
11
+ import { removeGridEntity } from "../../functions/gridEntities";
9
12
  import {
10
13
  getCoins,
11
14
  getCollectibles,
12
15
  getTrinkets,
13
16
  } from "../../functions/pickupsSpecific";
17
+ import { calculateStageType } from "../../functions/stage";
14
18
  import { vectorEquals } from "../../functions/vector";
15
19
  import { CustomStage } from "../../interfaces/CustomStage";
20
+ import { TrapdoorDestination } from "../../types/TrapdoorDestination";
21
+ import { spawnCustomTrapdoor } from "../customTrapdoor/exports";
22
+ import { DEFAULT_BASE_STAGE } from "./exports";
23
+ import v from "./v";
16
24
 
17
25
  /** For `GridEntityType.DECORATION` (1) */
18
26
  export function setCustomDecorationGraphics(
@@ -25,6 +33,11 @@ export function setCustomDecorationGraphics(
25
33
  return;
26
34
  }
27
35
 
36
+ const gridEntityType = gridEntity.GetType();
37
+ if (gridEntityType !== GridEntityType.DECORATION) {
38
+ return;
39
+ }
40
+
28
41
  // Ignore custom grid entities. (They are represented as decorations with a non-zero variant.)
29
42
  const variant = gridEntity.GetVariant();
30
43
  if (variant !== (DecorationVariant.VANILLA_DECORATION as int)) {
@@ -51,6 +64,11 @@ export function setCustomRockGraphics(
51
64
  return;
52
65
  }
53
66
 
67
+ const gridEntityRock = gridEntity.ToRock();
68
+ if (gridEntityRock === undefined) {
69
+ return;
70
+ }
71
+
54
72
  const sprite = gridEntity.GetSprite();
55
73
  const fileName = sprite.GetFilename();
56
74
  if (fileName === "gfx/grid/grid_rock.anm2") {
@@ -73,6 +91,11 @@ export function setCustomPitGraphics(
73
91
  return;
74
92
  }
75
93
 
94
+ const gridEntityPit = gridEntity.ToPit();
95
+ if (gridEntityPit === undefined) {
96
+ return;
97
+ }
98
+
76
99
  const sprite = gridEntity.GetSprite();
77
100
  const fileName = sprite.GetFilename();
78
101
  if (fileName === "gfx/grid/grid_pit.anm2") {
@@ -86,6 +109,17 @@ export function setCustomDoorGraphics(
86
109
  customStage: CustomStage,
87
110
  gridEntity: GridEntity,
88
111
  ): void {
112
+ // If the end-user did not specify custom pit graphics, default to Basement graphics. (We don't
113
+ // have to adjust anything for this case.)
114
+ if (customStage.doorPNGPaths === undefined) {
115
+ return;
116
+ }
117
+
118
+ const gridEntityDoor = gridEntity.ToDoor();
119
+ if (gridEntityDoor === undefined) {
120
+ return;
121
+ }
122
+
89
123
  const sprite = gridEntity.GetSprite();
90
124
  const fileName = sprite.GetFilename();
91
125
  const doorPNGPath = getNewDoorPNGPath(customStage, fileName);
@@ -148,6 +182,33 @@ function getNewDoorPNGPath(
148
182
  return undefined;
149
183
  }
150
184
 
185
+ export function convertVanillaTrapdoors(
186
+ customStage: CustomStage,
187
+ gridEntity: GridEntity,
188
+ ): void {
189
+ const gridEntityType = gridEntity.GetType();
190
+ if (gridEntityType !== GridEntityType.TRAPDOOR) {
191
+ return;
192
+ }
193
+
194
+ removeGridEntity(gridEntity, true);
195
+
196
+ // - If we are on the first floor of a custom stage, then the destination will be the second floor
197
+ // of the custom stage. (e.g. Caves 1 to Caves 2)
198
+ // - If we are on the second floor of a custom stage, then the destination will be the vanilla
199
+ // floor equivalent to 2 floors after the floor used as a basis for the custom stage.
200
+ const baseStage =
201
+ customStage.baseStage === undefined
202
+ ? DEFAULT_BASE_STAGE
203
+ : customStage.baseStage;
204
+ const vanillaNextStage = (baseStage + 2) as LevelStage;
205
+ const vanillaNextStageType = calculateStageType(vanillaNextStage);
206
+ const destination: TrapdoorDestination = v.run.firstFloor
207
+ ? [customStage.name, 2]
208
+ : [vanillaNextStage, vanillaNextStageType];
209
+ spawnCustomTrapdoor(gridEntity.Position, destination);
210
+ }
211
+
151
212
  /**
152
213
  * The rewards are based on the ones from the wiki:
153
214
  * https://bindingofisaacrebirth.fandom.com/wiki/Rocks#Urns