isaacscript-common 55.1.0 → 55.2.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/index.rollup.d.ts +26 -1
- package/dist/isaacscript-common.lua +2607 -2575
- package/dist/src/classes/callbacks/PostNewRoomEarly.lua +2 -2
- package/dist/src/classes/features/callbackLogic/CustomRevive.d.ts.map +1 -1
- package/dist/src/classes/features/callbackLogic/CustomRevive.lua +1 -2
- package/dist/src/classes/features/other/CustomStages.lua +2 -2
- package/dist/src/classes/features/other/ExtraConsoleCommands.lua +2 -2
- package/dist/src/classes/features/other/Pause.lua +2 -2
- package/dist/src/classes/features/other/TaintedLazarusPlayers.lua +2 -2
- package/dist/src/classes/features/other/saveDataManager/loadFromDisk.d.ts.map +1 -1
- package/dist/src/classes/features/other/saveDataManager/loadFromDisk.lua +1 -2
- package/dist/src/classes/features/other/saveDataManager/restoreDefaults.lua +2 -2
- package/dist/src/functions/hex.lua +2 -2
- package/dist/src/functions/jsonHelpers.lua +2 -2
- package/dist/src/functions/log.d.ts +7 -0
- package/dist/src/functions/log.d.ts.map +1 -1
- package/dist/src/functions/log.lua +8 -0
- package/dist/src/functions/logMisc.d.ts +0 -7
- package/dist/src/functions/logMisc.d.ts.map +1 -1
- package/dist/src/functions/logMisc.lua +0 -9
- package/dist/src/functions/rng.d.ts.map +1 -1
- package/dist/src/functions/rng.lua +4 -1
- package/dist/src/functions/roomShape.d.ts +5 -0
- package/dist/src/functions/roomShape.d.ts.map +1 -1
- package/dist/src/functions/roomShape.lua +7 -0
- package/dist/src/functions/rooms.d.ts +10 -0
- package/dist/src/functions/rooms.d.ts.map +1 -1
- package/dist/src/functions/rooms.lua +14 -2
- package/dist/src/functions/stage.d.ts +8 -1
- package/dist/src/functions/stage.d.ts.map +1 -1
- package/dist/src/functions/stage.lua +5 -0
- package/dist/src/sets/bigRoomShapesSet.d.ts +3 -0
- package/dist/src/sets/bigRoomShapesSet.d.ts.map +1 -0
- package/dist/src/sets/bigRoomShapesSet.lua +17 -0
- package/package.json +1 -1
- package/src/classes/callbacks/PostNewRoomEarly.ts +1 -1
- package/src/classes/features/callbackLogic/CustomRevive.ts +1 -2
- package/src/classes/features/other/CustomStages.ts +1 -1
- package/src/classes/features/other/ExtraConsoleCommands.ts +1 -1
- package/src/classes/features/other/Pause.ts +1 -1
- package/src/classes/features/other/TaintedLazarusPlayers.ts +1 -1
- package/src/classes/features/other/saveDataManager/loadFromDisk.ts +1 -2
- package/src/classes/features/other/saveDataManager/restoreDefaults.ts +1 -1
- package/src/functions/hex.ts +1 -1
- package/src/functions/jsonHelpers.ts +1 -1
- package/src/functions/log.ts +11 -0
- package/src/functions/logMisc.ts +1 -12
- package/src/functions/rng.ts +4 -2
- package/src/functions/roomShape.ts +9 -0
- package/src/functions/rooms.ts +18 -1
- package/src/functions/stage.ts +8 -1
- package/src/sets/bigRoomShapesSet.ts +12 -0
package/src/functions/logMisc.ts
CHANGED
|
@@ -22,7 +22,7 @@ import { getEntityID } from "./entities";
|
|
|
22
22
|
import { getEnumEntries } from "./enums";
|
|
23
23
|
import { hasFlag } from "./flag";
|
|
24
24
|
import { getIsaacAPIClassName } from "./isaacAPIClass";
|
|
25
|
-
import { log
|
|
25
|
+
import { log } from "./log";
|
|
26
26
|
import { getPlayerHealth } from "./playerHealth";
|
|
27
27
|
import { getEffectsList, getPlayerName } from "./players";
|
|
28
28
|
import { getRoomData, getRoomGridIndex, getRoomListIndex } from "./roomData";
|
|
@@ -128,17 +128,6 @@ export function logEntityID(this: void, entity: Entity): void {
|
|
|
128
128
|
log(`Logging entity: ${entityID}`);
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
/**
|
|
132
|
-
* Helper function to log an error message and also print it to the console for better visibility.
|
|
133
|
-
*
|
|
134
|
-
* This is useful in situations where using the `error` function would be dangerous (since it
|
|
135
|
-
* prevents all of the subsequent code in the callback from running).
|
|
136
|
-
*/
|
|
137
|
-
export function logError(this: void, msg: string): void {
|
|
138
|
-
const errorMsg = `Error: ${msg}`;
|
|
139
|
-
logAndPrint(errorMsg);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
131
|
/** Helper function for logging every flag that is turned on. Useful when debugging. */
|
|
143
132
|
export function logFlags<T extends BitFlag | BitFlag128>(
|
|
144
133
|
this: void,
|
package/src/functions/rng.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { CopyableIsaacAPIClassType } from "isaac-typescript-definitions";
|
|
|
2
2
|
import { game } from "../core/cachedClasses";
|
|
3
3
|
import { SerializationBrand } from "../enums/private/SerializationBrand";
|
|
4
4
|
import { isaacAPIClassEquals, isIsaacAPIClassOfType } from "./isaacAPIClass";
|
|
5
|
+
import { logError } from "./log";
|
|
5
6
|
import { getNumbersFromTable, tableHasKeys } from "./table";
|
|
6
7
|
import { isTable } from "./types";
|
|
7
8
|
import { assertDefined } from "./utils";
|
|
@@ -155,8 +156,9 @@ export function setAllRNGToStartSeed(object: unknown): void {
|
|
|
155
156
|
/** Helper function to set a seed to an RNG object using Blade's recommended shift index. */
|
|
156
157
|
export function setSeed(rng: RNG, seed: Seed): void {
|
|
157
158
|
if (seed === 0) {
|
|
158
|
-
|
|
159
|
-
|
|
159
|
+
seed = getRandomSeed();
|
|
160
|
+
logError(
|
|
161
|
+
"Failed to set a RNG object to a seed of 0. Using a random value instead.",
|
|
160
162
|
);
|
|
161
163
|
}
|
|
162
164
|
|
|
@@ -10,6 +10,7 @@ import { ROOM_SHAPE_TO_GRID_WIDTH } from "../objects/roomShapeToGridWidth";
|
|
|
10
10
|
import { ROOM_SHAPE_TO_TOP_LEFT_POSITION } from "../objects/roomShapeToTopLeftPosition";
|
|
11
11
|
import { ROOM_SHAPE_VOLUMES } from "../objects/roomShapeVolumes";
|
|
12
12
|
import { L_ROOM_SHAPES_SET } from "../sets/LRoomShapesSet";
|
|
13
|
+
import { BIG_ROOM_SHAPES_SET } from "../sets/bigRoomShapesSet";
|
|
13
14
|
import { NARROW_ROOM_SHAPES_SET } from "../sets/narrowRoomShapesSet";
|
|
14
15
|
|
|
15
16
|
/**
|
|
@@ -109,6 +110,14 @@ export function getRoomShapeWidth(roomShape: RoomShape): int {
|
|
|
109
110
|
return ROOM_SHAPE_TO_GRID_WIDTH[roomShape];
|
|
110
111
|
}
|
|
111
112
|
|
|
113
|
+
/**
|
|
114
|
+
* Helper function to detect if the provided room shape is big. Specifically, this is all 1x2 rooms,
|
|
115
|
+
* 2x2 rooms, and L rooms.
|
|
116
|
+
*/
|
|
117
|
+
export function isBigRoomShape(roomShape: RoomShape): boolean {
|
|
118
|
+
return BIG_ROOM_SHAPES_SET.has(roomShape);
|
|
119
|
+
}
|
|
120
|
+
|
|
112
121
|
export function isLRoomShape(roomShape: RoomShape): boolean {
|
|
113
122
|
return L_ROOM_SHAPES_SET.has(roomShape);
|
|
114
123
|
}
|
package/src/functions/rooms.ts
CHANGED
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
getRoomDescriptorReadOnly,
|
|
46
46
|
getRoomGridIndex,
|
|
47
47
|
} from "./roomData";
|
|
48
|
-
import { isLRoomShape } from "./roomShape";
|
|
48
|
+
import { isBigRoomShape, isLRoomShape } from "./roomShape";
|
|
49
49
|
import { reloadRoom } from "./roomTransition";
|
|
50
50
|
import { getGotoCommand } from "./stage";
|
|
51
51
|
import { asNumber } from "./types";
|
|
@@ -318,6 +318,15 @@ export function inBeastRoom(): boolean {
|
|
|
318
318
|
return isBeastRoom(roomData);
|
|
319
319
|
}
|
|
320
320
|
|
|
321
|
+
/**
|
|
322
|
+
* Helper function to detect if the current room is big. Specifically, this is all 1x2 rooms, 2x2
|
|
323
|
+
* rooms, and L rooms.
|
|
324
|
+
*/
|
|
325
|
+
export function inBigRoom(): boolean {
|
|
326
|
+
const roomData = getRoomData();
|
|
327
|
+
return isBigRoom(roomData);
|
|
328
|
+
}
|
|
329
|
+
|
|
321
330
|
/**
|
|
322
331
|
* Helper function to check if the current room is the Boss Room for a particular boss. This will
|
|
323
332
|
* only work for bosses that have dedicated boss rooms in the "00.special rooms.stb" file.
|
|
@@ -601,6 +610,14 @@ export function isBeastRoom(roomData: RoomConfig): boolean {
|
|
|
601
610
|
);
|
|
602
611
|
}
|
|
603
612
|
|
|
613
|
+
/**
|
|
614
|
+
* Helper function to detect if the provided room is big. Specifically, this is all 1x2 rooms, 2x2
|
|
615
|
+
* rooms, and L rooms.
|
|
616
|
+
*/
|
|
617
|
+
export function isBigRoom(roomData: RoomConfig): boolean {
|
|
618
|
+
return isBigRoomShape(roomData.Shape);
|
|
619
|
+
}
|
|
620
|
+
|
|
604
621
|
/**
|
|
605
622
|
* Helper function to check if the provided room is the Boss Room for a particular boss. This will
|
|
606
623
|
* only work for bosses that have dedicated boss rooms in the "00.special rooms.stb" file.
|
package/src/functions/stage.ts
CHANGED
|
@@ -181,7 +181,14 @@ export function getStageType(): StageType {
|
|
|
181
181
|
return level.GetStageType();
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
/**
|
|
184
|
+
/**
|
|
185
|
+
* Helper function to directly warp to a specific stage using the "stage" console command.
|
|
186
|
+
*
|
|
187
|
+
* Note that if you use this function on game frame 0, it will confuse the
|
|
188
|
+
* `POST_GAME_STARTED_REORDERED`, `POST_NEW_LEVEL_REORDERED`, and `POST_NEW_ROOM_REORDERED` custom
|
|
189
|
+
* callbacks. If you are using the function in this situation, remember to call the
|
|
190
|
+
* `reorderedCallbacksSetStage` function.
|
|
191
|
+
*/
|
|
185
192
|
export function goToStage(stage: LevelStage, stageType: StageType): void {
|
|
186
193
|
const stageTypeLetterSuffix = stageTypeToLetter(stageType);
|
|
187
194
|
const command = `stage ${stage}${stageTypeLetterSuffix}`;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RoomShape } from "isaac-typescript-definitions";
|
|
2
|
+
import { ReadonlySet } from "../types/ReadonlySet";
|
|
3
|
+
|
|
4
|
+
export const BIG_ROOM_SHAPES_SET = new ReadonlySet<RoomShape>([
|
|
5
|
+
RoomShape.SHAPE_1x2, // 4
|
|
6
|
+
RoomShape.SHAPE_2x1, // 6
|
|
7
|
+
RoomShape.SHAPE_2x2, // 8
|
|
8
|
+
RoomShape.LTL, // 9
|
|
9
|
+
RoomShape.LTR, // 10
|
|
10
|
+
RoomShape.LBL, // 11
|
|
11
|
+
RoomShape.LBR, // 12
|
|
12
|
+
]);
|