isaacscript-common 1.2.88 → 1.2.91

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.
@@ -10,18 +10,18 @@ export declare function getDebugPrependString(msg: string, numParentFunctions?:
10
10
  * and the line number before the string.
11
11
  */
12
12
  export declare function log(this: void, msg: string): void;
13
- /** Helper function for printing out every damage flag that is turned on. Helpful when debugging. */
13
+ /** Helper function for printing out every damage flag that is turned on. Useful when debugging. */
14
14
  export declare function logAllDamageFlags(this: void, flags: int): void;
15
- /** Helper function for printing out every entity flag that is turned on. Helpful when debugging. */
15
+ /** Helper function for printing out every entity flag that is turned on. Useful when debugging. */
16
16
  export declare function logAllEntityFlags(this: void, flags: int): void;
17
- /** Helper function for printing out every flag that is turned on. Helpful when debugging. */
17
+ /** Helper function for printing out every flag that is turned on. Useful when debugging. */
18
18
  export declare function logAllFlags(this: void, flags: int, flagEnum: LuaTable, description?: string): void;
19
19
  /**
20
- * Helper function for printing out every game state flag that is turned on. Helpful when debugging.
20
+ * Helper function for printing out every game state flag that is turned on. Useful when debugging.
21
21
  */
22
22
  export declare function logAllGameStateFlags(this: void): void;
23
23
  /**
24
- * Helper function for printing out every projectile flag that is turned on. Helpful when debugging.
24
+ * Helper function for printing out every projectile flag that is turned on. Useful when debugging.
25
25
  */
26
26
  export declare function logAllProjectileFlags(this: void, flags: int): void;
27
27
  /**
@@ -29,15 +29,17 @@ export declare function logAllProjectileFlags(this: void, flags: int): void;
29
29
  * particular run.
30
30
  */
31
31
  export declare function logAllSeedEffects(this: void): void;
32
- /** Helper function for printing out every use flag that is turned on. Helpful when debugging. */
32
+ /** Helper function for printing out every tear flag that is turned on. Useful when debugging. */
33
33
  export declare function logAllTearFlags(this: void, flags: int): void;
34
- /** Helper function for printing out every use flag that is turned on. Helpful when debugging. */
34
+ /** Helper function for printing out every use flag that is turned on. Useful when debugging. */
35
35
  export declare function logAllUseFlags(this: void, flags: int): void;
36
36
  export declare function logArray<T>(this: void, array: T[]): void;
37
37
  export declare function logColor(this: void, color: Color): void;
38
38
  export declare function logEntity(this: void, entity: Entity): void;
39
39
  export declare function logKColor(this: void, kColor: KColor): void;
40
40
  export declare function logMap(this: void, map: Map<AnyNotNil, unknown>): void;
41
+ /** Helper function for printing out information about the current room. */
42
+ export declare function logRoom(this: void): void;
41
43
  export declare function logTable(this: void, table: unknown, parentTables?: number): void;
42
44
  export declare function logTemporaryEffects(this: void, player: EntityPlayer): void;
43
45
  export declare function logSet(this: void, set: Set<AnyNotNil>): void;
@@ -1,7 +1,8 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  local ____lualib = require("lualib_bundle")
3
3
  local Map = ____lualib.Map
4
- local __TS__Iterator = ____lualib.__TS__Iterator
4
+ local __TS__Spread = ____lualib.__TS__Spread
5
+ local __TS__ArraySort = ____lualib.__TS__ArraySort
5
6
  local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
6
7
  local Set = ____lualib.Set
7
8
  local ____exports = {}
@@ -13,6 +14,11 @@ local ____flag = require("functions.flag")
13
14
  local hasFlag = ____flag.hasFlag
14
15
  local ____player = require("functions.player")
15
16
  local getEffectsList = ____player.getEffectsList
17
+ local ____rooms = require("functions.rooms")
18
+ local getRoomListIndex = ____rooms.getRoomListIndex
19
+ local getRoomSafeGridIndex = ____rooms.getRoomSafeGridIndex
20
+ local getRoomSubType = ____rooms.getRoomSubType
21
+ local getRoomVariant = ____rooms.getRoomVariant
16
22
  local ____trinkets = require("functions.trinkets")
17
23
  local getTrinketName = ____trinkets.getTrinketName
18
24
  function ____exports.getDebugPrependString(self, msg, numParentFunctions)
@@ -115,13 +121,26 @@ function ____exports.logKColor(kColor)
115
121
  end
116
122
  function ____exports.logMap(map)
117
123
  ____exports.log("Printing out a TSTL Map:")
118
- for ____, ____value in __TS__Iterator(map:entries()) do
119
- local key = ____value[1]
120
- local value = ____value[2]
124
+ local mapKeys = {__TS__Spread(map:keys())}
125
+ __TS__ArraySort(mapKeys)
126
+ for ____, key in ipairs(mapKeys) do
127
+ local value = map:get(key)
121
128
  ____exports.log(((" Key: " .. tostring(key)) .. ", Value: ") .. tostring(value))
122
129
  end
123
130
  ____exports.log("The size of the map was: " .. tostring(map.size))
124
131
  end
132
+ function ____exports.logRoom()
133
+ local game = Game()
134
+ local room = game:GetRoom()
135
+ local roomType = room:GetType()
136
+ local roomVariant = getRoomVariant(nil)
137
+ local roomSubType = getRoomSubType(nil)
138
+ local roomSafeGridIndex = getRoomSafeGridIndex(nil)
139
+ local roomListIndex = getRoomListIndex(nil)
140
+ ____exports.log((((("Current room type/variant/sub-type: " .. tostring(roomType)) .. ".") .. tostring(roomVariant)) .. ".") .. tostring(roomSubType))
141
+ ____exports.log("Current room safe grid index: " .. tostring(roomSafeGridIndex))
142
+ ____exports.log("Current room list index: " .. tostring(roomListIndex))
143
+ end
125
144
  function ____exports.logTable(____table, parentTables)
126
145
  if parentTables == nil then
127
146
  parentTables = 0
@@ -134,13 +153,16 @@ function ____exports.logTable(____table, parentTables)
134
153
  " ",
135
154
  math.floor(numSpaces)
136
155
  )
156
+ local numKeys = 0
137
157
  for key, value in pairs(____table) do
138
158
  ____exports.log((((indentation .. "Key: ") .. tostring(key)) .. ", Value: ") .. tostring(value))
139
159
  local valueType = type(value)
140
160
  if valueType == "table" then
141
161
  ____exports.logTable(value, parentTables + 1)
142
162
  end
163
+ numKeys = numKeys + 1
143
164
  end
165
+ ____exports.log("The size of the table was: " .. tostring(numKeys))
144
166
  end
145
167
  function ____exports.logTemporaryEffects(player)
146
168
  local effects = getEffectsList(nil, player)
@@ -168,7 +190,9 @@ function ____exports.logTemporaryEffects(player)
168
190
  end
169
191
  function ____exports.logSet(set)
170
192
  ____exports.log("Printing out a TSTL Set:")
171
- for ____, value in __TS__Iterator(set:values()) do
193
+ local setValues = {__TS__Spread(set:values())}
194
+ __TS__ArraySort(setValues)
195
+ for ____, value in ipairs(setValues) do
172
196
  ____exports.log(" Value: " .. tostring(value))
173
197
  end
174
198
  ____exports.log("The size of the set was: " .. tostring(set.size))
@@ -192,6 +216,7 @@ function ____exports.setLogFunctionsGlobal(self)
192
216
  globals.logEntity = ____exports.logEntity
193
217
  globals.logKColor = ____exports.logKColor
194
218
  globals.logMap = ____exports.logMap
219
+ globals.logRoom = ____exports.logRoom
195
220
  globals.logTable = ____exports.logTable
196
221
  globals.logTemporaryEffects = ____exports.logTemporaryEffects
197
222
  globals.logSet = ____exports.logSet
@@ -147,8 +147,8 @@ export declare function inBeastRoom(): boolean;
147
147
  export declare function inBossRoomOf(bossID: BossID): boolean;
148
148
  /**
149
149
  * Helper function for determining whether the current room is a crawlspace. Use this function over
150
- * comparing to `GridRooms.ROOM_DUNGEON_IDX` directly since there is a special case of the player
151
- * being in The Beast room.
150
+ * comparing to `RoomType.ROOM_DUNGEON` or `GridRooms.ROOM_DUNGEON_IDX` since there is a special
151
+ * case of the player being in a boss fight that take place in a dungeon.
152
152
  */
153
153
  export declare function inCrawlspace(): boolean;
154
154
  /**
@@ -171,6 +171,14 @@ export declare function inGenesisRoom(): boolean;
171
171
  * will only work for minibosses that have dedicated boss rooms in the "00.special rooms.stb" file.
172
172
  */
173
173
  export declare function inMinibossRoomOf(minibossID: MinibossID): boolean;
174
+ /**
175
+ * Helper function for checking if the room room is a secret shop from the Member Card collectible.
176
+ *
177
+ * Secret shops are simply copies of normal shops but with the backdrop of a secret room. In other
178
+ * words, they will have the same room type, room variant, and room sub-type of a normal shop. Thus,
179
+ * the only way to detect them is by using the grid index.
180
+ */
181
+ export declare function inSecretShop(): boolean;
174
182
  /**
175
183
  * Helper function to determine whether or not the current room is the starting room of a floor.
176
184
  * Only returns true for the starting room of the primary dimension (meaning that being in the
@@ -92,7 +92,7 @@ end
92
92
  function ____exports.inDeathCertificateArea(self)
93
93
  local roomStageID = ____exports.getRoomStageID(nil)
94
94
  local roomSubType = ____exports.getRoomSubType(nil)
95
- return roomStageID == 35 and (roomSubType == 33 or roomSubType == 33)
95
+ return roomStageID == 35 and (roomSubType == 33 or roomSubType == 34)
96
96
  end
97
97
  function ____exports.changeRoom(self, roomGridIndex)
98
98
  local game = Game()
@@ -195,9 +195,11 @@ function ____exports.inAngelShop(self)
195
195
  return roomType == RoomType.ROOM_ANGEL and roomSubType == 1
196
196
  end
197
197
  function ____exports.inBeastRoom(self)
198
- local roomSafeGridIndex = ____exports.getRoomSafeGridIndex(nil)
198
+ local game = Game()
199
+ local room = game:GetRoom()
200
+ local roomType = room:GetType()
199
201
  local roomSubType = ____exports.getRoomSubType(nil)
200
- return roomSafeGridIndex == GridRooms.ROOM_DUNGEON_IDX and roomSubType == 4
202
+ return roomType == RoomType.ROOM_DUNGEON and roomSubType == 4
201
203
  end
202
204
  function ____exports.inBossRoomOf(self, bossID)
203
205
  local game = Game()
@@ -208,9 +210,11 @@ function ____exports.inBossRoomOf(self, bossID)
208
210
  return roomType == RoomType.ROOM_BOSS and roomStageID == 0 and roomSubType == bossID
209
211
  end
210
212
  function ____exports.inCrawlspace(self)
211
- local roomSafeGridIndex = ____exports.getRoomSafeGridIndex(nil)
213
+ local game = Game()
214
+ local room = game:GetRoom()
215
+ local roomType = room:GetType()
212
216
  local roomSubType = ____exports.getRoomSubType(nil)
213
- return roomSafeGridIndex == GridRooms.ROOM_DUNGEON_IDX and roomSubType ~= 4
217
+ return roomType == RoomType.ROOM_DUNGEON and roomSubType ~= 4
214
218
  end
215
219
  function ____exports.inDevilsCrownTreasureRoom(self)
216
220
  local roomDescriptor = ____exports.getCurrentRoomDescriptorReadOnly(nil)
@@ -241,6 +245,9 @@ function ____exports.inMinibossRoomOf(self, minibossID)
241
245
  local roomSubType = ____exports.getRoomSubType(nil)
242
246
  return roomType == RoomType.ROOM_MINIBOSS and roomStageID == 0 and roomSubType == minibossID
243
247
  end
248
+ function ____exports.inSecretShop(self)
249
+ return ____exports.getRoomSafeGridIndex(nil) == GridRooms.ROOM_SECRET_SHOP_IDX
250
+ end
244
251
  function ____exports.inStartingRoom(self)
245
252
  local game = Game()
246
253
  local level = game:GetLevel()
@@ -298,12 +305,12 @@ function ____exports.setRoomCleared(self)
298
305
  for ____, door in ipairs(getDoors(nil)) do
299
306
  do
300
307
  if isHiddenSecretRoomDoor(nil, door) then
301
- goto __continue56
308
+ goto __continue57
302
309
  end
303
310
  openDoorFast(nil, door)
304
311
  door.ExtraVisible = false
305
312
  end
306
- ::__continue56::
313
+ ::__continue57::
307
314
  end
308
315
  sfx:Stop(SoundEffect.SOUND_DOOR_HEAVY_OPEN)
309
316
  game:ShakeScreen(0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.88",
3
+ "version": "1.2.91",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",
@@ -26,7 +26,7 @@
26
26
  ],
27
27
  "devDependencies": {
28
28
  "@zamiell/typescript-to-lua": "^1.4.0",
29
- "isaac-typescript-definitions": "^1.0.354",
29
+ "isaac-typescript-definitions": "^1.0.355",
30
30
  "isaacscript-lint": "^1.0.81",
31
31
  "isaacscript-tsconfig": "^1.1.8",
32
32
  "typedoc": "^0.22.12",