isaacscript-common 6.19.0 → 6.20.2
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/constants.d.ts +5 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.lua +4 -0
- package/dist/features/customStage/exports.d.ts +6 -1
- package/dist/features/customStage/exports.d.ts.map +1 -1
- package/dist/features/customStage/exports.lua +14 -11
- package/dist/features/customTrapdoor/blackSprite.d.ts.map +1 -1
- package/dist/features/customTrapdoor/blackSprite.lua +1 -0
- 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 +155 -0
- package/dist/functions/levelGrid.d.ts.map +1 -0
- package/dist/functions/levelGrid.lua +349 -0
- package/dist/functions/roomData.d.ts +6 -1
- 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 +67 -68
- package/dist/functions/rooms.d.ts.map +1 -1
- package/dist/functions/rooms.lua +176 -203
- 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/constants.ts +8 -0
- package/src/features/customStage/exports.ts +25 -14
- package/src/features/customTrapdoor/blackSprite.ts +1 -0
- 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 +468 -0
- package/src/functions/roomData.ts +13 -1
- package/src/functions/roomGrid.ts +9 -0
- package/src/functions/rooms.ts +161 -219
- package/src/index.ts +3 -0
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
3
|
+
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
4
|
+
local Map = ____lualib.Map
|
|
5
|
+
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
6
|
+
local Set = ____lualib.Set
|
|
7
|
+
local __TS__New = ____lualib.__TS__New
|
|
8
|
+
local ____exports = {}
|
|
9
|
+
local ADJACENT_ROOM_GRID_INDEX_DELTAS
|
|
10
|
+
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
11
|
+
local DisplayFlag = ____isaac_2Dtypescript_2Ddefinitions.DisplayFlag
|
|
12
|
+
local DownpourRoomSubType = ____isaac_2Dtypescript_2Ddefinitions.DownpourRoomSubType
|
|
13
|
+
local LevelStateFlag = ____isaac_2Dtypescript_2Ddefinitions.LevelStateFlag
|
|
14
|
+
local MinesRoomSubType = ____isaac_2Dtypescript_2Ddefinitions.MinesRoomSubType
|
|
15
|
+
local RoomDescriptorFlag = ____isaac_2Dtypescript_2Ddefinitions.RoomDescriptorFlag
|
|
16
|
+
local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
|
|
17
|
+
local ____cachedClasses = require("cachedClasses")
|
|
18
|
+
local game = ____cachedClasses.game
|
|
19
|
+
local ____constants = require("constants")
|
|
20
|
+
local ALL_DISPLAY_FLAGS = ____constants.ALL_DISPLAY_FLAGS
|
|
21
|
+
local LEVEL_GRID_ROW_WIDTH = ____constants.LEVEL_GRID_ROW_WIDTH
|
|
22
|
+
local MAX_LEVEL_GRID_INDEX = ____constants.MAX_LEVEL_GRID_INDEX
|
|
23
|
+
local ____roomShapeToDoorSlotsToGridIndexDelta = require("objects.roomShapeToDoorSlotsToGridIndexDelta")
|
|
24
|
+
local ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA = ____roomShapeToDoorSlotsToGridIndexDelta.ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA
|
|
25
|
+
local ____array = require("functions.array")
|
|
26
|
+
local getRandomArrayElement = ____array.getRandomArrayElement
|
|
27
|
+
local ____doors = require("functions.doors")
|
|
28
|
+
local doorSlotToDoorSlotFlag = ____doors.doorSlotToDoorSlotFlag
|
|
29
|
+
local ____flag = require("functions.flag")
|
|
30
|
+
local addFlag = ____flag.addFlag
|
|
31
|
+
local hasFlag = ____flag.hasFlag
|
|
32
|
+
local removeFlag = ____flag.removeFlag
|
|
33
|
+
local ____rng = require("functions.rng")
|
|
34
|
+
local getRandomSeed = ____rng.getRandomSeed
|
|
35
|
+
local ____roomData = require("functions.roomData")
|
|
36
|
+
local getRoomAllowedDoors = ____roomData.getRoomAllowedDoors
|
|
37
|
+
local getRoomData = ____roomData.getRoomData
|
|
38
|
+
local getRoomDescriptor = ____roomData.getRoomDescriptor
|
|
39
|
+
local getRoomGridIndex = ____roomData.getRoomGridIndex
|
|
40
|
+
local getRoomShape = ____roomData.getRoomShape
|
|
41
|
+
local ____rooms = require("functions.rooms")
|
|
42
|
+
local getRooms = ____rooms.getRooms
|
|
43
|
+
local getRoomsInGrid = ____rooms.getRoomsInGrid
|
|
44
|
+
local ____roomShape = require("functions.roomShape")
|
|
45
|
+
local getGridIndexDelta = ____roomShape.getGridIndexDelta
|
|
46
|
+
--- Helper function to get the room grid indexes that are adjacent to a given room grid index.
|
|
47
|
+
--
|
|
48
|
+
-- Adjacent room grid indexes that are outside of the grid will not be included in the returned
|
|
49
|
+
-- array.
|
|
50
|
+
--
|
|
51
|
+
-- If a room grid index is provided that is outside of the grid, then an empty array will be
|
|
52
|
+
-- returned.
|
|
53
|
+
--
|
|
54
|
+
-- Note that this function does not take the shape of the room into account; it only looks at a
|
|
55
|
+
-- single room grid index.
|
|
56
|
+
--
|
|
57
|
+
-- @param roomGridIndex Optional. Default is the current room index.
|
|
58
|
+
function ____exports.getAdjacentRoomGridIndexes(self, roomGridIndex)
|
|
59
|
+
local roomGridIndexToUse = roomGridIndex == nil and getRoomGridIndex(nil) or roomGridIndex
|
|
60
|
+
if not ____exports.isRoomGridIndexInBounds(nil, roomGridIndexToUse) then
|
|
61
|
+
return {}
|
|
62
|
+
end
|
|
63
|
+
local adjacentRoomGridIndexes = __TS__ArrayMap(
|
|
64
|
+
ADJACENT_ROOM_GRID_INDEX_DELTAS,
|
|
65
|
+
function(____, delta) return roomGridIndexToUse + delta end
|
|
66
|
+
)
|
|
67
|
+
return __TS__ArrayFilter(
|
|
68
|
+
adjacentRoomGridIndexes,
|
|
69
|
+
function(____, adjacentRoomGridIndex) return ____exports.isRoomGridIndexInBounds(nil, adjacentRoomGridIndex) end
|
|
70
|
+
)
|
|
71
|
+
end
|
|
72
|
+
--- Helper function to iterate through the possible doors for a room and see if any of them would be
|
|
73
|
+
-- a valid spot to insert a brand new room on the floor.
|
|
74
|
+
--
|
|
75
|
+
-- @param roomGridIndex Optional. Default is the current room index.
|
|
76
|
+
-- @returns A array of tuples of `DoorSlot` and room grid index.
|
|
77
|
+
function ____exports.getNewRoomCandidatesBesideRoom(self, roomGridIndex)
|
|
78
|
+
local roomDescriptor = getRoomDescriptor(nil, roomGridIndex)
|
|
79
|
+
if not ____exports.isRoomGridIndexInBounds(nil, roomDescriptor.SafeGridIndex) then
|
|
80
|
+
return {}
|
|
81
|
+
end
|
|
82
|
+
local roomData = roomDescriptor.Data
|
|
83
|
+
if roomData == nil then
|
|
84
|
+
return {}
|
|
85
|
+
end
|
|
86
|
+
local doorSlotToRoomGridIndexes = ____exports.getRoomShapeNeighborGridIndexes(nil, roomDescriptor.SafeGridIndex, roomData.Shape)
|
|
87
|
+
local roomCandidates = {}
|
|
88
|
+
for ____, ____value in __TS__Iterator(doorSlotToRoomGridIndexes:entries()) do
|
|
89
|
+
local doorSlot = ____value[1]
|
|
90
|
+
local neighborRoomGridIndex = ____value[2]
|
|
91
|
+
do
|
|
92
|
+
local doorSlotFlag = doorSlotToDoorSlotFlag(nil, doorSlot)
|
|
93
|
+
if not hasFlag(nil, roomData.Doors, doorSlotFlag) then
|
|
94
|
+
goto __continue13
|
|
95
|
+
end
|
|
96
|
+
if ____exports.roomExists(nil, neighborRoomGridIndex) then
|
|
97
|
+
goto __continue13
|
|
98
|
+
end
|
|
99
|
+
if not ____exports.isDeadEnd(nil, neighborRoomGridIndex) then
|
|
100
|
+
goto __continue13
|
|
101
|
+
end
|
|
102
|
+
roomCandidates[#roomCandidates + 1] = {doorSlot, neighborRoomGridIndex}
|
|
103
|
+
end
|
|
104
|
+
::__continue13::
|
|
105
|
+
end
|
|
106
|
+
return roomCandidates
|
|
107
|
+
end
|
|
108
|
+
--- Helper function to search through all of the rooms on the floor for a spot to insert a brand new
|
|
109
|
+
-- room.
|
|
110
|
+
--
|
|
111
|
+
-- @returns A array of tuples of adjacent room grid index, `DoorSlot`, and new room grid index.
|
|
112
|
+
function ____exports.getNewRoomCandidatesForLevel(self)
|
|
113
|
+
local rooms = getRoomsInGrid(nil)
|
|
114
|
+
local normalRooms = __TS__ArrayFilter(
|
|
115
|
+
rooms,
|
|
116
|
+
function(____, room) return room.Data ~= nil and room.Data.Type == RoomType.DEFAULT and room.Data.Subtype ~= DownpourRoomSubType.MIRROR and room.Data.Subtype ~= MinesRoomSubType.MINESHAFT_ENTRANCE end
|
|
117
|
+
)
|
|
118
|
+
local newRoomCandidates = {}
|
|
119
|
+
for ____, room in ipairs(normalRooms) do
|
|
120
|
+
local newRoomCandidatesBesideRoom = ____exports.getNewRoomCandidatesBesideRoom(nil, room.SafeGridIndex)
|
|
121
|
+
for ____, ____value in ipairs(newRoomCandidatesBesideRoom) do
|
|
122
|
+
local doorSlot = ____value[1]
|
|
123
|
+
local newRoomGridIndex = ____value[2]
|
|
124
|
+
newRoomCandidates[#newRoomCandidates + 1] = {room.SafeGridIndex, doorSlot, newRoomGridIndex}
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
return newRoomCandidates
|
|
128
|
+
end
|
|
129
|
+
--- Helper function to get the room grid index delta that each hypothetical door in a given room
|
|
130
|
+
-- shape would go to.
|
|
131
|
+
--
|
|
132
|
+
-- This is used by the `getRoomShapeNeighborGridIndexes` function.
|
|
133
|
+
--
|
|
134
|
+
-- @returns A map of `DoorSlot` to the corresponding room grid index delta.
|
|
135
|
+
function ____exports.getRoomShapeNeighborGridIndexDeltas(self, roomShape)
|
|
136
|
+
return ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA[roomShape]
|
|
137
|
+
end
|
|
138
|
+
--- Helper function to get the room grid index that each hypothetical door in a given room shape
|
|
139
|
+
-- would go to. (This will not include room grid indexes that are outside of the grid.)
|
|
140
|
+
--
|
|
141
|
+
-- @param safeRoomGridIndex This must be the room safe grid index (i.e. the top-left room grid index
|
|
142
|
+
-- for the respective room).
|
|
143
|
+
-- @param roomShape The shape of the room.
|
|
144
|
+
-- @returns A map of `DoorSlot` to the corresponding room grid index.
|
|
145
|
+
function ____exports.getRoomShapeNeighborGridIndexes(self, safeRoomGridIndex, roomShape)
|
|
146
|
+
local roomShapeNeighborGridIndexDeltas = ____exports.getRoomShapeNeighborGridIndexDeltas(nil, roomShape)
|
|
147
|
+
local neighborGridIndexes = __TS__New(Map)
|
|
148
|
+
for ____, ____value in __TS__Iterator(roomShapeNeighborGridIndexDeltas:entries()) do
|
|
149
|
+
local doorSlot = ____value[1]
|
|
150
|
+
local delta = ____value[2]
|
|
151
|
+
local roomGridIndex = safeRoomGridIndex + delta
|
|
152
|
+
if ____exports.isRoomGridIndexInBounds(nil, roomGridIndex) then
|
|
153
|
+
neighborGridIndexes:set(doorSlot, roomGridIndex)
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
return neighborGridIndexes
|
|
157
|
+
end
|
|
158
|
+
--- Helper function to check if the given room grid index is a dead end. Specifically, this is
|
|
159
|
+
-- defined as having only one adjacent room that exists.
|
|
160
|
+
--
|
|
161
|
+
-- Note that this function does not take the shape of the room into account; it only looks at a
|
|
162
|
+
-- single room grid index.
|
|
163
|
+
--
|
|
164
|
+
-- This function does not care if the given room grid index actually exists, so you can use it to
|
|
165
|
+
-- check if a hypothetical room would be a dead end.
|
|
166
|
+
--
|
|
167
|
+
-- @param roomGridIndex Optional. Default is the current room index.
|
|
168
|
+
function ____exports.isDeadEnd(self, roomGridIndex)
|
|
169
|
+
local adjacentRoomGridIndexes = ____exports.getAdjacentRoomGridIndexes(nil, roomGridIndex)
|
|
170
|
+
local adjacentRoomData = __TS__ArrayMap(
|
|
171
|
+
adjacentRoomGridIndexes,
|
|
172
|
+
function(____, adjacentRoomGridIndex) return getRoomData(nil, adjacentRoomGridIndex) end
|
|
173
|
+
)
|
|
174
|
+
local existingRoomData = __TS__ArrayFilter(
|
|
175
|
+
adjacentRoomData,
|
|
176
|
+
function(____, data) return data ~= nil end
|
|
177
|
+
)
|
|
178
|
+
return #existingRoomData == 1
|
|
179
|
+
end
|
|
180
|
+
--- Helper function to determine if a given room grid index is inside of the normal 13x13 level grid.
|
|
181
|
+
--
|
|
182
|
+
-- For example, Devil Rooms and the Mega Satan room are not considered to be inside the grid.
|
|
183
|
+
function ____exports.isRoomGridIndexInBounds(self, roomGridIndex)
|
|
184
|
+
return roomGridIndex >= 0 and roomGridIndex <= MAX_LEVEL_GRID_INDEX
|
|
185
|
+
end
|
|
186
|
+
--- Helper function to check if a room exists at the given room grid index. (A room will exist if it
|
|
187
|
+
-- has non-undefined data in the room descriptor.)
|
|
188
|
+
function ____exports.roomExists(self, roomGridIndex)
|
|
189
|
+
local roomData = getRoomData(nil, roomGridIndex)
|
|
190
|
+
return roomData ~= nil
|
|
191
|
+
end
|
|
192
|
+
local LEFT = -1
|
|
193
|
+
local UP = -LEVEL_GRID_ROW_WIDTH
|
|
194
|
+
local RIGHT = 1
|
|
195
|
+
local DOWN = LEVEL_GRID_ROW_WIDTH
|
|
196
|
+
ADJACENT_ROOM_GRID_INDEX_DELTAS = {LEFT, UP, RIGHT, DOWN}
|
|
197
|
+
--- Helper function to get the room safe grid index for every room on the entire floor.
|
|
198
|
+
function ____exports.getAllRoomGridIndexes(self)
|
|
199
|
+
local rooms = getRooms(nil)
|
|
200
|
+
return __TS__ArrayMap(
|
|
201
|
+
rooms,
|
|
202
|
+
function(____, roomDescriptor) return roomDescriptor.SafeGridIndex end
|
|
203
|
+
)
|
|
204
|
+
end
|
|
205
|
+
--- Helper function to pick a random valid spot on the floor to insert a brand new room. Note that
|
|
206
|
+
-- some floors will not have any valid spots. If this is the case, this function will return
|
|
207
|
+
-- undefined.
|
|
208
|
+
--
|
|
209
|
+
-- @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
210
|
+
-- `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
211
|
+
-- @returns Either a tuple of adjacent room grid index, `DoorSlot`, and new room grid index, or
|
|
212
|
+
-- undefined.
|
|
213
|
+
function ____exports.getNewRoomCandidate(self, seedOrRNG)
|
|
214
|
+
if seedOrRNG == nil then
|
|
215
|
+
seedOrRNG = getRandomSeed(nil)
|
|
216
|
+
end
|
|
217
|
+
local newRoomCandidatesForLevel = ____exports.getNewRoomCandidatesForLevel(nil)
|
|
218
|
+
if #newRoomCandidatesForLevel == 0 then
|
|
219
|
+
return nil
|
|
220
|
+
end
|
|
221
|
+
return getRandomArrayElement(nil, newRoomCandidatesForLevel, seedOrRNG)
|
|
222
|
+
end
|
|
223
|
+
--- Helper function to get an array of all of the safe grid indexes for rooms that match the
|
|
224
|
+
-- specified room type.
|
|
225
|
+
--
|
|
226
|
+
-- This function only searches through rooms in the current dimension.
|
|
227
|
+
--
|
|
228
|
+
-- This function is variadic, meaning that you can specify N arguments to get the combined grid
|
|
229
|
+
-- indexes for N room types.
|
|
230
|
+
function ____exports.getRoomGridIndexesForType(self, ...)
|
|
231
|
+
local roomTypesSet = __TS__New(Set, {...})
|
|
232
|
+
local rooms = getRoomsInGrid(nil)
|
|
233
|
+
local matchingRooms = __TS__ArrayFilter(
|
|
234
|
+
rooms,
|
|
235
|
+
function(____, roomDescriptor) return roomDescriptor.Data ~= nil and roomTypesSet:has(roomDescriptor.Data.Type) end
|
|
236
|
+
)
|
|
237
|
+
return __TS__ArrayMap(
|
|
238
|
+
matchingRooms,
|
|
239
|
+
function(____, roomDescriptor) return roomDescriptor.SafeGridIndex end
|
|
240
|
+
)
|
|
241
|
+
end
|
|
242
|
+
--- Helper function to get the grid indexes of all the rooms connected to the given room index,
|
|
243
|
+
-- taking the shape of the room into account. (This will only include rooms with valid data.)
|
|
244
|
+
--
|
|
245
|
+
-- Returns an empty map if the provided room grid index is out of bounds or has no associated room
|
|
246
|
+
-- data.
|
|
247
|
+
--
|
|
248
|
+
-- @param roomGridIndex Optional. Default is the current room index.
|
|
249
|
+
-- @returns A map of `DoorSlot` to the corresponding room grid index.
|
|
250
|
+
function ____exports.getRoomNeighbors(self, roomGridIndex)
|
|
251
|
+
local roomDescriptor = getRoomDescriptor(nil, roomGridIndex)
|
|
252
|
+
if not ____exports.isRoomGridIndexInBounds(nil, roomDescriptor.SafeGridIndex) then
|
|
253
|
+
return __TS__New(Map)
|
|
254
|
+
end
|
|
255
|
+
local roomData = roomDescriptor.Data
|
|
256
|
+
if roomData == nil then
|
|
257
|
+
return __TS__New(Map)
|
|
258
|
+
end
|
|
259
|
+
local doorSlotToRoomGridIndexes = ____exports.getRoomShapeNeighborGridIndexes(nil, roomDescriptor.SafeGridIndex, roomData.Shape)
|
|
260
|
+
local roomNeighbors = __TS__New(Map)
|
|
261
|
+
for ____, ____value in __TS__Iterator(doorSlotToRoomGridIndexes:entries()) do
|
|
262
|
+
local doorSlot = ____value[1]
|
|
263
|
+
local neighborRoomGridIndex = ____value[2]
|
|
264
|
+
if ____exports.roomExists(nil, neighborRoomGridIndex) then
|
|
265
|
+
roomNeighbors:set(doorSlot, neighborRoomGridIndex)
|
|
266
|
+
end
|
|
267
|
+
end
|
|
268
|
+
return roomNeighbors
|
|
269
|
+
end
|
|
270
|
+
function ____exports.isDoorSlotValidAtGridIndex(self, doorSlot, roomGridIndex)
|
|
271
|
+
local allowedDoors = getRoomAllowedDoors(nil, roomGridIndex)
|
|
272
|
+
return allowedDoors:has(doorSlot)
|
|
273
|
+
end
|
|
274
|
+
function ____exports.isDoorSlotValidAtGridIndexForRedRoom(self, doorSlot, roomGridIndex)
|
|
275
|
+
local doorSlotValidAtGridIndex = ____exports.isDoorSlotValidAtGridIndex(nil, doorSlot, roomGridIndex)
|
|
276
|
+
if not doorSlotValidAtGridIndex then
|
|
277
|
+
return false
|
|
278
|
+
end
|
|
279
|
+
local roomShape = getRoomShape(nil, roomGridIndex)
|
|
280
|
+
if roomShape == nil then
|
|
281
|
+
return false
|
|
282
|
+
end
|
|
283
|
+
local delta = getGridIndexDelta(nil, roomShape, doorSlot)
|
|
284
|
+
if delta == nil then
|
|
285
|
+
return false
|
|
286
|
+
end
|
|
287
|
+
local redRoomGridIndex = roomGridIndex + delta
|
|
288
|
+
return not ____exports.roomExists(nil, redRoomGridIndex) and ____exports.isRoomGridIndexInBounds(nil, redRoomGridIndex)
|
|
289
|
+
end
|
|
290
|
+
--- Helper function to detect if the provided room was created by the Red Key item. Under the hood,
|
|
291
|
+
-- this checks for the `RoomDescriptorFlag.FLAG_RED_ROOM` flag.
|
|
292
|
+
--
|
|
293
|
+
-- @param roomGridIndex Optional. Default is the current room index.
|
|
294
|
+
function ____exports.isRedKeyRoom(self, roomGridIndex)
|
|
295
|
+
local roomDescriptor = getRoomDescriptor(nil, roomGridIndex)
|
|
296
|
+
return hasFlag(nil, roomDescriptor.Flags, RoomDescriptorFlag.RED_ROOM)
|
|
297
|
+
end
|
|
298
|
+
--- Helper function to generate a new room on the floor at a valid dead end attached to a normal
|
|
299
|
+
-- room.
|
|
300
|
+
--
|
|
301
|
+
-- Under the hood, this function uses the `Level.MakeRedRoomDoor` method to create the room.
|
|
302
|
+
--
|
|
303
|
+
-- The newly created room will have data corresponding to the game's randomly generated red room. If
|
|
304
|
+
-- you want to modify this, use the `setRoomData` helper function.
|
|
305
|
+
--
|
|
306
|
+
-- @returns The room grid index of the new room or undefined if the floor had no valid dead ends to
|
|
307
|
+
-- place a room.
|
|
308
|
+
function ____exports.newRoom(self)
|
|
309
|
+
local newRoomCandidate = ____exports.getNewRoomCandidate(nil)
|
|
310
|
+
if newRoomCandidate == nil then
|
|
311
|
+
return nil
|
|
312
|
+
end
|
|
313
|
+
local adjacentRoomGridIndex, doorSlot, newRoomGridIndex = table.unpack(newRoomCandidate)
|
|
314
|
+
local level = game:GetLevel()
|
|
315
|
+
level:MakeRedRoomDoor(adjacentRoomGridIndex, doorSlot)
|
|
316
|
+
local roomDescriptor = getRoomDescriptor(nil, newRoomGridIndex)
|
|
317
|
+
roomDescriptor.Flags = removeFlag(nil, roomDescriptor.Flags, RoomDescriptorFlag.RED_ROOM)
|
|
318
|
+
local roomData = roomDescriptor.Data
|
|
319
|
+
if roomData ~= nil then
|
|
320
|
+
local hasFullMap = level:GetStateFlag(LevelStateFlag.FULL_MAP_EFFECT)
|
|
321
|
+
local hasCompass = level:GetStateFlag(LevelStateFlag.COMPASS_EFFECT)
|
|
322
|
+
local hasBlueMap = level:GetStateFlag(LevelStateFlag.BLUE_MAP_EFFECT)
|
|
323
|
+
local roomType = roomData.Type
|
|
324
|
+
local isSecretRoom = roomType == RoomType.SECRET or roomType == RoomType.SUPER_SECRET
|
|
325
|
+
if hasFullMap then
|
|
326
|
+
roomDescriptor.DisplayFlags = ALL_DISPLAY_FLAGS
|
|
327
|
+
elseif not isSecretRoom and hasCompass then
|
|
328
|
+
roomDescriptor.DisplayFlags = addFlag(nil, DisplayFlag.VISIBLE, DisplayFlag.SHOW_ICON)
|
|
329
|
+
elseif isSecretRoom and hasBlueMap then
|
|
330
|
+
roomDescriptor.DisplayFlags = addFlag(nil, DisplayFlag.VISIBLE, DisplayFlag.SHOW_ICON)
|
|
331
|
+
end
|
|
332
|
+
end
|
|
333
|
+
return newRoomGridIndex
|
|
334
|
+
end
|
|
335
|
+
--- Helper function to get the coordinates of a given grid index. The floor is represented by a 13x13
|
|
336
|
+
-- grid.
|
|
337
|
+
--
|
|
338
|
+
-- - Since the starting room is in the center, the starting room grid index of 84 is equal to
|
|
339
|
+
-- coordinates of (6, 6).
|
|
340
|
+
-- - The top-left grid index of 0 is equal to coordinates of: (12, 0)
|
|
341
|
+
-- - The top-right grid index of 12 is equal to coordinates of: (0, 0)
|
|
342
|
+
-- - The bottom-left grid index of 156 is equal to coordinates of: (0, 12)
|
|
343
|
+
-- - The bottom-right grid index of 168 is equal to coordinates of: (12, 12)
|
|
344
|
+
function ____exports.roomGridIndexToXY(self, roomGridIndex)
|
|
345
|
+
local x = roomGridIndex % LEVEL_GRID_ROW_WIDTH
|
|
346
|
+
local y = math.floor(roomGridIndex / LEVEL_GRID_ROW_WIDTH)
|
|
347
|
+
return {x, y}
|
|
348
|
+
end
|
|
349
|
+
return ____exports
|
|
@@ -20,7 +20,7 @@ export declare function getRoomDescriptor(roomGridIndex?: int): RoomDescriptor;
|
|
|
20
20
|
* Alias for the `Level.GetCurrentRoomDesc` method. Use this to make it more clear what type of
|
|
21
21
|
* `RoomDescriptor` object that you are retrieving.
|
|
22
22
|
*/
|
|
23
|
-
export declare function getRoomDescriptorReadOnly():
|
|
23
|
+
export declare function getRoomDescriptorReadOnly(): Readonly<RoomDescriptor>;
|
|
24
24
|
/**
|
|
25
25
|
* Helper function to get the grid index of the current room.
|
|
26
26
|
*
|
|
@@ -107,4 +107,9 @@ export declare function getRoomVariant(roomGridIndex?: int): int;
|
|
|
107
107
|
* @param roomGridIndex Optional. Default is the current room index.
|
|
108
108
|
*/
|
|
109
109
|
export declare function getRoomVisitedCount(roomGridIndex?: int): int;
|
|
110
|
+
/**
|
|
111
|
+
* Helper function to set the data for a given room. This will change the room type, contents, and
|
|
112
|
+
* so on.
|
|
113
|
+
*/
|
|
114
|
+
export declare function setRoomData(roomGridIndex: int, roomData: Readonly<RoomConfig>): void;
|
|
110
115
|
//# sourceMappingURL=roomData.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"roomData.d.ts","sourceRoot":"","sources":["../../src/functions/roomData.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAER,SAAS,EACT,QAAQ,EACR,OAAO,EACR,MAAM,8BAA8B,CAAC;AAMtC;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,GAAG,CAAC,QAAQ,CAAC,CAiBtE;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,UAAU,GAAG,SAAS,CAGvE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,cAAc,CAQrE;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,
|
|
1
|
+
{"version":3,"file":"roomData.d.ts","sourceRoot":"","sources":["../../src/functions/roomData.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAER,SAAS,EACT,QAAQ,EACR,OAAO,EACR,MAAM,8BAA8B,CAAC;AAMtC;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,GAAG,CAAC,QAAQ,CAAC,CAiBtE;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,UAAU,GAAG,SAAS,CAGvE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,cAAc,CAQrE;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,QAAQ,CAAC,cAAc,CAAC,CAGpE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,IAAI,GAAG,CAatC;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,GAAG,CAGzD;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,MAAM,CAGvD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,SAAS,GAAG,SAAS,CAGvE;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,OAAO,CAG3D;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,GAAG,CAGvD;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,QAAQ,CAGzD;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,GAAG,CAGvD;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,GAAG,CAG5D;AAED;;;GAGG;AACH,wBAAgB,WAAW,CACzB,aAAa,EAAE,GAAG,EAClB,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,GAC7B,IAAI,CAGN"}
|
|
@@ -158,4 +158,10 @@ function ____exports.getRoomVisitedCount(self, roomGridIndex)
|
|
|
158
158
|
local roomDescriptor = ____exports.getRoomDescriptor(nil, roomGridIndex)
|
|
159
159
|
return roomDescriptor.VisitedCount
|
|
160
160
|
end
|
|
161
|
+
--- Helper function to set the data for a given room. This will change the room type, contents, and
|
|
162
|
+
-- so on.
|
|
163
|
+
function ____exports.setRoomData(self, roomGridIndex, roomData)
|
|
164
|
+
local roomDescriptor = ____exports.getRoomDescriptor(nil, roomGridIndex)
|
|
165
|
+
roomDescriptor.Data = roomData
|
|
166
|
+
end
|
|
161
167
|
return ____exports
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* These functions have to do with the grid index inside of a room (i.e. the grid index that grid
|
|
3
|
+
* entities use).
|
|
4
|
+
*
|
|
5
|
+
* For functions having to do with the room grid index of the level, see the "Level Grid" functions.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
1
9
|
import { RoomShape } from "isaac-typescript-definitions";
|
|
2
10
|
/**
|
|
3
11
|
* Helper function to convert grid coordinates to a world position `Vector`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"roomGrid.d.ts","sourceRoot":"","sources":["../../src/functions/roomGrid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAUzD;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,MAAM,CAGrE;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,GAAG,EACd,SAAS,EAAE,SAAS,GACnB,MAAM,CAMR;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAIxE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,SAAS,GACnB,OAAO,CAIT;AA0BD;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIpE;AAED;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIxE"}
|
|
1
|
+
{"version":3,"file":"roomGrid.d.ts","sourceRoot":"","sources":["../../src/functions/roomGrid.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAUzD;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,MAAM,CAGrE;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,GAAG,EACd,SAAS,EAAE,SAAS,GACnB,MAAM,CAMR;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAIxE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,SAAS,GACnB,OAAO,CAIT;AA0BD;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIpE;AAED;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIxE"}
|
|
@@ -1,48 +1,54 @@
|
|
|
1
|
-
import { BossID, Dimension, Direction,
|
|
1
|
+
import { BackdropType, BossID, Dimension, Direction, ItemPoolType, MinibossID, RoomTransitionAnim, RoomType } from "isaac-typescript-definitions";
|
|
2
2
|
/**
|
|
3
3
|
* Helper function for quickly switching to a new room without playing a particular animation. Use
|
|
4
4
|
* this helper function over invoking the `Game.ChangeRoom` method directly to ensure that you do
|
|
5
5
|
* not forget to set the `LeaveDoor` property and to prevent crashing on invalid room grid indexes.
|
|
6
6
|
*/
|
|
7
7
|
export declare function changeRoom(roomGridIndex: int): void;
|
|
8
|
-
/**
|
|
9
|
-
* Helper function to get an array with every valid `Dimension` (not including `Dimension.CURRENT`).
|
|
10
|
-
*/
|
|
11
|
-
export declare function getAllDimensions(): Dimension[];
|
|
12
|
-
/** Helper function to get the grid index for every room on the entire floor. */
|
|
13
|
-
export declare function getAllRoomGridIndexes(): int[];
|
|
14
|
-
/**
|
|
15
|
-
* Helper function to get the current dimension. Most of the time, this will be `Dimension.MAIN`,
|
|
16
|
-
* but it can change if e.g. the player is in the mirror world of Downpour/Dross.
|
|
17
|
-
*/
|
|
18
|
-
export declare function getDimension(): Dimension;
|
|
19
8
|
/**
|
|
20
9
|
* Helper function to get the number of rooms that are currently on the floor layout. This does not
|
|
21
10
|
* include off-grid rooms, like the Devil Room.
|
|
22
11
|
*/
|
|
23
12
|
export declare function getNumRooms(): int;
|
|
24
13
|
/**
|
|
25
|
-
* Helper function to get
|
|
26
|
-
*
|
|
14
|
+
* Helper function to get a read-only copy of the room descriptor for every room on the level. This
|
|
15
|
+
* includes off-grid rooms, such as the Devil Room, and extra-dimensional rooms, if they are
|
|
16
|
+
* generated and exist.
|
|
17
|
+
*
|
|
18
|
+
* Room descriptors without any data are assumed to be non-existent and are not included.
|
|
19
|
+
*
|
|
20
|
+
* Under the hood, this is performed by iterating over the `RoomList` from the `Level.GetRooms`
|
|
21
|
+
* method. This is the best way to see if off-grid rooms have been initialized, since it is possible
|
|
22
|
+
* for mods to insert room data at non-official negative room grid indexes.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getReadOnlyRooms(): Array<Readonly<RoomDescriptor>>;
|
|
25
|
+
/**
|
|
26
|
+
* Helper function to get the room data for a specific room type and variant combination. This is
|
|
27
|
+
* accomplished by using the "goto" console command to load the specified room into the
|
|
28
|
+
* `GridRoom.DEBUG` slot.
|
|
29
|
+
*
|
|
30
|
+
* Returns undefined if the provided room type and variant combination were not found. (A warning
|
|
31
|
+
* message will also appear on the console, since the "goto" command will fail.)
|
|
27
32
|
*
|
|
28
|
-
*
|
|
33
|
+
* Note that the side effect of using the "goto" console command is that it will trigger a room
|
|
34
|
+
* transition after a short delay. By default, this function cancels the incoming room transition by
|
|
35
|
+
* using the `Game.StartRoomTransition` method to travel to the same room.
|
|
29
36
|
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
37
|
+
* @param roomType The type of room to retrieve.
|
|
38
|
+
* @param roomVariant The room variant to retrieve. (The room variant is the "ID" of the room in
|
|
39
|
+
* Basement Renovator.)
|
|
40
|
+
* @param cancelRoomTransition Optional. Whether to cancel the room transition by using the
|
|
41
|
+
* `Game.StartRoomTransition` method to travel to the same room. Default
|
|
42
|
+
* is true. Set this to false if you are getting the data for many rooms
|
|
43
|
+
* at the same time, and then use the `teleport` helper function when
|
|
44
|
+
* you are finished.
|
|
32
45
|
*/
|
|
33
|
-
export declare function
|
|
46
|
+
export declare function getRoomDataForTypeVariant(roomType: RoomType, roomVariant: int, cancelRoomTransition?: boolean): Readonly<RoomConfig> | undefined;
|
|
34
47
|
/**
|
|
35
48
|
* Helper function to get the item pool type for the current room. For example, this returns
|
|
36
49
|
* `ItemPoolType.ItemPoolType.POOL_ANGEL` if you are in an Angel Room.
|
|
37
50
|
*/
|
|
38
51
|
export declare function getRoomItemPoolType(): ItemPoolType;
|
|
39
|
-
/**
|
|
40
|
-
* Helper function to get the grid indexes of all the rooms connected to the given room index.
|
|
41
|
-
*
|
|
42
|
-
* @param roomGridIndex Optional. Default is the current room index.
|
|
43
|
-
*/
|
|
44
|
-
export declare function getRoomNeighbors(roomGridIndex?: int): int[];
|
|
45
|
-
export declare function getRoomShapeNeighborGridIndexDeltas(roomShape: RoomShape): int[];
|
|
46
52
|
/**
|
|
47
53
|
* Helper function to get the proper name of a room type.
|
|
48
54
|
*
|
|
@@ -50,33 +56,44 @@ export declare function getRoomShapeNeighborGridIndexDeltas(roomShape: RoomShape
|
|
|
50
56
|
*/
|
|
51
57
|
export declare function getRoomTypeName(roomType: RoomType): string;
|
|
52
58
|
/**
|
|
53
|
-
* Helper function to get the room descriptor for every room on the level
|
|
54
|
-
*
|
|
55
|
-
*
|
|
59
|
+
* Helper function to get the room descriptor for every room on the level. This includes off-grid
|
|
60
|
+
* rooms, such as the Devil Room.
|
|
61
|
+
*
|
|
62
|
+
* Room descriptors without any data are assumed to be non-existent and are not included.
|
|
63
|
+
*
|
|
64
|
+
* - If you want just the rooms inside of the grid, use the `getRoomsInGrid` helper function.
|
|
65
|
+
* - If you want just the rooms outside of the grid, use the `getRoomsOutsideGrid` helper function.
|
|
56
66
|
*
|
|
57
67
|
* @param includeExtraDimensionalRooms Optional. On some floors (e.g. Downpour 2, Mines 2),
|
|
58
|
-
* extra-dimensional rooms are automatically generated
|
|
59
|
-
*
|
|
68
|
+
* extra-dimensional rooms are automatically generated. Default is
|
|
69
|
+
* false.
|
|
60
70
|
*/
|
|
61
71
|
export declare function getRooms(includeExtraDimensionalRooms?: boolean): RoomDescriptor[];
|
|
62
72
|
/**
|
|
63
|
-
* Helper function to get the room descriptor for every room on the level
|
|
64
|
-
*
|
|
65
|
-
*
|
|
73
|
+
* Helper function to get the room descriptor for every room on the level that is on the grid. (For
|
|
74
|
+
* example, Devil Rooms are excluded.)
|
|
75
|
+
*
|
|
76
|
+
* Room descriptors without any data are assumed to be non-existent and are not included.
|
|
66
77
|
*
|
|
67
78
|
* @param includeExtraDimensionalRooms Optional. On some floors (e.g. Downpour 2, Mines 2),
|
|
68
|
-
* extra-dimensional rooms are automatically be generated
|
|
69
|
-
*
|
|
79
|
+
* extra-dimensional rooms are automatically be generated. Default
|
|
80
|
+
* is false.
|
|
70
81
|
*/
|
|
71
82
|
export declare function getRoomsInGrid(includeExtraDimensionalRooms?: boolean): RoomDescriptor[];
|
|
72
83
|
/**
|
|
73
84
|
* Helper function to get the room descriptor for every room on the level in a specific dimension.
|
|
74
|
-
*
|
|
75
|
-
* non-existent and are not added to the list.
|
|
85
|
+
* This will not include any off-grid rooms, such as the Devil Room.
|
|
76
86
|
*
|
|
77
|
-
*
|
|
87
|
+
* Room descriptors without any data are assumed to be non-existent and are not included.
|
|
78
88
|
*/
|
|
79
89
|
export declare function getRoomsOfDimension(dimension: Dimension): RoomDescriptor[];
|
|
90
|
+
/**
|
|
91
|
+
* Helper function to get the room descriptor for every room on the level that is outside of the
|
|
92
|
+
* grid (like a Devil Room).
|
|
93
|
+
*
|
|
94
|
+
* Room descriptors without any data are assumed to be non-existent and are not included.
|
|
95
|
+
*/
|
|
96
|
+
export declare function getRoomsOutsideGrid(): RoomDescriptor[];
|
|
80
97
|
/**
|
|
81
98
|
* Helper function to determine if the current room shape is equal to `RoomShape.1x2` or
|
|
82
99
|
* `RoomShape.2x1`.
|
|
@@ -106,7 +123,6 @@ export declare function inDeathCertificateArea(): boolean;
|
|
|
106
123
|
* flag.
|
|
107
124
|
*/
|
|
108
125
|
export declare function inDevilsCrownTreasureRoom(): boolean;
|
|
109
|
-
export declare function inDimension(dimension: Dimension): boolean;
|
|
110
126
|
export declare function inDoubleTrouble(): boolean;
|
|
111
127
|
export declare function inGenesisRoom(): boolean;
|
|
112
128
|
/** Helper function to determine if the current room shape is one of the four L room shapes. */
|
|
@@ -139,37 +155,13 @@ export declare function inStartingRoom(): boolean;
|
|
|
139
155
|
/**
|
|
140
156
|
* Helper function to loop through every room on the floor and see if it has been cleared.
|
|
141
157
|
*
|
|
142
|
-
* This function will only check rooms
|
|
158
|
+
* This function will only check rooms inside the gird and inside the current dimension.
|
|
143
159
|
*
|
|
144
160
|
* @param onlyCheckRoomTypes Optional. A whitelist of room types. If specified, room types not in
|
|
145
161
|
* the array will be ignored. If not specified, then all rooms will be
|
|
146
162
|
* checked. Undefined by default.
|
|
147
163
|
*/
|
|
148
164
|
export declare function isAllRoomsClear(onlyCheckRoomTypes?: RoomType[]): boolean;
|
|
149
|
-
export declare function isDoorSlotValidAtGridIndex(doorSlot: DoorSlot, roomGridIndex: int): boolean;
|
|
150
|
-
export declare function isDoorSlotValidAtGridIndexForRedRoom(doorSlot: DoorSlot, roomGridIndex: int): boolean;
|
|
151
|
-
/**
|
|
152
|
-
* Helper function to detect if the provided room was created by the Red Key item. Under the hood,
|
|
153
|
-
* this checks for the `RoomDescriptorFlag.FLAG_RED_ROOM` flag.
|
|
154
|
-
*
|
|
155
|
-
* @param roomGridIndex Optional. Default is the current room index.
|
|
156
|
-
*/
|
|
157
|
-
export declare function isRedKeyRoom(roomGridIndex?: int): boolean;
|
|
158
|
-
/**
|
|
159
|
-
* Helper function to determine if the provided room is part of the floor layout. For example, Devil
|
|
160
|
-
* Rooms and the Mega Satan room are not considered to be inside the map.
|
|
161
|
-
*
|
|
162
|
-
* @param roomGridIndex Optional. Default is the current room index.
|
|
163
|
-
*/
|
|
164
|
-
export declare function isRoomInsideMap(roomGridIndex?: int): boolean;
|
|
165
|
-
/** Helper function to check if a room exists at the given room grid index. */
|
|
166
|
-
export declare function roomExists(roomGridIndex: int): boolean;
|
|
167
|
-
/**
|
|
168
|
-
* Helper function to get the coordinates of a given grid index. The floor is represented by a 13x13
|
|
169
|
-
* grid. For example, since the starting room is in the center, the starting room grid index of 84
|
|
170
|
-
* be equal to coordinates of (?, ?).
|
|
171
|
-
*/
|
|
172
|
-
export declare function roomGridIndexToXY(roomGridIndex: int): [x: int, y: int];
|
|
173
165
|
/**
|
|
174
166
|
* If the `Room.Update` method is called in a `POST_NEW_ROOM` callback, then some entities will
|
|
175
167
|
* slide around (such as the player). Since those entity velocities are already at zero, setting
|
|
@@ -177,6 +169,8 @@ export declare function roomGridIndexToXY(roomGridIndex: int): [x: int, y: int];
|
|
|
177
169
|
* positions/velocities before updating the room, and then restore those positions/velocities.
|
|
178
170
|
*/
|
|
179
171
|
export declare function roomUpdateSafe(): void;
|
|
172
|
+
/** Helper function to set the backdrop of the current room. */
|
|
173
|
+
export declare function setBackdrop(backdropType: BackdropType): void;
|
|
180
174
|
/**
|
|
181
175
|
* Helper function to convert an uncleared room to a cleared room in the `POST_NEW_ROOM` callback.
|
|
182
176
|
* This is useful because if enemies are removed in this callback, a room drop will be awarded and
|
|
@@ -191,13 +185,18 @@ export declare function setRoomUncleared(): void;
|
|
|
191
185
|
/**
|
|
192
186
|
* Helper function to change the current room. It can be used for both teleportation and "normal"
|
|
193
187
|
* room transitions, depending on what is passed for the `direction` and `roomTransitionAnim`
|
|
194
|
-
* arguments.
|
|
195
|
-
*
|
|
196
|
-
*
|
|
188
|
+
* arguments.
|
|
189
|
+
*
|
|
190
|
+
* Use this function instead of invoking the `Game.StartRoomTransition` method directly so that:
|
|
191
|
+
* - you do not forget to set `Level.LeaveDoor` property
|
|
192
|
+
* - to prevent crashing on invalid room grid indexes
|
|
193
|
+
* - to automatically handle Curse of the Maze
|
|
197
194
|
*
|
|
198
195
|
* @param roomGridIndex The room grid index of the destination room.
|
|
199
196
|
* @param direction Optional. Default is `Direction.NO_DIRECTION`.
|
|
200
197
|
* @param roomTransitionAnim Optional. Default is `RoomTransitionAnim.TELEPORT`.
|
|
198
|
+
* @param force Optional. Whether to temporarily disable Curse of the Maze. Default is false. If set
|
|
199
|
+
* to false, then this function may not go to the provided room grid index.
|
|
201
200
|
*/
|
|
202
|
-
export declare function teleport(roomGridIndex: int, direction?: Direction, roomTransitionAnim?: RoomTransitionAnim): void;
|
|
201
|
+
export declare function teleport(roomGridIndex: int, direction?: Direction, roomTransitionAnim?: RoomTransitionAnim, force?: boolean): void;
|
|
203
202
|
//# sourceMappingURL=rooms.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rooms.d.ts","sourceRoot":"","sources":["../../src/functions/rooms.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EACN,SAAS,EACT,SAAS,
|
|
1
|
+
{"version":3,"file":"rooms.d.ts","sourceRoot":"","sources":["../../src/functions/rooms.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EACZ,MAAM,EACN,SAAS,EACT,SAAS,EAKT,YAAY,EAEZ,UAAU,EAGV,kBAAkB,EAClB,QAAQ,EAGT,MAAM,8BAA8B,CAAC;AAiCtC;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,aAAa,EAAE,GAAG,GAAG,IAAI,CAenD;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,GAAG,CAGjC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,IAAI,KAAK,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAiBlE;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,GAAG,EAChB,oBAAoB,UAAO,GAC1B,QAAQ,CAAC,UAAU,CAAC,GAAG,SAAS,CAgBlC;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,YAAY,CAOlD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAE1D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CACtB,4BAA4B,UAAQ,GACnC,cAAc,EAAE,CAOlB;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,4BAA4B,UAAQ,GACnC,cAAc,EAAE,CAqBlB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,cAAc,EAAE,CAe1E;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAI,cAAc,EAAE,CAWtD;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAKnC;AAED,wBAAgB,WAAW,IAAI,OAAO,CAOrC;AAED,wBAAgB,WAAW,IAAI,OAAO,CASrC;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAWpD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAOtC;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAWhD;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,IAAI,OAAO,CAGnD;AAED,wBAAgB,eAAe,IAAI,OAAO,CAMzC;AAED,wBAAgB,aAAa,IAAI,OAAO,CAKvC;AAED,+FAA+F;AAC/F,wBAAgB,OAAO,IAAI,OAAO,CAUjC;AAED,wBAAgB,eAAe,IAAI,OAAO,CAKzC;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,OAAO,CASrC;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAWhE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAKtC;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAMxC;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,kBAAkB,CAAC,EAAE,QAAQ,EAAE,GAAG,OAAO,CAcxE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAWrC;AAED,+DAA+D;AAC/D,wBAAgB,WAAW,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI,CAE5D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,IAAI,CA8BrC;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAKvC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,QAAQ,CACtB,aAAa,EAAE,GAAG,EAClB,SAAS,YAAyB,EAClC,kBAAkB,qBAA8B,EAChD,KAAK,UAAQ,GACZ,IAAI,CA0BN"}
|