isaacscript-common 1.0.576 → 1.0.577

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.
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * Helper function for quickly switching to a new room without playing a particular animation.
4
4
  * Always use this helper function over invoking `Game().ChangeRoom()` directly to ensure that you
5
- * do not forget to set the LeaveDoor property.
5
+ * do not forget to set the LeaveDoor property and to prevent crashing on invalid room grid indexes.
6
6
  */
7
7
  export declare function changeRoom(roomGridIndex: int): void;
8
8
  export declare function getAllRoomGridIndexes(): int[];
@@ -85,6 +85,10 @@ end
85
85
  function ____exports.changeRoom(self, roomGridIndex)
86
86
  local game = Game()
87
87
  local level = game:GetLevel()
88
+ local roomData = ____exports.getRoomData(nil, roomGridIndex)
89
+ if roomData == nil then
90
+ error(("Failed to change the room to to grid index " .. tostring(roomGridIndex)) .. " because that room does not exist.")
91
+ end
88
92
  level.LeaveDoor = -1
89
93
  game:ChangeRoom(roomGridIndex)
90
94
  end
@@ -246,17 +250,17 @@ function ____exports.isAllRoomsClear(self, onlyCheckRoomTypes)
246
250
  do
247
251
  local roomData = roomDescriptor.Data
248
252
  if roomData == nil then
249
- goto __continue48
253
+ goto __continue49
250
254
  end
251
255
  local roomType = roomData.Type
252
256
  if roomTypeWhitelist ~= nil and not roomTypeWhitelist:has(roomType) then
253
- goto __continue48
257
+ goto __continue49
254
258
  end
255
259
  if not roomDescriptor.Clear then
256
260
  return false
257
261
  end
258
262
  end
259
- ::__continue48::
263
+ ::__continue49::
260
264
  end
261
265
  return true
262
266
  end
@@ -292,12 +296,12 @@ function ____exports.setRoomCleared(self)
292
296
  for ____, door in ipairs(getDoors(nil)) do
293
297
  do
294
298
  if isHiddenSecretRoomDoor(nil, door) then
295
- goto __continue59
299
+ goto __continue60
296
300
  end
297
301
  openDoorFast(nil, door)
298
302
  door.ExtraVisible = false
299
303
  end
300
- ::__continue59::
304
+ ::__continue60::
301
305
  end
302
306
  sfx:Stop(SoundEffect.SOUND_DOOR_HEAVY_OPEN)
303
307
  game:ShakeScreen(0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.0.576",
3
+ "version": "1.0.577",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",