isaacscript-common 2.0.5 → 2.0.6
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/functions/doors.d.ts +16 -0
- package/dist/functions/doors.lua +18 -5
- package/package.json +2 -2
|
@@ -14,6 +14,22 @@ export declare function getDevilRoomDoor(): GridEntityDoor | undefined;
|
|
|
14
14
|
* lowest slot number.
|
|
15
15
|
*/
|
|
16
16
|
export declare function getDevilRoomOrAngelRoomDoor(): GridEntityDoor | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Helper function to get the position that a player will enter a room at.
|
|
19
|
+
*
|
|
20
|
+
* When players enter a room, they do not appear exactly on the location of the door, because then
|
|
21
|
+
* they would immediately collide with the loading zone. Instead, they are offset by a certain
|
|
22
|
+
* amount of units.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getDoorEnterPosition(door: GridEntityDoor): Vector;
|
|
25
|
+
/**
|
|
26
|
+
* Helper function to help calculate the position that a player will enter a room at.
|
|
27
|
+
*
|
|
28
|
+
* When players enter a room, they do not appear exactly on the location of the door, because then
|
|
29
|
+
* they would immediately collide with the loading zone. Instead, they are offset by a certain
|
|
30
|
+
* amount of units.
|
|
31
|
+
*/
|
|
32
|
+
export declare function getDoorEnterPositionOffset(doorSlot: DoorSlot): Vector;
|
|
17
33
|
/** Helper function to get the possible door slots that can exist for a given room shape. */
|
|
18
34
|
export declare function getDoorSlotsForRoomShape(roomShape: RoomShape): ReadonlySet<DoorSlot>;
|
|
19
35
|
/**
|
package/dist/functions/doors.lua
CHANGED
|
@@ -4,6 +4,7 @@ local __TS__New = ____lualib.__TS__New
|
|
|
4
4
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
5
5
|
local __TS__ArrayFind = ____lualib.__TS__ArrayFind
|
|
6
6
|
local ____exports = {}
|
|
7
|
+
local ROOM_ENTRY_OFFSET_FROM_DOOR
|
|
7
8
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
8
9
|
local DoorSlot = ____isaac_2Dtypescript_2Ddefinitions.DoorSlot
|
|
9
10
|
local DoorState = ____isaac_2Dtypescript_2Ddefinitions.DoorState
|
|
@@ -19,8 +20,18 @@ local ____doorSlotToDirection = require("objects.doorSlotToDirection")
|
|
|
19
20
|
local DOOR_SLOT_TO_DIRECTION = ____doorSlotToDirection.DOOR_SLOT_TO_DIRECTION
|
|
20
21
|
local ____roomShapeToDoorSlots = require("objects.roomShapeToDoorSlots")
|
|
21
22
|
local ROOM_SHAPE_TO_DOOR_SLOTS = ____roomShapeToDoorSlots.ROOM_SHAPE_TO_DOOR_SLOTS
|
|
23
|
+
local ____direction = require("functions.direction")
|
|
24
|
+
local directionToVector = ____direction.directionToVector
|
|
22
25
|
local ____enums = require("functions.enums")
|
|
23
26
|
local getEnumValues = ____enums.getEnumValues
|
|
27
|
+
function ____exports.doorSlotToDirection(self, doorSlot)
|
|
28
|
+
return DOOR_SLOT_TO_DIRECTION[doorSlot]
|
|
29
|
+
end
|
|
30
|
+
function ____exports.getDoorEnterPositionOffset(self, doorSlot)
|
|
31
|
+
local direction = ____exports.doorSlotToDirection(nil, doorSlot)
|
|
32
|
+
local vector = directionToVector(nil, direction)
|
|
33
|
+
return vector * ROOM_ENTRY_OFFSET_FROM_DOOR
|
|
34
|
+
end
|
|
24
35
|
function ____exports.getDoors(self, ...)
|
|
25
36
|
local roomTypes = {...}
|
|
26
37
|
local room = game:GetRoom()
|
|
@@ -31,13 +42,13 @@ function ____exports.getDoors(self, ...)
|
|
|
31
42
|
do
|
|
32
43
|
local door = room:GetDoor(doorSlot)
|
|
33
44
|
if door == nil then
|
|
34
|
-
goto
|
|
45
|
+
goto __continue15
|
|
35
46
|
end
|
|
36
47
|
if roomTypesSet.size == 0 or roomTypesSet:has(door.TargetRoomType) then
|
|
37
48
|
doors[#doors + 1] = door
|
|
38
49
|
end
|
|
39
50
|
end
|
|
40
|
-
::
|
|
51
|
+
::__continue15::
|
|
41
52
|
end
|
|
42
53
|
return doors
|
|
43
54
|
end
|
|
@@ -59,6 +70,7 @@ function ____exports.removeDoors(self, ...)
|
|
|
59
70
|
____exports.removeDoor(nil, door)
|
|
60
71
|
end
|
|
61
72
|
end
|
|
73
|
+
ROOM_ENTRY_OFFSET_FROM_DOOR = 40
|
|
62
74
|
function ____exports.closeAllDoors(self)
|
|
63
75
|
for ____, door in ipairs(____exports.getDoors(nil)) do
|
|
64
76
|
door:Close(true)
|
|
@@ -73,9 +85,6 @@ function ____exports.doorSlotFlagToDoorSlot(self, doorSlotFlag)
|
|
|
73
85
|
local doorSlot = DOOR_SLOT_FLAG_TO_DOOR_SLOT[doorSlotFlag]
|
|
74
86
|
return doorSlot == nil and DEFAULT_DOOR_SLOT or doorSlot
|
|
75
87
|
end
|
|
76
|
-
function ____exports.doorSlotToDirection(self, doorSlot)
|
|
77
|
-
return DOOR_SLOT_TO_DIRECTION[doorSlot]
|
|
78
|
-
end
|
|
79
88
|
function ____exports.getAngelRoomDoor(self)
|
|
80
89
|
local angelRoomDoors = ____exports.getDoors(nil, RoomType.ANGEL)
|
|
81
90
|
local ____temp_0
|
|
@@ -106,6 +115,10 @@ function ____exports.getDevilRoomOrAngelRoomDoor(self)
|
|
|
106
115
|
end
|
|
107
116
|
return ____temp_2
|
|
108
117
|
end
|
|
118
|
+
function ____exports.getDoorEnterPosition(self, door)
|
|
119
|
+
local offset = ____exports.getDoorEnterPositionOffset(nil, door.Slot)
|
|
120
|
+
return door.Position + offset
|
|
121
|
+
end
|
|
109
122
|
function ____exports.getDoorSlotsForRoomShape(self, roomShape)
|
|
110
123
|
local doorSlots = ROOM_SHAPE_TO_DOOR_SLOTS[roomShape]
|
|
111
124
|
return doorSlots == nil and __TS__New(Set) or doorSlots
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"description": "Helper functions for IsaacScript mods",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dist/**/*.d.ts"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"isaac-typescript-definitions": "^2.0.
|
|
28
|
+
"isaac-typescript-definitions": "^2.0.10"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"isaacscript-lint": "^1.0.140",
|