isaacscript-common 26.1.2 → 26.2.1
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 +45 -0
- package/dist/isaacscript-common.lua +87 -47
- package/dist/src/classes/features/other/CustomTrapdoors.lua +1 -2
- package/dist/src/classes/features/other/DisableInputs.d.ts.map +1 -1
- package/dist/src/classes/features/other/DisableInputs.lua +4 -3
- package/dist/src/classes/features/other/ModdedElementSets.d.ts.map +1 -1
- package/dist/src/classes/features/other/ModdedElementSets.lua +4 -2
- package/dist/src/classes/features/other/Pause.d.ts.map +1 -1
- package/dist/src/classes/features/other/Pause.lua +3 -2
- package/dist/src/functions/array.d.ts.map +1 -1
- package/dist/src/functions/array.lua +3 -2
- package/dist/src/functions/doors.d.ts.map +1 -1
- package/dist/src/functions/doors.lua +4 -2
- package/dist/src/functions/enums.d.ts.map +1 -1
- package/dist/src/functions/enums.lua +3 -2
- package/dist/src/functions/gridEntities.lua +3 -3
- package/dist/src/functions/level.d.ts +10 -0
- package/dist/src/functions/level.d.ts.map +1 -1
- package/dist/src/functions/level.lua +11 -0
- package/dist/src/functions/levelGrid.d.ts +10 -0
- package/dist/src/functions/levelGrid.d.ts.map +1 -1
- package/dist/src/functions/levelGrid.lua +17 -7
- package/dist/src/functions/logMisc.d.ts.map +1 -1
- package/dist/src/functions/logMisc.lua +4 -2
- package/dist/src/functions/players.d.ts.map +1 -1
- package/dist/src/functions/players.lua +6 -5
- package/dist/src/functions/random.d.ts.map +1 -1
- package/dist/src/functions/random.lua +3 -2
- package/dist/src/functions/roomShapeWalls.d.ts.map +1 -1
- package/dist/src/functions/roomShapeWalls.lua +12 -11
- package/dist/src/functions/rooms.d.ts.map +1 -1
- package/dist/src/functions/rooms.lua +3 -2
- package/dist/src/functions/set.d.ts.map +1 -1
- package/dist/src/functions/set.lua +3 -1
- package/dist/src/functions/utils.d.ts.map +1 -1
- package/dist/src/functions/utils.lua +3 -2
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.lua +8 -0
- package/package.json +1 -1
- package/src/classes/features/other/CustomTrapdoors.ts +1 -1
- package/src/classes/features/other/DisableInputs.ts +3 -2
- package/src/classes/features/other/ModdedElementSets.ts +3 -2
- package/src/classes/features/other/Pause.ts +2 -1
- package/src/functions/array.ts +2 -1
- package/src/functions/doors.ts +3 -2
- package/src/functions/enums.ts +2 -1
- package/src/functions/gridEntities.ts +3 -3
- package/src/functions/level.ts +18 -1
- package/src/functions/levelGrid.ts +21 -7
- package/src/functions/logMisc.ts +3 -2
- package/src/functions/players.ts +5 -4
- package/src/functions/random.ts +2 -1
- package/src/functions/roomShapeWalls.ts +6 -5
- package/src/functions/rooms.ts +2 -1
- package/src/functions/set.ts +2 -1
- package/src/functions/utils.ts +2 -1
- package/src/index.ts +1 -0
|
@@ -9,7 +9,6 @@ local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
|
9
9
|
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
10
10
|
local __TS__StringIncludes = ____lualib.__TS__StringIncludes
|
|
11
11
|
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
12
|
-
local Set = ____lualib.Set
|
|
13
12
|
local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
|
|
14
13
|
local ____exports = {}
|
|
15
14
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
@@ -35,6 +34,8 @@ local ____roomTypeNames = require("src.objects.roomTypeNames")
|
|
|
35
34
|
local ROOM_TYPE_NAMES = ____roomTypeNames.ROOM_TYPE_NAMES
|
|
36
35
|
local ____mineShaftRoomSubTypesSet = require("src.sets.mineShaftRoomSubTypesSet")
|
|
37
36
|
local MINE_SHAFT_ROOM_SUB_TYPE_SET = ____mineShaftRoomSubTypesSet.MINE_SHAFT_ROOM_SUB_TYPE_SET
|
|
37
|
+
local ____ReadonlySet = require("src.types.ReadonlySet")
|
|
38
|
+
local ReadonlySet = ____ReadonlySet.ReadonlySet
|
|
38
39
|
local ____dimensions = require("src.functions.dimensions")
|
|
39
40
|
local getAllDimensions = ____dimensions.getAllDimensions
|
|
40
41
|
local inDimension = ____dimensions.inDimension
|
|
@@ -403,7 +404,7 @@ function ____exports.isAllRoomsClear(self, onlyCheckRoomTypes)
|
|
|
403
404
|
if onlyCheckRoomTypes == nil then
|
|
404
405
|
matchingRooms = rooms
|
|
405
406
|
else
|
|
406
|
-
local roomTypeWhitelist = __TS__New(
|
|
407
|
+
local roomTypeWhitelist = __TS__New(ReadonlySet, onlyCheckRoomTypes)
|
|
407
408
|
matchingRooms = __TS__ArrayFilter(
|
|
408
409
|
rooms,
|
|
409
410
|
function(____, roomDescriptor) return roomDescriptor.Data ~= nil and roomTypeWhitelist:has(roomDescriptor.Data.Type) end
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../../src/functions/set.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../../src/functions/set.ts"],"names":[],"mappings":";;AAKA;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAC5B,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,EACf,GAAG,SAAS,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,GAC3C,IAAI,CAMN;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,GACtC,GAAG,CAAC,CAAC,CAAC,CASR;AAED,mGAAmG;AACnG,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,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TS__ArraySort
|
|
8
8
|
local ____exports = {}
|
|
9
|
+
local ____ReadonlySet = require("src.types.ReadonlySet")
|
|
10
|
+
local ReadonlySet = ____ReadonlySet.ReadonlySet
|
|
9
11
|
local ____array = require("src.functions.array")
|
|
10
12
|
local getArrayCombinations = ____array.getArrayCombinations
|
|
11
13
|
local getRandomArrayElement = ____array.getRandomArrayElement
|
|
@@ -114,7 +116,7 @@ function ____exports.getSetCombinations(self, set, includeEmptyArray)
|
|
|
114
116
|
local combinations = getArrayCombinations(nil, values, includeEmptyArray)
|
|
115
117
|
return __TS__ArrayMap(
|
|
116
118
|
combinations,
|
|
117
|
-
function(____, array) return __TS__New(
|
|
119
|
+
function(____, array) return __TS__New(ReadonlySet, array) end
|
|
118
120
|
)
|
|
119
121
|
end
|
|
120
122
|
--- Helper function to add one or more elements to a set at once without having to repeatedly call
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/functions/utils.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/functions/utils.ts"],"names":[],"mappings":";AAMA;;;;;;;;;;;GAWG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,SAAS,SAAI,GAAG,GAAG,EAAE,CAWlE;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,OAAO,EACZ,oBAAoB,EAAE,MAAM,GAC3B,MAAM,CAQR;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,SAAS,SAAI,GAAG,GAAG,EAAE,CAOlE;AAED;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAE/D;AAED;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAMvC;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAI5C;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAetC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI,CAI3D;AAED;;;;;;;;;;;;GAYG;AAEH,wBAAgB,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAG"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
3
|
-
local Set = ____lualib.Set
|
|
4
3
|
local __TS__New = ____lualib.__TS__New
|
|
5
4
|
local ____exports = {}
|
|
6
5
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
7
6
|
local RenderMode = ____isaac_2Dtypescript_2Ddefinitions.RenderMode
|
|
8
7
|
local ____cachedClasses = require("src.core.cachedClasses")
|
|
9
8
|
local game = ____cachedClasses.game
|
|
9
|
+
local ____ReadonlySet = require("src.types.ReadonlySet")
|
|
10
|
+
local ReadonlySet = ____ReadonlySet.ReadonlySet
|
|
10
11
|
local ____playerIndex = require("src.functions.playerIndex")
|
|
11
12
|
local getAllPlayers = ____playerIndex.getAllPlayers
|
|
12
13
|
local ____types = require("src.functions.types")
|
|
@@ -87,7 +88,7 @@ function ____exports.isMultiplayer(self)
|
|
|
87
88
|
players,
|
|
88
89
|
function(____, player) return player.ControllerIndex end
|
|
89
90
|
)
|
|
90
|
-
local controllerIndexesSet = __TS__New(
|
|
91
|
+
local controllerIndexesSet = __TS__New(ReadonlySet, controllerIndexes)
|
|
91
92
|
return controllerIndexesSet.size > 1
|
|
92
93
|
end
|
|
93
94
|
--- Helper function to see if the current render callback is rendering a water reflection.
|
package/dist/src/index.d.ts
CHANGED
|
@@ -93,6 +93,7 @@ export * from "./functions/positionVelocity";
|
|
|
93
93
|
export * from "./functions/pressurePlate";
|
|
94
94
|
export * from "./functions/projectiles";
|
|
95
95
|
export * from "./functions/random";
|
|
96
|
+
export * from "./functions/readOnly";
|
|
96
97
|
export * from "./functions/revive";
|
|
97
98
|
export * from "./functions/rng";
|
|
98
99
|
export * from "./functions/rockAlt";
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,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;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC"}
|
package/dist/src/index.lua
CHANGED
|
@@ -759,6 +759,14 @@ do
|
|
|
759
759
|
end
|
|
760
760
|
end
|
|
761
761
|
end
|
|
762
|
+
do
|
|
763
|
+
local ____export = require("src.functions.readOnly")
|
|
764
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
765
|
+
if ____exportKey ~= "default" then
|
|
766
|
+
____exports[____exportKey] = ____exportValue
|
|
767
|
+
end
|
|
768
|
+
end
|
|
769
|
+
end
|
|
762
770
|
do
|
|
763
771
|
local ____export = require("src.functions.revive")
|
|
764
772
|
for ____exportKey, ____exportValue in pairs(____export) do
|
package/package.json
CHANGED
|
@@ -513,7 +513,7 @@ export class CustomTrapdoors extends Feature {
|
|
|
513
513
|
// We don't want to allow pausing, since that will allow render frames to pass without advancing
|
|
514
514
|
// the stage traveling logic. (We track how many render frames have passed to know when to move
|
|
515
515
|
// to the next step.)
|
|
516
|
-
const whitelist = new
|
|
516
|
+
const whitelist = new ReadonlySet([ButtonAction.CONSOLE]);
|
|
517
517
|
this.disableInputs.disableAllInputsExceptFor(tstlClassName, whitelist);
|
|
518
518
|
setPlayerAttributes(player, gridEntity.Position);
|
|
519
519
|
dropTaintedForgotten(player);
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
} from "isaac-typescript-definitions";
|
|
6
6
|
import { Exported } from "../../../decorators";
|
|
7
7
|
import { getMoveActions, getShootActions } from "../../../functions/input";
|
|
8
|
+
import { ReadonlySet } from "../../../types/ReadonlySet";
|
|
8
9
|
import { Feature } from "../../private/Feature";
|
|
9
10
|
|
|
10
11
|
const v = {
|
|
@@ -141,7 +142,7 @@ export class DisableInputs extends Feature {
|
|
|
141
142
|
*/
|
|
142
143
|
@Exported
|
|
143
144
|
public disableInputs(key: string, ...buttonActions: ButtonAction[]): void {
|
|
144
|
-
const buttonActionsSet = new
|
|
145
|
+
const buttonActionsSet = new ReadonlySet(buttonActions);
|
|
145
146
|
v.run.disableInputs.set(key, buttonActionsSet);
|
|
146
147
|
}
|
|
147
148
|
|
|
@@ -158,7 +159,7 @@ export class DisableInputs extends Feature {
|
|
|
158
159
|
*/
|
|
159
160
|
@Exported
|
|
160
161
|
public disableAllInputs(key: string): void {
|
|
161
|
-
v.run.disableAllInputsWithWhitelistMap.set(key, new
|
|
162
|
+
v.run.disableAllInputsWithWhitelistMap.set(key, new ReadonlySet());
|
|
162
163
|
v.run.enableAllInputsWithBlacklistMap.delete(key);
|
|
163
164
|
}
|
|
164
165
|
|
|
@@ -43,6 +43,7 @@ import {
|
|
|
43
43
|
import { repeat } from "../../../functions/utils";
|
|
44
44
|
import { ITEM_CONFIG_CARD_TYPES_FOR_CARDS_SET } from "../../../sets/itemConfigCardTypesForCardsSet";
|
|
45
45
|
import { ReadonlyMap } from "../../../types/ReadonlyMap";
|
|
46
|
+
import { ReadonlySet } from "../../../types/ReadonlySet";
|
|
46
47
|
import { Feature } from "../../private/Feature";
|
|
47
48
|
import { ModdedElementDetection } from "./ModdedElementDetection";
|
|
48
49
|
|
|
@@ -614,7 +615,7 @@ export class ModdedElementSets extends Feature {
|
|
|
614
615
|
|
|
615
616
|
const collectiblesSet = this.cacheFlagToCollectibleTypesMap.get(cacheFlag);
|
|
616
617
|
if (collectiblesSet === undefined) {
|
|
617
|
-
return new
|
|
618
|
+
return new ReadonlySet();
|
|
618
619
|
}
|
|
619
620
|
|
|
620
621
|
return collectiblesSet;
|
|
@@ -1167,7 +1168,7 @@ export class ModdedElementSets extends Feature {
|
|
|
1167
1168
|
|
|
1168
1169
|
const trinketsSet = this.cacheFlagToTrinketTypesMap.get(cacheFlag);
|
|
1169
1170
|
if (trinketsSet === undefined) {
|
|
1170
|
-
return new
|
|
1171
|
+
return new ReadonlySet();
|
|
1171
1172
|
}
|
|
1172
1173
|
|
|
1173
1174
|
return trinketsSet;
|
|
@@ -17,6 +17,7 @@ import { logError } from "../../../functions/logMisc";
|
|
|
17
17
|
import { getAllPlayers } from "../../../functions/playerIndex";
|
|
18
18
|
import { useActiveItemTemp } from "../../../functions/players";
|
|
19
19
|
import { getTSTLClassName } from "../../../functions/tstlClass";
|
|
20
|
+
import { ReadonlySet } from "../../../types/ReadonlySet";
|
|
20
21
|
import { Feature } from "../../private/Feature";
|
|
21
22
|
import { DisableInputs } from "./DisableInputs";
|
|
22
23
|
|
|
@@ -173,7 +174,7 @@ export class Pause extends Feature {
|
|
|
173
174
|
error("Failed to get the class name for the pause feature.");
|
|
174
175
|
}
|
|
175
176
|
|
|
176
|
-
const whitelist = new
|
|
177
|
+
const whitelist = new ReadonlySet([
|
|
177
178
|
ButtonAction.MENU_CONFIRM,
|
|
178
179
|
ButtonAction.CONSOLE,
|
|
179
180
|
]);
|
package/src/functions/array.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReadonlySet } from "../types/ReadonlySet";
|
|
1
2
|
import { getRandomInt } from "./random";
|
|
2
3
|
import { getRandomSeed, isRNG, newRNG } from "./rng";
|
|
3
4
|
import { isNumber, isTable } from "./types";
|
|
@@ -131,7 +132,7 @@ export function arrayRemoveIndex<T>(
|
|
|
131
132
|
originalArray: T[] | readonly T[],
|
|
132
133
|
...indexesToRemove: int[]
|
|
133
134
|
): T[] {
|
|
134
|
-
const indexesToRemoveSet = new
|
|
135
|
+
const indexesToRemoveSet = new ReadonlySet(indexesToRemove);
|
|
135
136
|
|
|
136
137
|
const array: T[] = [];
|
|
137
138
|
originalArray.forEach((element, i) => {
|
package/src/functions/doors.ts
CHANGED
|
@@ -24,6 +24,7 @@ import { DOOR_SLOT_TO_DOOR_SLOT_FLAG } from "../objects/doorSlotToDoorSlotFlag";
|
|
|
24
24
|
import { OPPOSITE_DOOR_SLOTS } from "../objects/oppositeDoorSlots";
|
|
25
25
|
import { ROOM_SHAPE_TO_DOOR_SLOT_COORDINATES } from "../objects/roomShapeToDoorSlotCoordinates";
|
|
26
26
|
import { ROOM_SHAPE_TO_DOOR_SLOTS } from "../objects/roomShapeToDoorSlots";
|
|
27
|
+
import { ReadonlySet } from "../types/ReadonlySet";
|
|
27
28
|
import { arrayToBitFlags } from "./bitwise";
|
|
28
29
|
import { directionToVector } from "./direction";
|
|
29
30
|
import { hasFlag } from "./flag";
|
|
@@ -189,7 +190,7 @@ export function getDoorSlotsForRoomShape(
|
|
|
189
190
|
export function getDoors(...roomTypes: RoomType[]): GridEntityDoor[] {
|
|
190
191
|
const room = game.GetRoom();
|
|
191
192
|
const roomShape = room.GetRoomShape();
|
|
192
|
-
const roomTypesSet = new
|
|
193
|
+
const roomTypesSet = new ReadonlySet(roomTypes);
|
|
193
194
|
|
|
194
195
|
// We iterate over the possible door slots for this room shape instead of all door slots in order
|
|
195
196
|
// to prevent crashes from accessing invalid memory.
|
|
@@ -223,7 +224,7 @@ export function getDoors(...roomTypes: RoomType[]): GridEntityDoor[] {
|
|
|
223
224
|
* that match any of the N room grid indexes.
|
|
224
225
|
*/
|
|
225
226
|
export function getDoorsToRoomIndex(...roomGridIndex: int[]): GridEntityDoor[] {
|
|
226
|
-
const roomGridIndexesSet = new
|
|
227
|
+
const roomGridIndexesSet = new ReadonlySet(roomGridIndex);
|
|
227
228
|
const doors = getDoors();
|
|
228
229
|
return doors.filter((door) => roomGridIndexesSet.has(door.TargetRoomIndex));
|
|
229
230
|
}
|
package/src/functions/enums.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReadonlySet } from "../types/ReadonlySet";
|
|
1
2
|
import { getRandomArrayElement } from "./array";
|
|
2
3
|
import { getRandomSeed } from "./rng";
|
|
3
4
|
import { isString } from "./types";
|
|
@@ -177,7 +178,7 @@ export function validateEnumContiguous<T>(
|
|
|
177
178
|
);
|
|
178
179
|
}
|
|
179
180
|
|
|
180
|
-
const valuesSet = new
|
|
181
|
+
const valuesSet = new ReadonlySet(values);
|
|
181
182
|
for (const value of iRange(lastValue)) {
|
|
182
183
|
if (!valuesSet.has(value as unknown as T[keyof T])) {
|
|
183
184
|
error(
|
|
@@ -185,7 +185,7 @@ export function getGridEntities(
|
|
|
185
185
|
return gridEntities;
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
const gridEntityTypesSet = new
|
|
188
|
+
const gridEntityTypesSet = new ReadonlySet(gridEntityTypes);
|
|
189
189
|
return gridEntities.filter((gridEntity) => {
|
|
190
190
|
const gridEntityType = gridEntity.GetType();
|
|
191
191
|
return gridEntityTypesSet.has(gridEntityType);
|
|
@@ -221,7 +221,7 @@ export function getGridEntitiesExcept(
|
|
|
221
221
|
return gridEntities;
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
-
const gridEntityTypesSet = new
|
|
224
|
+
const gridEntityTypesSet = new ReadonlySet(gridEntityTypes);
|
|
225
225
|
return gridEntities.filter((gridEntity) => {
|
|
226
226
|
const gridEntityType = gridEntity.GetType();
|
|
227
227
|
return !gridEntityTypesSet.has(gridEntityType);
|
|
@@ -463,7 +463,7 @@ export function isPostBossVoidPortal(gridEntity: GridEntity): boolean {
|
|
|
463
463
|
export function removeAllGridEntitiesExcept(
|
|
464
464
|
...gridEntityTypes: GridEntityType[]
|
|
465
465
|
): GridEntity[] {
|
|
466
|
-
const gridEntityTypeExceptions = new
|
|
466
|
+
const gridEntityTypeExceptions = new ReadonlySet(gridEntityTypes);
|
|
467
467
|
const gridEntities = getGridEntities();
|
|
468
468
|
const removedGridEntities: GridEntity[] = [];
|
|
469
469
|
for (const gridEntity of gridEntities) {
|
package/src/functions/level.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import { RoomType } from "isaac-typescript-definitions";
|
|
1
2
|
import { DOOR_SLOT_VALUES } from "../arrays/cachedEnumValues";
|
|
2
3
|
import { game } from "../core/cachedClasses";
|
|
3
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
getRoomDescriptorsForType,
|
|
6
|
+
isDoorSlotValidAtGridIndexForRedRoom,
|
|
7
|
+
} from "./levelGrid";
|
|
4
8
|
import { getNumRooms, getRoomsInsideGrid } from "./rooms";
|
|
5
9
|
|
|
10
|
+
/** Helper function to fill every possible square with a red room. */
|
|
6
11
|
export function fillLevelWithRedRooms(): void {
|
|
7
12
|
const level = game.GetLevel();
|
|
8
13
|
|
|
@@ -25,3 +30,15 @@ export function fillLevelWithRedRooms(): void {
|
|
|
25
30
|
}
|
|
26
31
|
} while (numRoomsInGrid !== getNumRooms());
|
|
27
32
|
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Helper function to check to see if the current floor has one or more of a specific room type in
|
|
36
|
+
* it.
|
|
37
|
+
*
|
|
38
|
+
* This function is variadic, meaning that you can pass as many room types as you want to check for.
|
|
39
|
+
* This function will return true if any of the room types are found.
|
|
40
|
+
*/
|
|
41
|
+
export function levelHasRoomType(...roomTypes: RoomType[]): boolean {
|
|
42
|
+
const roomDescriptors = getRoomDescriptorsForType(...roomTypes);
|
|
43
|
+
return roomDescriptors.length > 0;
|
|
44
|
+
}
|
|
@@ -261,25 +261,39 @@ export function getRoomAdjacentGridIndexes(
|
|
|
261
261
|
}
|
|
262
262
|
|
|
263
263
|
/**
|
|
264
|
-
* Helper function to get an array of all of the
|
|
265
|
-
*
|
|
264
|
+
* Helper function to get an array of all of the room descriptors for rooms that match the specified
|
|
265
|
+
* room type.
|
|
266
266
|
*
|
|
267
267
|
* This function only searches through rooms in the current dimension.
|
|
268
268
|
*
|
|
269
|
-
* This function is variadic, meaning that you can specify N arguments to get the combined
|
|
270
|
-
*
|
|
269
|
+
* This function is variadic, meaning that you can specify N arguments to get the combined room
|
|
270
|
+
* descriptors for N room types.
|
|
271
271
|
*/
|
|
272
|
-
export function
|
|
272
|
+
export function getRoomDescriptorsForType(
|
|
273
|
+
...roomTypes: RoomType[]
|
|
274
|
+
): RoomDescriptor[] {
|
|
273
275
|
const roomTypesSet = new Set<RoomType>([...roomTypes]);
|
|
274
276
|
|
|
275
277
|
const rooms = getRoomsInsideGrid();
|
|
276
|
-
|
|
278
|
+
return rooms.filter(
|
|
277
279
|
(roomDescriptor) =>
|
|
278
280
|
roomDescriptor.Data !== undefined &&
|
|
279
281
|
roomTypesSet.has(roomDescriptor.Data.Type),
|
|
280
282
|
);
|
|
283
|
+
}
|
|
281
284
|
|
|
282
|
-
|
|
285
|
+
/**
|
|
286
|
+
* Helper function to get an array of all of the safe grid indexes for rooms that match the
|
|
287
|
+
* specified room type.
|
|
288
|
+
*
|
|
289
|
+
* This function only searches through rooms in the current dimension.
|
|
290
|
+
*
|
|
291
|
+
* This function is variadic, meaning that you can specify N arguments to get the combined grid
|
|
292
|
+
* indexes for N room types.
|
|
293
|
+
*/
|
|
294
|
+
export function getRoomGridIndexesForType(...roomTypes: RoomType[]): int[] {
|
|
295
|
+
const roomDescriptors = getRoomDescriptorsForType(...roomTypes);
|
|
296
|
+
return roomDescriptors.map((roomDescriptor) => roomDescriptor.SafeGridIndex);
|
|
283
297
|
}
|
|
284
298
|
|
|
285
299
|
/**
|
package/src/functions/logMisc.ts
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
UseFlag,
|
|
15
15
|
} from "isaac-typescript-definitions";
|
|
16
16
|
import { game, musicManager, sfxManager } from "../core/cachedClasses";
|
|
17
|
+
import { ReadonlySet } from "../types/ReadonlySet";
|
|
17
18
|
import { arrayToString, isArray } from "./array";
|
|
18
19
|
import { getCollectibleName } from "./collectibles";
|
|
19
20
|
import { getEntityID } from "./entities";
|
|
@@ -413,10 +414,10 @@ export function logTableDifferences<K extends AnyNotNil, V>(
|
|
|
413
414
|
log("Comparing two Lua tables:");
|
|
414
415
|
|
|
415
416
|
const table1Keys = Object.keys(table1);
|
|
416
|
-
const table1KeysSet = new
|
|
417
|
+
const table1KeysSet = new ReadonlySet(table1Keys);
|
|
417
418
|
|
|
418
419
|
const table2Keys = Object.keys(table2);
|
|
419
|
-
const table2KeysSet = new
|
|
420
|
+
const table2KeysSet = new ReadonlySet(table2Keys);
|
|
420
421
|
|
|
421
422
|
const keysSet = combineSets(table1KeysSet, table2KeysSet);
|
|
422
423
|
const keys = [...keysSet.values()];
|
package/src/functions/players.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
TRINKET_SLOT_VALUES,
|
|
14
14
|
} from "../arrays/cachedEnumValues";
|
|
15
15
|
import { game, itemConfig } from "../core/cachedClasses";
|
|
16
|
+
import { ReadonlySet } from "../types/ReadonlySet";
|
|
16
17
|
import { getLastElement, sumArray } from "./array";
|
|
17
18
|
import { getCharacterName, isVanillaCharacter } from "./characters";
|
|
18
19
|
import { getCollectibleMaxCharges } from "./collectibles";
|
|
@@ -82,7 +83,7 @@ export function anyPlayerHasTrinket(trinketType: TrinketType): boolean {
|
|
|
82
83
|
* for. Returns true if any of the characters supplied are present.
|
|
83
84
|
*/
|
|
84
85
|
export function anyPlayerIs(...matchingCharacters: PlayerType[]): boolean {
|
|
85
|
-
const matchingCharacterSet = new
|
|
86
|
+
const matchingCharacterSet = new ReadonlySet(matchingCharacters);
|
|
86
87
|
const characters = getCharacters();
|
|
87
88
|
return characters.some((character) => matchingCharacterSet.has(character));
|
|
88
89
|
}
|
|
@@ -365,7 +366,7 @@ export function getPlayerNumHitsRemaining(player: EntityPlayer): int {
|
|
|
365
366
|
* for. Returns true if any of the characters supplied are present.
|
|
366
367
|
*/
|
|
367
368
|
export function getPlayersOfType(...characters: PlayerType[]): EntityPlayer[] {
|
|
368
|
-
const charactersSet = new
|
|
369
|
+
const charactersSet = new ReadonlySet(characters);
|
|
369
370
|
const players = getPlayers();
|
|
370
371
|
return players.filter((player) => {
|
|
371
372
|
const character = player.GetPlayerType();
|
|
@@ -481,7 +482,7 @@ export function hasCollectibleInActiveSlot(
|
|
|
481
482
|
collectibleType: CollectibleType,
|
|
482
483
|
...activeSlots: ActiveSlot[]
|
|
483
484
|
): boolean {
|
|
484
|
-
const matchingActiveSlotsSet = new
|
|
485
|
+
const matchingActiveSlotsSet = new ReadonlySet(activeSlots);
|
|
485
486
|
const activeItemSlots = getActiveItemSlots(player, collectibleType);
|
|
486
487
|
return activeItemSlots.some((activeSlot) =>
|
|
487
488
|
matchingActiveSlotsSet.has(activeSlot),
|
|
@@ -568,7 +569,7 @@ export function isCharacter(
|
|
|
568
569
|
player: EntityPlayer,
|
|
569
570
|
...characters: PlayerType[]
|
|
570
571
|
): boolean {
|
|
571
|
-
const characterSet = new
|
|
572
|
+
const characterSet = new ReadonlySet(characters);
|
|
572
573
|
const character = player.GetPlayerType();
|
|
573
574
|
return characterSet.has(character);
|
|
574
575
|
}
|
package/src/functions/random.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReadonlySet } from "../types/ReadonlySet";
|
|
1
2
|
import { getRandomSeed, isRNG, newRNG } from "./rng";
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -81,7 +82,7 @@ export function getRandomInt(
|
|
|
81
82
|
max = oldMin;
|
|
82
83
|
}
|
|
83
84
|
|
|
84
|
-
const exceptionsSet = new
|
|
85
|
+
const exceptionsSet = new ReadonlySet(exceptions);
|
|
85
86
|
|
|
86
87
|
let randomInt: int;
|
|
87
88
|
do {
|
|
@@ -3,6 +3,7 @@ import { ROOM_SHAPE_VALUES } from "../arrays/cachedEnumValues";
|
|
|
3
3
|
import { game } from "../core/cachedClasses";
|
|
4
4
|
import { CornerType } from "../enums/CornerType";
|
|
5
5
|
import { Corner } from "../interfaces/Corner";
|
|
6
|
+
import { ReadonlySet } from "../types/ReadonlySet";
|
|
6
7
|
import { getGridIndexesBetween } from "./gridIndex";
|
|
7
8
|
import { inBossRoomOf, inHomeCloset } from "./rooms";
|
|
8
9
|
import { getRoomShapeCorners, isLRoom } from "./roomShape";
|
|
@@ -38,7 +39,7 @@ function getVanillaWallGridIndexSetForRoomShape(
|
|
|
38
39
|
case RoomShape.LTL: {
|
|
39
40
|
const [topMiddle, topRight, middleLeft, middle, bottomLeft, bottomRight] =
|
|
40
41
|
corners as [Corner, Corner, Corner, Corner, Corner, Corner];
|
|
41
|
-
return new
|
|
42
|
+
return new ReadonlySet([
|
|
42
43
|
// Horizontal
|
|
43
44
|
...getGridIndexesBetween(
|
|
44
45
|
topMiddle.gridIndex,
|
|
@@ -79,7 +80,7 @@ function getVanillaWallGridIndexSetForRoomShape(
|
|
|
79
80
|
case RoomShape.LTR: {
|
|
80
81
|
const [topLeft, topMiddle, middle, middleRight, bottomLeft, bottomRight] =
|
|
81
82
|
corners as [Corner, Corner, Corner, Corner, Corner, Corner];
|
|
82
|
-
return new
|
|
83
|
+
return new ReadonlySet([
|
|
83
84
|
// Horizontal
|
|
84
85
|
...getGridIndexesBetween(
|
|
85
86
|
topLeft.gridIndex,
|
|
@@ -120,7 +121,7 @@ function getVanillaWallGridIndexSetForRoomShape(
|
|
|
120
121
|
case RoomShape.LBL: {
|
|
121
122
|
const [topLeft, topRight, middleLeft, middle, bottomMiddle, bottomRight] =
|
|
122
123
|
corners as [Corner, Corner, Corner, Corner, Corner, Corner];
|
|
123
|
-
return new
|
|
124
|
+
return new ReadonlySet([
|
|
124
125
|
// Horizontal
|
|
125
126
|
...getGridIndexesBetween(
|
|
126
127
|
topLeft.gridIndex,
|
|
@@ -161,7 +162,7 @@ function getVanillaWallGridIndexSetForRoomShape(
|
|
|
161
162
|
case RoomShape.LBR: {
|
|
162
163
|
const [topLeft, topRight, middle, middleRight, bottomLeft, bottomMiddle] =
|
|
163
164
|
corners as [Corner, Corner, Corner, Corner, Corner, Corner];
|
|
164
|
-
return new
|
|
165
|
+
return new ReadonlySet([
|
|
165
166
|
// Horizontal
|
|
166
167
|
...getGridIndexesBetween(
|
|
167
168
|
topLeft.gridIndex,
|
|
@@ -225,7 +226,7 @@ function getWallGridIndexSetForRectangleRoomShape(
|
|
|
225
226
|
Corner,
|
|
226
227
|
];
|
|
227
228
|
|
|
228
|
-
return new
|
|
229
|
+
return new ReadonlySet([
|
|
229
230
|
// Horizontal
|
|
230
231
|
...getGridIndexesBetween(topLeft.gridIndex, topRight.gridIndex, roomShape),
|
|
231
232
|
...getGridIndexesBetween(
|
package/src/functions/rooms.ts
CHANGED
|
@@ -21,6 +21,7 @@ import { game, sfxManager } from "../core/cachedClasses";
|
|
|
21
21
|
import { MAX_LEVEL_GRID_INDEX } from "../core/constants";
|
|
22
22
|
import { ROOM_TYPE_NAMES } from "../objects/roomTypeNames";
|
|
23
23
|
import { MINE_SHAFT_ROOM_SUB_TYPE_SET } from "../sets/mineShaftRoomSubTypesSet";
|
|
24
|
+
import { ReadonlySet } from "../types/ReadonlySet";
|
|
24
25
|
import { getAllDimensions, inDimension } from "./dimensions";
|
|
25
26
|
import {
|
|
26
27
|
closeAllDoors,
|
|
@@ -535,7 +536,7 @@ export function isAllRoomsClear(onlyCheckRoomTypes?: RoomType[]): boolean {
|
|
|
535
536
|
if (onlyCheckRoomTypes === undefined) {
|
|
536
537
|
matchingRooms = rooms;
|
|
537
538
|
} else {
|
|
538
|
-
const roomTypeWhitelist = new
|
|
539
|
+
const roomTypeWhitelist = new ReadonlySet(onlyCheckRoomTypes);
|
|
539
540
|
matchingRooms = rooms.filter(
|
|
540
541
|
(roomDescriptor) =>
|
|
541
542
|
roomDescriptor.Data !== undefined &&
|
package/src/functions/set.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReadonlySet } from "../types/ReadonlySet";
|
|
1
2
|
import { getArrayCombinations, getRandomArrayElement, sumArray } from "./array";
|
|
2
3
|
import { getRandomSeed } from "./rng";
|
|
3
4
|
import { isPrimitive } from "./types";
|
|
@@ -107,7 +108,7 @@ export function getSetCombinations<T>(
|
|
|
107
108
|
const values = getSortedSetValues(set);
|
|
108
109
|
const combinations = getArrayCombinations(values, includeEmptyArray);
|
|
109
110
|
|
|
110
|
-
return combinations.map((array) => new
|
|
111
|
+
return combinations.map((array) => new ReadonlySet(array));
|
|
111
112
|
}
|
|
112
113
|
|
|
113
114
|
/**
|
package/src/functions/utils.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { RenderMode } from "isaac-typescript-definitions";
|
|
2
2
|
import { game } from "../core/cachedClasses";
|
|
3
|
+
import { ReadonlySet } from "../types/ReadonlySet";
|
|
3
4
|
import { getAllPlayers } from "./playerIndex";
|
|
4
5
|
import { isFunction } from "./types";
|
|
5
6
|
|
|
@@ -88,7 +89,7 @@ export function inRange(num: int, start: int, end: int): boolean {
|
|
|
88
89
|
export function isMultiplayer(): boolean {
|
|
89
90
|
const players = getAllPlayers();
|
|
90
91
|
const controllerIndexes = players.map((player) => player.ControllerIndex);
|
|
91
|
-
const controllerIndexesSet = new
|
|
92
|
+
const controllerIndexesSet = new ReadonlySet(controllerIndexes);
|
|
92
93
|
|
|
93
94
|
return controllerIndexesSet.size > 1;
|
|
94
95
|
}
|
package/src/index.ts
CHANGED
|
@@ -93,6 +93,7 @@ export * from "./functions/positionVelocity";
|
|
|
93
93
|
export * from "./functions/pressurePlate";
|
|
94
94
|
export * from "./functions/projectiles";
|
|
95
95
|
export * from "./functions/random";
|
|
96
|
+
export * from "./functions/readOnly";
|
|
96
97
|
export * from "./functions/revive";
|
|
97
98
|
export * from "./functions/rng";
|
|
98
99
|
export * from "./functions/rockAlt";
|