isaacscript-common 1.2.275 → 1.2.276
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.
|
@@ -29,6 +29,8 @@ export declare function getDoors(...roomTypes: RoomType[]): GridEntityDoor[];
|
|
|
29
29
|
*/
|
|
30
30
|
export declare function getDoorsToRoomIndex(...roomGridIndex: int[]): GridEntityDoor[];
|
|
31
31
|
export declare function getRepentanceDoor(): GridEntityDoor | undefined;
|
|
32
|
+
/** Helper function to find unused door slots in the room that can be used to make custom doors. */
|
|
33
|
+
export declare function getUnusedDoorSlots(): DoorSlot[];
|
|
32
34
|
export declare function isAngelRoomDoor(door: GridEntityDoor): boolean;
|
|
33
35
|
export declare function isDevilRoomDoor(door: GridEntityDoor): boolean;
|
|
34
36
|
/** Helper function to see if a door slot could exist for a given room shape. */
|
package/dist/functions/doors.lua
CHANGED
|
@@ -12,6 +12,8 @@ local ____doorSlotToDirection = require("objects.doorSlotToDirection")
|
|
|
12
12
|
local DOOR_SLOT_TO_DIRECTION = ____doorSlotToDirection.DOOR_SLOT_TO_DIRECTION
|
|
13
13
|
local ____roomShapeToDoorSlots = require("objects.roomShapeToDoorSlots")
|
|
14
14
|
local ROOM_SHAPE_TO_DOOR_SLOTS = ____roomShapeToDoorSlots.ROOM_SHAPE_TO_DOOR_SLOTS
|
|
15
|
+
local ____utils = require("functions.utils")
|
|
16
|
+
local getEnumValues = ____utils.getEnumValues
|
|
15
17
|
function ____exports.getDoors(self, ...)
|
|
16
18
|
local roomTypes = {...}
|
|
17
19
|
local room = game:GetRoom()
|
|
@@ -116,6 +118,14 @@ function ____exports.getRepentanceDoor(self)
|
|
|
116
118
|
function(____, door) return ____exports.isRepentanceDoor(nil, door) end
|
|
117
119
|
)
|
|
118
120
|
end
|
|
121
|
+
function ____exports.getUnusedDoorSlots(self)
|
|
122
|
+
local room = game:GetRoom()
|
|
123
|
+
local doorSlots = getEnumValues(nil, DoorSlot)
|
|
124
|
+
return __TS__ArrayFilter(
|
|
125
|
+
doorSlots,
|
|
126
|
+
function(____, doorSlot) return room:IsDoorSlotAllowed(doorSlot) and room:GetDoor(doorSlot) == nil end
|
|
127
|
+
)
|
|
128
|
+
end
|
|
119
129
|
function ____exports.isAngelRoomDoor(self, door)
|
|
120
130
|
return door.TargetRoomType == RoomType.ROOM_ANGEL
|
|
121
131
|
end
|
|
@@ -10,13 +10,13 @@ function ____exports.giveTrinketsBack(self, player, trinketSituation)
|
|
|
10
10
|
if trinketSituation == nil then
|
|
11
11
|
return
|
|
12
12
|
end
|
|
13
|
-
local
|
|
14
|
-
local
|
|
15
|
-
if
|
|
16
|
-
player:TryRemoveTrinket(
|
|
13
|
+
local trinketType1 = player:GetTrinket(0)
|
|
14
|
+
local trinketType2 = player:GetTrinket(1)
|
|
15
|
+
if trinketType1 ~= TrinketType.TRINKET_NULL then
|
|
16
|
+
player:TryRemoveTrinket(trinketType1)
|
|
17
17
|
end
|
|
18
|
-
if
|
|
19
|
-
player:TryRemoveTrinket(
|
|
18
|
+
if trinketType2 ~= TrinketType.TRINKET_NULL then
|
|
19
|
+
player:TryRemoveTrinket(trinketType2)
|
|
20
20
|
end
|
|
21
21
|
____repeat(
|
|
22
22
|
nil,
|
|
@@ -26,47 +26,47 @@ function ____exports.giveTrinketsBack(self, player, trinketSituation)
|
|
|
26
26
|
useActiveItemTemp(nil, player, CollectibleType.COLLECTIBLE_SMELTER)
|
|
27
27
|
end
|
|
28
28
|
)
|
|
29
|
-
if trinketSituation.
|
|
30
|
-
player:AddTrinket(trinketSituation.
|
|
29
|
+
if trinketSituation.trinketType1 ~= TrinketType.TRINKET_NULL then
|
|
30
|
+
player:AddTrinket(trinketSituation.trinketType1, false)
|
|
31
31
|
end
|
|
32
|
-
if trinketSituation.
|
|
33
|
-
player:AddTrinket(trinketSituation.
|
|
32
|
+
if trinketSituation.trinketType2 ~= TrinketType.TRINKET_NULL then
|
|
33
|
+
player:AddTrinket(trinketSituation.trinketType2, false)
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
36
|
function ____exports.temporarilyRemoveTrinket(self, player, trinketType)
|
|
37
37
|
if not player:HasTrinket(trinketType) then
|
|
38
38
|
return nil
|
|
39
39
|
end
|
|
40
|
-
local
|
|
41
|
-
local
|
|
40
|
+
local trinketType1 = player:GetTrinket(0)
|
|
41
|
+
local trinketType2 = player:GetTrinket(1)
|
|
42
42
|
local numTrinkets = 0
|
|
43
43
|
while player:HasTrinket(trinketType) do
|
|
44
44
|
player:TryRemoveTrinket(trinketType)
|
|
45
45
|
numTrinkets = numTrinkets + 1
|
|
46
46
|
end
|
|
47
47
|
local numSmeltedTrinkets = numTrinkets
|
|
48
|
-
local trinketWasInSlot1 =
|
|
48
|
+
local trinketWasInSlot1 = trinketType1 == trinketType or trinketType1 + TRINKET_GOLDEN_FLAG == trinketType
|
|
49
49
|
if trinketWasInSlot1 then
|
|
50
50
|
numSmeltedTrinkets = numSmeltedTrinkets - 1
|
|
51
51
|
end
|
|
52
|
-
local trinketWasInSlot2 =
|
|
52
|
+
local trinketWasInSlot2 = trinketType2 == trinketType or trinketType2 + TRINKET_GOLDEN_FLAG == trinketType
|
|
53
53
|
if trinketWasInSlot2 then
|
|
54
54
|
numSmeltedTrinkets = numSmeltedTrinkets - 1
|
|
55
55
|
end
|
|
56
|
-
return {trinketTypeRemoved = trinketType,
|
|
56
|
+
return {trinketTypeRemoved = trinketType, trinketType1 = trinketType1, trinketType2 = trinketType2, numSmeltedTrinkets = numSmeltedTrinkets}
|
|
57
57
|
end
|
|
58
58
|
function ____exports.temporarilyRemoveTrinkets(self, player)
|
|
59
|
-
local
|
|
60
|
-
local
|
|
61
|
-
if
|
|
59
|
+
local trinketType1 = player:GetTrinket(0)
|
|
60
|
+
local trinketType2 = player:GetTrinket(1)
|
|
61
|
+
if trinketType1 == TrinketType.TRINKET_NULL and trinketType2 == TrinketType.TRINKET_NULL then
|
|
62
62
|
return nil
|
|
63
63
|
end
|
|
64
|
-
if
|
|
65
|
-
player:TryRemoveTrinket(
|
|
64
|
+
if trinketType1 ~= TrinketType.TRINKET_NULL then
|
|
65
|
+
player:TryRemoveTrinket(trinketType1)
|
|
66
66
|
end
|
|
67
|
-
if
|
|
68
|
-
player:TryRemoveTrinket(
|
|
67
|
+
if trinketType2 ~= TrinketType.TRINKET_NULL then
|
|
68
|
+
player:TryRemoveTrinket(trinketType2)
|
|
69
69
|
end
|
|
70
|
-
return {trinketTypeRemoved = TrinketType.TRINKET_NULL,
|
|
70
|
+
return {trinketTypeRemoved = TrinketType.TRINKET_NULL, trinketType1 = trinketType1, trinketType2 = trinketType2, numSmeltedTrinkets = 0}
|
|
71
71
|
end
|
|
72
72
|
return ____exports
|
|
@@ -28,16 +28,16 @@ function ____exports.getMaxTrinketType(self)
|
|
|
28
28
|
end
|
|
29
29
|
function ____exports.getOpenTrinketSlot(self, player)
|
|
30
30
|
local maxTrinkets = player:GetMaxTrinkets()
|
|
31
|
-
local
|
|
32
|
-
local
|
|
31
|
+
local trinketType1 = player:GetTrinket(0)
|
|
32
|
+
local trinketType2 = player:GetTrinket(1)
|
|
33
33
|
if maxTrinkets == 1 then
|
|
34
|
-
return
|
|
34
|
+
return trinketType1 == TrinketType.TRINKET_NULL and 0 or nil
|
|
35
35
|
end
|
|
36
36
|
if maxTrinkets == 2 then
|
|
37
|
-
if
|
|
37
|
+
if trinketType1 == TrinketType.TRINKET_NULL then
|
|
38
38
|
return 0
|
|
39
39
|
end
|
|
40
|
-
return
|
|
40
|
+
return trinketType2 == TrinketType.TRINKET_NULL and 1 or nil
|
|
41
41
|
end
|
|
42
42
|
return error("The player has an unknown number of trinket slots: " .. tostring(maxTrinkets))
|
|
43
43
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
export interface TrinketSituation {
|
|
3
3
|
trinketTypeRemoved: TrinketType | int;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
trinketType1: TrinketType | int;
|
|
5
|
+
trinketType2: TrinketType | int;
|
|
6
6
|
numSmeltedTrinkets: int;
|
|
7
7
|
}
|