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.
- package/dist/constants.d.ts +6 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.lua +4 -0
- package/dist/constantsFirstLast.d.ts +2 -2
- package/dist/constantsFirstLast.lua +2 -2
- package/dist/enums/RockAltType.d.ts +12 -1
- package/dist/enums/RockAltType.d.ts.map +1 -1
- package/dist/enums/RockAltType.lua +4 -2
- package/dist/enums/private/StageTravelState.d.ts +4 -3
- package/dist/enums/private/StageTravelState.d.ts.map +1 -1
- package/dist/enums/private/StageTravelState.lua +6 -4
- package/dist/features/customStage/backdrop.d.ts.map +1 -1
- package/dist/features/customStage/backdrop.lua +3 -2
- package/dist/features/customStage/customStageConstants.d.ts +11 -0
- package/dist/features/customStage/customStageConstants.d.ts.map +1 -1
- package/dist/features/customStage/customStageConstants.lua +10 -0
- package/dist/features/customStage/customStageGridEntities.d.ts +1 -0
- package/dist/features/customStage/customStageGridEntities.d.ts.map +1 -1
- package/dist/features/customStage/customStageGridEntities.lua +65 -23
- package/dist/features/customStage/exports.d.ts +17 -3
- package/dist/features/customStage/exports.d.ts.map +1 -1
- package/dist/features/customStage/exports.lua +65 -46
- package/dist/features/customStage/init.d.ts.map +1 -1
- package/dist/features/customStage/init.lua +7 -12
- package/dist/features/customStage/shadows.d.ts.map +1 -1
- package/dist/features/customStage/shadows.lua +2 -1
- package/dist/features/customStage/streakText.d.ts +0 -7
- package/dist/features/customStage/streakText.d.ts.map +1 -1
- package/dist/features/customStage/streakText.lua +52 -85
- package/dist/features/customStage/v.d.ts +13 -0
- package/dist/features/customStage/v.d.ts.map +1 -1
- package/dist/features/customStage/v.lua +6 -1
- package/dist/features/customStage/versusScreen.d.ts.map +1 -1
- package/dist/features/customStage/versusScreen.lua +32 -1
- package/dist/features/customTrapdoor/blackSprite.d.ts.map +1 -1
- package/dist/features/customTrapdoor/blackSprite.lua +2 -1
- package/dist/features/customTrapdoor/customTrapdoorConstants.d.ts +4 -0
- package/dist/features/customTrapdoor/customTrapdoorConstants.d.ts.map +1 -1
- package/dist/features/customTrapdoor/exports.d.ts +11 -7
- package/dist/features/customTrapdoor/exports.d.ts.map +1 -1
- package/dist/features/customTrapdoor/exports.lua +6 -5
- package/dist/features/customTrapdoor/init.d.ts.map +1 -1
- package/dist/features/customTrapdoor/init.lua +35 -20
- package/dist/features/customTrapdoor/touched.lua +1 -1
- package/dist/features/customTrapdoor/v.d.ts +2 -2
- package/dist/features/customTrapdoor/v.d.ts.map +1 -1
- package/dist/features/extraConsoleCommands/commandsSubroutines.d.ts.map +1 -1
- package/dist/features/extraConsoleCommands/commandsSubroutines.lua +3 -3
- package/dist/features/playerInventory.d.ts +7 -0
- package/dist/features/playerInventory.d.ts.map +1 -1
- package/dist/features/playerInventory.lua +7 -0
- package/dist/features/saveDataManager/exports.d.ts +3 -0
- package/dist/features/saveDataManager/exports.d.ts.map +1 -1
- package/dist/features/saveDataManager/exports.lua +3 -0
- package/dist/functions/collectibleSet.d.ts +1 -1
- package/dist/functions/collectibleSet.lua +1 -1
- package/dist/functions/doors.d.ts +10 -0
- package/dist/functions/doors.d.ts.map +1 -1
- package/dist/functions/doors.lua +6 -0
- package/dist/functions/levelGrid.lua +1 -1
- package/dist/functions/log.d.ts +1 -15
- package/dist/functions/log.d.ts.map +1 -1
- package/dist/functions/log.lua +3 -218
- package/dist/functions/logEntities.d.ts +16 -0
- package/dist/functions/logEntities.d.ts.map +1 -0
- package/dist/functions/logEntities.lua +220 -0
- package/dist/functions/rockAlt.d.ts +6 -5
- package/dist/functions/rockAlt.d.ts.map +1 -1
- package/dist/functions/rockAlt.lua +147 -18
- package/dist/functions/roomData.d.ts +1 -1
- package/dist/functions/roomData.d.ts.map +1 -1
- package/dist/functions/roomTransition.d.ts +26 -0
- package/dist/functions/roomTransition.d.ts.map +1 -0
- package/dist/functions/roomTransition.lua +75 -0
- package/dist/functions/rooms.d.ts +36 -35
- package/dist/functions/rooms.d.ts.map +1 -1
- package/dist/functions/rooms.lua +94 -99
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.lua +8 -0
- package/dist/interfaces/private/CustomTrapdoorDescription.d.ts +2 -2
- package/dist/interfaces/private/CustomTrapdoorDescription.d.ts.map +1 -1
- package/dist/objects/backdropTypeToRockAltType.lua +3 -3
- package/dist/types/TrapdoorDestination.d.ts +3 -0
- package/dist/types/TrapdoorDestination.d.ts.map +1 -0
- package/dist/types/TrapdoorDestination.lua +2 -0
- package/package.json +2 -2
- package/src/constants.ts +6 -0
- package/src/constantsFirstLast.ts +2 -2
- package/src/enums/RockAltType.ts +14 -1
- package/src/enums/private/StageTravelState.ts +2 -1
- package/src/features/customStage/backdrop.ts +2 -1
- package/src/features/customStage/customStageConstants.ts +16 -0
- package/src/features/customStage/customStageGridEntities.ts +61 -0
- package/src/features/customStage/exports.ts +81 -42
- package/src/features/customStage/init.ts +7 -18
- package/src/features/customStage/shadows.ts +2 -1
- package/src/features/customStage/streakText.ts +59 -96
- package/src/features/customStage/v.ts +17 -0
- package/src/features/customStage/versusScreen.ts +29 -0
- package/src/features/customTrapdoor/blackSprite.ts +6 -1
- package/src/features/customTrapdoor/customTrapdoorConstants.ts +4 -0
- package/src/features/customTrapdoor/exports.ts +8 -6
- package/src/features/customTrapdoor/init.ts +55 -23
- package/src/features/customTrapdoor/touched.ts +4 -1
- package/src/features/customTrapdoor/v.ts +2 -5
- package/src/features/extraConsoleCommands/commandsSubroutines.ts +4 -1
- package/src/features/playerInventory.ts +7 -0
- package/src/features/saveDataManager/exports.ts +3 -0
- package/src/functions/collectibleSet.ts +1 -1
- package/src/functions/doors.ts +10 -0
- package/src/functions/levelGrid.ts +1 -1
- package/src/functions/log.ts +1 -279
- package/src/functions/logEntities.ts +276 -0
- package/src/functions/rockAlt.ts +147 -19
- package/src/functions/roomData.ts +1 -1
- package/src/functions/roomTransition.ts +78 -0
- package/src/functions/rooms.ts +104 -107
- package/src/index.ts +1 -0
- package/src/interfaces/private/CustomTrapdoorDescription.ts +2 -2
- package/src/objects/backdropTypeToRockAltType.ts +3 -3
- package/src/types/TrapdoorDestination.ts +5 -0
package/src/functions/rooms.ts
CHANGED
|
@@ -1,27 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AngelRoomSubType,
|
|
3
|
+
BackdropType,
|
|
3
4
|
BossID,
|
|
4
5
|
Dimension,
|
|
5
|
-
Direction,
|
|
6
6
|
DoorSlot,
|
|
7
7
|
DungeonSubType,
|
|
8
8
|
GridRoom,
|
|
9
9
|
HomeRoomSubType,
|
|
10
10
|
ItemPoolType,
|
|
11
|
-
LevelCurse,
|
|
12
11
|
MinibossID,
|
|
13
12
|
RoomDescriptorFlag,
|
|
14
13
|
RoomShape,
|
|
15
|
-
RoomTransitionAnim,
|
|
16
14
|
RoomType,
|
|
17
15
|
SoundEffect,
|
|
18
16
|
StageID,
|
|
19
17
|
} from "isaac-typescript-definitions";
|
|
20
18
|
import { game, sfxManager } from "../cachedClasses";
|
|
21
|
-
import { MAX_LEVEL_GRID_INDEX } from "../constants";
|
|
19
|
+
import { MAX_LEVEL_GRID_INDEX, NUM_DIMENSIONS } from "../constants";
|
|
22
20
|
import { ROOM_TYPE_NAMES } from "../objects/roomTypeNames";
|
|
23
21
|
import { MINE_SHAFT_ROOM_SUB_TYPE_SET } from "../sets/mineShaftRoomSubTypesSet";
|
|
24
|
-
import { hasCurse } from "./curses";
|
|
25
22
|
import { inDimension } from "./dimensions";
|
|
26
23
|
import {
|
|
27
24
|
closeAllDoors,
|
|
@@ -39,14 +36,16 @@ import {
|
|
|
39
36
|
} from "./positionVelocity";
|
|
40
37
|
import {
|
|
41
38
|
getRoomData,
|
|
39
|
+
getRoomDescriptor,
|
|
42
40
|
getRoomDescriptorReadOnly,
|
|
43
41
|
getRoomGridIndex,
|
|
44
42
|
getRoomName,
|
|
45
43
|
getRoomStageID,
|
|
46
44
|
getRoomSubType,
|
|
47
45
|
} from "./roomData";
|
|
46
|
+
import { reloadRoom } from "./roomTransition";
|
|
48
47
|
import { getGotoCommand } from "./stage";
|
|
49
|
-
import { irange } from "./utils";
|
|
48
|
+
import { erange, irange } from "./utils";
|
|
50
49
|
|
|
51
50
|
/**
|
|
52
51
|
* Helper function for quickly switching to a new room without playing a particular animation. Use
|
|
@@ -79,6 +78,36 @@ export function getNumRooms(): int {
|
|
|
79
78
|
return rooms.length;
|
|
80
79
|
}
|
|
81
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Helper function to get a read-only copy of the room descriptor for every room on the level. This
|
|
83
|
+
* includes off-grid rooms, such as the Devil Room, and extra-dimensional rooms, if they are
|
|
84
|
+
* generated and exist.
|
|
85
|
+
*
|
|
86
|
+
* Room descriptors without any data are assumed to be non-existent and are not included.
|
|
87
|
+
*
|
|
88
|
+
* Under the hood, this is performed by iterating over the `RoomList` from the `Level.GetRooms`
|
|
89
|
+
* method. This is the best way to see if off-grid rooms have been initialized, since it is possible
|
|
90
|
+
* for mods to insert room data at non-official negative room grid indexes.
|
|
91
|
+
*/
|
|
92
|
+
export function getReadOnlyRooms(): Array<Readonly<RoomDescriptor>> {
|
|
93
|
+
const level = game.GetLevel();
|
|
94
|
+
const roomList = level.GetRooms();
|
|
95
|
+
|
|
96
|
+
const readOnlyRoomDescriptors: Array<Readonly<RoomDescriptor>> = [];
|
|
97
|
+
|
|
98
|
+
for (let i = 0; i < roomList.Size; i++) {
|
|
99
|
+
const readOnlyRoomDescriptor = roomList.Get(i);
|
|
100
|
+
if (
|
|
101
|
+
readOnlyRoomDescriptor !== undefined &&
|
|
102
|
+
readOnlyRoomDescriptor.Data !== undefined
|
|
103
|
+
) {
|
|
104
|
+
readOnlyRoomDescriptors.push(readOnlyRoomDescriptor);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return readOnlyRoomDescriptors;
|
|
109
|
+
}
|
|
110
|
+
|
|
82
111
|
/**
|
|
83
112
|
* Helper function to get the room data for a specific room type and variant combination. This is
|
|
84
113
|
* accomplished by using the "goto" console command to load the specified room into the
|
|
@@ -110,13 +139,7 @@ export function getRoomDataForTypeVariant(
|
|
|
110
139
|
const newRoomData = getRoomData(GridRoom.DEBUG);
|
|
111
140
|
|
|
112
141
|
if (cancelRoomTransition) {
|
|
113
|
-
|
|
114
|
-
teleport(
|
|
115
|
-
roomGridIndex,
|
|
116
|
-
Direction.NO_DIRECTION,
|
|
117
|
-
RoomTransitionAnim.FADE,
|
|
118
|
-
true,
|
|
119
|
-
);
|
|
142
|
+
reloadRoom();
|
|
120
143
|
}
|
|
121
144
|
|
|
122
145
|
return newRoomData;
|
|
@@ -146,87 +169,105 @@ export function getRoomTypeName(roomType: RoomType): string {
|
|
|
146
169
|
|
|
147
170
|
/**
|
|
148
171
|
* Helper function to get the room descriptor for every room on the level. This includes off-grid
|
|
149
|
-
* rooms, such as the Devil Room.
|
|
150
|
-
* which only usually happens once they have been visited at least once.)
|
|
172
|
+
* rooms, such as the Devil Room.
|
|
151
173
|
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
174
|
+
* Room descriptors without any data are assumed to be non-existent and are not included.
|
|
175
|
+
*
|
|
176
|
+
* - If you want just the rooms inside of the grid, use the `getRoomsInGrid` helper function.
|
|
177
|
+
* - If you want just the rooms outside of the grid, use the `getRoomsOutsideGrid` helper function.
|
|
154
178
|
*
|
|
155
179
|
* @param includeExtraDimensionalRooms Optional. On some floors (e.g. Downpour 2, Mines 2),
|
|
156
|
-
* extra-dimensional rooms are automatically generated
|
|
157
|
-
*
|
|
180
|
+
* extra-dimensional rooms are automatically generated. Default is
|
|
181
|
+
* false.
|
|
158
182
|
*/
|
|
159
183
|
export function getRooms(
|
|
160
184
|
includeExtraDimensionalRooms = false,
|
|
161
185
|
): RoomDescriptor[] {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
for (let i = 0; i < roomList.Size; i++) {
|
|
169
|
-
const roomDescriptor = roomList.Get(i);
|
|
170
|
-
if (roomDescriptor === undefined || roomDescriptor.Data === undefined) {
|
|
171
|
-
continue;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
if (
|
|
175
|
-
!includeExtraDimensionalRooms &&
|
|
176
|
-
roomsMap.has(roomDescriptor.SafeGridIndex)
|
|
177
|
-
) {
|
|
178
|
-
continue;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
roomsMap.set(roomDescriptor.SafeGridIndex, roomDescriptor);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
return [...roomsMap.values()];
|
|
186
|
+
// The obvious way to get all of the rooms would be to iterate over the `RoomList` from the
|
|
187
|
+
// `Level.GetRooms` method. However, this results in read-only data, and we want to return a
|
|
188
|
+
// writable object. Instead, we let the heavy lifting be handled by other functions.
|
|
189
|
+
const roomsInGrid = getRoomsInGrid(includeExtraDimensionalRooms);
|
|
190
|
+
const roomsOutsideGrid = getRoomsOutsideGrid();
|
|
191
|
+
return [...roomsInGrid, ...roomsOutsideGrid];
|
|
185
192
|
}
|
|
186
193
|
|
|
187
194
|
/**
|
|
188
|
-
* Helper function to get the room descriptor for every room on the level
|
|
189
|
-
*
|
|
195
|
+
* Helper function to get the room descriptor for every room on the level that is on the grid. (For
|
|
196
|
+
* example, Devil Rooms are excluded.)
|
|
190
197
|
*
|
|
191
|
-
*
|
|
192
|
-
* data are assumed to be non-existent and are not added to the list.
|
|
198
|
+
* Room descriptors without any data are assumed to be non-existent and are not included.
|
|
193
199
|
*
|
|
194
200
|
* @param includeExtraDimensionalRooms Optional. On some floors (e.g. Downpour 2, Mines 2),
|
|
195
|
-
* extra-dimensional rooms are automatically be generated
|
|
196
|
-
*
|
|
201
|
+
* extra-dimensional rooms are automatically be generated. Default
|
|
202
|
+
* is false.
|
|
197
203
|
*/
|
|
198
204
|
export function getRoomsInGrid(
|
|
199
205
|
includeExtraDimensionalRooms = false,
|
|
200
206
|
): RoomDescriptor[] {
|
|
201
|
-
const
|
|
202
|
-
|
|
207
|
+
const level = game.GetLevel();
|
|
208
|
+
|
|
209
|
+
const dimensions = includeExtraDimensionalRooms
|
|
210
|
+
? (erange(NUM_DIMENSIONS) as Dimension[])
|
|
211
|
+
: [Dimension.CURRENT];
|
|
212
|
+
|
|
213
|
+
/** We use a map instead of an array because room shapes occupy more than one room grid index. */
|
|
214
|
+
const roomDescriptorMap = new Map<PtrHash, RoomDescriptor>();
|
|
215
|
+
|
|
216
|
+
for (const dimension of dimensions) {
|
|
217
|
+
for (const roomGridIndex of irange(MAX_LEVEL_GRID_INDEX)) {
|
|
218
|
+
const roomDescriptor = level.GetRoomByIdx(roomGridIndex, dimension);
|
|
219
|
+
if (roomDescriptor.Data !== undefined) {
|
|
220
|
+
const ptrHash = GetPtrHash(roomDescriptor);
|
|
221
|
+
roomDescriptorMap.set(ptrHash, roomDescriptor);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
return [...roomDescriptorMap.values()];
|
|
203
227
|
}
|
|
204
228
|
|
|
205
229
|
/**
|
|
206
230
|
* Helper function to get the room descriptor for every room on the level in a specific dimension.
|
|
207
231
|
* This will not include any off-grid rooms, such as the Devil Room.
|
|
208
232
|
*
|
|
209
|
-
*
|
|
210
|
-
* data are assumed to be non-existent and are not added to the list.
|
|
211
|
-
*
|
|
212
|
-
* @returns A map of room ListIndex to RoomDescriptor.
|
|
233
|
+
* Room descriptors without any data are assumed to be non-existent and are not included.
|
|
213
234
|
*/
|
|
214
235
|
export function getRoomsOfDimension(dimension: Dimension): RoomDescriptor[] {
|
|
215
236
|
const level = game.GetLevel();
|
|
216
237
|
|
|
217
238
|
/** We use a map instead of an array because room shapes occupy more than one room grid index. */
|
|
218
|
-
const roomsMap = new Map<
|
|
239
|
+
const roomsMap = new Map<PtrHash, RoomDescriptor>();
|
|
219
240
|
|
|
220
241
|
for (const roomGridIndex of irange(MAX_LEVEL_GRID_INDEX)) {
|
|
221
242
|
const roomDescriptor = level.GetRoomByIdx(roomGridIndex, dimension);
|
|
222
243
|
if (roomDescriptor.Data !== undefined) {
|
|
223
|
-
|
|
244
|
+
const ptrHash = GetPtrHash(roomDescriptor);
|
|
245
|
+
roomsMap.set(ptrHash, roomDescriptor);
|
|
224
246
|
}
|
|
225
247
|
}
|
|
226
248
|
|
|
227
249
|
return [...roomsMap.values()];
|
|
228
250
|
}
|
|
229
251
|
|
|
252
|
+
/**
|
|
253
|
+
* Helper function to get the room descriptor for every room on the level that is outside of the
|
|
254
|
+
* grid (like a Devil Room).
|
|
255
|
+
*
|
|
256
|
+
* Room descriptors without any data are assumed to be non-existent and are not included.
|
|
257
|
+
*/
|
|
258
|
+
export function getRoomsOutsideGrid(): RoomDescriptor[] {
|
|
259
|
+
// We filter an array of all rooms instead of iterating over the `GridRoom` enum because it is
|
|
260
|
+
// possible for mods to insert data at arbitrary negative room grid indexes.
|
|
261
|
+
const readOnlyRooms = getReadOnlyRooms();
|
|
262
|
+
const readOnlyRoomsOffGrid = readOnlyRooms.filter(
|
|
263
|
+
(readOnlyRoomDescriptor) => readOnlyRoomDescriptor.SafeGridIndex < 0,
|
|
264
|
+
);
|
|
265
|
+
|
|
266
|
+
return readOnlyRoomsOffGrid.map((readOnlyRoomDescriptor) =>
|
|
267
|
+
getRoomDescriptor(readOnlyRoomDescriptor.SafeGridIndex),
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
|
|
230
271
|
/**
|
|
231
272
|
* Helper function to determine if the current room shape is equal to `RoomShape.1x2` or
|
|
232
273
|
* `RoomShape.2x1`.
|
|
@@ -413,7 +454,7 @@ export function inStartingRoom(): boolean {
|
|
|
413
454
|
/**
|
|
414
455
|
* Helper function to loop through every room on the floor and see if it has been cleared.
|
|
415
456
|
*
|
|
416
|
-
* This function will only check rooms
|
|
457
|
+
* This function will only check rooms inside the gird and inside the current dimension.
|
|
417
458
|
*
|
|
418
459
|
* @param onlyCheckRoomTypes Optional. A whitelist of room types. If specified, room types not in
|
|
419
460
|
* the array will be ignored. If not specified, then all rooms will be
|
|
@@ -422,7 +463,7 @@ export function inStartingRoom(): boolean {
|
|
|
422
463
|
export function isAllRoomsClear(onlyCheckRoomTypes?: RoomType[]): boolean {
|
|
423
464
|
const roomTypeWhitelist =
|
|
424
465
|
onlyCheckRoomTypes === undefined ? null : new Set(onlyCheckRoomTypes);
|
|
425
|
-
const rooms =
|
|
466
|
+
const rooms = getRoomsInGrid();
|
|
426
467
|
const matchingRooms =
|
|
427
468
|
roomTypeWhitelist === null
|
|
428
469
|
? rooms
|
|
@@ -454,6 +495,11 @@ export function roomUpdateSafe(): void {
|
|
|
454
495
|
setEntityVelocities(entityVelocities, entities);
|
|
455
496
|
}
|
|
456
497
|
|
|
498
|
+
/** Helper function to set the backdrop of the current room. */
|
|
499
|
+
export function setBackdrop(backdropType: BackdropType): void {
|
|
500
|
+
game.ShowHallucination(0, backdropType);
|
|
501
|
+
}
|
|
502
|
+
|
|
457
503
|
/**
|
|
458
504
|
* Helper function to convert an uncleared room to a cleared room in the `POST_NEW_ROOM` callback.
|
|
459
505
|
* This is useful because if enemies are removed in this callback, a room drop will be awarded and
|
|
@@ -501,52 +547,3 @@ export function setRoomUncleared(): void {
|
|
|
501
547
|
room.SetClear(false);
|
|
502
548
|
closeAllDoors();
|
|
503
549
|
}
|
|
504
|
-
|
|
505
|
-
/**
|
|
506
|
-
* Helper function to change the current room. It can be used for both teleportation and "normal"
|
|
507
|
-
* room transitions, depending on what is passed for the `direction` and `roomTransitionAnim`
|
|
508
|
-
* arguments.
|
|
509
|
-
*
|
|
510
|
-
* Use this function instead of invoking the `Game.StartRoomTransition` method directly so that:
|
|
511
|
-
* - you do not forget to set `Level.LeaveDoor` property
|
|
512
|
-
* - to prevent crashing on invalid room grid indexes
|
|
513
|
-
* - to automatically handle Curse of the Maze
|
|
514
|
-
*
|
|
515
|
-
* @param roomGridIndex The room grid index of the destination room.
|
|
516
|
-
* @param direction Optional. Default is `Direction.NO_DIRECTION`.
|
|
517
|
-
* @param roomTransitionAnim Optional. Default is `RoomTransitionAnim.TELEPORT`.
|
|
518
|
-
* @param force Optional. Whether to temporarily disable Curse of the Maze. Default is false. If set
|
|
519
|
-
* to false, then this function may not go to the provided room grid index.
|
|
520
|
-
*/
|
|
521
|
-
export function teleport(
|
|
522
|
-
roomGridIndex: int,
|
|
523
|
-
direction = Direction.NO_DIRECTION,
|
|
524
|
-
roomTransitionAnim = RoomTransitionAnim.TELEPORT,
|
|
525
|
-
force = false,
|
|
526
|
-
): void {
|
|
527
|
-
const level = game.GetLevel();
|
|
528
|
-
|
|
529
|
-
// Before starting a room transition, we must ensure that Curse of the Maze is not in effect, or
|
|
530
|
-
// else the room transition might send us to the wrong room.
|
|
531
|
-
const shouldTempDisableCurse = force && hasCurse(LevelCurse.MAZE);
|
|
532
|
-
if (shouldTempDisableCurse) {
|
|
533
|
-
level.RemoveCurses(LevelCurse.MAZE);
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
const roomData = getRoomData(roomGridIndex);
|
|
537
|
-
if (roomData === undefined) {
|
|
538
|
-
error(
|
|
539
|
-
`Failed to change the room to grid index ${roomGridIndex} because that room does not exist.`,
|
|
540
|
-
);
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
// This must be set before every `Game.StartRoomTransition` method invocation or else the function
|
|
544
|
-
// can send you to the wrong room.
|
|
545
|
-
level.LeaveDoor = DoorSlot.NO_DOOR_SLOT;
|
|
546
|
-
|
|
547
|
-
game.StartRoomTransition(roomGridIndex, direction, roomTransitionAnim);
|
|
548
|
-
|
|
549
|
-
if (shouldTempDisableCurse) {
|
|
550
|
-
level.AddCurse(LevelCurse.MAZE, false);
|
|
551
|
-
}
|
|
552
|
-
}
|
package/src/index.ts
CHANGED
|
@@ -127,6 +127,7 @@ export * from "./functions/language";
|
|
|
127
127
|
export * from "./functions/level";
|
|
128
128
|
export * from "./functions/levelGrid";
|
|
129
129
|
export * from "./functions/log";
|
|
130
|
+
export * from "./functions/logEntities";
|
|
130
131
|
export * from "./functions/map";
|
|
131
132
|
export * from "./functions/math";
|
|
132
133
|
export * from "./functions/mergeTests";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TrapdoorDestination } from "../../types/TrapdoorDestination";
|
|
2
2
|
|
|
3
3
|
export interface CustomTrapdoorDescription {
|
|
4
4
|
open: boolean;
|
|
5
|
-
destination:
|
|
5
|
+
destination: TrapdoorDestination;
|
|
6
6
|
firstSpawn: boolean;
|
|
7
7
|
}
|
|
@@ -35,12 +35,12 @@ export const BACKDROP_TYPE_TO_ROCK_ALT_TYPE: {
|
|
|
35
35
|
[BackdropType.GREED_SHOP]: RockAltType.URN, // 28
|
|
36
36
|
[BackdropType.DUNGEON]: RockAltType.URN, // 29
|
|
37
37
|
[BackdropType.SACRIFICE]: RockAltType.SKULL, // 30
|
|
38
|
-
[BackdropType.DOWNPOUR]: RockAltType.
|
|
38
|
+
[BackdropType.DOWNPOUR]: RockAltType.BUCKET_DOWNPOUR, // 31
|
|
39
39
|
[BackdropType.MINES]: RockAltType.MUSHROOM, // 32
|
|
40
40
|
[BackdropType.MAUSOLEUM]: RockAltType.SKULL, // 33
|
|
41
41
|
[BackdropType.CORPSE]: RockAltType.POLYP, // 34
|
|
42
42
|
[BackdropType.PLANETARIUM]: RockAltType.URN, // 35
|
|
43
|
-
[BackdropType.DOWNPOUR_ENTRANCE]: RockAltType.
|
|
43
|
+
[BackdropType.DOWNPOUR_ENTRANCE]: RockAltType.BUCKET_DOWNPOUR, // 36
|
|
44
44
|
[BackdropType.MINES_ENTRANCE]: RockAltType.MUSHROOM, // 37
|
|
45
45
|
[BackdropType.MAUSOLEUM_ENTRANCE]: RockAltType.SKULL, // 38
|
|
46
46
|
[BackdropType.CORPSE_ENTRANCE]: RockAltType.SKULL, // 39
|
|
@@ -49,7 +49,7 @@ export const BACKDROP_TYPE_TO_ROCK_ALT_TYPE: {
|
|
|
49
49
|
[BackdropType.MAUSOLEUM_4]: RockAltType.SKULL, // 42
|
|
50
50
|
[BackdropType.CORPSE_2]: RockAltType.POLYP, // 43
|
|
51
51
|
[BackdropType.CORPSE_3]: RockAltType.POLYP, // 44
|
|
52
|
-
[BackdropType.DROSS]: RockAltType.
|
|
52
|
+
[BackdropType.DROSS]: RockAltType.BUCKET_DROSS, // 45
|
|
53
53
|
[BackdropType.ASHPIT]: RockAltType.MUSHROOM, // 46
|
|
54
54
|
[BackdropType.GEHENNA]: RockAltType.SKULL, // 47
|
|
55
55
|
[BackdropType.MORTIS]: RockAltType.POLYP, // 48
|