isaacscript-common 2.0.3 → 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/constantsMax.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PlayerType } from "isaac-typescript-definitions";
|
|
1
|
+
import { PillColor, PlayerType } from "isaac-typescript-definitions";
|
|
2
2
|
export declare const NUM_CARDS: number;
|
|
3
3
|
export declare const MAX_CARD: number;
|
|
4
4
|
export declare const NUM_VANILLA_CARDS: number;
|
|
@@ -16,3 +16,4 @@ export declare const MAX_TRINKET_TYPE: number;
|
|
|
16
16
|
export declare const NUM_VANILLA_TRINKET_TYPES: number;
|
|
17
17
|
export declare const MAX_VANILLA_TRINKET_TYPE: number;
|
|
18
18
|
export declare const MAX_VANILLA_PLAYER_TYPE: PlayerType;
|
|
19
|
+
export declare const MAX_NORMAL_PILL_COLOR = PillColor.WHITE_YELLOW;
|
package/dist/constantsMax.lua
CHANGED
|
@@ -2,6 +2,7 @@ local ____exports = {}
|
|
|
2
2
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
3
3
|
local Card = ____isaac_2Dtypescript_2Ddefinitions.Card
|
|
4
4
|
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
|
|
5
|
+
local PillColor = ____isaac_2Dtypescript_2Ddefinitions.PillColor
|
|
5
6
|
local PillEffect = ____isaac_2Dtypescript_2Ddefinitions.PillEffect
|
|
6
7
|
local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
|
|
7
8
|
local TrinketType = ____isaac_2Dtypescript_2Ddefinitions.TrinketType
|
|
@@ -27,4 +28,5 @@ ____exports.MAX_TRINKET_TYPE = ____exports.NUM_COLLECTIBLE_TYPES - 1
|
|
|
27
28
|
____exports.NUM_VANILLA_TRINKET_TYPES = getEnumLength(nil, TrinketType) - 1
|
|
28
29
|
____exports.MAX_VANILLA_TRINKET_TYPE = ____exports.NUM_VANILLA_COLLECTIBLE_TYPES
|
|
29
30
|
____exports.MAX_VANILLA_PLAYER_TYPE = getLastEnumValue(nil, PlayerType)
|
|
31
|
+
____exports.MAX_NORMAL_PILL_COLOR = PillColor.WHITE_YELLOW
|
|
30
32
|
return ____exports
|
|
@@ -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
|
|
@@ -6,6 +6,14 @@ import { ItemConfigPillEffectClass, ItemConfigPillEffectType, PillColor, PillEff
|
|
|
6
6
|
* corresponds to the horse pill color for blue/blue.
|
|
7
7
|
*/
|
|
8
8
|
export declare function getHorsePillColor(pillColor: PillColor): PillColor;
|
|
9
|
+
/**
|
|
10
|
+
* Helper function to get the corresponding normal pill color from a horse pill color.
|
|
11
|
+
*
|
|
12
|
+
* For example, passing 2049 would result in `PillColor.BLUE_BLUE`.
|
|
13
|
+
*
|
|
14
|
+
* If called with a non-horse pill color, this function will return back the same color.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getNormalPillColorFromHorse(pillColor: PillColor): PillColor;
|
|
9
17
|
/**
|
|
10
18
|
* Helper function to get a pill effect class from a PillEffect enum value. In this context, the
|
|
11
19
|
* class is equal to the numerical prefix in the "class" tag in the "pocketitems.xml" file. Use the
|
package/dist/functions/pills.lua
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
local ____exports = {}
|
|
2
|
+
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
3
|
+
local PillColor = ____isaac_2Dtypescript_2Ddefinitions.PillColor
|
|
2
4
|
local ____cachedClasses = require("cachedClasses")
|
|
3
5
|
local itemConfig = ____cachedClasses.itemConfig
|
|
4
6
|
local ____pillEffectClasses = require("objects.pillEffectClasses")
|
|
@@ -17,6 +19,10 @@ local HORSE_PILL_ADJUSTMENT = 2048
|
|
|
17
19
|
function ____exports.getHorsePillColor(self, pillColor)
|
|
18
20
|
return pillColor + HORSE_PILL_ADJUSTMENT
|
|
19
21
|
end
|
|
22
|
+
function ____exports.getNormalPillColorFromHorse(self, pillColor)
|
|
23
|
+
local normalPillColor = pillColor - HORSE_PILL_ADJUSTMENT
|
|
24
|
+
return normalPillColor > PillColor.NULL and normalPillColor or pillColor
|
|
25
|
+
end
|
|
20
26
|
function ____exports.getPillEffectClass(self, pillEffect)
|
|
21
27
|
local pillEffectClass = PILL_EFFECT_CLASSES[pillEffect]
|
|
22
28
|
return pillEffectClass == nil and DEFAULT_PILL_EFFECT_CLASS or pillEffectClass
|
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",
|