isaacscript-common 1.0.455 → 1.0.459
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 +3 -0
- package/dist/constants.lua +3 -0
- package/dist/functions/log.d.ts +1 -0
- package/dist/functions/log.lua +6 -0
- package/dist/functions/rooms.d.ts +16 -3
- package/dist/functions/rooms.lua +18 -17
- package/package.json +2 -2
package/dist/constants.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export declare const AZAZEL_DEFAULT_BRIMSTONE_DISTANCE = 75.125;
|
|
|
8
8
|
export declare const BOMB_EXPLODE_FRAME = 45;
|
|
9
9
|
export declare const CHARACTERS_WITH_AN_ACTIVE_ITEM: Set<PlayerType>;
|
|
10
10
|
export declare const CHARACTERS_WITH_NO_RED_HEARTS: Set<PlayerType>;
|
|
11
|
+
export declare const DEFAULT_ITEM_POOL_TYPE = ItemPoolType.POOL_TREASURE;
|
|
11
12
|
/** This is also the distance that a player spawns from the door that they enter a room from. */
|
|
12
13
|
export declare const DISTANCE_OF_GRID_TILE = 40;
|
|
13
14
|
export declare const DOOR_HITBOX_DISTANCE = 11;
|
|
@@ -24,6 +25,7 @@ export declare const EGGY_STATE_FRAME_OF_FINAL_SPIDER = 45;
|
|
|
24
25
|
*/
|
|
25
26
|
export declare const FIRST_GLITCHED_COLLECTIBLE_TYPE: number;
|
|
26
27
|
export declare const GENESIS_ROOM_VARIANT = 1000;
|
|
28
|
+
export declare const GENESIS_ROOM_SUBTYPE = 99;
|
|
27
29
|
export declare const GOLDEN_TRINKET_SHIFT: number;
|
|
28
30
|
/**
|
|
29
31
|
* This maps the GridEntityXMLType (i.e. the type contained in the room XML/STB file) to the
|
|
@@ -63,6 +65,7 @@ export declare const MAX_ROOM_INDEX = 168;
|
|
|
63
65
|
export declare const MAX_VANILLA_COLLECTIBLE_TYPE = CollectibleType.COLLECTIBLE_MOMS_RING;
|
|
64
66
|
export declare const MOVEMENT_ACTIONS: Set<ButtonAction>;
|
|
65
67
|
export declare const ONE_BY_ONE_ROOM_GRID_SIZE = 135;
|
|
68
|
+
export declare const ROOM_TYPE_TO_ITEM_POOL_TYPE_MAP: Map<RoomType, ItemPoolType>;
|
|
66
69
|
export declare const SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES: Set<CollectibleType>;
|
|
67
70
|
export declare const SHOOTING_ACTIONS: Set<ButtonAction>;
|
|
68
71
|
/**
|
package/dist/constants.lua
CHANGED
|
@@ -5,11 +5,13 @@ ____exports.AZAZEL_DEFAULT_BRIMSTONE_DISTANCE = 75.125
|
|
|
5
5
|
____exports.BOMB_EXPLODE_FRAME = 45
|
|
6
6
|
____exports.CHARACTERS_WITH_AN_ACTIVE_ITEM = __TS__New(Set, {PlayerType.PLAYER_ISAAC, PlayerType.PLAYER_MAGDALENE, PlayerType.PLAYER_JUDAS, PlayerType.PLAYER_BLUEBABY, PlayerType.PLAYER_EVE, PlayerType.PLAYER_EDEN, PlayerType.PLAYER_THELOST, PlayerType.PLAYER_LILITH, PlayerType.PLAYER_KEEPER, PlayerType.PLAYER_APOLLYON, PlayerType.PLAYER_EDEN_B})
|
|
7
7
|
____exports.CHARACTERS_WITH_NO_RED_HEARTS = __TS__New(Set, {PlayerType.PLAYER_BLUEBABY, PlayerType.PLAYER_BLACKJUDAS, PlayerType.PLAYER_JUDAS_B, PlayerType.PLAYER_BLUEBABY_B, PlayerType.PLAYER_THEFORGOTTEN_B, PlayerType.PLAYER_BETHANY_B})
|
|
8
|
+
____exports.DEFAULT_ITEM_POOL_TYPE = ItemPoolType.POOL_TREASURE
|
|
8
9
|
____exports.DISTANCE_OF_GRID_TILE = 40
|
|
9
10
|
____exports.DOOR_HITBOX_DISTANCE = 11
|
|
10
11
|
____exports.EGGY_STATE_FRAME_OF_FINAL_SPIDER = 45
|
|
11
12
|
____exports.FIRST_GLITCHED_COLLECTIBLE_TYPE = (1 << 32) - 1
|
|
12
13
|
____exports.GENESIS_ROOM_VARIANT = 1000
|
|
14
|
+
____exports.GENESIS_ROOM_SUBTYPE = 99
|
|
13
15
|
____exports.GOLDEN_TRINKET_SHIFT = 1 << 15
|
|
14
16
|
____exports.GRID_ENTITY_XML_MAP = __TS__New(Map, {{1000, {GridEntityType.GRID_ROCK, 0}}, {1001, {GridEntityType.GRID_ROCK_BOMB, 0}}, {1002, {GridEntityType.GRID_ROCK_ALT, 0}}, {1003, {GridEntityType.GRID_ROCKT, 0}}, {1008, {GridEntityType.GRID_ROCK_ALT2, 0}}, {1009, {GridEntityType.GRID_ROCK_ALT2, 1}}, {1010, {GridEntityType.GRID_ROCK_SPIKED, 0}}, {1011, {GridEntityType.GRID_ROCK_GOLD, 0}}, {1300, {GridEntityType.GRID_TNT, 0}}, {1490, {GridEntityType.GRID_POOP, 1}}, {1494, {GridEntityType.GRID_POOP, 4}}, {1495, {GridEntityType.GRID_POOP, 2}}, {1496, {GridEntityType.GRID_POOP, 3}}, {1497, {GridEntityType.GRID_POOP, 5}}, {1498, {GridEntityType.GRID_POOP, 6}}, {1500, {GridEntityType.GRID_POOP, 0}}, {1501, {GridEntityType.GRID_POOP, 11}}, {1900, {GridEntityType.GRID_ROCKB, 0}}, {1901, {GridEntityType.GRID_PILLAR, 0}}, {1930, {GridEntityType.GRID_SPIKES, 0}}, {1931, {GridEntityType.GRID_SPIKES_ONOFF, 0}}, {1940, {GridEntityType.GRID_SPIDERWEB, 0}}, {1999, {GridEntityType.GRID_WALL, 0}}, {3000, {GridEntityType.GRID_PIT, 0}}, {3001, {GridEntityType.GRID_PIT, 16}}, {3009, {GridEntityType.GRID_PIT, 0}}, {4000, {GridEntityType.GRID_LOCK, 0}}, {4500, {GridEntityType.GRID_PRESSURE_PLATE, 0}}, {5000, {GridEntityType.GRID_STATUE, 0}}, {5001, {GridEntityType.GRID_STATUE, 1}}, {6100, {GridEntityType.GRID_TELEPORTER, 0}}, {9000, {GridEntityType.GRID_TRAPDOOR, 0}}, {9100, {GridEntityType.GRID_STAIRS, 0}}, {10000, {GridEntityType.GRID_GRAVITY, 0}}})
|
|
15
17
|
____exports.GRID_INDEX_CENTER_OF_1X1_ROOM = 67
|
|
@@ -26,6 +28,7 @@ ____exports.MAX_ROOM_INDEX = 168
|
|
|
26
28
|
____exports.MAX_VANILLA_COLLECTIBLE_TYPE = CollectibleType.COLLECTIBLE_MOMS_RING
|
|
27
29
|
____exports.MOVEMENT_ACTIONS = __TS__New(Set, {ButtonAction.ACTION_LEFT, ButtonAction.ACTION_RIGHT, ButtonAction.ACTION_UP, ButtonAction.ACTION_DOWN})
|
|
28
30
|
____exports.ONE_BY_ONE_ROOM_GRID_SIZE = 135
|
|
31
|
+
____exports.ROOM_TYPE_TO_ITEM_POOL_TYPE_MAP = __TS__New(Map, {{RoomType.ROOM_SHOP, ItemPoolType.POOL_SHOP}, {RoomType.ROOM_TREASURE, ItemPoolType.POOL_TREASURE}, {RoomType.ROOM_BOSS, ItemPoolType.POOL_BOSS}, {RoomType.ROOM_SECRET, ItemPoolType.POOL_SECRET}, {RoomType.ROOM_CURSE, ItemPoolType.POOL_CURSE}, {RoomType.ROOM_CHALLENGE, ItemPoolType.POOL_BOSS}, {RoomType.ROOM_LIBRARY, ItemPoolType.POOL_LIBRARY}, {RoomType.ROOM_DEVIL, ItemPoolType.POOL_DEVIL}, {RoomType.ROOM_ANGEL, ItemPoolType.POOL_ANGEL}, {RoomType.ROOM_CHEST, ItemPoolType.POOL_GOLDEN_CHEST}, {RoomType.ROOM_BLACK_MARKET, ItemPoolType.POOL_SHOP}, {RoomType.ROOM_PLANETARIUM, ItemPoolType.POOL_PLANETARIUM}, {RoomType.ROOM_ULTRASECRET, ItemPoolType.POOL_ULTRA_SECRET}})
|
|
29
32
|
____exports.SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES = __TS__New(Set, {CollectibleType.COLLECTIBLE_FORGET_ME_NOW, CollectibleType.COLLECTIBLE_EDENS_SOUL, CollectibleType.COLLECTIBLE_ALABASTER_BOX, CollectibleType.COLLECTIBLE_PLAN_C, CollectibleType.COLLECTIBLE_MAMA_MEGA, CollectibleType.COLLECTIBLE_SACRIFICIAL_ALTAR, CollectibleType.COLLECTIBLE_DEATH_CERTIFICATE, CollectibleType.COLLECTIBLE_R_KEY})
|
|
30
33
|
____exports.SHOOTING_ACTIONS = __TS__New(Set, {ButtonAction.ACTION_SHOOTLEFT, ButtonAction.ACTION_SHOOTRIGHT, ButtonAction.ACTION_SHOOTUP, ButtonAction.ACTION_SHOOTDOWN})
|
|
31
34
|
____exports.UI_HEART_WIDTH = 12
|
package/dist/functions/log.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export declare function logKColor(this: void, kColor: KColor): void;
|
|
|
38
38
|
export declare function logMap(this: void, map: Map<AnyNotNil, unknown>): void;
|
|
39
39
|
export declare function logTable(this: void, table: unknown): void;
|
|
40
40
|
export declare function logSet(this: void, set: Set<AnyNotNil>): void;
|
|
41
|
+
export declare function logVector(this: void, vector: Vector): void;
|
|
41
42
|
/**
|
|
42
43
|
* Converts every `isaacscript-common` function that begins with "log" to a global function.
|
|
43
44
|
* This is useful for printing out variables from the in-game debug console.
|
package/dist/functions/log.lua
CHANGED
|
@@ -128,6 +128,11 @@ function ____exports.logSet(set)
|
|
|
128
128
|
"The size of the set was: " .. tostring(set.size)
|
|
129
129
|
)
|
|
130
130
|
end
|
|
131
|
+
function ____exports.logVector(vector)
|
|
132
|
+
____exports.log(
|
|
133
|
+
((("Vector: (" .. tostring(vector.X)) .. ", ") .. tostring(vector.Y)) .. ")"
|
|
134
|
+
)
|
|
135
|
+
end
|
|
131
136
|
function ____exports.setLogFunctionsGlobal(self)
|
|
132
137
|
local globals = _G
|
|
133
138
|
globals.log = ____exports.log
|
|
@@ -144,6 +149,7 @@ function ____exports.setLogFunctionsGlobal(self)
|
|
|
144
149
|
globals.logMap = ____exports.logMap
|
|
145
150
|
globals.logTable = ____exports.logTable
|
|
146
151
|
globals.logSet = ____exports.logSet
|
|
152
|
+
globals.logVector = ____exports.logVector
|
|
147
153
|
end
|
|
148
154
|
function ____exports.traceback(self)
|
|
149
155
|
if debug ~= nil then
|
|
@@ -36,6 +36,12 @@ export declare function getRoomIndex(): int;
|
|
|
36
36
|
* This function only searches through rooms in the current dimension.
|
|
37
37
|
*/
|
|
38
38
|
export declare function getRoomIndexesForType(roomType: RoomType): Set<int>;
|
|
39
|
+
/**
|
|
40
|
+
* Helper function to get the item pool type for the current room. For example, this returns
|
|
41
|
+
* `ItemPoolType.ItemPoolType.POOL_ANGEL` if you are in an Angel Room. Returns
|
|
42
|
+
* `DEFAULT_ITEM_POOL_TYPE` if there is no particular pool associated with the current room type.
|
|
43
|
+
*/
|
|
44
|
+
export declare function getRoomItemPoolType(): ItemPoolType;
|
|
39
45
|
/**
|
|
40
46
|
* Helper function to get the name of the room as it appears in the STB/XML data.
|
|
41
47
|
*
|
|
@@ -73,10 +79,18 @@ export declare function getRoomVisitedCount(): int;
|
|
|
73
79
|
* equal to `Vector(80, 160)`.
|
|
74
80
|
*/
|
|
75
81
|
export declare function gridToPos(x: int, y: int): Vector;
|
|
82
|
+
/**
|
|
83
|
+
* Helper function to see if the current room shape is equal to `RoomShape.ROOMSHAPE_1x2` or
|
|
84
|
+
* `RoomShape.ROOMSHAPE_2x1`.
|
|
85
|
+
*/
|
|
76
86
|
export declare function in2x1Room(): boolean;
|
|
77
87
|
export declare function inAngelShop(): boolean;
|
|
78
88
|
export declare function inBeastRoom(): boolean;
|
|
79
|
-
|
|
89
|
+
/**
|
|
90
|
+
* Helper function to check if the current room is a boss room for a particular boss. This will only
|
|
91
|
+
* work for bosses that have dedicated boss rooms in the "00.special rooms.stb" file.
|
|
92
|
+
*/
|
|
93
|
+
export declare function inBossRoomOf(bossID: BossID): boolean;
|
|
80
94
|
/**
|
|
81
95
|
* Helper function for determining whether the current room is a crawlspace. Use this function over
|
|
82
96
|
* comparing to `GridRooms.ROOM_DUNGEON_IDX` directly since there is a special case of the player
|
|
@@ -89,8 +103,7 @@ export declare function inCrawlspace(): boolean;
|
|
|
89
103
|
*/
|
|
90
104
|
export declare function inDeathCertificateArea(): boolean;
|
|
91
105
|
export declare function inDimension(dimension: Dimension): boolean;
|
|
106
|
+
/** Helper function to see if the current room shape is one of the four L room shapes. */
|
|
92
107
|
export declare function inLRoom(): boolean;
|
|
93
|
-
export declare function inLambRoom(): boolean;
|
|
94
108
|
export declare function inGenesisRoom(): boolean;
|
|
95
|
-
export declare function inItLivesRoom(): boolean;
|
|
96
109
|
export declare function inStartingRoom(): boolean;
|
package/dist/functions/rooms.lua
CHANGED
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
require("lualib_bundle");
|
|
3
3
|
local ____exports = {}
|
|
4
4
|
local ____constants = require("constants")
|
|
5
|
+
local DEFAULT_ITEM_POOL_TYPE = ____constants.DEFAULT_ITEM_POOL_TYPE
|
|
6
|
+
local GENESIS_ROOM_SUBTYPE = ____constants.GENESIS_ROOM_SUBTYPE
|
|
5
7
|
local GENESIS_ROOM_VARIANT = ____constants.GENESIS_ROOM_VARIANT
|
|
6
8
|
local MAX_ROOM_INDEX = ____constants.MAX_ROOM_INDEX
|
|
9
|
+
local ROOM_TYPE_TO_ITEM_POOL_TYPE_MAP = ____constants.ROOM_TYPE_TO_ITEM_POOL_TYPE_MAP
|
|
7
10
|
function ____exports.getRoomIndex(self)
|
|
8
11
|
local game = Game()
|
|
9
12
|
local level = game:GetLevel()
|
|
@@ -14,9 +17,6 @@ function ____exports.getRoomIndex(self)
|
|
|
14
17
|
local roomDesc = level:GetCurrentRoomDesc()
|
|
15
18
|
return roomDesc.SafeGridIndex
|
|
16
19
|
end
|
|
17
|
-
local IT_LIVES_ROOM_VARIANTS = {1090, 1091, 1092, 1093, 1094}
|
|
18
|
-
local BLUE_BABY_ROOM_VARIANTS = {3390, 3391, 3392, 3393}
|
|
19
|
-
local LAMB_ROOM_VARIANTS = {5130}
|
|
20
20
|
function ____exports.changeRoom(self, roomIndex)
|
|
21
21
|
local game = Game()
|
|
22
22
|
local level = game:GetLevel()
|
|
@@ -75,6 +75,13 @@ function ____exports.getRoomIndexesForType(self, roomType)
|
|
|
75
75
|
end
|
|
76
76
|
return roomIndexes
|
|
77
77
|
end
|
|
78
|
+
function ____exports.getRoomItemPoolType(self)
|
|
79
|
+
local game = Game()
|
|
80
|
+
local room = game:GetRoom()
|
|
81
|
+
local roomType = room:GetType()
|
|
82
|
+
local itemPoolType = ROOM_TYPE_TO_ITEM_POOL_TYPE_MAP:get(roomType)
|
|
83
|
+
return ((itemPoolType == nil) and DEFAULT_ITEM_POOL_TYPE) or itemPoolType
|
|
84
|
+
end
|
|
78
85
|
function ____exports.getRoomName(self)
|
|
79
86
|
local roomData = ____exports.getRoomData(nil)
|
|
80
87
|
if roomData == nil then
|
|
@@ -135,10 +142,13 @@ function ____exports.inBeastRoom(self)
|
|
|
135
142
|
local roomSubType = ____exports.getRoomSubType(nil)
|
|
136
143
|
return (roomIndex == GridRooms.ROOM_DUNGEON_IDX) and (roomSubType == 4)
|
|
137
144
|
end
|
|
138
|
-
function ____exports.
|
|
145
|
+
function ____exports.inBossRoomOf(self, bossID)
|
|
146
|
+
local game = Game()
|
|
147
|
+
local room = game:GetRoom()
|
|
148
|
+
local roomType = room:GetType()
|
|
139
149
|
local roomStageID = ____exports.getRoomStageID(nil)
|
|
140
|
-
local
|
|
141
|
-
return (roomStageID == 0) and
|
|
150
|
+
local roomSubType = ____exports.getRoomSubType(nil)
|
|
151
|
+
return ((roomType == RoomType.ROOM_BOSS) and (roomStageID == 0)) and (roomSubType == bossID)
|
|
142
152
|
end
|
|
143
153
|
function ____exports.inCrawlspace(self)
|
|
144
154
|
local roomIndex = ____exports.getRoomIndex(nil)
|
|
@@ -159,22 +169,13 @@ function ____exports.inLRoom(self)
|
|
|
159
169
|
local roomShape = room:GetRoomShape()
|
|
160
170
|
return (((roomShape == RoomShape.ROOMSHAPE_LTL) or (roomShape == RoomShape.ROOMSHAPE_LTR)) or (roomShape == RoomShape.ROOMSHAPE_LBL)) or (roomShape == RoomShape.ROOMSHAPE_LBR)
|
|
161
171
|
end
|
|
162
|
-
function ____exports.inLambRoom(self)
|
|
163
|
-
local roomStageID = ____exports.getRoomStageID(nil)
|
|
164
|
-
local roomVariant = ____exports.getRoomVariant(nil)
|
|
165
|
-
return (roomStageID == 0) and __TS__ArrayIncludes(LAMB_ROOM_VARIANTS, roomVariant)
|
|
166
|
-
end
|
|
167
172
|
function ____exports.inGenesisRoom(self)
|
|
168
173
|
local game = Game()
|
|
169
174
|
local room = game:GetRoom()
|
|
170
175
|
local roomType = room:GetType()
|
|
171
176
|
local roomVariant = ____exports.getRoomVariant(nil)
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
function ____exports.inItLivesRoom(self)
|
|
175
|
-
local roomStageID = ____exports.getRoomStageID(nil)
|
|
176
|
-
local roomVariant = ____exports.getRoomVariant(nil)
|
|
177
|
-
return (roomStageID == 0) and __TS__ArrayIncludes(IT_LIVES_ROOM_VARIANTS, roomVariant)
|
|
177
|
+
local roomSubType = ____exports.getRoomSubType(nil)
|
|
178
|
+
return ((roomType == RoomType.ROOM_ISAACS) and (roomVariant == GENESIS_ROOM_VARIANT)) and (roomSubType == GENESIS_ROOM_SUBTYPE)
|
|
178
179
|
end
|
|
179
180
|
function ____exports.inStartingRoom(self)
|
|
180
181
|
local game = Game()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.459",
|
|
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
|
"devDependencies": {
|
|
28
|
-
"isaac-typescript-definitions": "^1.0.
|
|
28
|
+
"isaac-typescript-definitions": "^1.0.278",
|
|
29
29
|
"isaacscript-lint": "^1.0.67",
|
|
30
30
|
"typedoc": "^0.22.9",
|
|
31
31
|
"typescript": "4.4.4",
|