isaacscript-common 16.1.3 → 16.1.5
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.5
|
|
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,
|
|
@@ -20047,8 +20042,8 @@ local __TS__Spread = ____lualib.__TS__Spread
|
|
|
20047
20042
|
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
20048
20043
|
local __TS__ArrayFind = ____lualib.__TS__ArrayFind
|
|
20049
20044
|
local __TS__New = ____lualib.__TS__New
|
|
20050
|
-
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
20051
20045
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
20046
|
+
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
20052
20047
|
local ____exports = {}
|
|
20053
20048
|
local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
|
|
20054
20049
|
local DoorSlot = ____isaac_2Dtypescript_2Ddefinitions.DoorSlot
|
|
@@ -20096,13 +20091,17 @@ function ____exports.getDoorSlotEnterPositionOffset(self, doorSlot)
|
|
|
20096
20091
|
local oppositeVector = vector * -1
|
|
20097
20092
|
return oppositeVector * DISTANCE_OF_GRID_TILE
|
|
20098
20093
|
end
|
|
20094
|
+
function ____exports.getDoorSlotsForRoomShape(self, roomShape)
|
|
20095
|
+
return ROOM_SHAPE_TO_DOOR_SLOTS[roomShape]
|
|
20096
|
+
end
|
|
20099
20097
|
function ____exports.getDoors(self, ...)
|
|
20100
20098
|
local roomTypes = {...}
|
|
20101
20099
|
local room = game:GetRoom()
|
|
20100
|
+
local roomShape = room:GetRoomShape()
|
|
20102
20101
|
local roomTypesSet = __TS__New(Set, roomTypes)
|
|
20103
|
-
local
|
|
20102
|
+
local possibleDoorSlots = ____exports.getDoorSlotsForRoomShape(nil, roomShape)
|
|
20104
20103
|
local doors = {}
|
|
20105
|
-
for ____, doorSlot in
|
|
20104
|
+
for ____, doorSlot in __TS__Iterator(possibleDoorSlots) do
|
|
20106
20105
|
do
|
|
20107
20106
|
local door = room:GetDoor(doorSlot)
|
|
20108
20107
|
if door == nil then
|
|
@@ -20223,9 +20222,6 @@ function ____exports.getDoorSlotEnterPosition(self, doorSlot)
|
|
|
20223
20222
|
local offset = ____exports.getDoorSlotEnterPositionOffset(nil, doorSlot)
|
|
20224
20223
|
return position + offset
|
|
20225
20224
|
end
|
|
20226
|
-
function ____exports.getDoorSlotsForRoomShape(self, roomShape)
|
|
20227
|
-
return ROOM_SHAPE_TO_DOOR_SLOTS[roomShape]
|
|
20228
|
-
end
|
|
20229
20225
|
function ____exports.getDoorsToRoomIndex(self, ...)
|
|
20230
20226
|
local roomGridIndex = {...}
|
|
20231
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,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,w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AED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAU/D;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAKpE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAE9D;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAM9D;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAUnD;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI,IAAI,CAMnC;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAKvD;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,GAAG,SAAS,EAAE,QAAQ,EAAE,GAAG,GAAG,CAK5D;AAED,+CAA+C;AAC/C,wBAAgB,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAGrD;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,KAAK,EAAE,cAAc,EAAE,GAAG,IAAI,CAI5D"}
|
|
@@ -4,8 +4,8 @@ local __TS__Spread = ____lualib.__TS__Spread
|
|
|
4
4
|
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
5
5
|
local __TS__ArrayFind = ____lualib.__TS__ArrayFind
|
|
6
6
|
local __TS__New = ____lualib.__TS__New
|
|
7
|
-
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
8
7
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
8
|
+
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
9
9
|
local ____exports = {}
|
|
10
10
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
11
11
|
local DoorSlot = ____isaac_2Dtypescript_2Ddefinitions.DoorSlot
|
|
@@ -58,16 +58,21 @@ function ____exports.getDoorSlotEnterPositionOffset(self, doorSlot)
|
|
|
58
58
|
local oppositeVector = vector * -1
|
|
59
59
|
return oppositeVector * DISTANCE_OF_GRID_TILE
|
|
60
60
|
end
|
|
61
|
+
--- Helper function to get the possible door slots that can exist for a given room shape.
|
|
62
|
+
function ____exports.getDoorSlotsForRoomShape(self, roomShape)
|
|
63
|
+
return ROOM_SHAPE_TO_DOOR_SLOTS[roomShape]
|
|
64
|
+
end
|
|
61
65
|
--- Helper function to get all of the doors in the room. By default, it will return every door. You
|
|
62
66
|
-- can optionally specify one or more room types to return only the doors that match the specified
|
|
63
67
|
-- room types.
|
|
64
68
|
function ____exports.getDoors(self, ...)
|
|
65
69
|
local roomTypes = {...}
|
|
66
70
|
local room = game:GetRoom()
|
|
71
|
+
local roomShape = room:GetRoomShape()
|
|
67
72
|
local roomTypesSet = __TS__New(Set, roomTypes)
|
|
68
|
-
local
|
|
73
|
+
local possibleDoorSlots = ____exports.getDoorSlotsForRoomShape(nil, roomShape)
|
|
69
74
|
local doors = {}
|
|
70
|
-
for ____, doorSlot in
|
|
75
|
+
for ____, doorSlot in __TS__Iterator(possibleDoorSlots) do
|
|
71
76
|
do
|
|
72
77
|
local door = room:GetDoor(doorSlot)
|
|
73
78
|
if door == nil then
|
|
@@ -218,10 +223,6 @@ function ____exports.getDoorSlotEnterPosition(self, doorSlot)
|
|
|
218
223
|
local offset = ____exports.getDoorSlotEnterPositionOffset(nil, doorSlot)
|
|
219
224
|
return position + offset
|
|
220
225
|
end
|
|
221
|
-
--- Helper function to get the possible door slots that can exist for a given room shape.
|
|
222
|
-
function ____exports.getDoorSlotsForRoomShape(self, roomShape)
|
|
223
|
-
return ROOM_SHAPE_TO_DOOR_SLOTS[roomShape]
|
|
224
|
-
end
|
|
225
226
|
--- Helper function to get all of the doors in the room that lead to the provided room index.
|
|
226
227
|
--
|
|
227
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
|
@@ -185,11 +185,15 @@ export function getDoorSlotsForRoomShape(
|
|
|
185
185
|
*/
|
|
186
186
|
export function getDoors(...roomTypes: RoomType[]): GridEntityDoor[] {
|
|
187
187
|
const room = game.GetRoom();
|
|
188
|
+
const roomShape = room.GetRoomShape();
|
|
188
189
|
const roomTypesSet = new Set(roomTypes);
|
|
189
190
|
|
|
190
|
-
|
|
191
|
+
// We iterate over the possible door slots for this room shape instead of all door slots in order
|
|
192
|
+
// to prevent crashes from accessing invalid memory.
|
|
193
|
+
const possibleDoorSlots = getDoorSlotsForRoomShape(roomShape);
|
|
194
|
+
|
|
191
195
|
const doors: GridEntityDoor[] = [];
|
|
192
|
-
for (const doorSlot of
|
|
196
|
+
for (const doorSlot of possibleDoorSlots) {
|
|
193
197
|
const door = room.GetDoor(doorSlot);
|
|
194
198
|
if (door === undefined) {
|
|
195
199
|
continue;
|