isaacscript-common 7.6.2 → 7.7.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/features/extraConsoleCommands/commandsSubroutines.d.ts +1 -0
- package/dist/features/extraConsoleCommands/commandsSubroutines.d.ts.map +1 -1
- package/dist/features/extraConsoleCommands/commandsSubroutines.lua +31 -7
- package/dist/features/extraConsoleCommands/init.lua +1 -0
- package/dist/features/extraConsoleCommands/listCommands.d.ts +2 -0
- package/dist/features/extraConsoleCommands/listCommands.d.ts.map +1 -1
- package/dist/features/extraConsoleCommands/listCommands.lua +5 -0
- package/dist/functions/levelGrid.d.ts +44 -12
- package/dist/functions/levelGrid.d.ts.map +1 -1
- package/dist/functions/levelGrid.lua +97 -59
- package/dist/objects/roomTypeNames.d.ts +0 -1
- package/dist/objects/roomTypeNames.d.ts.map +1 -1
- package/dist/objects/roomTypeNames.lua +0 -1
- package/package.json +1 -1
- package/src/features/extraConsoleCommands/commandsSubroutines.ts +30 -9
- package/src/features/extraConsoleCommands/init.ts +1 -0
- package/src/features/extraConsoleCommands/listCommands.ts +6 -0
- package/src/functions/levelGrid.ts +126 -61
- package/src/objects/roomTypeNames.ts +0 -2
|
@@ -7,4 +7,5 @@ export declare function listGridEntities(params: string, includeWalls: boolean):
|
|
|
7
7
|
export declare function movePlayer(params: string, direction: Direction): void;
|
|
8
8
|
export declare function spawnTrapdoorOrCrawlSpace(trapdoor: boolean): void;
|
|
9
9
|
export declare function warpToRoomType(roomType: RoomType): void;
|
|
10
|
+
export declare function warpNextToRoomType(roomType: RoomType): void;
|
|
10
11
|
//# sourceMappingURL=commandsSubroutines.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commandsSubroutines.d.ts","sourceRoot":"","sources":["../../../src/features/extraConsoleCommands/commandsSubroutines.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAIT,QAAQ,EACT,MAAM,8BAA8B,CAAC;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gBrE;AAED,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAUjE;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAWvD;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAuB3D"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local Map = ____lualib.Map
|
|
3
|
+
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
1
4
|
local ____exports = {}
|
|
2
5
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
3
6
|
local GridEntityType = ____isaac_2Dtypescript_2Ddefinitions.GridEntityType
|
|
@@ -12,6 +15,7 @@ local directionToVector = ____direction.directionToVector
|
|
|
12
15
|
local ____gridEntities = require("functions.gridEntities")
|
|
13
16
|
local spawnGridEntityWithVariant = ____gridEntities.spawnGridEntityWithVariant
|
|
14
17
|
local ____levelGrid = require("functions.levelGrid")
|
|
18
|
+
local getRoomAdjacentGridIndexes = ____levelGrid.getRoomAdjacentGridIndexes
|
|
15
19
|
local getRoomGridIndexesForType = ____levelGrid.getRoomGridIndexesForType
|
|
16
20
|
local ____logEntities = require("functions.logEntities")
|
|
17
21
|
local logAllEntities = ____logEntities.logAllEntities
|
|
@@ -26,7 +30,6 @@ local changeRoom = ____rooms.changeRoom
|
|
|
26
30
|
local ____utils = require("functions.utils")
|
|
27
31
|
local printConsole = ____utils.printConsole
|
|
28
32
|
local ____roomTypeNames = require("objects.roomTypeNames")
|
|
29
|
-
local DEFAULT_ROOM_TYPE_NAME = ____roomTypeNames.DEFAULT_ROOM_TYPE_NAME
|
|
30
33
|
local ROOM_TYPE_NAMES = ____roomTypeNames.ROOM_TYPE_NAMES
|
|
31
34
|
local DEFAULT_MOVE_UNITS = 0.5
|
|
32
35
|
function ____exports.addHeart(self, params, healthType)
|
|
@@ -109,12 +112,6 @@ function ____exports.spawnTrapdoorOrCrawlSpace(self, trapdoor)
|
|
|
109
112
|
end
|
|
110
113
|
function ____exports.warpToRoomType(self, roomType)
|
|
111
114
|
local roomTypeName = ROOM_TYPE_NAMES[roomType]
|
|
112
|
-
if roomTypeName == DEFAULT_ROOM_TYPE_NAME then
|
|
113
|
-
printConsole(
|
|
114
|
-
nil,
|
|
115
|
-
"Invalid room type: " .. tostring(roomType)
|
|
116
|
-
)
|
|
117
|
-
end
|
|
118
115
|
local gridIndexes = getRoomGridIndexesForType(nil, roomType)
|
|
119
116
|
local firstGridIndex = gridIndexes[1]
|
|
120
117
|
if firstGridIndex == nil then
|
|
@@ -127,4 +124,31 @@ function ____exports.warpToRoomType(self, roomType)
|
|
|
127
124
|
((("Warped to room type: " .. roomTypeName) .. " (") .. tostring(roomType)) .. ")"
|
|
128
125
|
)
|
|
129
126
|
end
|
|
127
|
+
function ____exports.warpNextToRoomType(self, roomType)
|
|
128
|
+
local roomTypeName = ROOM_TYPE_NAMES[roomType]
|
|
129
|
+
local gridIndexes = getRoomGridIndexesForType(nil, roomType)
|
|
130
|
+
local firstGridIndex = gridIndexes[1]
|
|
131
|
+
if firstGridIndex == nil then
|
|
132
|
+
printConsole(nil, ("There are no " .. roomTypeName) .. "s on this floor.")
|
|
133
|
+
return
|
|
134
|
+
end
|
|
135
|
+
local adjacentRoomGridIndexes = getRoomAdjacentGridIndexes(nil, firstGridIndex)
|
|
136
|
+
for ____, ____value in __TS__Iterator(adjacentRoomGridIndexes:entries()) do
|
|
137
|
+
local _doorSlot = ____value[1]
|
|
138
|
+
local roomGridIndex = ____value[2]
|
|
139
|
+
local roomData = getRoomData(nil, roomGridIndex)
|
|
140
|
+
if roomData ~= nil and roomData.Type == RoomType.DEFAULT then
|
|
141
|
+
changeRoom(nil, firstGridIndex)
|
|
142
|
+
printConsole(
|
|
143
|
+
nil,
|
|
144
|
+
((("Warped next to room type: " .. roomTypeName) .. " (") .. tostring(roomType)) .. ")"
|
|
145
|
+
)
|
|
146
|
+
return
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
printConsole(
|
|
150
|
+
nil,
|
|
151
|
+
((("Failed to find the room next to room type: " .. roomTypeName) .. " (") .. tostring(roomType)) .. ")"
|
|
152
|
+
)
|
|
153
|
+
end
|
|
130
154
|
return ____exports
|
|
@@ -42,6 +42,7 @@ function initMap(self)
|
|
|
42
42
|
extraConsoleCommandsFunctionMap:set("bombsDisplay", commandsDisplay.bombsDisplay)
|
|
43
43
|
extraConsoleCommandsFunctionMap:set("bombs", commands.bombs)
|
|
44
44
|
extraConsoleCommandsFunctionMap:set("boneHearts", commands.boneHearts)
|
|
45
|
+
extraConsoleCommandsFunctionMap:set("bossNextRoom", commands.bossNextRoom)
|
|
45
46
|
extraConsoleCommandsFunctionMap:set("bossRoom", commands.bossRoom)
|
|
46
47
|
extraConsoleCommandsFunctionMap:set("bossRush", commands.bossRush)
|
|
47
48
|
extraConsoleCommandsFunctionMap:set("brokenHearts", commands.brokenHearts)
|
|
@@ -44,6 +44,8 @@ export declare function bombs(params: string): void;
|
|
|
44
44
|
* numbers to remove hearts.)
|
|
45
45
|
*/
|
|
46
46
|
export declare function boneHearts(params: string): void;
|
|
47
|
+
/** Warps to the room next to the first Boss Room on the floor. */
|
|
48
|
+
export declare function bossNextRoom(): void;
|
|
47
49
|
/** Warps to the first Boss Room on the floor. */
|
|
48
50
|
export declare function bossRoom(): void;
|
|
49
51
|
/** Warps to the Boss Rush for the floor. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listCommands.d.ts","sourceRoot":"","sources":["../../../src/features/extraConsoleCommands/listCommands.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"listCommands.d.ts","sourceRoot":"","sources":["../../../src/features/extraConsoleCommands/listCommands.ts"],"names":[],"mappings":"AA6GA;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CA2C/C;AAED;;;GAGG;AAC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IAAI,CAG3B;AAED,6DAA6D;AAC7D,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAkBvD;AAED,gEAAgE;AAChE,wBAAgB,KAAK,IAAI,IAAI,CAY5B;AAED,+CAA+C;AAC/C,wBAAgB,YAAY,IAAI,IAAI,CAInC;AAED,4CAA4C;AAC5C,wBAAgB,SAAS,IAAI,IAAI,CAEhC;AAED,yDAAyD;AACzD,wBAAgB,eAAe,IAAI,IAAI,CAEtC;AAED;;;GAGG;AACH,wBAAgB,KAAK,IAAI,IAAI,CAQ5B;AAED,wCAAwC;AACxC,wBAAgB,KAAK,IAAI,IAAI,CAE5B;AAED,6CAA6C;AAC7C,wBAAgB,eAAe,IAAI,IAAI,CAEtC;AAED,qDAAqD;AACrD,wBAAgB,YAAY,IAAI,IAAI,CAEnC;AAED,yDAAyD;AACzD,wBAAgB,eAAe,IAAI,IAAI,CAEtC;AAED,sFAAsF;AACtF,wBAAgB,MAAM,IAAI,IAAI,CAQ7B;AAED,wFAAwF;AACxF,wBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEvC;AAED;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CA0BzC"}
|
|
@@ -107,6 +107,7 @@ local listEntities = ____commandsSubroutines.listEntities
|
|
|
107
107
|
local listGridEntities = ____commandsSubroutines.listGridEntities
|
|
108
108
|
local movePlayer = ____commandsSubroutines.movePlayer
|
|
109
109
|
local spawnTrapdoorOrCrawlSpace = ____commandsSubroutines.spawnTrapdoorOrCrawlSpace
|
|
110
|
+
local warpNextToRoomType = ____commandsSubroutines.warpNextToRoomType
|
|
110
111
|
local warpToRoomType = ____commandsSubroutines.warpToRoomType
|
|
111
112
|
local ____v = require("features.extraConsoleCommands.v")
|
|
112
113
|
local v = ____v.default
|
|
@@ -322,6 +323,10 @@ end
|
|
|
322
323
|
function ____exports.boneHearts(self, params)
|
|
323
324
|
addHeart(nil, params, HealthType.BONE)
|
|
324
325
|
end
|
|
326
|
+
--- Warps to the room next to the first Boss Room on the floor.
|
|
327
|
+
function ____exports.bossNextRoom(self)
|
|
328
|
+
warpNextToRoomType(nil, RoomType.BOSS)
|
|
329
|
+
end
|
|
325
330
|
--- Warps to the first Boss Room on the floor.
|
|
326
331
|
function ____exports.bossRoom(self)
|
|
327
332
|
warpToRoomType(nil, RoomType.BOSS)
|
|
@@ -8,7 +8,23 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { DoorSlot, RoomShape, RoomType } from "isaac-typescript-definitions";
|
|
10
10
|
/**
|
|
11
|
-
* Helper function to get the room grid indexes that
|
|
11
|
+
* Helper function to get only the adjacent room grid indexes that exist (i.e. have room data).
|
|
12
|
+
*
|
|
13
|
+
* This is just a filtering of the results of the `getAdjacentExistingRoomGridIndexes` function. See
|
|
14
|
+
* that function for more information.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getAdjacentExistingRoomGridIndexes(roomGridIndex?: int): int[];
|
|
17
|
+
/**
|
|
18
|
+
* Helper function to get only the adjacent room grid indexes that do not exist (i.e. do not have
|
|
19
|
+
* room data).
|
|
20
|
+
*
|
|
21
|
+
* This is just a filtering of the results of the `getAdjacentExistingRoomGridIndexes` function. See
|
|
22
|
+
* that function for more information.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getAdjacentNonExistingRoomGridIndexes(roomGridIndex?: int): int[];
|
|
25
|
+
/**
|
|
26
|
+
* Helper function to get all of the room grid indexes that are adjacent to a given room grid index
|
|
27
|
+
* (even if those room grid indexes do not have any rooms in them).
|
|
12
28
|
*
|
|
13
29
|
* Adjacent room grid indexes that are outside of the grid will not be included in the returned
|
|
14
30
|
* array.
|
|
@@ -54,6 +70,17 @@ export declare function getNewRoomCandidatesForLevel(): Array<[
|
|
|
54
70
|
doorSlot: DoorSlot,
|
|
55
71
|
newRoomGridIndex: int
|
|
56
72
|
]>;
|
|
73
|
+
/**
|
|
74
|
+
* Helper function to get the grid indexes of all the rooms connected to the given room index,
|
|
75
|
+
* taking the shape of the room into account. (This will only include rooms with valid data.)
|
|
76
|
+
*
|
|
77
|
+
* Returns an empty map if the provided room grid index is out of bounds or has no associated room
|
|
78
|
+
* data.
|
|
79
|
+
*
|
|
80
|
+
* @param roomGridIndex Optional. Default is the current room index.
|
|
81
|
+
* @returns A map of `DoorSlot` to the corresponding room grid index.
|
|
82
|
+
*/
|
|
83
|
+
export declare function getRoomAdjacentGridIndexes(roomGridIndex?: int): Map<DoorSlot, int>;
|
|
57
84
|
/**
|
|
58
85
|
* Helper function to get an array of all of the safe grid indexes for rooms that match the
|
|
59
86
|
* specified room type.
|
|
@@ -65,25 +92,22 @@ export declare function getNewRoomCandidatesForLevel(): Array<[
|
|
|
65
92
|
*/
|
|
66
93
|
export declare function getRoomGridIndexesForType(...roomTypes: RoomType[]): int[];
|
|
67
94
|
/**
|
|
68
|
-
* Helper function to get the grid indexes
|
|
69
|
-
*
|
|
95
|
+
* Helper function to get only the adjacent room grid indexes for a room shape that exist (i.e. have
|
|
96
|
+
* room data).
|
|
70
97
|
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
* @param roomGridIndex Optional. Default is the current room index.
|
|
75
|
-
* @returns A map of `DoorSlot` to the corresponding room grid index.
|
|
98
|
+
* This is just a filtering of the results of the `getRoomShapeAdjacentGridIndexes` function. See
|
|
99
|
+
* that function for more information.
|
|
76
100
|
*/
|
|
77
|
-
export declare function
|
|
101
|
+
export declare function getRoomShapeAdjacentExistingGridIndexes(safeRoomGridIndex: int, roomShape: RoomShape): Map<DoorSlot, int>;
|
|
78
102
|
/**
|
|
79
103
|
* Helper function to get the room grid index delta that each hypothetical door in a given room
|
|
80
104
|
* shape would go to.
|
|
81
105
|
*
|
|
82
|
-
* This is used by the `
|
|
106
|
+
* This is used by the `getRoomShapeAdjacentGridIndexes` function.
|
|
83
107
|
*
|
|
84
108
|
* @returns A map of `DoorSlot` to the corresponding room grid index delta.
|
|
85
109
|
*/
|
|
86
|
-
export declare function
|
|
110
|
+
export declare function getRoomShapeAdjacentGridIndexDeltas(roomShape: RoomShape): Map<DoorSlot, int>;
|
|
87
111
|
/**
|
|
88
112
|
* Helper function to get the room grid index that each hypothetical door in a given room shape
|
|
89
113
|
* would go to. (This will not include room grid indexes that are outside of the grid.)
|
|
@@ -93,7 +117,15 @@ export declare function getRoomShapeNeighborGridIndexDeltas(roomShape: RoomShape
|
|
|
93
117
|
* @param roomShape The shape of the room.
|
|
94
118
|
* @returns A map of `DoorSlot` to the corresponding room grid index.
|
|
95
119
|
*/
|
|
96
|
-
export declare function
|
|
120
|
+
export declare function getRoomShapeAdjacentGridIndexes(safeRoomGridIndex: int, roomShape: RoomShape): Map<DoorSlot, int>;
|
|
121
|
+
/**
|
|
122
|
+
* Helper function to get only the adjacent room grid indexes for a room shape that do not exist
|
|
123
|
+
* (i.e. do not have room data).
|
|
124
|
+
*
|
|
125
|
+
* This is just a filtering of the results of the `getRoomShapeAdjacentGridIndexes` function. See
|
|
126
|
+
* that function for more information.
|
|
127
|
+
*/
|
|
128
|
+
export declare function getRoomShapeAdjacentNonExistingGridIndexes(safeRoomGridIndex: int, roomShape: RoomShape): Map<DoorSlot, int>;
|
|
97
129
|
/**
|
|
98
130
|
* Helper function to check if the given room grid index is a dead end. Specifically, this is
|
|
99
131
|
* defined as having only one adjacent room that exists.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"levelGrid.d.ts","sourceRoot":"","sources":["../../src/functions/levelGrid.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAEL,QAAQ,EAKR,SAAS,EACT,QAAQ,EACT,MAAM,8BAA8B,CAAC;AA8BtC
|
|
1
|
+
{"version":3,"file":"levelGrid.d.ts","sourceRoot":"","sources":["../../src/functions/levelGrid.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAEL,QAAQ,EAKR,SAAS,EACT,QAAQ,EACT,M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.__TS__ArrayMap
|
|
3
2
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
3
|
+
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
4
4
|
local Map = ____lualib.Map
|
|
5
5
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
6
|
-
local Set = ____lualib.Set
|
|
7
6
|
local __TS__New = ____lualib.__TS__New
|
|
7
|
+
local Set = ____lualib.Set
|
|
8
8
|
local ____exports = {}
|
|
9
9
|
local ADJACENT_ROOM_GRID_INDEX_DELTAS
|
|
10
10
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
@@ -45,7 +45,20 @@ local ____roomShape = require("functions.roomShape")
|
|
|
45
45
|
local getGridIndexDelta = ____roomShape.getGridIndexDelta
|
|
46
46
|
local ____types = require("functions.types")
|
|
47
47
|
local asNumber = ____types.asNumber
|
|
48
|
-
--- Helper function to get the room grid indexes that
|
|
48
|
+
--- Helper function to get only the adjacent room grid indexes that do not exist (i.e. do not have
|
|
49
|
+
-- room data).
|
|
50
|
+
--
|
|
51
|
+
-- This is just a filtering of the results of the `getAdjacentExistingRoomGridIndexes` function. See
|
|
52
|
+
-- that function for more information.
|
|
53
|
+
function ____exports.getAdjacentNonExistingRoomGridIndexes(self, roomGridIndex)
|
|
54
|
+
local adjacentRoomGridIndexes = ____exports.getAdjacentRoomGridIndexes(nil, roomGridIndex)
|
|
55
|
+
return __TS__ArrayFilter(
|
|
56
|
+
adjacentRoomGridIndexes,
|
|
57
|
+
function(____, adjacentRoomGridIndex) return getRoomData(nil, adjacentRoomGridIndex) == nil end
|
|
58
|
+
)
|
|
59
|
+
end
|
|
60
|
+
--- Helper function to get all of the room grid indexes that are adjacent to a given room grid index
|
|
61
|
+
-- (even if those room grid indexes do not have any rooms in them).
|
|
49
62
|
--
|
|
50
63
|
-- Adjacent room grid indexes that are outside of the grid will not be included in the returned
|
|
51
64
|
-- array.
|
|
@@ -85,25 +98,22 @@ function ____exports.getNewRoomCandidatesBesideRoom(self, roomGridIndex)
|
|
|
85
98
|
if roomData == nil then
|
|
86
99
|
return {}
|
|
87
100
|
end
|
|
88
|
-
local doorSlotToRoomGridIndexes = ____exports.
|
|
101
|
+
local doorSlotToRoomGridIndexes = ____exports.getRoomShapeAdjacentNonExistingGridIndexes(nil, roomDescriptor.SafeGridIndex, roomData.Shape)
|
|
89
102
|
local roomCandidates = {}
|
|
90
103
|
for ____, ____value in __TS__Iterator(doorSlotToRoomGridIndexes:entries()) do
|
|
91
104
|
local doorSlot = ____value[1]
|
|
92
|
-
local
|
|
105
|
+
local adjacentRoomGridIndex = ____value[2]
|
|
93
106
|
do
|
|
94
107
|
local doorSlotFlag = doorSlotToDoorSlotFlag(nil, doorSlot)
|
|
95
108
|
if not hasFlag(nil, roomData.Doors, doorSlotFlag) then
|
|
96
|
-
goto
|
|
97
|
-
end
|
|
98
|
-
if ____exports.roomExists(nil, neighborRoomGridIndex) then
|
|
99
|
-
goto __continue13
|
|
109
|
+
goto __continue17
|
|
100
110
|
end
|
|
101
|
-
if not ____exports.isDeadEnd(nil,
|
|
102
|
-
goto
|
|
111
|
+
if not ____exports.isDeadEnd(nil, adjacentRoomGridIndex) then
|
|
112
|
+
goto __continue17
|
|
103
113
|
end
|
|
104
|
-
roomCandidates[#roomCandidates + 1] = {doorSlot,
|
|
114
|
+
roomCandidates[#roomCandidates + 1] = {doorSlot, adjacentRoomGridIndex}
|
|
105
115
|
end
|
|
106
|
-
::
|
|
116
|
+
::__continue17::
|
|
107
117
|
end
|
|
108
118
|
return roomCandidates
|
|
109
119
|
end
|
|
@@ -128,13 +138,30 @@ function ____exports.getNewRoomCandidatesForLevel(self)
|
|
|
128
138
|
end
|
|
129
139
|
return newRoomCandidates
|
|
130
140
|
end
|
|
141
|
+
--- Helper function to get only the adjacent room grid indexes for a room shape that exist (i.e. have
|
|
142
|
+
-- room data).
|
|
143
|
+
--
|
|
144
|
+
-- This is just a filtering of the results of the `getRoomShapeAdjacentGridIndexes` function. See
|
|
145
|
+
-- that function for more information.
|
|
146
|
+
function ____exports.getRoomShapeAdjacentExistingGridIndexes(self, safeRoomGridIndex, roomShape)
|
|
147
|
+
local roomShapeAdjacentGridIndexes = ____exports.getRoomShapeAdjacentGridIndexes(nil, safeRoomGridIndex, roomShape)
|
|
148
|
+
for ____, ____value in __TS__Iterator(roomShapeAdjacentGridIndexes:entries()) do
|
|
149
|
+
local doorSlot = ____value[1]
|
|
150
|
+
local roomGridIndex = ____value[2]
|
|
151
|
+
local roomData = getRoomData(nil, roomGridIndex)
|
|
152
|
+
if roomData == nil then
|
|
153
|
+
roomShapeAdjacentGridIndexes:delete(doorSlot)
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
return roomShapeAdjacentGridIndexes
|
|
157
|
+
end
|
|
131
158
|
--- Helper function to get the room grid index delta that each hypothetical door in a given room
|
|
132
159
|
-- shape would go to.
|
|
133
160
|
--
|
|
134
|
-
-- This is used by the `
|
|
161
|
+
-- This is used by the `getRoomShapeAdjacentGridIndexes` function.
|
|
135
162
|
--
|
|
136
163
|
-- @returns A map of `DoorSlot` to the corresponding room grid index delta.
|
|
137
|
-
function ____exports.
|
|
164
|
+
function ____exports.getRoomShapeAdjacentGridIndexDeltas(self, roomShape)
|
|
138
165
|
return ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA[roomShape]
|
|
139
166
|
end
|
|
140
167
|
--- Helper function to get the room grid index that each hypothetical door in a given room shape
|
|
@@ -144,18 +171,35 @@ end
|
|
|
144
171
|
-- for the respective room).
|
|
145
172
|
-- @param roomShape The shape of the room.
|
|
146
173
|
-- @returns A map of `DoorSlot` to the corresponding room grid index.
|
|
147
|
-
function ____exports.
|
|
148
|
-
local
|
|
149
|
-
local
|
|
150
|
-
for ____, ____value in __TS__Iterator(
|
|
174
|
+
function ____exports.getRoomShapeAdjacentGridIndexes(self, safeRoomGridIndex, roomShape)
|
|
175
|
+
local roomShapeAdjacentGridIndexDeltas = ____exports.getRoomShapeAdjacentGridIndexDeltas(nil, roomShape)
|
|
176
|
+
local adjacentGridIndexes = __TS__New(Map)
|
|
177
|
+
for ____, ____value in __TS__Iterator(roomShapeAdjacentGridIndexDeltas:entries()) do
|
|
151
178
|
local doorSlot = ____value[1]
|
|
152
179
|
local delta = ____value[2]
|
|
153
180
|
local roomGridIndex = safeRoomGridIndex + delta
|
|
154
181
|
if ____exports.isRoomInsideGrid(nil, roomGridIndex) then
|
|
155
|
-
|
|
182
|
+
adjacentGridIndexes:set(doorSlot, roomGridIndex)
|
|
156
183
|
end
|
|
157
184
|
end
|
|
158
|
-
return
|
|
185
|
+
return adjacentGridIndexes
|
|
186
|
+
end
|
|
187
|
+
--- Helper function to get only the adjacent room grid indexes for a room shape that do not exist
|
|
188
|
+
-- (i.e. do not have room data).
|
|
189
|
+
--
|
|
190
|
+
-- This is just a filtering of the results of the `getRoomShapeAdjacentGridIndexes` function. See
|
|
191
|
+
-- that function for more information.
|
|
192
|
+
function ____exports.getRoomShapeAdjacentNonExistingGridIndexes(self, safeRoomGridIndex, roomShape)
|
|
193
|
+
local roomShapeAdjacentGridIndexes = ____exports.getRoomShapeAdjacentGridIndexes(nil, safeRoomGridIndex, roomShape)
|
|
194
|
+
for ____, ____value in __TS__Iterator(roomShapeAdjacentGridIndexes:entries()) do
|
|
195
|
+
local doorSlot = ____value[1]
|
|
196
|
+
local roomGridIndex = ____value[2]
|
|
197
|
+
local roomData = getRoomData(nil, roomGridIndex)
|
|
198
|
+
if roomData ~= nil then
|
|
199
|
+
roomShapeAdjacentGridIndexes:delete(doorSlot)
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
return roomShapeAdjacentGridIndexes
|
|
159
203
|
end
|
|
160
204
|
--- Helper function to check if the given room grid index is a dead end. Specifically, this is
|
|
161
205
|
-- defined as having only one adjacent room that exists.
|
|
@@ -168,16 +212,8 @@ end
|
|
|
168
212
|
--
|
|
169
213
|
-- @param roomGridIndex Optional. Default is the current room index.
|
|
170
214
|
function ____exports.isDeadEnd(self, roomGridIndex)
|
|
171
|
-
local
|
|
172
|
-
|
|
173
|
-
adjacentRoomGridIndexes,
|
|
174
|
-
function(____, adjacentRoomGridIndex) return getRoomData(nil, adjacentRoomGridIndex) end
|
|
175
|
-
)
|
|
176
|
-
local existingRoomData = __TS__ArrayFilter(
|
|
177
|
-
adjacentRoomData,
|
|
178
|
-
function(____, data) return data ~= nil end
|
|
179
|
-
)
|
|
180
|
-
return #existingRoomData == 1
|
|
215
|
+
local adjacentNonExistingRoomGridIndexes = ____exports.getAdjacentNonExistingRoomGridIndexes(nil, roomGridIndex)
|
|
216
|
+
return #adjacentNonExistingRoomGridIndexes == 1
|
|
181
217
|
end
|
|
182
218
|
--- Helper function to determine if a given room grid index is inside of the normal 13x13 level grid.
|
|
183
219
|
--
|
|
@@ -201,6 +237,17 @@ local UP = -LEVEL_GRID_ROW_WIDTH
|
|
|
201
237
|
local RIGHT = 1
|
|
202
238
|
local DOWN = LEVEL_GRID_ROW_WIDTH
|
|
203
239
|
ADJACENT_ROOM_GRID_INDEX_DELTAS = {LEFT, UP, RIGHT, DOWN}
|
|
240
|
+
--- Helper function to get only the adjacent room grid indexes that exist (i.e. have room data).
|
|
241
|
+
--
|
|
242
|
+
-- This is just a filtering of the results of the `getAdjacentExistingRoomGridIndexes` function. See
|
|
243
|
+
-- that function for more information.
|
|
244
|
+
function ____exports.getAdjacentExistingRoomGridIndexes(self, roomGridIndex)
|
|
245
|
+
local adjacentRoomGridIndexes = ____exports.getAdjacentRoomGridIndexes(nil, roomGridIndex)
|
|
246
|
+
return __TS__ArrayFilter(
|
|
247
|
+
adjacentRoomGridIndexes,
|
|
248
|
+
function(____, adjacentRoomGridIndex) return getRoomData(nil, adjacentRoomGridIndex) ~= nil end
|
|
249
|
+
)
|
|
250
|
+
end
|
|
204
251
|
--- Helper function to get the room safe grid index for every room on the entire floor.
|
|
205
252
|
function ____exports.getAllRoomGridIndexes(self)
|
|
206
253
|
local rooms = getRooms(nil)
|
|
@@ -227,6 +274,25 @@ function ____exports.getNewRoomCandidate(self, seedOrRNG)
|
|
|
227
274
|
end
|
|
228
275
|
return getRandomArrayElement(nil, newRoomCandidatesForLevel, seedOrRNG)
|
|
229
276
|
end
|
|
277
|
+
--- Helper function to get the grid indexes of all the rooms connected to the given room index,
|
|
278
|
+
-- taking the shape of the room into account. (This will only include rooms with valid data.)
|
|
279
|
+
--
|
|
280
|
+
-- Returns an empty map if the provided room grid index is out of bounds or has no associated room
|
|
281
|
+
-- data.
|
|
282
|
+
--
|
|
283
|
+
-- @param roomGridIndex Optional. Default is the current room index.
|
|
284
|
+
-- @returns A map of `DoorSlot` to the corresponding room grid index.
|
|
285
|
+
function ____exports.getRoomAdjacentGridIndexes(self, roomGridIndex)
|
|
286
|
+
local roomDescriptor = getRoomDescriptor(nil, roomGridIndex)
|
|
287
|
+
if not ____exports.isRoomInsideGrid(nil, roomDescriptor.SafeGridIndex) then
|
|
288
|
+
return __TS__New(Map)
|
|
289
|
+
end
|
|
290
|
+
local roomData = roomDescriptor.Data
|
|
291
|
+
if roomData == nil then
|
|
292
|
+
return __TS__New(Map)
|
|
293
|
+
end
|
|
294
|
+
return ____exports.getRoomShapeAdjacentExistingGridIndexes(nil, roomDescriptor.SafeGridIndex, roomData.Shape)
|
|
295
|
+
end
|
|
230
296
|
--- Helper function to get an array of all of the safe grid indexes for rooms that match the
|
|
231
297
|
-- specified room type.
|
|
232
298
|
--
|
|
@@ -246,34 +312,6 @@ function ____exports.getRoomGridIndexesForType(self, ...)
|
|
|
246
312
|
function(____, roomDescriptor) return roomDescriptor.SafeGridIndex end
|
|
247
313
|
)
|
|
248
314
|
end
|
|
249
|
-
--- Helper function to get the grid indexes of all the rooms connected to the given room index,
|
|
250
|
-
-- taking the shape of the room into account. (This will only include rooms with valid data.)
|
|
251
|
-
--
|
|
252
|
-
-- Returns an empty map if the provided room grid index is out of bounds or has no associated room
|
|
253
|
-
-- data.
|
|
254
|
-
--
|
|
255
|
-
-- @param roomGridIndex Optional. Default is the current room index.
|
|
256
|
-
-- @returns A map of `DoorSlot` to the corresponding room grid index.
|
|
257
|
-
function ____exports.getRoomNeighbors(self, roomGridIndex)
|
|
258
|
-
local roomDescriptor = getRoomDescriptor(nil, roomGridIndex)
|
|
259
|
-
if not ____exports.isRoomInsideGrid(nil, roomDescriptor.SafeGridIndex) then
|
|
260
|
-
return __TS__New(Map)
|
|
261
|
-
end
|
|
262
|
-
local roomData = roomDescriptor.Data
|
|
263
|
-
if roomData == nil then
|
|
264
|
-
return __TS__New(Map)
|
|
265
|
-
end
|
|
266
|
-
local doorSlotToRoomGridIndexes = ____exports.getRoomShapeNeighborGridIndexes(nil, roomDescriptor.SafeGridIndex, roomData.Shape)
|
|
267
|
-
local roomNeighbors = __TS__New(Map)
|
|
268
|
-
for ____, ____value in __TS__Iterator(doorSlotToRoomGridIndexes:entries()) do
|
|
269
|
-
local doorSlot = ____value[1]
|
|
270
|
-
local neighborRoomGridIndex = ____value[2]
|
|
271
|
-
if ____exports.roomExists(nil, neighborRoomGridIndex) then
|
|
272
|
-
roomNeighbors:set(doorSlot, neighborRoomGridIndex)
|
|
273
|
-
end
|
|
274
|
-
end
|
|
275
|
-
return roomNeighbors
|
|
276
|
-
end
|
|
277
315
|
function ____exports.isDoorSlotValidAtGridIndex(self, doorSlot, roomGridIndex)
|
|
278
316
|
local allowedDoors = getRoomAllowedDoors(nil, roomGridIndex)
|
|
279
317
|
return allowedDoors:has(doorSlot)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"roomTypeNames.d.ts","sourceRoot":"","sources":["../../src/objects/roomTypeNames.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAExD,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"roomTypeNames.d.ts","sourceRoot":"","sources":["../../src/objects/roomTypeNames.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAExD,eAAO,MAAM,eAAe,EAAE;IAAE,QAAQ,EAAE,GAAG,IAAI,QAAQ,GAAG,MAAM;CA8BxD,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
local ____exports = {}
|
|
2
2
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
3
3
|
local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
|
|
4
|
-
____exports.DEFAULT_ROOM_TYPE_NAME = "Unknown"
|
|
5
4
|
____exports.ROOM_TYPE_NAMES = {
|
|
6
5
|
[RoomType.DEFAULT] = "default room",
|
|
7
6
|
[RoomType.SHOP] = "shop",
|
package/package.json
CHANGED
|
@@ -9,7 +9,10 @@ import { game } from "../../core/cachedClasses";
|
|
|
9
9
|
import { HealthType } from "../../enums/HealthType";
|
|
10
10
|
import { directionToVector } from "../../functions/direction";
|
|
11
11
|
import { spawnGridEntityWithVariant } from "../../functions/gridEntities";
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
getRoomAdjacentGridIndexes,
|
|
14
|
+
getRoomGridIndexesForType,
|
|
15
|
+
} from "../../functions/levelGrid";
|
|
13
16
|
import {
|
|
14
17
|
logAllEntities,
|
|
15
18
|
logAllGridEntities,
|
|
@@ -18,10 +21,7 @@ import { addPlayerHealthType } from "../../functions/playerHealth";
|
|
|
18
21
|
import { getRoomData, getRoomDescriptor } from "../../functions/roomData";
|
|
19
22
|
import { changeRoom } from "../../functions/rooms";
|
|
20
23
|
import { printConsole } from "../../functions/utils";
|
|
21
|
-
import {
|
|
22
|
-
DEFAULT_ROOM_TYPE_NAME,
|
|
23
|
-
ROOM_TYPE_NAMES,
|
|
24
|
-
} from "../../objects/roomTypeNames";
|
|
24
|
+
import { ROOM_TYPE_NAMES } from "../../objects/roomTypeNames";
|
|
25
25
|
|
|
26
26
|
const DEFAULT_MOVE_UNITS = 0.5;
|
|
27
27
|
|
|
@@ -127,10 +127,6 @@ export function spawnTrapdoorOrCrawlSpace(trapdoor: boolean): void {
|
|
|
127
127
|
|
|
128
128
|
export function warpToRoomType(roomType: RoomType): void {
|
|
129
129
|
const roomTypeName = ROOM_TYPE_NAMES[roomType];
|
|
130
|
-
if (roomTypeName === DEFAULT_ROOM_TYPE_NAME) {
|
|
131
|
-
printConsole(`Invalid room type: ${roomType}`);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
130
|
const gridIndexes = getRoomGridIndexesForType(roomType);
|
|
135
131
|
const firstGridIndex = gridIndexes[0];
|
|
136
132
|
if (firstGridIndex === undefined) {
|
|
@@ -141,3 +137,28 @@ export function warpToRoomType(roomType: RoomType): void {
|
|
|
141
137
|
changeRoom(firstGridIndex);
|
|
142
138
|
printConsole(`Warped to room type: ${roomTypeName} (${roomType})`);
|
|
143
139
|
}
|
|
140
|
+
|
|
141
|
+
export function warpNextToRoomType(roomType: RoomType): void {
|
|
142
|
+
const roomTypeName = ROOM_TYPE_NAMES[roomType];
|
|
143
|
+
const gridIndexes = getRoomGridIndexesForType(roomType);
|
|
144
|
+
const firstGridIndex = gridIndexes[0];
|
|
145
|
+
if (firstGridIndex === undefined) {
|
|
146
|
+
printConsole(`There are no ${roomTypeName}s on this floor.`);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const adjacentRoomGridIndexes = getRoomAdjacentGridIndexes(firstGridIndex);
|
|
151
|
+
|
|
152
|
+
for (const [_doorSlot, roomGridIndex] of adjacentRoomGridIndexes.entries()) {
|
|
153
|
+
const roomData = getRoomData(roomGridIndex);
|
|
154
|
+
if (roomData !== undefined && roomData.Type === RoomType.DEFAULT) {
|
|
155
|
+
changeRoom(firstGridIndex);
|
|
156
|
+
printConsole(`Warped next to room type: ${roomTypeName} (${roomType})`);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
printConsole(
|
|
162
|
+
`Failed to find the room next to room type: ${roomTypeName} (${roomType})`,
|
|
163
|
+
);
|
|
164
|
+
}
|
|
@@ -46,6 +46,7 @@ function initMap() {
|
|
|
46
46
|
);
|
|
47
47
|
extraConsoleCommandsFunctionMap.set("bombs", commands.bombs);
|
|
48
48
|
extraConsoleCommandsFunctionMap.set("boneHearts", commands.boneHearts);
|
|
49
|
+
extraConsoleCommandsFunctionMap.set("bossNextRoom", commands.bossNextRoom);
|
|
49
50
|
extraConsoleCommandsFunctionMap.set("bossRoom", commands.bossRoom);
|
|
50
51
|
extraConsoleCommandsFunctionMap.set("bossRush", commands.bossRush);
|
|
51
52
|
extraConsoleCommandsFunctionMap.set("brokenHearts", commands.brokenHearts);
|
|
@@ -102,6 +102,7 @@ import {
|
|
|
102
102
|
listGridEntities,
|
|
103
103
|
movePlayer,
|
|
104
104
|
spawnTrapdoorOrCrawlSpace,
|
|
105
|
+
warpNextToRoomType,
|
|
105
106
|
warpToRoomType,
|
|
106
107
|
} from "./commandsSubroutines";
|
|
107
108
|
import v from "./v";
|
|
@@ -284,6 +285,11 @@ export function boneHearts(params: string): void {
|
|
|
284
285
|
addHeart(params, HealthType.BONE);
|
|
285
286
|
}
|
|
286
287
|
|
|
288
|
+
/** Warps to the room next to the first Boss Room on the floor. */
|
|
289
|
+
export function bossNextRoom(): void {
|
|
290
|
+
warpNextToRoomType(RoomType.BOSS);
|
|
291
|
+
}
|
|
292
|
+
|
|
287
293
|
/** Warps to the first Boss Room on the floor. */
|
|
288
294
|
export function bossRoom(): void {
|
|
289
295
|
warpToRoomType(RoomType.BOSS);
|
|
@@ -47,7 +47,37 @@ const DOWN = LEVEL_GRID_ROW_WIDTH;
|
|
|
47
47
|
const ADJACENT_ROOM_GRID_INDEX_DELTAS: readonly int[] = [LEFT, UP, RIGHT, DOWN];
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
|
-
* Helper function to get the room grid indexes that
|
|
50
|
+
* Helper function to get only the adjacent room grid indexes that exist (i.e. have room data).
|
|
51
|
+
*
|
|
52
|
+
* This is just a filtering of the results of the `getAdjacentExistingRoomGridIndexes` function. See
|
|
53
|
+
* that function for more information.
|
|
54
|
+
*/
|
|
55
|
+
export function getAdjacentExistingRoomGridIndexes(roomGridIndex?: int): int[] {
|
|
56
|
+
const adjacentRoomGridIndexes = getAdjacentRoomGridIndexes(roomGridIndex);
|
|
57
|
+
return adjacentRoomGridIndexes.filter(
|
|
58
|
+
(adjacentRoomGridIndex) => getRoomData(adjacentRoomGridIndex) !== undefined,
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Helper function to get only the adjacent room grid indexes that do not exist (i.e. do not have
|
|
64
|
+
* room data).
|
|
65
|
+
*
|
|
66
|
+
* This is just a filtering of the results of the `getAdjacentExistingRoomGridIndexes` function. See
|
|
67
|
+
* that function for more information.
|
|
68
|
+
*/
|
|
69
|
+
export function getAdjacentNonExistingRoomGridIndexes(
|
|
70
|
+
roomGridIndex?: int,
|
|
71
|
+
): int[] {
|
|
72
|
+
const adjacentRoomGridIndexes = getAdjacentRoomGridIndexes(roomGridIndex);
|
|
73
|
+
return adjacentRoomGridIndexes.filter(
|
|
74
|
+
(adjacentRoomGridIndex) => getRoomData(adjacentRoomGridIndex) === undefined,
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Helper function to get all of the room grid indexes that are adjacent to a given room grid index
|
|
80
|
+
* (even if those room grid indexes do not have any rooms in them).
|
|
51
81
|
*
|
|
52
82
|
* Adjacent room grid indexes that are outside of the grid will not be included in the returned
|
|
53
83
|
* array.
|
|
@@ -127,7 +157,7 @@ export function getNewRoomCandidatesBesideRoom(
|
|
|
127
157
|
return [];
|
|
128
158
|
}
|
|
129
159
|
|
|
130
|
-
const doorSlotToRoomGridIndexes =
|
|
160
|
+
const doorSlotToRoomGridIndexes = getRoomShapeAdjacentNonExistingGridIndexes(
|
|
131
161
|
roomDescriptor.SafeGridIndex,
|
|
132
162
|
roomData.Shape,
|
|
133
163
|
);
|
|
@@ -136,29 +166,24 @@ export function getNewRoomCandidatesBesideRoom(
|
|
|
136
166
|
|
|
137
167
|
for (const [
|
|
138
168
|
doorSlot,
|
|
139
|
-
|
|
169
|
+
adjacentRoomGridIndex,
|
|
140
170
|
] of doorSlotToRoomGridIndexes.entries()) {
|
|
141
|
-
// The "
|
|
142
|
-
// real room we are examining will only have a subset of these doors. Thus, we
|
|
143
|
-
//
|
|
171
|
+
// The "getRoomShapeAdjacentNonExistingGridIndexes" returns grid indexes for every possible
|
|
172
|
+
// door, but the real room we are examining will only have a subset of these doors. Thus, we
|
|
173
|
+
// have to exclude adjacent grid indexes where it would not be possible to place a door.
|
|
144
174
|
const doorSlotFlag = doorSlotToDoorSlotFlag(doorSlot);
|
|
145
175
|
if (!hasFlag(roomData.Doors, doorSlotFlag)) {
|
|
146
176
|
continue;
|
|
147
177
|
}
|
|
148
178
|
|
|
149
|
-
// If the neighboring room already exists, then it is not a possible candidate for a new room.
|
|
150
|
-
if (roomExists(neighborRoomGridIndex)) {
|
|
151
|
-
continue;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
179
|
// Check to see if hypothetically creating a room at the given room grid index would be a dead
|
|
155
180
|
// end. In other words, if we created the room, we would only want it to connect to one other
|
|
156
181
|
// room (this one).
|
|
157
|
-
if (!isDeadEnd(
|
|
182
|
+
if (!isDeadEnd(adjacentRoomGridIndex)) {
|
|
158
183
|
continue;
|
|
159
184
|
}
|
|
160
185
|
|
|
161
|
-
roomCandidates.push([doorSlot,
|
|
186
|
+
roomCandidates.push([doorSlot, adjacentRoomGridIndex]);
|
|
162
187
|
}
|
|
163
188
|
|
|
164
189
|
return roomCandidates;
|
|
@@ -196,6 +221,36 @@ export function getNewRoomCandidatesForLevel(): Array<
|
|
|
196
221
|
return newRoomCandidates;
|
|
197
222
|
}
|
|
198
223
|
|
|
224
|
+
/**
|
|
225
|
+
* Helper function to get the grid indexes of all the rooms connected to the given room index,
|
|
226
|
+
* taking the shape of the room into account. (This will only include rooms with valid data.)
|
|
227
|
+
*
|
|
228
|
+
* Returns an empty map if the provided room grid index is out of bounds or has no associated room
|
|
229
|
+
* data.
|
|
230
|
+
*
|
|
231
|
+
* @param roomGridIndex Optional. Default is the current room index.
|
|
232
|
+
* @returns A map of `DoorSlot` to the corresponding room grid index.
|
|
233
|
+
*/
|
|
234
|
+
export function getRoomAdjacentGridIndexes(
|
|
235
|
+
roomGridIndex?: int,
|
|
236
|
+
): Map<DoorSlot, int> {
|
|
237
|
+
const roomDescriptor = getRoomDescriptor(roomGridIndex);
|
|
238
|
+
|
|
239
|
+
if (!isRoomInsideGrid(roomDescriptor.SafeGridIndex)) {
|
|
240
|
+
return new Map();
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
const roomData = roomDescriptor.Data;
|
|
244
|
+
if (roomData === undefined) {
|
|
245
|
+
return new Map();
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return getRoomShapeAdjacentExistingGridIndexes(
|
|
249
|
+
roomDescriptor.SafeGridIndex,
|
|
250
|
+
roomData.Shape,
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
|
|
199
254
|
/**
|
|
200
255
|
* Helper function to get an array of all of the safe grid indexes for rooms that match the
|
|
201
256
|
* specified room type.
|
|
@@ -219,57 +274,43 @@ export function getRoomGridIndexesForType(...roomTypes: RoomType[]): int[] {
|
|
|
219
274
|
}
|
|
220
275
|
|
|
221
276
|
/**
|
|
222
|
-
* Helper function to get the grid indexes
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
* Returns an empty map if the provided room grid index is out of bounds or has no associated room
|
|
226
|
-
* data.
|
|
277
|
+
* Helper function to get only the adjacent room grid indexes for a room shape that exist (i.e. have
|
|
278
|
+
* room data).
|
|
227
279
|
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
280
|
+
* This is just a filtering of the results of the `getRoomShapeAdjacentGridIndexes` function. See
|
|
281
|
+
* that function for more information.
|
|
230
282
|
*/
|
|
231
|
-
export function
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
const roomData = roomDescriptor.Data;
|
|
239
|
-
if (roomData === undefined) {
|
|
240
|
-
return new Map();
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
const doorSlotToRoomGridIndexes = getRoomShapeNeighborGridIndexes(
|
|
244
|
-
roomDescriptor.SafeGridIndex,
|
|
245
|
-
roomData.Shape,
|
|
283
|
+
export function getRoomShapeAdjacentExistingGridIndexes(
|
|
284
|
+
safeRoomGridIndex: int,
|
|
285
|
+
roomShape: RoomShape,
|
|
286
|
+
): Map<DoorSlot, int> {
|
|
287
|
+
const roomShapeAdjacentGridIndexes = getRoomShapeAdjacentGridIndexes(
|
|
288
|
+
safeRoomGridIndex,
|
|
289
|
+
roomShape,
|
|
246
290
|
);
|
|
247
291
|
|
|
248
|
-
// The "getRoomShapeNeighborGridIndexes" returns grid indexes for every possible door, but the
|
|
249
|
-
// real room we are examining will only have a subset of these doors. However, we do not have to
|
|
250
|
-
// worry about filtering the map, since we perform a room existence check below.
|
|
251
|
-
const roomNeighbors = new Map<DoorSlot, int>();
|
|
252
292
|
for (const [
|
|
253
293
|
doorSlot,
|
|
254
|
-
|
|
255
|
-
] of
|
|
256
|
-
|
|
257
|
-
|
|
294
|
+
roomGridIndex,
|
|
295
|
+
] of roomShapeAdjacentGridIndexes.entries()) {
|
|
296
|
+
const roomData = getRoomData(roomGridIndex);
|
|
297
|
+
if (roomData === undefined) {
|
|
298
|
+
roomShapeAdjacentGridIndexes.delete(doorSlot);
|
|
258
299
|
}
|
|
259
300
|
}
|
|
260
301
|
|
|
261
|
-
return
|
|
302
|
+
return roomShapeAdjacentGridIndexes;
|
|
262
303
|
}
|
|
263
304
|
|
|
264
305
|
/**
|
|
265
306
|
* Helper function to get the room grid index delta that each hypothetical door in a given room
|
|
266
307
|
* shape would go to.
|
|
267
308
|
*
|
|
268
|
-
* This is used by the `
|
|
309
|
+
* This is used by the `getRoomShapeAdjacentGridIndexes` function.
|
|
269
310
|
*
|
|
270
311
|
* @returns A map of `DoorSlot` to the corresponding room grid index delta.
|
|
271
312
|
*/
|
|
272
|
-
export function
|
|
313
|
+
export function getRoomShapeAdjacentGridIndexDeltas(
|
|
273
314
|
roomShape: RoomShape,
|
|
274
315
|
): Map<DoorSlot, int> {
|
|
275
316
|
return ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA[roomShape];
|
|
@@ -284,22 +325,51 @@ export function getRoomShapeNeighborGridIndexDeltas(
|
|
|
284
325
|
* @param roomShape The shape of the room.
|
|
285
326
|
* @returns A map of `DoorSlot` to the corresponding room grid index.
|
|
286
327
|
*/
|
|
287
|
-
export function
|
|
328
|
+
export function getRoomShapeAdjacentGridIndexes(
|
|
288
329
|
safeRoomGridIndex: int,
|
|
289
330
|
roomShape: RoomShape,
|
|
290
331
|
): Map<DoorSlot, int> {
|
|
291
|
-
const
|
|
292
|
-
|
|
332
|
+
const roomShapeAdjacentGridIndexDeltas =
|
|
333
|
+
getRoomShapeAdjacentGridIndexDeltas(roomShape);
|
|
293
334
|
|
|
294
|
-
const
|
|
295
|
-
for (const [doorSlot, delta] of
|
|
335
|
+
const adjacentGridIndexes = new Map<DoorSlot, int>();
|
|
336
|
+
for (const [doorSlot, delta] of roomShapeAdjacentGridIndexDeltas.entries()) {
|
|
296
337
|
const roomGridIndex = safeRoomGridIndex + delta;
|
|
297
338
|
if (isRoomInsideGrid(roomGridIndex)) {
|
|
298
|
-
|
|
339
|
+
adjacentGridIndexes.set(doorSlot, roomGridIndex);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
return adjacentGridIndexes;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Helper function to get only the adjacent room grid indexes for a room shape that do not exist
|
|
348
|
+
* (i.e. do not have room data).
|
|
349
|
+
*
|
|
350
|
+
* This is just a filtering of the results of the `getRoomShapeAdjacentGridIndexes` function. See
|
|
351
|
+
* that function for more information.
|
|
352
|
+
*/
|
|
353
|
+
export function getRoomShapeAdjacentNonExistingGridIndexes(
|
|
354
|
+
safeRoomGridIndex: int,
|
|
355
|
+
roomShape: RoomShape,
|
|
356
|
+
): Map<DoorSlot, int> {
|
|
357
|
+
const roomShapeAdjacentGridIndexes = getRoomShapeAdjacentGridIndexes(
|
|
358
|
+
safeRoomGridIndex,
|
|
359
|
+
roomShape,
|
|
360
|
+
);
|
|
361
|
+
|
|
362
|
+
for (const [
|
|
363
|
+
doorSlot,
|
|
364
|
+
roomGridIndex,
|
|
365
|
+
] of roomShapeAdjacentGridIndexes.entries()) {
|
|
366
|
+
const roomData = getRoomData(roomGridIndex);
|
|
367
|
+
if (roomData !== undefined) {
|
|
368
|
+
roomShapeAdjacentGridIndexes.delete(doorSlot);
|
|
299
369
|
}
|
|
300
370
|
}
|
|
301
371
|
|
|
302
|
-
return
|
|
372
|
+
return roomShapeAdjacentGridIndexes;
|
|
303
373
|
}
|
|
304
374
|
|
|
305
375
|
/**
|
|
@@ -315,15 +385,10 @@ export function getRoomShapeNeighborGridIndexes(
|
|
|
315
385
|
* @param roomGridIndex Optional. Default is the current room index.
|
|
316
386
|
*/
|
|
317
387
|
export function isDeadEnd(roomGridIndex?: int): boolean {
|
|
318
|
-
const
|
|
319
|
-
|
|
320
|
-
(adjacentRoomGridIndex) => getRoomData(adjacentRoomGridIndex),
|
|
321
|
-
);
|
|
322
|
-
const existingRoomData = adjacentRoomData.filter(
|
|
323
|
-
(data): data is RoomConfig => data !== undefined,
|
|
324
|
-
);
|
|
388
|
+
const adjacentNonExistingRoomGridIndexes =
|
|
389
|
+
getAdjacentNonExistingRoomGridIndexes(roomGridIndex);
|
|
325
390
|
|
|
326
|
-
return
|
|
391
|
+
return adjacentNonExistingRoomGridIndexes.length === 1;
|
|
327
392
|
}
|
|
328
393
|
|
|
329
394
|
export function isDoorSlotValidAtGridIndex(
|