isaacscript-common 6.20.0 → 6.20.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/constants.d.ts +5 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.lua +4 -0
- package/dist/functions/levelGrid.d.ts +5 -2
- package/dist/functions/levelGrid.d.ts.map +1 -1
- package/dist/functions/levelGrid.lua +28 -5
- package/dist/functions/roomData.d.ts +1 -1
- package/dist/functions/roomData.d.ts.map +1 -1
- package/dist/functions/roomData.lua +2 -2
- package/dist/functions/rooms.d.ts +3 -0
- package/dist/functions/rooms.d.ts.map +1 -1
- package/dist/functions/rooms.lua +3 -0
- package/package.json +1 -1
- package/src/constants.ts +8 -0
- package/src/functions/levelGrid.ts +53 -9
- package/src/functions/roomData.ts +2 -2
- package/src/functions/rooms.ts +3 -0
package/dist/constants.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { CollectibleType, ItemPoolType } from "isaac-typescript-definitions";
|
|
2
|
+
export declare const ALL_DISPLAY_FLAGS: BitFlags<number & {
|
|
3
|
+
readonly __bitFlagBrand: symbol;
|
|
4
|
+
} & {
|
|
5
|
+
readonly __displayFlagBrand: symbol;
|
|
6
|
+
}>;
|
|
2
7
|
/**
|
|
3
8
|
* The distance of the laser when Azazel does not have any range up items yet. For more info, see
|
|
4
9
|
* the documentation for the `getAzazelBrimstoneDistance` function.
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAGf,YAAY,EAEb,MAAM,8BAA8B,CAAC;AAKtC,eAAO,MAAM,iBAAiB;;;;EAI7B,CAAC;AAEF;;;G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CAAyC;AACzC,eAAO,MAAM,uCAAuC,QAAmB,CAAC;AAExE,iCAAiC;AACjC,eAAO,MAAM,sCAAsC,QAAmB,CAAC;AAEvE;;;GAGG;AACH,eAAO,MAAM,gCAAgC,QAAmB,CAAC;AAEjE,+EAA+E;AAC/E,eAAO,MAAM,iCAAiC,SAAS,CAAC;AAExD,eAAO,MAAM,cAAc,QAA+B,CAAC;AAE3D;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAAyB,CAAC;AAExD,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAC3C,eAAO,MAAM,sBAAsB,QAA8B,CAAC;AAElE,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAE7C,6FAA6F;AAC7F,eAAO,MAAM,gDAAgD,QAAQ,CAAC;AAEtE;;;GAGG;AACH,eAAO,MAAM,cAAc,KAAK,CAAC;AAEjC;;;GAGG;AACH,eAAO,MAAM,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAgB,CAAC;AAExD;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAgB,CAAC;AAEzD;;;;;GAKG;AACH,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAkB,CAAC;AAE5D;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAsB,CAAC"}
|
package/dist/constants.lua
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
local ____exports = {}
|
|
2
2
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
3
3
|
local Dimension = ____isaac_2Dtypescript_2Ddefinitions.Dimension
|
|
4
|
+
local DisplayFlag = ____isaac_2Dtypescript_2Ddefinitions.DisplayFlag
|
|
4
5
|
local ItemPoolType = ____isaac_2Dtypescript_2Ddefinitions.ItemPoolType
|
|
5
6
|
local TrinketSlot = ____isaac_2Dtypescript_2Ddefinitions.TrinketSlot
|
|
6
7
|
local ____constantsFirstLast = require("constantsFirstLast")
|
|
7
8
|
local NUM_NORMAL_PILL_COLORS = ____constantsFirstLast.NUM_NORMAL_PILL_COLORS
|
|
8
9
|
local ____enums = require("functions.enums")
|
|
9
10
|
local getEnumLength = ____enums.getEnumLength
|
|
11
|
+
local ____flag = require("functions.flag")
|
|
12
|
+
local addFlag = ____flag.addFlag
|
|
13
|
+
____exports.ALL_DISPLAY_FLAGS = addFlag(nil, DisplayFlag.VISIBLE, DisplayFlag.SHADOW, DisplayFlag.SHOW_ICON)
|
|
10
14
|
--- The distance of the laser when Azazel does not have any range up items yet. For more info, see
|
|
11
15
|
-- the documentation for the `getAzazelBrimstoneDistance` function.
|
|
12
16
|
____exports.AZAZEL_DEFAULT_BRIMSTONE_DISTANCE = 75.125
|
|
@@ -49,7 +49,7 @@ export declare function getNewRoomCandidatesBesideRoom(roomGridIndex?: int): Arr
|
|
|
49
49
|
*
|
|
50
50
|
* @returns A array of tuples of adjacent room grid index, `DoorSlot`, and new room grid index.
|
|
51
51
|
*/
|
|
52
|
-
export declare function
|
|
52
|
+
export declare function getNewRoomCandidatesForLevel(): Array<[
|
|
53
53
|
adjacentRoomGridIndex: int,
|
|
54
54
|
doorSlot: DoorSlot,
|
|
55
55
|
newRoomGridIndex: int
|
|
@@ -135,7 +135,10 @@ export declare function isRoomGridIndexInBounds(roomGridIndex: int): boolean;
|
|
|
135
135
|
* place a room.
|
|
136
136
|
*/
|
|
137
137
|
export declare function newRoom(): int | undefined;
|
|
138
|
-
/**
|
|
138
|
+
/**
|
|
139
|
+
* Helper function to check if a room exists at the given room grid index. (A room will exist if it
|
|
140
|
+
* has non-undefined data in the room descriptor.)
|
|
141
|
+
*/
|
|
139
142
|
export declare function roomExists(roomGridIndex: int): boolean;
|
|
140
143
|
/**
|
|
141
144
|
* Helper function to get the coordinates of a given grid index. The floor is represented by a 13x13
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"levelGrid.d.ts","sourceRoot":"","sources":["../../src/functions/levelGrid.ts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AEpB;AAED;;;;;;;;GAQG;AACH,wBAAgB,+BAA+B,CAC7C,iBAAiB,EAAE,GAAG,EACtB,SAAS,EAAE,SAAS,GACnB,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAapB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,OAAO,CAUtD;AAED,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,GAAG,GACjB,OAAO,CAGT;AAED,wBAAgB,oCAAoC,CAClD,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,GAAG,GACjB,OAAO,CAuBT;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,OAAO,CAGzD;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,aAAa,EAAE,GAAG,GAAG,OAAO,CAEnE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,OAAO,IAAI,GAAG,GAAG,SAAS,CA6CzC;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,aAAa,EAAE,GAAG,GAAG,OAAO,CAGtD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,GAAG,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,CAKtE"}
|
|
@@ -8,13 +8,16 @@ local __TS__New = ____lualib.__TS__New
|
|
|
8
8
|
local ____exports = {}
|
|
9
9
|
local ADJACENT_ROOM_GRID_INDEX_DELTAS
|
|
10
10
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
11
|
+
local DisplayFlag = ____isaac_2Dtypescript_2Ddefinitions.DisplayFlag
|
|
11
12
|
local DownpourRoomSubType = ____isaac_2Dtypescript_2Ddefinitions.DownpourRoomSubType
|
|
13
|
+
local LevelStateFlag = ____isaac_2Dtypescript_2Ddefinitions.LevelStateFlag
|
|
12
14
|
local MinesRoomSubType = ____isaac_2Dtypescript_2Ddefinitions.MinesRoomSubType
|
|
13
15
|
local RoomDescriptorFlag = ____isaac_2Dtypescript_2Ddefinitions.RoomDescriptorFlag
|
|
14
16
|
local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
|
|
15
17
|
local ____cachedClasses = require("cachedClasses")
|
|
16
18
|
local game = ____cachedClasses.game
|
|
17
19
|
local ____constants = require("constants")
|
|
20
|
+
local ALL_DISPLAY_FLAGS = ____constants.ALL_DISPLAY_FLAGS
|
|
18
21
|
local LEVEL_GRID_ROW_WIDTH = ____constants.LEVEL_GRID_ROW_WIDTH
|
|
19
22
|
local MAX_LEVEL_GRID_INDEX = ____constants.MAX_LEVEL_GRID_INDEX
|
|
20
23
|
local ____roomShapeToDoorSlotsToGridIndexDelta = require("objects.roomShapeToDoorSlotsToGridIndexDelta")
|
|
@@ -24,7 +27,9 @@ local getRandomArrayElement = ____array.getRandomArrayElement
|
|
|
24
27
|
local ____doors = require("functions.doors")
|
|
25
28
|
local doorSlotToDoorSlotFlag = ____doors.doorSlotToDoorSlotFlag
|
|
26
29
|
local ____flag = require("functions.flag")
|
|
30
|
+
local addFlag = ____flag.addFlag
|
|
27
31
|
local hasFlag = ____flag.hasFlag
|
|
32
|
+
local removeFlag = ____flag.removeFlag
|
|
28
33
|
local ____rng = require("functions.rng")
|
|
29
34
|
local getRandomSeed = ____rng.getRandomSeed
|
|
30
35
|
local ____roomData = require("functions.roomData")
|
|
@@ -104,7 +109,7 @@ end
|
|
|
104
109
|
-- room.
|
|
105
110
|
--
|
|
106
111
|
-- @returns A array of tuples of adjacent room grid index, `DoorSlot`, and new room grid index.
|
|
107
|
-
function ____exports.
|
|
112
|
+
function ____exports.getNewRoomCandidatesForLevel(self)
|
|
108
113
|
local rooms = getRoomsInGrid(nil)
|
|
109
114
|
local normalRooms = __TS__ArrayFilter(
|
|
110
115
|
rooms,
|
|
@@ -178,7 +183,8 @@ end
|
|
|
178
183
|
function ____exports.isRoomGridIndexInBounds(self, roomGridIndex)
|
|
179
184
|
return roomGridIndex >= 0 and roomGridIndex <= MAX_LEVEL_GRID_INDEX
|
|
180
185
|
end
|
|
181
|
-
--- Helper function to check if a room exists at the given room grid index.
|
|
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.)
|
|
182
188
|
function ____exports.roomExists(self, roomGridIndex)
|
|
183
189
|
local roomData = getRoomData(nil, roomGridIndex)
|
|
184
190
|
return roomData ~= nil
|
|
@@ -208,11 +214,11 @@ function ____exports.getNewRoomCandidate(self, seedOrRNG)
|
|
|
208
214
|
if seedOrRNG == nil then
|
|
209
215
|
seedOrRNG = getRandomSeed(nil)
|
|
210
216
|
end
|
|
211
|
-
local
|
|
212
|
-
if #
|
|
217
|
+
local newRoomCandidatesForLevel = ____exports.getNewRoomCandidatesForLevel(nil)
|
|
218
|
+
if #newRoomCandidatesForLevel == 0 then
|
|
213
219
|
return nil
|
|
214
220
|
end
|
|
215
|
-
return getRandomArrayElement(nil,
|
|
221
|
+
return getRandomArrayElement(nil, newRoomCandidatesForLevel, seedOrRNG)
|
|
216
222
|
end
|
|
217
223
|
--- Helper function to get an array of all of the safe grid indexes for rooms that match the
|
|
218
224
|
-- specified room type.
|
|
@@ -307,6 +313,23 @@ function ____exports.newRoom(self)
|
|
|
307
313
|
local adjacentRoomGridIndex, doorSlot, newRoomGridIndex = table.unpack(newRoomCandidate)
|
|
308
314
|
local level = game:GetLevel()
|
|
309
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
|
|
310
333
|
return newRoomGridIndex
|
|
311
334
|
end
|
|
312
335
|
--- Helper function to get the coordinates of a given grid index. The floor is represented by a 13x13
|
|
@@ -111,5 +111,5 @@ export declare function getRoomVisitedCount(roomGridIndex?: int): int;
|
|
|
111
111
|
* Helper function to set the data for a given room. This will change the room type, contents, and
|
|
112
112
|
* so on.
|
|
113
113
|
*/
|
|
114
|
-
export declare function setRoomData(roomGridIndex: int,
|
|
114
|
+
export declare function setRoomData(roomGridIndex: int, roomData: Readonly<RoomConfig>): void;
|
|
115
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;AA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AAI,CAGN"}
|
|
@@ -160,8 +160,8 @@ function ____exports.getRoomVisitedCount(self, roomGridIndex)
|
|
|
160
160
|
end
|
|
161
161
|
--- Helper function to set the data for a given room. This will change the room type, contents, and
|
|
162
162
|
-- so on.
|
|
163
|
-
function ____exports.setRoomData(self, roomGridIndex,
|
|
163
|
+
function ____exports.setRoomData(self, roomGridIndex, roomData)
|
|
164
164
|
local roomDescriptor = ____exports.getRoomDescriptor(nil, roomGridIndex)
|
|
165
|
-
roomDescriptor.Data =
|
|
165
|
+
roomDescriptor.Data = roomData
|
|
166
166
|
end
|
|
167
167
|
return ____exports
|
|
@@ -15,6 +15,9 @@ export declare function getNumRooms(): int;
|
|
|
15
15
|
* accomplished by using the "goto" console command to load the specified room into the
|
|
16
16
|
* `GridRoom.DEBUG` slot.
|
|
17
17
|
*
|
|
18
|
+
* Returns undefined if the provided room type and variant combination were not found. (A warning
|
|
19
|
+
* message will also appear on the console, since the "goto" command will fail.)
|
|
20
|
+
*
|
|
18
21
|
* Note that the side effect of using the "goto" console command is that it will trigger a room
|
|
19
22
|
* transition after a short delay. By default, this function cancels the incoming room transition by
|
|
20
23
|
* using the `Game.StartRoomTransition` method to travel to the same room.
|
|
@@ -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,EAKT,YAAY,EAEZ,UAAU,EAGV,kBAAkB,EAClB,QAAQ,EAGT,MAAM,8BAA8B,CAAC;AAgCtC;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,aAAa,EAAE,GAAG,GAAG,IAAI,CAenD;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,GAAG,CAGjC;AAED
|
|
1
|
+
{"version":3,"file":"rooms.d.ts","sourceRoot":"","sources":["../../src/functions/rooms.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EACN,SAAS,EACT,SA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O,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;;;;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"}
|
package/dist/functions/rooms.lua
CHANGED
|
@@ -177,6 +177,9 @@ end
|
|
|
177
177
|
-- accomplished by using the "goto" console command to load the specified room into the
|
|
178
178
|
-- `GridRoom.DEBUG` slot.
|
|
179
179
|
--
|
|
180
|
+
-- Returns undefined if the provided room type and variant combination were not found. (A warning
|
|
181
|
+
-- message will also appear on the console, since the "goto" command will fail.)
|
|
182
|
+
--
|
|
180
183
|
-- Note that the side effect of using the "goto" console command is that it will trigger a room
|
|
181
184
|
-- transition after a short delay. By default, this function cancels the incoming room transition by
|
|
182
185
|
-- using the `Game.StartRoomTransition` method to travel to the same room.
|
package/package.json
CHANGED
package/src/constants.ts
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CollectibleType,
|
|
3
3
|
Dimension,
|
|
4
|
+
DisplayFlag,
|
|
4
5
|
ItemPoolType,
|
|
5
6
|
TrinketSlot,
|
|
6
7
|
} from "isaac-typescript-definitions";
|
|
7
8
|
import { NUM_NORMAL_PILL_COLORS } from "./constantsFirstLast";
|
|
8
9
|
import { getEnumLength } from "./functions/enums";
|
|
10
|
+
import { addFlag } from "./functions/flag";
|
|
11
|
+
|
|
12
|
+
export const ALL_DISPLAY_FLAGS = addFlag(
|
|
13
|
+
DisplayFlag.VISIBLE,
|
|
14
|
+
DisplayFlag.SHADOW,
|
|
15
|
+
DisplayFlag.SHOW_ICON,
|
|
16
|
+
);
|
|
9
17
|
|
|
10
18
|
/**
|
|
11
19
|
* The distance of the laser when Azazel does not have any range up items yet. For more info, see
|
|
@@ -8,19 +8,25 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import {
|
|
11
|
+
DisplayFlag,
|
|
11
12
|
DoorSlot,
|
|
12
13
|
DownpourRoomSubType,
|
|
14
|
+
LevelStateFlag,
|
|
13
15
|
MinesRoomSubType,
|
|
14
16
|
RoomDescriptorFlag,
|
|
15
17
|
RoomShape,
|
|
16
18
|
RoomType,
|
|
17
19
|
} from "isaac-typescript-definitions";
|
|
18
20
|
import { game } from "../cachedClasses";
|
|
19
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
ALL_DISPLAY_FLAGS,
|
|
23
|
+
LEVEL_GRID_ROW_WIDTH,
|
|
24
|
+
MAX_LEVEL_GRID_INDEX,
|
|
25
|
+
} from "../constants";
|
|
20
26
|
import { ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA } from "../objects/roomShapeToDoorSlotsToGridIndexDelta";
|
|
21
27
|
import { getRandomArrayElement } from "./array";
|
|
22
28
|
import { doorSlotToDoorSlotFlag } from "./doors";
|
|
23
|
-
import { hasFlag } from "./flag";
|
|
29
|
+
import { addFlag, hasFlag, removeFlag } from "./flag";
|
|
24
30
|
import { getRandomSeed } from "./rng";
|
|
25
31
|
import {
|
|
26
32
|
getRoomAllowedDoors,
|
|
@@ -91,12 +97,12 @@ export function getNewRoomCandidate(
|
|
|
91
97
|
):
|
|
92
98
|
| [adjacentRoomGridIndex: int, doorSlot: DoorSlot, newRoomGridIndex: int]
|
|
93
99
|
| undefined {
|
|
94
|
-
const
|
|
95
|
-
if (
|
|
100
|
+
const newRoomCandidatesForLevel = getNewRoomCandidatesForLevel();
|
|
101
|
+
if (newRoomCandidatesForLevel.length === 0) {
|
|
96
102
|
return undefined;
|
|
97
103
|
}
|
|
98
104
|
|
|
99
|
-
return getRandomArrayElement(
|
|
105
|
+
return getRandomArrayElement(newRoomCandidatesForLevel, seedOrRNG);
|
|
100
106
|
}
|
|
101
107
|
|
|
102
108
|
/**
|
|
@@ -132,13 +138,14 @@ export function getNewRoomCandidatesBesideRoom(
|
|
|
132
138
|
neighborRoomGridIndex,
|
|
133
139
|
] of doorSlotToRoomGridIndexes.entries()) {
|
|
134
140
|
// The "getRoomShapeNeighborGridIndexes" returns grid indexes for every possible door, but the
|
|
135
|
-
// real room we are examining will only have a subset of these doors.
|
|
141
|
+
// real room we are examining will only have a subset of these doors. Thus, we have to exclude
|
|
142
|
+
// neighbor grid indexes where it would not be possible to place a door.
|
|
136
143
|
const doorSlotFlag = doorSlotToDoorSlotFlag(doorSlot);
|
|
137
144
|
if (!hasFlag(roomData.Doors, doorSlotFlag)) {
|
|
138
145
|
continue;
|
|
139
146
|
}
|
|
140
147
|
|
|
141
|
-
// If the room already exists, then it is not a possible candidate for a new room.
|
|
148
|
+
// If the neighboring room already exists, then it is not a possible candidate for a new room.
|
|
142
149
|
if (roomExists(neighborRoomGridIndex)) {
|
|
143
150
|
continue;
|
|
144
151
|
}
|
|
@@ -162,7 +169,7 @@ export function getNewRoomCandidatesBesideRoom(
|
|
|
162
169
|
*
|
|
163
170
|
* @returns A array of tuples of adjacent room grid index, `DoorSlot`, and new room grid index.
|
|
164
171
|
*/
|
|
165
|
-
export function
|
|
172
|
+
export function getNewRoomCandidatesForLevel(): Array<
|
|
166
173
|
[adjacentRoomGridIndex: int, doorSlot: DoorSlot, newRoomGridIndex: int]
|
|
167
174
|
> {
|
|
168
175
|
const rooms = getRoomsInGrid();
|
|
@@ -396,10 +403,47 @@ export function newRoom(): int | undefined {
|
|
|
396
403
|
const level = game.GetLevel();
|
|
397
404
|
level.MakeRedRoomDoor(adjacentRoomGridIndex, doorSlot);
|
|
398
405
|
|
|
406
|
+
// By default, the room will be a "red room" and have a red graphical tint, so we want to make it
|
|
407
|
+
// a normal room.
|
|
408
|
+
const roomDescriptor = getRoomDescriptor(newRoomGridIndex);
|
|
409
|
+
roomDescriptor.Flags = removeFlag(
|
|
410
|
+
roomDescriptor.Flags,
|
|
411
|
+
RoomDescriptorFlag.RED_ROOM,
|
|
412
|
+
);
|
|
413
|
+
|
|
414
|
+
// By default, the new room will not appear on the map, even if the player has The Mind. Thus, we
|
|
415
|
+
// must manually alter the `DisplayFlags` of the room descriptor.
|
|
416
|
+
const roomData = roomDescriptor.Data;
|
|
417
|
+
if (roomData !== undefined) {
|
|
418
|
+
const hasFullMap = level.GetStateFlag(LevelStateFlag.FULL_MAP_EFFECT);
|
|
419
|
+
const hasCompass = level.GetStateFlag(LevelStateFlag.COMPASS_EFFECT);
|
|
420
|
+
const hasBlueMap = level.GetStateFlag(LevelStateFlag.BLUE_MAP_EFFECT);
|
|
421
|
+
const roomType = roomData.Type;
|
|
422
|
+
const isSecretRoom =
|
|
423
|
+
roomType === RoomType.SECRET || roomType === RoomType.SUPER_SECRET;
|
|
424
|
+
|
|
425
|
+
if (hasFullMap) {
|
|
426
|
+
roomDescriptor.DisplayFlags = ALL_DISPLAY_FLAGS;
|
|
427
|
+
} else if (!isSecretRoom && hasCompass) {
|
|
428
|
+
roomDescriptor.DisplayFlags = addFlag(
|
|
429
|
+
DisplayFlag.VISIBLE,
|
|
430
|
+
DisplayFlag.SHOW_ICON,
|
|
431
|
+
);
|
|
432
|
+
} else if (isSecretRoom && hasBlueMap) {
|
|
433
|
+
roomDescriptor.DisplayFlags = addFlag(
|
|
434
|
+
DisplayFlag.VISIBLE,
|
|
435
|
+
DisplayFlag.SHOW_ICON,
|
|
436
|
+
);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
399
440
|
return newRoomGridIndex;
|
|
400
441
|
}
|
|
401
442
|
|
|
402
|
-
/**
|
|
443
|
+
/**
|
|
444
|
+
* Helper function to check if a room exists at the given room grid index. (A room will exist if it
|
|
445
|
+
* has non-undefined data in the room descriptor.)
|
|
446
|
+
*/
|
|
403
447
|
export function roomExists(roomGridIndex: int): boolean {
|
|
404
448
|
const roomData = getRoomData(roomGridIndex);
|
|
405
449
|
return roomData !== undefined;
|
|
@@ -205,8 +205,8 @@ export function getRoomVisitedCount(roomGridIndex?: int): int {
|
|
|
205
205
|
*/
|
|
206
206
|
export function setRoomData(
|
|
207
207
|
roomGridIndex: int,
|
|
208
|
-
|
|
208
|
+
roomData: Readonly<RoomConfig>,
|
|
209
209
|
): void {
|
|
210
210
|
const roomDescriptor = getRoomDescriptor(roomGridIndex);
|
|
211
|
-
roomDescriptor.Data =
|
|
211
|
+
roomDescriptor.Data = roomData;
|
|
212
212
|
}
|
package/src/functions/rooms.ts
CHANGED
|
@@ -84,6 +84,9 @@ export function getNumRooms(): int {
|
|
|
84
84
|
* accomplished by using the "goto" console command to load the specified room into the
|
|
85
85
|
* `GridRoom.DEBUG` slot.
|
|
86
86
|
*
|
|
87
|
+
* Returns undefined if the provided room type and variant combination were not found. (A warning
|
|
88
|
+
* message will also appear on the console, since the "goto" command will fail.)
|
|
89
|
+
*
|
|
87
90
|
* Note that the side effect of using the "goto" console command is that it will trigger a room
|
|
88
91
|
* transition after a short delay. By default, this function cancels the incoming room transition by
|
|
89
92
|
* using the `Game.StartRoomTransition` method to travel to the same room.
|