isaacscript-common 6.19.0 → 6.20.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.
- package/dist/features/customStage/exports.d.ts.map +1 -1
- package/dist/features/customStage/exports.lua +2 -7
- package/dist/features/customTrapdoor/init.d.ts.map +1 -1
- package/dist/features/customTrapdoor/init.lua +10 -2
- package/dist/features/extraConsoleCommands/commandsSubroutines.d.ts.map +1 -1
- package/dist/features/extraConsoleCommands/commandsSubroutines.lua +2 -1
- package/dist/features/extraConsoleCommands/listCommands.d.ts.map +1 -1
- package/dist/features/extraConsoleCommands/listCommands.lua +2 -1
- package/dist/functions/curses.d.ts +3 -0
- package/dist/functions/curses.d.ts.map +1 -0
- package/dist/functions/curses.lua +11 -0
- package/dist/functions/dimensions.d.ts +12 -0
- package/dist/functions/dimensions.d.ts.map +1 -0
- package/dist/functions/dimensions.lua +35 -0
- package/dist/functions/level.d.ts.map +1 -1
- package/dist/functions/level.lua +8 -7
- package/dist/functions/levelGrid.d.ts +152 -0
- package/dist/functions/levelGrid.d.ts.map +1 -0
- package/dist/functions/levelGrid.lua +326 -0
- package/dist/functions/roomData.d.ts +5 -0
- package/dist/functions/roomData.d.ts.map +1 -1
- package/dist/functions/roomData.lua +6 -0
- package/dist/functions/roomGrid.d.ts +8 -0
- package/dist/functions/roomGrid.d.ts.map +1 -1
- package/dist/functions/rooms.d.ts +39 -61
- package/dist/functions/rooms.d.ts.map +1 -1
- package/dist/functions/rooms.lua +126 -200
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.lua +24 -0
- package/package.json +2 -2
- package/src/features/customStage/exports.ts +10 -11
- package/src/features/customTrapdoor/init.ts +7 -3
- package/src/features/extraConsoleCommands/commandsSubroutines.ts +2 -1
- package/src/features/extraConsoleCommands/listCommands.ts +2 -1
- package/src/functions/curses.ts +9 -0
- package/src/functions/dimensions.ts +41 -0
- package/src/functions/level.ts +7 -10
- package/src/functions/levelGrid.ts +424 -0
- package/src/functions/roomData.ts +12 -0
- package/src/functions/roomGrid.ts +9 -0
- package/src/functions/rooms.ts +90 -206
- package/src/index.ts +3 -0
package/dist/functions/rooms.lua
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
|
-
local
|
|
3
|
-
local Set = ____lualib.Set
|
|
2
|
+
local Map = ____lualib.Map
|
|
4
3
|
local __TS__New = ____lualib.__TS__New
|
|
5
|
-
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
6
4
|
local __TS__Spread = ____lualib.__TS__Spread
|
|
7
|
-
local
|
|
5
|
+
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
8
6
|
local __TS__StringIncludes = ____lualib.__TS__StringIncludes
|
|
7
|
+
local Set = ____lualib.Set
|
|
9
8
|
local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
|
|
10
9
|
local ____exports = {}
|
|
11
10
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
@@ -16,6 +15,7 @@ local DoorSlot = ____isaac_2Dtypescript_2Ddefinitions.DoorSlot
|
|
|
16
15
|
local DungeonSubType = ____isaac_2Dtypescript_2Ddefinitions.DungeonSubType
|
|
17
16
|
local GridRoom = ____isaac_2Dtypescript_2Ddefinitions.GridRoom
|
|
18
17
|
local HomeRoomSubType = ____isaac_2Dtypescript_2Ddefinitions.HomeRoomSubType
|
|
18
|
+
local LevelCurse = ____isaac_2Dtypescript_2Ddefinitions.LevelCurse
|
|
19
19
|
local RoomDescriptorFlag = ____isaac_2Dtypescript_2Ddefinitions.RoomDescriptorFlag
|
|
20
20
|
local RoomShape = ____isaac_2Dtypescript_2Ddefinitions.RoomShape
|
|
21
21
|
local RoomTransitionAnim = ____isaac_2Dtypescript_2Ddefinitions.RoomTransitionAnim
|
|
@@ -26,15 +26,15 @@ local ____cachedClasses = require("cachedClasses")
|
|
|
26
26
|
local game = ____cachedClasses.game
|
|
27
27
|
local sfxManager = ____cachedClasses.sfxManager
|
|
28
28
|
local ____constants = require("constants")
|
|
29
|
-
local LEVEL_GRID_ROW_WIDTH = ____constants.LEVEL_GRID_ROW_WIDTH
|
|
30
29
|
local MAX_LEVEL_GRID_INDEX = ____constants.MAX_LEVEL_GRID_INDEX
|
|
31
|
-
local NUM_DIMENSIONS = ____constants.NUM_DIMENSIONS
|
|
32
|
-
local ____roomShapeToDoorSlotsToGridIndexDelta = require("objects.roomShapeToDoorSlotsToGridIndexDelta")
|
|
33
|
-
local ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA = ____roomShapeToDoorSlotsToGridIndexDelta.ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA
|
|
34
30
|
local ____roomTypeNames = require("objects.roomTypeNames")
|
|
35
31
|
local ROOM_TYPE_NAMES = ____roomTypeNames.ROOM_TYPE_NAMES
|
|
36
32
|
local ____mineShaftRoomSubTypesSet = require("sets.mineShaftRoomSubTypesSet")
|
|
37
33
|
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
|
+
local ____dimensions = require("functions.dimensions")
|
|
37
|
+
local inDimension = ____dimensions.inDimension
|
|
38
38
|
local ____doors = require("functions.doors")
|
|
39
39
|
local closeAllDoors = ____doors.closeAllDoors
|
|
40
40
|
local getDoors = ____doors.getDoors
|
|
@@ -50,26 +50,22 @@ local getEntityVelocities = ____positionVelocity.getEntityVelocities
|
|
|
50
50
|
local setEntityPositions = ____positionVelocity.setEntityPositions
|
|
51
51
|
local setEntityVelocities = ____positionVelocity.setEntityVelocities
|
|
52
52
|
local ____roomData = require("functions.roomData")
|
|
53
|
-
local getRoomAllowedDoors = ____roomData.getRoomAllowedDoors
|
|
54
53
|
local getRoomData = ____roomData.getRoomData
|
|
55
|
-
local getRoomDescriptor = ____roomData.getRoomDescriptor
|
|
56
54
|
local getRoomDescriptorReadOnly = ____roomData.getRoomDescriptorReadOnly
|
|
57
55
|
local getRoomGridIndex = ____roomData.getRoomGridIndex
|
|
58
56
|
local getRoomName = ____roomData.getRoomName
|
|
59
|
-
local getRoomShape = ____roomData.getRoomShape
|
|
60
57
|
local getRoomStageID = ____roomData.getRoomStageID
|
|
61
58
|
local getRoomSubType = ____roomData.getRoomSubType
|
|
62
|
-
local
|
|
63
|
-
local
|
|
59
|
+
local ____stage = require("functions.stage")
|
|
60
|
+
local getGotoCommand = ____stage.getGotoCommand
|
|
64
61
|
local ____utils = require("functions.utils")
|
|
65
|
-
local erange = ____utils.erange
|
|
66
62
|
local irange = ____utils.irange
|
|
67
|
-
function
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
--
|
|
72
|
-
-- non-existent and are not added to the list.
|
|
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.)
|
|
66
|
+
--
|
|
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.
|
|
73
69
|
--
|
|
74
70
|
-- @param includeExtraDimensionalRooms Optional. On some floors (e.g. Downpour 2, Mines 2),
|
|
75
71
|
-- extra-dimensional rooms are automatically generated and can be
|
|
@@ -80,32 +76,84 @@ function ____exports.getRooms(self, includeExtraDimensionalRooms)
|
|
|
80
76
|
end
|
|
81
77
|
local level = game:GetLevel()
|
|
82
78
|
local roomList = level:GetRooms()
|
|
79
|
+
--- Indexed by room safe grid index. We use a map to avoid adding extra dimensional rooms.
|
|
83
80
|
local roomsMap = __TS__New(Map)
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
81
|
+
do
|
|
82
|
+
local i = 0
|
|
83
|
+
while i < roomList.Size do
|
|
84
|
+
do
|
|
88
85
|
local roomDescriptor = roomList:Get(i)
|
|
89
|
-
if roomDescriptor
|
|
90
|
-
|
|
86
|
+
if roomDescriptor == nil or roomDescriptor.Data == nil then
|
|
87
|
+
goto __continue10
|
|
91
88
|
end
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
for ____, roomGridIndex in ipairs(irange(nil, MAX_LEVEL_GRID_INDEX)) do
|
|
97
|
-
local roomDescriptor = level:GetRoomByIdx(roomGridIndex)
|
|
98
|
-
if roomDescriptor.Data ~= nil then
|
|
99
|
-
roomsMap:set(roomDescriptor.ListIndex, roomDescriptor)
|
|
89
|
+
if not includeExtraDimensionalRooms and roomsMap:has(roomDescriptor.SafeGridIndex) then
|
|
90
|
+
goto __continue10
|
|
91
|
+
end
|
|
92
|
+
roomsMap:set(roomDescriptor.SafeGridIndex, roomDescriptor)
|
|
100
93
|
end
|
|
94
|
+
::__continue10::
|
|
95
|
+
i = i + 1
|
|
101
96
|
end
|
|
102
97
|
end
|
|
103
98
|
return {__TS__Spread(roomsMap:values())}
|
|
104
99
|
end
|
|
105
|
-
--- Helper function to
|
|
106
|
-
|
|
100
|
+
--- Helper function to get the room descriptor for every room on the level except for rooms that are
|
|
101
|
+
-- not on the grid.
|
|
102
|
+
--
|
|
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.
|
|
105
|
+
--
|
|
106
|
+
-- @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.
|
|
109
|
+
function ____exports.getRoomsInGrid(self, includeExtraDimensionalRooms)
|
|
110
|
+
if includeExtraDimensionalRooms == nil then
|
|
111
|
+
includeExtraDimensionalRooms = false
|
|
112
|
+
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
|
+
local level = game:GetLevel()
|
|
144
|
+
local shouldTempDisableCurse = force and hasCurse(nil, LevelCurse.MAZE)
|
|
145
|
+
if shouldTempDisableCurse then
|
|
146
|
+
level:RemoveCurses(LevelCurse.MAZE)
|
|
147
|
+
end
|
|
107
148
|
local roomData = getRoomData(nil, roomGridIndex)
|
|
108
|
-
|
|
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)
|
|
156
|
+
end
|
|
109
157
|
end
|
|
110
158
|
--- Helper function for quickly switching to a new room without playing a particular animation. Use
|
|
111
159
|
-- this helper function over invoking the `Game.ChangeRoom` method directly to ensure that you do
|
|
@@ -119,58 +167,46 @@ function ____exports.changeRoom(self, roomGridIndex)
|
|
|
119
167
|
level.LeaveDoor = DoorSlot.NO_DOOR_SLOT
|
|
120
168
|
game:ChangeRoom(roomGridIndex)
|
|
121
169
|
end
|
|
122
|
-
--- Helper function to get an array with every valid `Dimension` (not including `Dimension.CURRENT`).
|
|
123
|
-
function ____exports.getAllDimensions(self)
|
|
124
|
-
return erange(nil, NUM_DIMENSIONS)
|
|
125
|
-
end
|
|
126
|
-
--- Helper function to get the grid index for every room on the entire floor.
|
|
127
|
-
function ____exports.getAllRoomGridIndexes(self)
|
|
128
|
-
local rooms = ____exports.getRooms(nil)
|
|
129
|
-
return __TS__ArrayMap(
|
|
130
|
-
rooms,
|
|
131
|
-
function(____, roomDescriptor) return roomDescriptor.SafeGridIndex end
|
|
132
|
-
)
|
|
133
|
-
end
|
|
134
|
-
--- Helper function to get the current dimension. Most of the time, this will be `Dimension.MAIN`,
|
|
135
|
-
-- but it can change if e.g. the player is in the mirror world of Downpour/Dross.
|
|
136
|
-
function ____exports.getDimension(self)
|
|
137
|
-
local level = game:GetLevel()
|
|
138
|
-
local roomGridIndex = getRoomGridIndex(nil)
|
|
139
|
-
local roomDescription = level:GetRoomByIdx(roomGridIndex, Dimension.CURRENT)
|
|
140
|
-
local currentRoomHash = GetPtrHash(roomDescription)
|
|
141
|
-
for ____, dimension in ipairs(____exports.getAllDimensions(nil)) do
|
|
142
|
-
local dimensionRoomDescription = level:GetRoomByIdx(roomGridIndex, dimension)
|
|
143
|
-
local dimensionRoomHash = GetPtrHash(dimensionRoomDescription)
|
|
144
|
-
if dimensionRoomHash == currentRoomHash then
|
|
145
|
-
return dimension
|
|
146
|
-
end
|
|
147
|
-
end
|
|
148
|
-
error("Failed to get the current dimension.")
|
|
149
|
-
end
|
|
150
170
|
--- Helper function to get the number of rooms that are currently on the floor layout. This does not
|
|
151
171
|
-- include off-grid rooms, like the Devil Room.
|
|
152
172
|
function ____exports.getNumRooms(self)
|
|
153
|
-
local rooms = ____exports.
|
|
173
|
+
local rooms = ____exports.getRoomsInGrid(nil)
|
|
154
174
|
return #rooms
|
|
155
175
|
end
|
|
156
|
-
--- Helper function to get
|
|
157
|
-
-- specified room
|
|
176
|
+
--- Helper function to get the room data for a specific room type and variant combination. This is
|
|
177
|
+
-- accomplished by using the "goto" console command to load the specified room into the
|
|
178
|
+
-- `GridRoom.DEBUG` slot.
|
|
158
179
|
--
|
|
159
|
-
--
|
|
180
|
+
-- Note that the side effect of using the "goto" console command is that it will trigger a room
|
|
181
|
+
-- transition after a short delay. By default, this function cancels the incoming room transition by
|
|
182
|
+
-- using the `Game.StartRoomTransition` method to travel to the same room.
|
|
160
183
|
--
|
|
161
|
-
--
|
|
162
|
-
--
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
)
|
|
184
|
+
-- @param roomType The type of room to retrieve.
|
|
185
|
+
-- @param roomVariant The room variant to retrieve. (The room variant is the "ID" of the room in
|
|
186
|
+
-- Basement Renovator.)
|
|
187
|
+
-- @param cancelRoomTransition Optional. Whether to cancel the room transition by using the
|
|
188
|
+
-- `Game.StartRoomTransition` method to travel to the same room. Default
|
|
189
|
+
-- is true. Set this to false if you are getting the data for many rooms
|
|
190
|
+
-- at the same time, and then use the `teleport` helper function when
|
|
191
|
+
-- you are finished.
|
|
192
|
+
function ____exports.getRoomDataForTypeVariant(self, roomType, roomVariant, cancelRoomTransition)
|
|
193
|
+
if cancelRoomTransition == nil then
|
|
194
|
+
cancelRoomTransition = true
|
|
195
|
+
end
|
|
196
|
+
local command = getGotoCommand(nil, roomType, roomVariant)
|
|
197
|
+
Isaac.ExecuteCommand(command)
|
|
198
|
+
local newRoomData = getRoomData(nil, GridRoom.DEBUG)
|
|
199
|
+
if cancelRoomTransition then
|
|
200
|
+
local roomGridIndex = getRoomGridIndex(nil)
|
|
201
|
+
____exports.teleport(
|
|
202
|
+
nil,
|
|
203
|
+
roomGridIndex,
|
|
204
|
+
Direction.NO_DIRECTION,
|
|
205
|
+
RoomTransitionAnim.FADE,
|
|
206
|
+
true
|
|
207
|
+
)
|
|
208
|
+
end
|
|
209
|
+
return newRoomData
|
|
174
210
|
end
|
|
175
211
|
--- Helper function to get the item pool type for the current room. For example, this returns
|
|
176
212
|
-- `ItemPoolType.ItemPoolType.POOL_ANGEL` if you are in an Angel Room.
|
|
@@ -181,59 +217,22 @@ function ____exports.getRoomItemPoolType(self)
|
|
|
181
217
|
local roomSeed = room:GetSpawnSeed()
|
|
182
218
|
return itemPool:GetPoolForRoom(roomType, roomSeed)
|
|
183
219
|
end
|
|
184
|
-
--- Helper function to get the grid indexes of all the rooms connected to the given room index.
|
|
185
|
-
--
|
|
186
|
-
-- @param roomGridIndex Optional. Default is the current room index.
|
|
187
|
-
function ____exports.getRoomNeighbors(self, roomGridIndex)
|
|
188
|
-
local roomDescriptor = getRoomDescriptor(nil, roomGridIndex)
|
|
189
|
-
if roomDescriptor.SafeGridIndex < 0 or roomDescriptor.SafeGridIndex > MAX_LEVEL_GRID_INDEX then
|
|
190
|
-
return {}
|
|
191
|
-
end
|
|
192
|
-
local roomData = roomDescriptor.Data
|
|
193
|
-
if roomData == nil then
|
|
194
|
-
return {}
|
|
195
|
-
end
|
|
196
|
-
local roomShape = roomData.Shape
|
|
197
|
-
local gridIndexDeltas = ____exports.getRoomShapeNeighborGridIndexDeltas(nil, roomShape)
|
|
198
|
-
local gridIndexes = __TS__ArrayMap(
|
|
199
|
-
gridIndexDeltas,
|
|
200
|
-
function(____, gridIndexDelta) return roomDescriptor.SafeGridIndex + gridIndexDelta end
|
|
201
|
-
)
|
|
202
|
-
return __TS__ArrayFilter(
|
|
203
|
-
gridIndexes,
|
|
204
|
-
function(____, gridIndex) return ____exports.roomExists(nil, gridIndex) end
|
|
205
|
-
)
|
|
206
|
-
end
|
|
207
220
|
--- Helper function to get the proper name of a room type.
|
|
208
221
|
--
|
|
209
222
|
-- For example, `RoomType.TREASURE` will return "Treasure Room".
|
|
210
223
|
function ____exports.getRoomTypeName(self, roomType)
|
|
211
224
|
return ROOM_TYPE_NAMES[roomType]
|
|
212
225
|
end
|
|
213
|
-
--- Helper function to get the room descriptor for every room on the level except for rooms that are
|
|
214
|
-
-- not on the grid. Uses the `Level.GetRooms` method to accomplish this. Rooms without data are
|
|
215
|
-
-- assumed to be non-existent and are not added to the list.
|
|
216
|
-
--
|
|
217
|
-
-- @param includeExtraDimensionalRooms Optional. On some floors (e.g. Downpour 2, Mines 2),
|
|
218
|
-
-- extra-dimensional rooms are automatically be generated and can be
|
|
219
|
-
-- seen when you iterate over the `RoomList`. Default is false.
|
|
220
|
-
function ____exports.getRoomsInGrid(self, includeExtraDimensionalRooms)
|
|
221
|
-
if includeExtraDimensionalRooms == nil then
|
|
222
|
-
includeExtraDimensionalRooms = false
|
|
223
|
-
end
|
|
224
|
-
local rooms = ____exports.getRooms(nil, includeExtraDimensionalRooms)
|
|
225
|
-
return __TS__ArrayFilter(
|
|
226
|
-
rooms,
|
|
227
|
-
function(____, roomDescriptor) return roomDescriptor.SafeGridIndex >= 0 end
|
|
228
|
-
)
|
|
229
|
-
end
|
|
230
226
|
--- Helper function to get the room descriptor for every room on the level in a specific dimension.
|
|
231
|
-
--
|
|
232
|
-
--
|
|
227
|
+
-- This will not include any off-grid rooms, such as the Devil Room.
|
|
228
|
+
--
|
|
229
|
+
-- Under the hood, this function uses the `Level.GetRooms` method to accomplish this. Rooms without
|
|
230
|
+
-- data are assumed to be non-existent and are not added to the list.
|
|
233
231
|
--
|
|
234
232
|
-- @returns A map of room ListIndex to RoomDescriptor.
|
|
235
233
|
function ____exports.getRoomsOfDimension(self, dimension)
|
|
236
234
|
local level = game:GetLevel()
|
|
235
|
+
--- We use a map instead of an array because room shapes occupy more than one room grid index.
|
|
237
236
|
local roomsMap = __TS__New(Map)
|
|
238
237
|
for ____, roomGridIndex in ipairs(irange(nil, MAX_LEVEL_GRID_INDEX)) do
|
|
239
238
|
local roomDescriptor = level:GetRoomByIdx(roomGridIndex, dimension)
|
|
@@ -294,9 +293,6 @@ function ____exports.inDevilsCrownTreasureRoom(self)
|
|
|
294
293
|
local roomDescriptor = getRoomDescriptorReadOnly(nil)
|
|
295
294
|
return hasFlag(nil, roomDescriptor.Flags, RoomDescriptorFlag.DEVIL_TREASURE)
|
|
296
295
|
end
|
|
297
|
-
function ____exports.inDimension(self, dimension)
|
|
298
|
-
return dimension == ____exports.getDimension(nil)
|
|
299
|
-
end
|
|
300
296
|
function ____exports.inDoubleTrouble(self)
|
|
301
297
|
local room = game:GetRoom()
|
|
302
298
|
local roomType = room:GetType()
|
|
@@ -349,7 +345,7 @@ function ____exports.inStartingRoom(self)
|
|
|
349
345
|
local level = game:GetLevel()
|
|
350
346
|
local startingRoomGridIndex = level:GetStartingRoomIndex()
|
|
351
347
|
local roomGridIndex = getRoomGridIndex(nil)
|
|
352
|
-
return roomGridIndex == startingRoomGridIndex and
|
|
348
|
+
return roomGridIndex == startingRoomGridIndex and inDimension(nil, Dimension.MAIN)
|
|
353
349
|
end
|
|
354
350
|
--- Helper function to loop through every room on the floor and see if it has been cleared.
|
|
355
351
|
--
|
|
@@ -376,52 +372,6 @@ function ____exports.isAllRoomsClear(self, onlyCheckRoomTypes)
|
|
|
376
372
|
function(____, roomDescriptor) return roomDescriptor.Clear end
|
|
377
373
|
)
|
|
378
374
|
end
|
|
379
|
-
function ____exports.isDoorSlotValidAtGridIndex(self, doorSlot, roomGridIndex)
|
|
380
|
-
local allowedDoors = getRoomAllowedDoors(nil, roomGridIndex)
|
|
381
|
-
return allowedDoors:has(doorSlot)
|
|
382
|
-
end
|
|
383
|
-
function ____exports.isDoorSlotValidAtGridIndexForRedRoom(self, doorSlot, roomGridIndex)
|
|
384
|
-
local doorSlotValidAtGridIndex = ____exports.isDoorSlotValidAtGridIndex(nil, doorSlot, roomGridIndex)
|
|
385
|
-
if not doorSlotValidAtGridIndex then
|
|
386
|
-
return false
|
|
387
|
-
end
|
|
388
|
-
local roomShape = getRoomShape(nil, roomGridIndex)
|
|
389
|
-
if roomShape == nil then
|
|
390
|
-
return false
|
|
391
|
-
end
|
|
392
|
-
local delta = getGridIndexDelta(nil, roomShape, doorSlot)
|
|
393
|
-
if delta == nil then
|
|
394
|
-
return false
|
|
395
|
-
end
|
|
396
|
-
local redRoomGridIndex = roomGridIndex + delta
|
|
397
|
-
return not ____exports.roomExists(nil, redRoomGridIndex) and redRoomGridIndex >= 0 and redRoomGridIndex <= MAX_LEVEL_GRID_INDEX
|
|
398
|
-
end
|
|
399
|
-
--- Helper function to detect if the provided room was created by the Red Key item. Under the hood,
|
|
400
|
-
-- this checks for the `RoomDescriptorFlag.FLAG_RED_ROOM` flag.
|
|
401
|
-
--
|
|
402
|
-
-- @param roomGridIndex Optional. Default is the current room index.
|
|
403
|
-
function ____exports.isRedKeyRoom(self, roomGridIndex)
|
|
404
|
-
local roomDescriptor = getRoomDescriptor(nil, roomGridIndex)
|
|
405
|
-
return hasFlag(nil, roomDescriptor.Flags, RoomDescriptorFlag.RED_ROOM)
|
|
406
|
-
end
|
|
407
|
-
--- Helper function to determine if the provided room is part of the floor layout. For example, Devil
|
|
408
|
-
-- Rooms and the Mega Satan room are not considered to be inside the map.
|
|
409
|
-
--
|
|
410
|
-
-- @param roomGridIndex Optional. Default is the current room index.
|
|
411
|
-
function ____exports.isRoomInsideMap(self, roomGridIndex)
|
|
412
|
-
if roomGridIndex == nil then
|
|
413
|
-
roomGridIndex = getRoomGridIndex(nil)
|
|
414
|
-
end
|
|
415
|
-
return roomGridIndex >= 0
|
|
416
|
-
end
|
|
417
|
-
--- Helper function to get the coordinates of a given grid index. The floor is represented by a 13x13
|
|
418
|
-
-- grid. For example, since the starting room is in the center, the starting room grid index of 84
|
|
419
|
-
-- be equal to coordinates of (?, ?).
|
|
420
|
-
function ____exports.roomGridIndexToXY(self, roomGridIndex)
|
|
421
|
-
local x = roomGridIndex % LEVEL_GRID_ROW_WIDTH
|
|
422
|
-
local y = math.floor(roomGridIndex / LEVEL_GRID_ROW_WIDTH)
|
|
423
|
-
return {x, y}
|
|
424
|
-
end
|
|
425
375
|
--- If the `Room.Update` method is called in a `POST_NEW_ROOM` callback, then some entities will
|
|
426
376
|
-- slide around (such as the player). Since those entity velocities are already at zero, setting
|
|
427
377
|
-- them to zero will have no effect. Thus, a generic solution is to record all of the entity
|
|
@@ -448,12 +398,12 @@ function ____exports.setRoomCleared(self)
|
|
|
448
398
|
for ____, door in ipairs(getDoors(nil)) do
|
|
449
399
|
do
|
|
450
400
|
if isHiddenSecretRoomDoor(nil, door) then
|
|
451
|
-
goto
|
|
401
|
+
goto __continue40
|
|
452
402
|
end
|
|
453
403
|
openDoorFast(nil, door)
|
|
454
404
|
door.ExtraVisible = false
|
|
455
405
|
end
|
|
456
|
-
::
|
|
406
|
+
::__continue40::
|
|
457
407
|
end
|
|
458
408
|
sfxManager:Stop(SoundEffect.DOOR_HEAVY_OPEN)
|
|
459
409
|
game:ShakeScreen(0)
|
|
@@ -465,28 +415,4 @@ function ____exports.setRoomUncleared(self)
|
|
|
465
415
|
room:SetClear(false)
|
|
466
416
|
closeAllDoors(nil)
|
|
467
417
|
end
|
|
468
|
-
--- Helper function to change the current room. It can be used for both teleportation and "normal"
|
|
469
|
-
-- room transitions, depending on what is passed for the `direction` and `roomTransitionAnim`
|
|
470
|
-
-- arguments. Use this function instead of invoking the `Game.StartRoomTransition` method directly
|
|
471
|
-
-- so that you do not forget to set `Level.LeaveDoor` property and to prevent crashing on invalid
|
|
472
|
-
-- room grid indexes.
|
|
473
|
-
--
|
|
474
|
-
-- @param roomGridIndex The room grid index of the destination room.
|
|
475
|
-
-- @param direction Optional. Default is `Direction.NO_DIRECTION`.
|
|
476
|
-
-- @param roomTransitionAnim Optional. Default is `RoomTransitionAnim.TELEPORT`.
|
|
477
|
-
function ____exports.teleport(self, roomGridIndex, direction, roomTransitionAnim)
|
|
478
|
-
if direction == nil then
|
|
479
|
-
direction = Direction.NO_DIRECTION
|
|
480
|
-
end
|
|
481
|
-
if roomTransitionAnim == nil then
|
|
482
|
-
roomTransitionAnim = RoomTransitionAnim.TELEPORT
|
|
483
|
-
end
|
|
484
|
-
local level = game:GetLevel()
|
|
485
|
-
local roomData = getRoomData(nil, roomGridIndex)
|
|
486
|
-
if roomData == nil then
|
|
487
|
-
error(("Failed to change the room to grid index " .. tostring(roomGridIndex)) .. " because that room does not exist.")
|
|
488
|
-
end
|
|
489
|
-
level.LeaveDoor = DoorSlot.NO_DOOR_SLOT
|
|
490
|
-
game:StartRoomTransition(roomGridIndex, direction, roomTransitionAnim)
|
|
491
|
-
end
|
|
492
418
|
return ____exports
|
package/dist/index.d.ts
CHANGED
|
@@ -54,9 +54,11 @@ export * from "./functions/collectibles";
|
|
|
54
54
|
export * from "./functions/collectibleSet";
|
|
55
55
|
export * from "./functions/collectibleTag";
|
|
56
56
|
export * from "./functions/color";
|
|
57
|
+
export * from "./functions/curses";
|
|
57
58
|
export * from "./functions/debug";
|
|
58
59
|
export * from "./functions/deepCopy";
|
|
59
60
|
export * from "./functions/deepCopyTests";
|
|
61
|
+
export * from "./functions/dimensions";
|
|
60
62
|
export * from "./functions/direction";
|
|
61
63
|
export * from "./functions/doors";
|
|
62
64
|
export * from "./functions/easing";
|
|
@@ -80,6 +82,7 @@ export * from "./functions/jsonRoom";
|
|
|
80
82
|
export * from "./functions/kColor";
|
|
81
83
|
export * from "./functions/language";
|
|
82
84
|
export * from "./functions/level";
|
|
85
|
+
export * from "./functions/levelGrid";
|
|
83
86
|
export * from "./functions/log";
|
|
84
87
|
export * from "./functions/map";
|
|
85
88
|
export * from "./functions/math";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,CAAC;AAC7E,OAAO,EACL,gBAAgB,EACh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Ac,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
|
@@ -430,6 +430,14 @@ do
|
|
|
430
430
|
end
|
|
431
431
|
end
|
|
432
432
|
end
|
|
433
|
+
do
|
|
434
|
+
local ____export = require("functions.curses")
|
|
435
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
436
|
+
if ____exportKey ~= "default" then
|
|
437
|
+
____exports[____exportKey] = ____exportValue
|
|
438
|
+
end
|
|
439
|
+
end
|
|
440
|
+
end
|
|
433
441
|
do
|
|
434
442
|
local ____export = require("functions.debug")
|
|
435
443
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
@@ -454,6 +462,14 @@ do
|
|
|
454
462
|
end
|
|
455
463
|
end
|
|
456
464
|
end
|
|
465
|
+
do
|
|
466
|
+
local ____export = require("functions.dimensions")
|
|
467
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
468
|
+
if ____exportKey ~= "default" then
|
|
469
|
+
____exports[____exportKey] = ____exportValue
|
|
470
|
+
end
|
|
471
|
+
end
|
|
472
|
+
end
|
|
457
473
|
do
|
|
458
474
|
local ____export = require("functions.direction")
|
|
459
475
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
@@ -638,6 +654,14 @@ do
|
|
|
638
654
|
end
|
|
639
655
|
end
|
|
640
656
|
end
|
|
657
|
+
do
|
|
658
|
+
local ____export = require("functions.levelGrid")
|
|
659
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
660
|
+
if ____exportKey ~= "default" then
|
|
661
|
+
____exports[____exportKey] = ____exportValue
|
|
662
|
+
end
|
|
663
|
+
end
|
|
664
|
+
end
|
|
641
665
|
do
|
|
642
666
|
local ____export = require("functions.log")
|
|
643
667
|
for ____exportKey, ____exportValue in pairs(____export) do
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.20.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.
|
|
25
|
+
"isaac-typescript-definitions": "^3.1.1"
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EntityType,
|
|
3
|
-
GridRoom,
|
|
4
3
|
LevelStage,
|
|
5
4
|
RoomShape,
|
|
6
5
|
RoomType,
|
|
@@ -11,9 +10,8 @@ import { reorderedCallbacksSetStage } from "../../callbacks/reorderedCallbacks";
|
|
|
11
10
|
import { getEntityIDFromConstituents } from "../../functions/entities";
|
|
12
11
|
import { log, logError } from "../../functions/log";
|
|
13
12
|
import { newRNG } from "../../functions/rng";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { getGotoCommand, setStage } from "../../functions/stage";
|
|
13
|
+
import { getRoomDataForTypeVariant, getRooms } from "../../functions/rooms";
|
|
14
|
+
import { setStage } from "../../functions/stage";
|
|
17
15
|
import { getRandomCustomStageRoom } from "./customStageUtils";
|
|
18
16
|
import { topStreakTextStart } from "./streakText";
|
|
19
17
|
import v, {
|
|
@@ -103,18 +101,19 @@ export function setCustomStage(name: string, verbose = false): void {
|
|
|
103
101
|
|
|
104
102
|
let newRoomData = customStageCachedRoomData.get(randomRoom.variant);
|
|
105
103
|
if (newRoomData === undefined) {
|
|
106
|
-
// We
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
104
|
+
// We do not already have the room data for this room cached.
|
|
105
|
+
newRoomData = getRoomDataForTypeVariant(
|
|
106
|
+
roomType,
|
|
107
|
+
randomRoom.variant,
|
|
108
|
+
false,
|
|
109
|
+
);
|
|
112
110
|
if (newRoomData === undefined) {
|
|
113
111
|
logError(
|
|
114
112
|
`Failed to get the room data for room variant ${randomRoom.variant} for custom stage: ${name}`,
|
|
115
113
|
);
|
|
116
114
|
continue;
|
|
117
115
|
}
|
|
116
|
+
|
|
118
117
|
customStageCachedRoomData.set(randomRoom.variant, newRoomData);
|
|
119
118
|
}
|
|
120
119
|
|
|
@@ -134,7 +133,7 @@ export function setCustomStage(name: string, verbose = false): void {
|
|
|
134
133
|
// Furthermore, we need to cancel the queued warp to the `GridRoom.DEBUG` room. We can accomplish
|
|
135
134
|
// both of these things by initiating a room transition to an arbitrary room. However, we rely on
|
|
136
135
|
// the parent function to do this, since for normal purposes, we need to initiate a room
|
|
137
|
-
// transition for pixelation
|
|
136
|
+
// transition for the pixelation effect.
|
|
138
137
|
}
|
|
139
138
|
|
|
140
139
|
export function setCustomStageDebug(): void {
|
|
@@ -10,6 +10,7 @@ import { StageTravelState } from "../../enums/private/StageTravelState";
|
|
|
10
10
|
import { movePlayersToCenter } from "../../functions/playerCenter";
|
|
11
11
|
import { getAllPlayers } from "../../functions/playerIndex";
|
|
12
12
|
import { getRoomGridIndex, getRoomListIndex } from "../../functions/roomData";
|
|
13
|
+
import { teleport } from "../../functions/rooms";
|
|
13
14
|
import { setStage } from "../../functions/stage";
|
|
14
15
|
import { isString } from "../../functions/types";
|
|
15
16
|
import { setCustomStage } from "../customStage/exports";
|
|
@@ -65,8 +66,10 @@ function checkAllPlayersJumpComplete() {
|
|
|
65
66
|
v.run.stateRenderFrame = renderFrameCount;
|
|
66
67
|
|
|
67
68
|
// In order to display the pixelation effect that should happen when we go to a new floor, we need
|
|
68
|
-
// to start a room transition. We arbitrarily pick the current room for this purpose.
|
|
69
|
-
|
|
69
|
+
// to start a room transition. We arbitrarily pick the current room for this purpose. (We do not
|
|
70
|
+
// have to worry about Curse of the Maze here, because even if we are taken to a different room,
|
|
71
|
+
// it will not matter, since we will be traveling to a new floor after the screen fades to black.)
|
|
72
|
+
teleport(
|
|
70
73
|
roomGridIndex,
|
|
71
74
|
Direction.NO_DIRECTION,
|
|
72
75
|
RoomTransitionAnim.PIXELATION,
|
|
@@ -99,10 +102,11 @@ function checkPixelationToBlackComplete() {
|
|
|
99
102
|
|
|
100
103
|
// Start another pixelation effect. This time, we will keep the screen black with the sprite, and
|
|
101
104
|
// then remove the black sprite once the pixelation effect is halfway complete.
|
|
102
|
-
|
|
105
|
+
teleport(
|
|
103
106
|
roomGridIndex,
|
|
104
107
|
Direction.NO_DIRECTION,
|
|
105
108
|
RoomTransitionAnim.PIXELATION,
|
|
109
|
+
true,
|
|
106
110
|
);
|
|
107
111
|
}
|
|
108
112
|
|
|
@@ -9,10 +9,11 @@ import { game } from "../../cachedClasses";
|
|
|
9
9
|
import { HealthType } from "../../enums/HealthType";
|
|
10
10
|
import { directionToVector } from "../../functions/direction";
|
|
11
11
|
import { spawnGridEntityWithVariant } from "../../functions/gridEntities";
|
|
12
|
+
import { getRoomGridIndexesForType } from "../../functions/levelGrid";
|
|
12
13
|
import { logAllEntities, logAllGridEntities } from "../../functions/log";
|
|
13
14
|
import { addPlayerHealthType } from "../../functions/playerHealth";
|
|
14
15
|
import { getRoomData, getRoomDescriptor } from "../../functions/roomData";
|
|
15
|
-
import { changeRoom
|
|
16
|
+
import { changeRoom } from "../../functions/rooms";
|
|
16
17
|
import { printConsole } from "../../functions/utils";
|
|
17
18
|
import {
|
|
18
19
|
DEFAULT_ROOM_TYPE_NAME,
|