isaacscript-common 16.1.2 → 16.1.4
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 16.1.
|
|
3
|
+
isaacscript-common 16.1.4
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -1443,10 +1443,6 @@ local function __TS__MathSign(val)
|
|
|
1443
1443
|
return 0
|
|
1444
1444
|
end
|
|
1445
1445
|
|
|
1446
|
-
local function __TS__Modulo50(a, b)
|
|
1447
|
-
return a - math.floor(a / b) * b
|
|
1448
|
-
end
|
|
1449
|
-
|
|
1450
1446
|
local function __TS__Number(value)
|
|
1451
1447
|
local valueType = type(value)
|
|
1452
1448
|
if valueType == "number" then
|
|
@@ -2535,7 +2531,6 @@ return {
|
|
|
2535
2531
|
__TS__MathAtan2 = __TS__MathAtan2,
|
|
2536
2532
|
__TS__MathModf = __TS__MathModf,
|
|
2537
2533
|
__TS__MathSign = __TS__MathSign,
|
|
2538
|
-
__TS__Modulo50 = __TS__Modulo50,
|
|
2539
2534
|
__TS__New = __TS__New,
|
|
2540
2535
|
__TS__Number = __TS__Number,
|
|
2541
2536
|
__TS__NumberIsFinite = __TS__NumberIsFinite,
|
|
@@ -20046,15 +20041,17 @@ local Set = ____lualib.Set
|
|
|
20046
20041
|
local __TS__Spread = ____lualib.__TS__Spread
|
|
20047
20042
|
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
20048
20043
|
local __TS__ArrayFind = ____lualib.__TS__ArrayFind
|
|
20044
|
+
local __TS__ArrayIncludes = ____lualib.__TS__ArrayIncludes
|
|
20045
|
+
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
20049
20046
|
local __TS__New = ____lualib.__TS__New
|
|
20050
20047
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
20051
|
-
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
20052
20048
|
local ____exports = {}
|
|
20053
20049
|
local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
|
|
20054
20050
|
local DoorSlot = ____isaac_2Dtypescript_2Ddefinitions.DoorSlot
|
|
20055
20051
|
local DoorSlotFlag = ____isaac_2Dtypescript_2Ddefinitions.DoorSlotFlag
|
|
20056
20052
|
local DoorState = ____isaac_2Dtypescript_2Ddefinitions.DoorState
|
|
20057
20053
|
local DoorVariant = ____isaac_2Dtypescript_2Ddefinitions.DoorVariant
|
|
20054
|
+
local GridEntityType = ____isaac_2Dtypescript_2Ddefinitions.GridEntityType
|
|
20058
20055
|
local GridRoom = ____isaac_2Dtypescript_2Ddefinitions.GridRoom
|
|
20059
20056
|
local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
|
|
20060
20057
|
local ____cachedClasses = require("src.core.cachedClasses")
|
|
@@ -20095,19 +20092,26 @@ function ____exports.getDoorSlotEnterPositionOffset(self, doorSlot)
|
|
|
20095
20092
|
local oppositeVector = vector * -1
|
|
20096
20093
|
return oppositeVector * DISTANCE_OF_GRID_TILE
|
|
20097
20094
|
end
|
|
20095
|
+
function ____exports.getDoorSlotsForRoomShape(self, roomShape)
|
|
20096
|
+
return ROOM_SHAPE_TO_DOOR_SLOTS[roomShape]
|
|
20097
|
+
end
|
|
20098
20098
|
function ____exports.getDoors(self, ...)
|
|
20099
20099
|
local roomTypes = {...}
|
|
20100
20100
|
local room = game:GetRoom()
|
|
20101
|
-
local
|
|
20102
|
-
local
|
|
20101
|
+
local roomShape = room:GetRoomShape()
|
|
20102
|
+
local possibleDoorSlots = ____exports.getDoorSlotsForRoomShape(nil, roomShape)
|
|
20103
20103
|
local doors = {}
|
|
20104
|
-
for ____, doorSlot in
|
|
20104
|
+
for ____, doorSlot in __TS__Iterator(possibleDoorSlots) do
|
|
20105
20105
|
do
|
|
20106
20106
|
local door = room:GetDoor(doorSlot)
|
|
20107
20107
|
if door == nil then
|
|
20108
20108
|
goto __continue25
|
|
20109
20109
|
end
|
|
20110
|
-
|
|
20110
|
+
local gridEntityType = door:GetType()
|
|
20111
|
+
if gridEntityType ~= GridEntityType.DOOR then
|
|
20112
|
+
goto __continue25
|
|
20113
|
+
end
|
|
20114
|
+
if #roomTypes == 0 or __TS__ArrayIncludes(roomTypes, door.TargetRoomType) then
|
|
20111
20115
|
doors[#doors + 1] = door
|
|
20112
20116
|
end
|
|
20113
20117
|
end
|
|
@@ -20218,9 +20222,6 @@ function ____exports.getDoorSlotEnterPosition(self, doorSlot)
|
|
|
20218
20222
|
local offset = ____exports.getDoorSlotEnterPositionOffset(nil, doorSlot)
|
|
20219
20223
|
return position + offset
|
|
20220
20224
|
end
|
|
20221
|
-
function ____exports.getDoorSlotsForRoomShape(self, roomShape)
|
|
20222
|
-
return ROOM_SHAPE_TO_DOOR_SLOTS[roomShape]
|
|
20223
|
-
end
|
|
20224
20225
|
function ____exports.getDoorsToRoomIndex(self, ...)
|
|
20225
20226
|
local roomGridIndex = {...}
|
|
20226
20227
|
local roomGridIndexesSet = __TS__New(Set, roomGridIndex)
|
package/dist/lualib_bundle.lua
CHANGED
|
@@ -1384,10 +1384,6 @@ local function __TS__MathSign(val)
|
|
|
1384
1384
|
return 0
|
|
1385
1385
|
end
|
|
1386
1386
|
|
|
1387
|
-
local function __TS__Modulo50(a, b)
|
|
1388
|
-
return a - math.floor(a / b) * b
|
|
1389
|
-
end
|
|
1390
|
-
|
|
1391
1387
|
local function __TS__Number(value)
|
|
1392
1388
|
local valueType = type(value)
|
|
1393
1389
|
if valueType == "number" then
|
|
@@ -2476,7 +2472,6 @@ return {
|
|
|
2476
2472
|
__TS__MathAtan2 = __TS__MathAtan2,
|
|
2477
2473
|
__TS__MathModf = __TS__MathModf,
|
|
2478
2474
|
__TS__MathSign = __TS__MathSign,
|
|
2479
|
-
__TS__Modulo50 = __TS__Modulo50,
|
|
2480
2475
|
__TS__New = __TS__New,
|
|
2481
2476
|
__TS__Number = __TS__Number,
|
|
2482
2477
|
__TS__NumberIsFinite = __TS__NumberIsFinite,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doors.d.ts","sourceRoot":"","sources":["../../../src/functions/doors.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,QAAQ,EACR,YAAY,
|
|
1
|
+
{"version":3,"file":"doors.d.ts","sourceRoot":"","sources":["../../../src/functions/doors.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,QAAQ,EACR,YAAY,EAKZ,SAAS,EACT,QAAQ,EACT,MAAM,8BAA8B,CAAC;AAmBtC,wBAAgB,aAAa,IAAI,IAAI,CAIpC;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAKxD;AAED,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,YAAY,GAAG,QAAQ,CAG3E;AAED,wBAAgB,wBAAwB,CACtC,aAAa,EAAE,QAAQ,CAAC,YAAY,CAAC,GACpC,QAAQ,EAAE,CAWZ;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAEjE;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,QAAQ,GAAG,YAAY,CAEvE;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EACL,QAAQ,EAAE,GACV,SAAS,QAAQ,EAAE,GACnB,GAAG,CAAC,QAAQ,CAAC,GACb,WAAW,CAAC,QAAQ,CAAC,GACxB,QAAQ,CAAC,YAAY,CAAC,CASxB;AAED,wBAAgB,gBAAgB,IAAI,cAAc,GAAG,SAAS,CAG7D;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,IAAI,cAAc,GAAG,SAAS,CAG5D;AAED,wBAAgB,gBAAgB,IAAI,cAAc,GAAG,SAAS,CAG7D;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,I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AE,cAAc,GAAG,IAAI,CAGrD;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,KAAK,EAAE,cAAc,EAAE,GAAG,IAAI,CAI5D"}
|
|
@@ -3,15 +3,17 @@ local Set = ____lualib.Set
|
|
|
3
3
|
local __TS__Spread = ____lualib.__TS__Spread
|
|
4
4
|
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
5
5
|
local __TS__ArrayFind = ____lualib.__TS__ArrayFind
|
|
6
|
+
local __TS__ArrayIncludes = ____lualib.__TS__ArrayIncludes
|
|
7
|
+
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
6
8
|
local __TS__New = ____lualib.__TS__New
|
|
7
9
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
8
|
-
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
9
10
|
local ____exports = {}
|
|
10
11
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
11
12
|
local DoorSlot = ____isaac_2Dtypescript_2Ddefinitions.DoorSlot
|
|
12
13
|
local DoorSlotFlag = ____isaac_2Dtypescript_2Ddefinitions.DoorSlotFlag
|
|
13
14
|
local DoorState = ____isaac_2Dtypescript_2Ddefinitions.DoorState
|
|
14
15
|
local DoorVariant = ____isaac_2Dtypescript_2Ddefinitions.DoorVariant
|
|
16
|
+
local GridEntityType = ____isaac_2Dtypescript_2Ddefinitions.GridEntityType
|
|
15
17
|
local GridRoom = ____isaac_2Dtypescript_2Ddefinitions.GridRoom
|
|
16
18
|
local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
|
|
17
19
|
local ____cachedClasses = require("src.core.cachedClasses")
|
|
@@ -57,22 +59,30 @@ function ____exports.getDoorSlotEnterPositionOffset(self, doorSlot)
|
|
|
57
59
|
local oppositeVector = vector * -1
|
|
58
60
|
return oppositeVector * DISTANCE_OF_GRID_TILE
|
|
59
61
|
end
|
|
62
|
+
--- Helper function to get the possible door slots that can exist for a given room shape.
|
|
63
|
+
function ____exports.getDoorSlotsForRoomShape(self, roomShape)
|
|
64
|
+
return ROOM_SHAPE_TO_DOOR_SLOTS[roomShape]
|
|
65
|
+
end
|
|
60
66
|
--- Helper function to get all of the doors in the room. By default, it will return every door. You
|
|
61
67
|
-- can optionally specify one or more room types to return only the doors that match the specified
|
|
62
68
|
-- room types.
|
|
63
69
|
function ____exports.getDoors(self, ...)
|
|
64
70
|
local roomTypes = {...}
|
|
65
71
|
local room = game:GetRoom()
|
|
66
|
-
local
|
|
67
|
-
local
|
|
72
|
+
local roomShape = room:GetRoomShape()
|
|
73
|
+
local possibleDoorSlots = ____exports.getDoorSlotsForRoomShape(nil, roomShape)
|
|
68
74
|
local doors = {}
|
|
69
|
-
for ____, doorSlot in
|
|
75
|
+
for ____, doorSlot in __TS__Iterator(possibleDoorSlots) do
|
|
70
76
|
do
|
|
71
77
|
local door = room:GetDoor(doorSlot)
|
|
72
78
|
if door == nil then
|
|
73
79
|
goto __continue25
|
|
74
80
|
end
|
|
75
|
-
|
|
81
|
+
local gridEntityType = door:GetType()
|
|
82
|
+
if gridEntityType ~= GridEntityType.DOOR then
|
|
83
|
+
goto __continue25
|
|
84
|
+
end
|
|
85
|
+
if #roomTypes == 0 or __TS__ArrayIncludes(roomTypes, door.TargetRoomType) then
|
|
76
86
|
doors[#doors + 1] = door
|
|
77
87
|
end
|
|
78
88
|
end
|
|
@@ -213,10 +223,6 @@ function ____exports.getDoorSlotEnterPosition(self, doorSlot)
|
|
|
213
223
|
local offset = ____exports.getDoorSlotEnterPositionOffset(nil, doorSlot)
|
|
214
224
|
return position + offset
|
|
215
225
|
end
|
|
216
|
-
--- Helper function to get the possible door slots that can exist for a given room shape.
|
|
217
|
-
function ____exports.getDoorSlotsForRoomShape(self, roomShape)
|
|
218
|
-
return ROOM_SHAPE_TO_DOOR_SLOTS[roomShape]
|
|
219
|
-
end
|
|
220
226
|
--- Helper function to get all of the doors in the room that lead to the provided room index.
|
|
221
227
|
--
|
|
222
228
|
-- This function is variadic, meaning that you can specify N arguments to return all of the doors
|
package/package.json
CHANGED
package/src/functions/doors.ts
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
DoorSlotFlag,
|
|
5
5
|
DoorState,
|
|
6
6
|
DoorVariant,
|
|
7
|
+
GridEntityType,
|
|
7
8
|
GridRoom,
|
|
8
9
|
RoomShape,
|
|
9
10
|
RoomType,
|
|
@@ -184,17 +185,23 @@ export function getDoorSlotsForRoomShape(
|
|
|
184
185
|
*/
|
|
185
186
|
export function getDoors(...roomTypes: RoomType[]): GridEntityDoor[] {
|
|
186
187
|
const room = game.GetRoom();
|
|
187
|
-
const
|
|
188
|
+
const roomShape = room.GetRoomShape();
|
|
189
|
+
const possibleDoorSlots = getDoorSlotsForRoomShape(roomShape);
|
|
188
190
|
|
|
189
|
-
const doorSlots = getEnumValues(DoorSlot);
|
|
190
191
|
const doors: GridEntityDoor[] = [];
|
|
191
|
-
for (const doorSlot of
|
|
192
|
+
for (const doorSlot of possibleDoorSlots) {
|
|
192
193
|
const door = room.GetDoor(doorSlot);
|
|
193
194
|
if (door === undefined) {
|
|
194
195
|
continue;
|
|
195
196
|
}
|
|
196
197
|
|
|
197
|
-
|
|
198
|
+
// In Repentance, sometimes doors won't be doors for some reason.
|
|
199
|
+
const gridEntityType = door.GetType();
|
|
200
|
+
if (gridEntityType !== GridEntityType.DOOR) {
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if (roomTypes.length === 0 || roomTypes.includes(door.TargetRoomType)) {
|
|
198
205
|
doors.push(door);
|
|
199
206
|
}
|
|
200
207
|
}
|