isaacscript-common 1.0.524 → 1.0.525

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.
Files changed (44) hide show
  1. package/dist/callbacks/subscriptions/PreNewLevel.d.ts +1 -1
  2. package/dist/callbacks/subscriptions/postBombInitLate.d.ts +2 -1
  3. package/dist/callbacks/subscriptions/postCursedTeleport.d.ts +2 -1
  4. package/dist/callbacks/subscriptions/postCustomRevive.d.ts +2 -1
  5. package/dist/callbacks/subscriptions/postEffectInitLate.d.ts +2 -1
  6. package/dist/callbacks/subscriptions/postEsauJr.d.ts +2 -1
  7. package/dist/callbacks/subscriptions/postFamiliarInitLate.d.ts +2 -1
  8. package/dist/callbacks/subscriptions/postFirstEsauJr.d.ts +2 -1
  9. package/dist/callbacks/subscriptions/postFirstFlip.d.ts +2 -1
  10. package/dist/callbacks/subscriptions/postFlip.d.ts +2 -1
  11. package/dist/callbacks/subscriptions/postGameStartedReordered.d.ts +1 -1
  12. package/dist/callbacks/subscriptions/postGridEntityInit.d.ts +2 -1
  13. package/dist/callbacks/subscriptions/postGridEntityRemove.d.ts +2 -1
  14. package/dist/callbacks/subscriptions/postGridEntityUpdate.d.ts +2 -1
  15. package/dist/callbacks/subscriptions/postItemPickup.d.ts +1 -0
  16. package/dist/callbacks/subscriptions/postKnifeInitLate.d.ts +2 -1
  17. package/dist/callbacks/subscriptions/postLaserInitLate.d.ts +2 -1
  18. package/dist/callbacks/subscriptions/postNPCInitLate.d.ts +2 -1
  19. package/dist/callbacks/subscriptions/postNewLevelReordered.d.ts +1 -1
  20. package/dist/callbacks/subscriptions/postNewRoomEarly.d.ts +1 -1
  21. package/dist/callbacks/subscriptions/postNewRoomReordered.d.ts +1 -1
  22. package/dist/callbacks/subscriptions/postPickupCollect.d.ts +2 -1
  23. package/dist/callbacks/subscriptions/postPickupInitLate.d.ts +2 -1
  24. package/dist/callbacks/subscriptions/postPlayerChangeHealth.d.ts +3 -1
  25. package/dist/callbacks/subscriptions/postPlayerChangeType.d.ts +2 -1
  26. package/dist/callbacks/subscriptions/postPlayerFatalDamage.d.ts +2 -1
  27. package/dist/callbacks/subscriptions/postPlayerInitLate.d.ts +2 -1
  28. package/dist/callbacks/subscriptions/postPlayerInitReordered.d.ts +2 -1
  29. package/dist/callbacks/subscriptions/postPlayerRenderReordered.d.ts +2 -1
  30. package/dist/callbacks/subscriptions/postPlayerUpdateReordered.d.ts +2 -1
  31. package/dist/callbacks/subscriptions/postProjectileInitLate.d.ts +2 -1
  32. package/dist/callbacks/subscriptions/postPurchase.d.ts +2 -1
  33. package/dist/callbacks/subscriptions/postSacrifice.d.ts +2 -1
  34. package/dist/callbacks/subscriptions/postSlotDestroyed.d.ts +2 -1
  35. package/dist/callbacks/subscriptions/postSlotInit.d.ts +2 -1
  36. package/dist/callbacks/subscriptions/postSlotRender.d.ts +2 -1
  37. package/dist/callbacks/subscriptions/postSlotUpdate.d.ts +2 -1
  38. package/dist/callbacks/subscriptions/postTearInitLate.d.ts +2 -1
  39. package/dist/callbacks/subscriptions/postTransformation.d.ts +2 -1
  40. package/dist/callbacks/subscriptions/preCustomRevive.d.ts +2 -1
  41. package/dist/callbacks/subscriptions/preItemPickup.d.ts +3 -1
  42. package/dist/functions/rooms.d.ts +11 -0
  43. package/dist/functions/rooms.lua +59 -48
  44. package/package.json +1 -1
@@ -1 +1 @@
1
- export {};
1
+ export declare type PreNewLevelCallbackType = () => void;
@@ -1 +1,2 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PostBombInitLateCallbackType = (bomb: EntityBomb) => void;
@@ -1 +1,2 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PostCursedTeleportCallbackType = (player: EntityPlayer) => void;
@@ -1 +1,2 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PostCustomReviveCallbackType = (player: EntityPlayer, revivalType: int) => void;
@@ -1 +1,2 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PostEffectInitLateCallbackType = (effect: EntityEffect) => void;
@@ -1 +1,2 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PostEsauJrCallbackType = (player: EntityPlayer) => void;
@@ -1 +1,2 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PostFamiliarInitLateCallbackType = (familiar: EntityFamiliar) => void;
@@ -1 +1,2 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PostFirstEsauJrCallbackType = (player: EntityPlayer) => void;
@@ -1 +1,2 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PostFirstFlipCallbackType = (player: EntityPlayer) => void;
@@ -1 +1,2 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PostFlipCallbackType = (player: EntityPlayer) => void;
@@ -1 +1 @@
1
- export {};
1
+ export declare type PostGameStartedReorderedCallbackType = (isContinued: boolean) => void;
@@ -1 +1,2 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PostGridEntityInitCallbackType = (gridEntity: GridEntity) => void;
@@ -1 +1,2 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PostGridEntityRemoveCallbackType = (gridIndex: int, gridEntityType: GridEntityType) => void;
@@ -1 +1,2 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PostGridEntityUpdateCallbackType = (gridEntity: GridEntity) => void;
@@ -1,2 +1,3 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
+ import { PickingUpItem } from "../../types/PickingUpItem";
2
3
  export declare type PostItemPickupCallbackType = (player: EntityPlayer, pickingUpItem: PickingUpItem) => void;
@@ -1 +1,2 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PostKnifeInitLateCallbackType = (knife: EntityKnife) => void;
@@ -1 +1,2 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PostLaserInitLateCallbackType = (laser: EntityLaser) => void;
@@ -1 +1,2 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PostNPCInitLateCallbackType = (npc: EntityNPC) => void;
@@ -1 +1 @@
1
- export {};
1
+ export declare type PostNewLevelReorderedCallbackType = () => void;
@@ -1 +1 @@
1
- export {};
1
+ export declare type PostNewRoomEarlyCallbackType = () => void;
@@ -1 +1 @@
1
- export {};
1
+ export declare type PostNewRoomReorderedCallbackType = () => void;
@@ -1 +1,2 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PostPickupCollectCallbackType = (pickup: EntityPickup, player: EntityPlayer) => void;
@@ -1 +1,2 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PostPickupInitLateCallbackType = (pickup: EntityPickup) => void;
@@ -1 +1,3 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ import { HealthType } from "../../types/HealthType";
3
+ export declare type PostPlayerChangeHealthCallbackType = (player: EntityPlayer, healthType: HealthType, amount: int) => void;
@@ -1 +1,2 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PostPlayerChangeTypeCallbackType = (player: EntityPlayer) => void;
@@ -1 +1,2 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PostPlayerFatalDamageCallbackType = (player: EntityPlayer) => boolean | void;
@@ -1 +1,2 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PostPlayerInitLateCallbackType = (player: EntityPlayer) => void;
@@ -1 +1,2 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PostPlayerInitReorderedCallbackType = (player: EntityPlayer) => void;
@@ -1 +1,2 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PostPlayerRenderReorderedCallbackType = (player: EntityPlayer) => void;
@@ -1 +1,2 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PostPlayerUpdateReorderedCallbackType = (player: EntityPlayer) => void;
@@ -1 +1,2 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PostProjectileInitLateCallbackType = (projectile: EntityProjectile) => void;
@@ -1 +1,2 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PostPurchaseCallbackType = (player: EntityPlayer, pickupVariant: PickupVariant | int, pickupSubType: int, pickupPrice: int) => void;
@@ -1 +1,2 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PostSacrificeCallbackType = (player: EntityPlayer, numSacrifices: int) => void;
@@ -1 +1,2 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PostSlotDestroyedCallbackType = (slot: Entity) => void;
@@ -1 +1,2 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PostSlotInitCallbackType = (slot: Entity) => void;
@@ -1 +1,2 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PostSlotRenderCallbackType = (slot: Entity) => void;
@@ -1 +1,2 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PostSlotUpdateCallbackType = (slot: Entity) => void;
@@ -1 +1,2 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PostTearInitLateCallbackType = (tear: EntityTear) => void;
@@ -1 +1,2 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PostTransformationCallbackType = (player: EntityPlayer, playerForm: PlayerForm, hasForm: boolean) => void;
@@ -1 +1,2 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PreCustomReviveCallbackType = (player: EntityPlayer) => int | void;
@@ -1 +1,3 @@
1
- export {};
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ import { PickingUpItem } from "../../types/PickingUpItem";
3
+ export declare type PreItemPickupCallbackType = (player: EntityPlayer, pickingUpItem: PickingUpItem) => void;
@@ -89,6 +89,15 @@ export declare function getRoomVariant(): int;
89
89
  * the variable is only incremented immediately before the PostNewRoom callback fires.
90
90
  */
91
91
  export declare function getRoomVisitedCount(): int;
92
+ /**
93
+ * Helper function to get the room descriptor for every room on the level. Uses the
94
+ * `Level.GetRooms()` method to accomplish this.
95
+ *
96
+ * @param includeExtraDimensionalRooms Optional. On some floors (e.g. Downpour 2, Mines 2),
97
+ * extra-dimensional rooms are automatically be generated and can be seen when you iterate over the
98
+ * `RoomList`. False by default.
99
+ */
100
+ export declare function getRooms(includeExtraDimensionalRooms?: boolean): RoomDescriptor[];
92
101
  /**
93
102
  * Converts a room X and Y coordinate to a position. For example, the coordinates of 0, 0 are
94
103
  * equal to `Vector(80, 160)`.
@@ -136,6 +145,8 @@ export declare function inStartingRoom(): boolean;
136
145
  /**
137
146
  * Helper function to loop through every room on the floor and see if it has been cleared.
138
147
  *
148
+ * This function will only check rooms in the current dimension.
149
+ *
139
150
  * @param onlyCheckRoomTypes Optional. A whitelist of room types. If specified, room types not in
140
151
  * the array will be ignored. If not specified, then all rooms will be checked. Undefined by
141
152
  * default.
@@ -44,6 +44,39 @@ function ____exports.getRoomSubType(self)
44
44
  end
45
45
  return roomData.Subtype
46
46
  end
47
+ function ____exports.getRooms(self, includeExtraDimensionalRooms)
48
+ if includeExtraDimensionalRooms == nil then
49
+ includeExtraDimensionalRooms = false
50
+ end
51
+ local game = Game()
52
+ local level = game:GetLevel()
53
+ local roomList = level:GetRooms()
54
+ local rooms = {}
55
+ if includeExtraDimensionalRooms then
56
+ do
57
+ local i = 0
58
+ while i < roomList.Size do
59
+ local roomDesc = roomList:Get(i)
60
+ if roomDesc ~= nil then
61
+ __TS__ArrayPush(rooms, roomDesc)
62
+ end
63
+ i = i + 1
64
+ end
65
+ end
66
+ else
67
+ do
68
+ local i = 0
69
+ while i <= MAX_ROOM_INDEX do
70
+ local roomDesc = level:GetRoomByIdx(i)
71
+ if roomDesc ~= nil then
72
+ __TS__ArrayPush(rooms, roomDesc)
73
+ end
74
+ i = i + 1
75
+ end
76
+ end
77
+ end
78
+ return rooms
79
+ end
47
80
  function ____exports.inDeathCertificateArea(self)
48
81
  local roomStageID = ____exports.getRoomStageID(nil)
49
82
  local roomSubType = ____exports.getRoomSubType(nil)
@@ -56,19 +89,11 @@ function ____exports.changeRoom(self, roomGridIndex)
56
89
  game:ChangeRoom(roomGridIndex)
57
90
  end
58
91
  function ____exports.getAllRoomGridIndexes(self)
59
- local game = Game()
60
- local level = game:GetLevel()
61
- local rooms = level:GetRooms()
62
92
  local allRoomGridIndexes = {}
63
- do
64
- local i = 0
65
- while i < rooms.Size do
66
- local roomDesc = rooms:Get(i)
67
- if roomDesc ~= nil then
68
- __TS__ArrayPush(allRoomGridIndexes, roomDesc.SafeGridIndex)
69
- end
70
- i = i + 1
71
- end
93
+ for ____, roomDesc in ipairs(
94
+ ____exports.getRooms(nil)
95
+ ) do
96
+ __TS__ArrayPush(allRoomGridIndexes, roomDesc.SafeGridIndex)
72
97
  end
73
98
  return allRoomGridIndexes
74
99
  end
@@ -111,17 +136,12 @@ function ____exports.getRoomListIndex(self)
111
136
  return roomDesc.ListIndex
112
137
  end
113
138
  function ____exports.getRoomGridIndexesForType(self, roomType)
114
- local game = Game()
115
- local level = game:GetLevel()
116
139
  local roomGridIndexes = {}
117
- do
118
- local i = 0
119
- while i <= MAX_ROOM_INDEX do
120
- local room = level:GetRoomByIdx(i)
121
- if ((room ~= nil) and (room.Data ~= nil)) and (room.Data.Type == roomType) then
122
- __TS__ArrayPush(roomGridIndexes, room.SafeGridIndex)
123
- end
124
- i = i + 1
140
+ for ____, roomDesc in ipairs(
141
+ ____exports.getRooms(nil)
142
+ ) do
143
+ if (roomDesc.Data ~= nil) and (roomDesc.Data.Type == roomType) then
144
+ __TS__ArrayPush(roomGridIndexes, roomDesc.SafeGridIndex)
125
145
  end
126
146
  end
127
147
  return roomGridIndexes
@@ -232,33 +252,24 @@ function ____exports.inStartingRoom(self)
232
252
  return (roomSafeGridIndex == startingRoomGridIndex) and ____exports.inDimension(nil, 0)
233
253
  end
234
254
  function ____exports.isAllRoomsClear(self, onlyCheckRoomTypes)
235
- local game = Game()
236
- local level = game:GetLevel()
237
- local rooms = level:GetRooms()
238
255
  local roomTypeWhitelist = (((onlyCheckRoomTypes == nil) and (function() return nil end)) or (function() return __TS__New(Set, onlyCheckRoomTypes) end))()
239
- do
240
- local i = 0
241
- while i < rooms.Size do
242
- do
243
- local roomDesc = rooms:Get(i)
244
- if roomDesc == nil then
245
- goto __continue42
246
- end
247
- local roomData = roomDesc.Data
248
- if roomData == nil then
249
- goto __continue42
250
- end
251
- local roomType = roomData.Type
252
- if (roomTypeWhitelist ~= nil) and (not roomTypeWhitelist:has(roomType)) then
253
- goto __continue42
254
- end
255
- if not roomDesc.Clear then
256
- return false
257
- end
256
+ for ____, roomDesc in ipairs(
257
+ ____exports.getRooms(nil)
258
+ ) do
259
+ do
260
+ local roomData = roomDesc.Data
261
+ if roomData == nil then
262
+ goto __continue48
263
+ end
264
+ local roomType = roomData.Type
265
+ if (roomTypeWhitelist ~= nil) and (not roomTypeWhitelist:has(roomType)) then
266
+ goto __continue48
267
+ end
268
+ if not roomDesc.Clear then
269
+ return false
258
270
  end
259
- ::__continue42::
260
- i = i + 1
261
271
  end
272
+ ::__continue48::
262
273
  end
263
274
  return true
264
275
  end
@@ -290,14 +301,14 @@ function ____exports.setRoomCleared(self)
290
301
  ) do
291
302
  do
292
303
  if isHiddenSecretRoomDoor(nil, door) then
293
- goto __continue51
304
+ goto __continue56
294
305
  end
295
306
  door.State = DoorState.STATE_OPEN
296
307
  local sprite = door:GetSprite()
297
308
  sprite:Play("Opened", true)
298
309
  door.ExtraVisible = false
299
310
  end
300
- ::__continue51::
311
+ ::__continue56::
301
312
  end
302
313
  sfx:Stop(SoundEffect.SOUND_DOOR_HEAVY_OPEN)
303
314
  game:ShakeScreen(0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.0.524",
3
+ "version": "1.0.525",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",