isaacscript-common 1.2.213 → 1.2.214
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/constants.d.ts +1 -0
- package/dist/constants.lua +1 -0
- package/dist/functions/npc.d.ts +2 -0
- package/dist/functions/npc.lua +5 -0
- package/dist/functions/rooms.d.ts +7 -0
- package/dist/functions/rooms.lua +12 -3
- package/dist/objects/roomShapeToGridIndexDelta.d.ts +8 -0
- package/dist/objects/roomShapeToGridIndexDelta.lua +85 -0
- package/dist/sets/sinEntityTypesSet.d.ts +2 -0
- package/dist/sets/sinEntityTypesSet.lua +14 -0
- package/package.json +2 -2
package/dist/constants.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export declare const FIRST_GLITCHED_COLLECTIBLE_TYPE: number;
|
|
|
37
37
|
export declare const GAME_FRAMES_PER_SECOND = 30;
|
|
38
38
|
export declare const GRID_INDEX_CENTER_OF_1X1_ROOM = 67;
|
|
39
39
|
export declare const ISAAC_FRAMES_PER_SECOND = 60;
|
|
40
|
+
export declare const LEVEL_GRID_ROW_LENGTH = 13;
|
|
40
41
|
/** In a 2x2 room, there can be 8 doors. */
|
|
41
42
|
export declare const MAX_NUM_DOORS = 8;
|
|
42
43
|
/**
|
package/dist/constants.lua
CHANGED
|
@@ -13,6 +13,7 @@ ____exports.FIRST_GLITCHED_COLLECTIBLE_TYPE = (1 << 32) - 1
|
|
|
13
13
|
____exports.GAME_FRAMES_PER_SECOND = 30
|
|
14
14
|
____exports.GRID_INDEX_CENTER_OF_1X1_ROOM = 67
|
|
15
15
|
____exports.ISAAC_FRAMES_PER_SECOND = 60
|
|
16
|
+
____exports.LEVEL_GRID_ROW_LENGTH = 13
|
|
16
17
|
____exports.MAX_NUM_DOORS = 8
|
|
17
18
|
____exports.MAX_NUM_FAMILIARS = 64
|
|
18
19
|
____exports.MAX_NUM_INPUTS = 4
|
package/dist/functions/npc.d.ts
CHANGED
|
@@ -49,6 +49,8 @@ export declare function isDyingEggyWithNoSpidersLeft(npc: EntityNPC): boolean;
|
|
|
49
49
|
* enemies.
|
|
50
50
|
*/
|
|
51
51
|
export declare function isRaglingDeathPatch(npc: EntityNPC): boolean;
|
|
52
|
+
/** Helper function to check if the provided NPC is a Sin miniboss, such as Sloth or Lust. */
|
|
53
|
+
export declare function isSin(npc: EntityNPC): boolean;
|
|
52
54
|
/**
|
|
53
55
|
* Helper function to remove all NPCs in the room.
|
|
54
56
|
*
|
package/dist/functions/npc.lua
CHANGED
|
@@ -7,6 +7,8 @@ local ____exports = {}
|
|
|
7
7
|
local NON_ALIVE_NPCS_TYPE_VARIANT, NON_ALIVE_NPCS_TYPE_VARIANT_SUBTYPE
|
|
8
8
|
local ____constants = require("constants")
|
|
9
9
|
local EGGY_STATE_FRAME_OF_FINAL_SPIDER = ____constants.EGGY_STATE_FRAME_OF_FINAL_SPIDER
|
|
10
|
+
local ____sinEntityTypesSet = require("sets.sinEntityTypesSet")
|
|
11
|
+
local SIN_ENTITY_TYPES_SET = ____sinEntityTypesSet.SIN_ENTITY_TYPES_SET
|
|
10
12
|
local ____entity = require("functions.entity")
|
|
11
13
|
local getEntities = ____entity.getEntities
|
|
12
14
|
local getFilteredNewEntities = ____entity.getFilteredNewEntities
|
|
@@ -139,6 +141,9 @@ function ____exports.getBosses(self, matchingEntityType, matchingVariant, matchi
|
|
|
139
141
|
function(____, npc) return npc:IsBoss() end
|
|
140
142
|
)
|
|
141
143
|
end
|
|
144
|
+
function ____exports.isSin(self, npc)
|
|
145
|
+
return SIN_ENTITY_TYPES_SET:has(npc.Type)
|
|
146
|
+
end
|
|
142
147
|
function ____exports.removeAllNPCs(self, cap)
|
|
143
148
|
local npcs = ____exports.getNPCs(nil)
|
|
144
149
|
return removeEntities(nil, npcs, cap)
|
|
@@ -15,6 +15,13 @@ export declare function getAllRoomGridIndexes(): int[];
|
|
|
15
15
|
* tricky to properly detect.
|
|
16
16
|
*/
|
|
17
17
|
export declare function getCurrentDimension(): Dimension;
|
|
18
|
+
/**
|
|
19
|
+
* Helper function to get the grid index delta that a door out of the given room shape would lead
|
|
20
|
+
* to. For example, if you went through the bottom door in a room of `RoomShape.ROOMSHAPE_1x2`, you
|
|
21
|
+
* would end up in a room with a grid index that is +26 units from the `SafeGridIndex` of where you
|
|
22
|
+
* started.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getGridIndexDelta(roomShape: RoomShape, doorSlot: DoorSlot): int | undefined;
|
|
18
25
|
/**
|
|
19
26
|
* Helper function to get an array of all of the safe grid indexes for rooms that match the
|
|
20
27
|
* specified room type.
|
package/dist/functions/rooms.lua
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
3
|
+
local Map = ____lualib.Map
|
|
3
4
|
local Set = ____lualib.Set
|
|
4
5
|
local __TS__New = ____lualib.__TS__New
|
|
5
6
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
6
7
|
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
7
8
|
local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
|
|
8
|
-
local Map = ____lualib.Map
|
|
9
9
|
local ____exports = {}
|
|
10
10
|
local ____cachedClasses = require("cachedClasses")
|
|
11
11
|
local game = ____cachedClasses.game
|
|
@@ -13,6 +13,8 @@ local sfxManager = ____cachedClasses.sfxManager
|
|
|
13
13
|
local ____constants = require("constants")
|
|
14
14
|
local MAX_ROOM_INDEX = ____constants.MAX_ROOM_INDEX
|
|
15
15
|
local NUM_DIMENSIONS = ____constants.NUM_DIMENSIONS
|
|
16
|
+
local ____roomShapeToGridIndexDelta = require("objects.roomShapeToGridIndexDelta")
|
|
17
|
+
local ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA = ____roomShapeToGridIndexDelta.ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA
|
|
16
18
|
local ____doors = require("functions.doors")
|
|
17
19
|
local closeAllDoors = ____doors.closeAllDoors
|
|
18
20
|
local getDoors = ____doors.getDoors
|
|
@@ -106,6 +108,13 @@ function ____exports.getCurrentDimension(self)
|
|
|
106
108
|
end
|
|
107
109
|
return error("Failed to get the current dimension using the starting room index of: " .. tostring(startingRoomGridIndex))
|
|
108
110
|
end
|
|
111
|
+
function ____exports.getGridIndexDelta(self, roomShape, doorSlot)
|
|
112
|
+
local doorSlotToGridIndexMap = ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA[roomShape]
|
|
113
|
+
if doorSlotToGridIndexMap == nil then
|
|
114
|
+
return nil
|
|
115
|
+
end
|
|
116
|
+
return doorSlotToGridIndexMap:get(doorSlot)
|
|
117
|
+
end
|
|
109
118
|
function ____exports.getRoomGridIndexesForType(self, ...)
|
|
110
119
|
local roomTypesSet = __TS__New(Set, {...})
|
|
111
120
|
local rooms = ____exports.getRooms(nil)
|
|
@@ -246,12 +255,12 @@ function ____exports.setRoomCleared(self)
|
|
|
246
255
|
for ____, door in ipairs(getDoors(nil)) do
|
|
247
256
|
do
|
|
248
257
|
if isHiddenSecretRoomDoor(nil, door) then
|
|
249
|
-
goto
|
|
258
|
+
goto __continue48
|
|
250
259
|
end
|
|
251
260
|
openDoorFast(nil, door)
|
|
252
261
|
door.ExtraVisible = false
|
|
253
262
|
end
|
|
254
|
-
::
|
|
263
|
+
::__continue48::
|
|
255
264
|
end
|
|
256
265
|
sfxManager:Stop(SoundEffect.SOUND_DOOR_HEAVY_OPEN)
|
|
257
266
|
game:ShakeScreen(0)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
/**
|
|
3
|
+
* Deltas are considered to be from the safe grid index of the room (i.e. the top left corner, or
|
|
4
|
+
* top right corner in the case of `RoomShape.ROOMSHAPE_LTL`).
|
|
5
|
+
*/
|
|
6
|
+
export declare const ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA: {
|
|
7
|
+
readonly [key in RoomShape]: Map<DoorSlot, int> | undefined;
|
|
8
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local Map = ____lualib.Map
|
|
3
|
+
local __TS__New = ____lualib.__TS__New
|
|
4
|
+
local ____exports = {}
|
|
5
|
+
local ____constants = require("constants")
|
|
6
|
+
local LEVEL_GRID_ROW_LENGTH = ____constants.LEVEL_GRID_ROW_LENGTH
|
|
7
|
+
local LEFT = -1
|
|
8
|
+
local UP = -LEVEL_GRID_ROW_LENGTH
|
|
9
|
+
local RIGHT = 1
|
|
10
|
+
local DOWN = LEVEL_GRID_ROW_LENGTH
|
|
11
|
+
____exports.ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA = {
|
|
12
|
+
[RoomShape.ROOMSHAPE_1x1] = __TS__New(Map, {{DoorSlot.LEFT0, LEFT}, {DoorSlot.UP0, UP}, {DoorSlot.RIGHT0, RIGHT}, {DoorSlot.DOWN0, DOWN}}),
|
|
13
|
+
[RoomShape.ROOMSHAPE_IH] = __TS__New(Map, {{DoorSlot.LEFT0, LEFT}, {DoorSlot.RIGHT0, RIGHT}}),
|
|
14
|
+
[RoomShape.ROOMSHAPE_IV] = __TS__New(Map, {{DoorSlot.UP0, UP}, {DoorSlot.DOWN0, DOWN}}),
|
|
15
|
+
[RoomShape.ROOMSHAPE_1x2] = __TS__New(Map, {
|
|
16
|
+
{DoorSlot.LEFT0, LEFT},
|
|
17
|
+
{DoorSlot.UP0, UP},
|
|
18
|
+
{DoorSlot.RIGHT0, RIGHT},
|
|
19
|
+
{DoorSlot.DOWN0, DOWN + DOWN},
|
|
20
|
+
{DoorSlot.LEFT1, DOWN + LEFT},
|
|
21
|
+
{DoorSlot.RIGHT1, DOWN + RIGHT}
|
|
22
|
+
}),
|
|
23
|
+
[RoomShape.ROOMSHAPE_IIV] = __TS__New(Map, {{DoorSlot.UP0, UP}, {DoorSlot.DOWN0, DOWN + DOWN}}),
|
|
24
|
+
[RoomShape.ROOMSHAPE_2x1] = __TS__New(Map, {
|
|
25
|
+
{DoorSlot.LEFT0, LEFT},
|
|
26
|
+
{DoorSlot.UP0, UP},
|
|
27
|
+
{DoorSlot.RIGHT0, RIGHT + RIGHT},
|
|
28
|
+
{DoorSlot.DOWN0, DOWN},
|
|
29
|
+
{DoorSlot.UP1, RIGHT + UP},
|
|
30
|
+
{DoorSlot.DOWN1, RIGHT + DOWN}
|
|
31
|
+
}),
|
|
32
|
+
[RoomShape.ROOMSHAPE_IIH] = __TS__New(Map, {{DoorSlot.LEFT0, LEFT}, {DoorSlot.RIGHT0, RIGHT + RIGHT}}),
|
|
33
|
+
[RoomShape.ROOMSHAPE_2x2] = __TS__New(Map, {
|
|
34
|
+
{DoorSlot.LEFT0, LEFT},
|
|
35
|
+
{DoorSlot.UP0, UP},
|
|
36
|
+
{DoorSlot.RIGHT0, RIGHT + RIGHT},
|
|
37
|
+
{DoorSlot.DOWN0, DOWN + DOWN},
|
|
38
|
+
{DoorSlot.LEFT1, DOWN + LEFT},
|
|
39
|
+
{DoorSlot.UP1, RIGHT + UP},
|
|
40
|
+
{DoorSlot.RIGHT1, RIGHT + DOWN + RIGHT},
|
|
41
|
+
{DoorSlot.DOWN1, RIGHT + DOWN + DOWN}
|
|
42
|
+
}),
|
|
43
|
+
[RoomShape.ROOMSHAPE_LTL] = __TS__New(Map, {
|
|
44
|
+
{DoorSlot.LEFT0, LEFT},
|
|
45
|
+
{DoorSlot.UP0, DOWN + LEFT + UP},
|
|
46
|
+
{DoorSlot.RIGHT0, RIGHT},
|
|
47
|
+
{DoorSlot.DOWN0, DOWN + LEFT + DOWN},
|
|
48
|
+
{DoorSlot.LEFT1, DOWN + LEFT + LEFT},
|
|
49
|
+
{DoorSlot.UP1, UP},
|
|
50
|
+
{DoorSlot.RIGHT1, DOWN + RIGHT},
|
|
51
|
+
{DoorSlot.DOWN1, DOWN + DOWN}
|
|
52
|
+
}),
|
|
53
|
+
[RoomShape.ROOMSHAPE_LTR] = __TS__New(Map, {
|
|
54
|
+
{DoorSlot.LEFT0, LEFT},
|
|
55
|
+
{DoorSlot.UP0, UP},
|
|
56
|
+
{DoorSlot.RIGHT0, RIGHT},
|
|
57
|
+
{DoorSlot.DOWN0, DOWN + DOWN},
|
|
58
|
+
{DoorSlot.LEFT1, DOWN + LEFT},
|
|
59
|
+
{DoorSlot.UP1, DOWN + RIGHT + UP},
|
|
60
|
+
{DoorSlot.RIGHT1, DOWN + RIGHT + RIGHT},
|
|
61
|
+
{DoorSlot.DOWN1, DOWN + RIGHT + DOWN}
|
|
62
|
+
}),
|
|
63
|
+
[RoomShape.ROOMSHAPE_LBL] = __TS__New(Map, {
|
|
64
|
+
{DoorSlot.LEFT0, LEFT},
|
|
65
|
+
{DoorSlot.UP0, UP},
|
|
66
|
+
{DoorSlot.RIGHT0, RIGHT + RIGHT},
|
|
67
|
+
{DoorSlot.DOWN0, DOWN},
|
|
68
|
+
{DoorSlot.LEFT1, RIGHT + DOWN + LEFT},
|
|
69
|
+
{DoorSlot.UP1, RIGHT + UP},
|
|
70
|
+
{DoorSlot.RIGHT1, RIGHT + DOWN + RIGHT},
|
|
71
|
+
{DoorSlot.DOWN1, RIGHT + DOWN + DOWN}
|
|
72
|
+
}),
|
|
73
|
+
[RoomShape.ROOMSHAPE_LBR] = __TS__New(Map, {
|
|
74
|
+
{DoorSlot.LEFT0, LEFT},
|
|
75
|
+
{DoorSlot.UP0, UP},
|
|
76
|
+
{DoorSlot.RIGHT0, RIGHT + RIGHT},
|
|
77
|
+
{DoorSlot.DOWN0, DOWN + DOWN},
|
|
78
|
+
{DoorSlot.LEFT1, DOWN + LEFT},
|
|
79
|
+
{DoorSlot.UP1, RIGHT + UP},
|
|
80
|
+
{DoorSlot.RIGHT1, DOWN + RIGHT},
|
|
81
|
+
{DoorSlot.DOWN1, RIGHT + DOWN}
|
|
82
|
+
}),
|
|
83
|
+
[RoomShape.NUM_ROOMSHAPES] = nil
|
|
84
|
+
}
|
|
85
|
+
return ____exports
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local Set = ____lualib.Set
|
|
3
|
+
local __TS__New = ____lualib.__TS__New
|
|
4
|
+
local ____exports = {}
|
|
5
|
+
____exports.SIN_ENTITY_TYPES_SET = __TS__New(Set, {
|
|
6
|
+
EntityType.ENTITY_SLOTH,
|
|
7
|
+
EntityType.ENTITY_LUST,
|
|
8
|
+
EntityType.ENTITY_WRATH,
|
|
9
|
+
EntityType.ENTITY_GLUTTONY,
|
|
10
|
+
EntityType.ENTITY_GREED,
|
|
11
|
+
EntityType.ENTITY_ENVY,
|
|
12
|
+
EntityType.ENTITY_PRIDE
|
|
13
|
+
})
|
|
14
|
+
return ____exports
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.214",
|
|
4
4
|
"description": "Helper functions for IsaacScript mods",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"isaacscript-lint": "^1.0.95",
|
|
30
30
|
"isaacscript-tsconfig": "^1.1.8",
|
|
31
31
|
"typedoc": "^0.22.13",
|
|
32
|
-
"typescript": "4.6.
|
|
32
|
+
"typescript": "4.6.3",
|
|
33
33
|
"typescript-to-lua": "^1.4.2"
|
|
34
34
|
}
|
|
35
35
|
}
|