isaacscript-common 1.2.103 → 1.2.104

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.
@@ -63,8 +63,6 @@ export declare const FINAL_STAGE: number;
63
63
  * second TMTRAINER item subtracts one from that, and so on.
64
64
  */
65
65
  export declare const FIRST_GLITCHED_COLLECTIBLE_TYPE: number;
66
- export declare const GENESIS_ROOM_VARIANT = -1;
67
- export declare const GENESIS_ROOM_SUBTYPE = -1;
68
66
  export declare const GOLDEN_TRINKET_SHIFT: number;
69
67
  export declare const GRID_INDEX_CENTER_OF_1X1_ROOM = 67;
70
68
  export declare const GAME_FRAMES_PER_SECOND = 30;
@@ -79,8 +79,6 @@ ____exports.FAMILIARS_THAT_SHOOT_PLAYER_TEARS = __TS__New(Set, {
79
79
  })
80
80
  ____exports.FINAL_STAGE = LevelStage.NUM_STAGES - 1
81
81
  ____exports.FIRST_GLITCHED_COLLECTIBLE_TYPE = (1 << 32) - 1
82
- ____exports.GENESIS_ROOM_VARIANT = -1
83
- ____exports.GENESIS_ROOM_SUBTYPE = -1
84
82
  ____exports.GOLDEN_TRINKET_SHIFT = 1 << 15
85
83
  ____exports.GRID_INDEX_CENTER_OF_1X1_ROOM = 67
86
84
  ____exports.GAME_FRAMES_PER_SECOND = 30
@@ -15,10 +15,9 @@ local hasFlag = ____flag.hasFlag
15
15
  local ____player = require("functions.player")
16
16
  local getEffectsList = ____player.getEffectsList
17
17
  local ____rooms = require("functions.rooms")
18
+ local getRoomData = ____rooms.getRoomData
18
19
  local getRoomGridIndex = ____rooms.getRoomGridIndex
19
20
  local getRoomListIndex = ____rooms.getRoomListIndex
20
- local getRoomSubType = ____rooms.getRoomSubType
21
- local getRoomVariant = ____rooms.getRoomVariant
22
21
  local ____trinkets = require("functions.trinkets")
23
22
  local getTrinketName = ____trinkets.getTrinketName
24
23
  function ____exports.getDebugPrependString(self, msg, numParentFunctions)
@@ -130,14 +129,14 @@ function ____exports.logMap(map)
130
129
  ____exports.log("The size of the map was: " .. tostring(map.size))
131
130
  end
132
131
  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
132
  local roomGridIndex = getRoomGridIndex(nil)
139
133
  local roomListIndex = getRoomListIndex(nil)
140
- ____exports.log((((("Current room type/variant/sub-type: " .. tostring(roomType)) .. ".") .. tostring(roomVariant)) .. ".") .. tostring(roomSubType))
134
+ local roomData = getRoomData(nil)
135
+ if roomData == nil then
136
+ ____exports.log("Current room data is undefined.")
137
+ else
138
+ ____exports.log((((("Current room type/variant/sub-type: " .. tostring(roomData.Type)) .. ".") .. tostring(roomData.Variant)) .. ".") .. tostring(roomData.Subtype))
139
+ end
141
140
  ____exports.log("Current room grid index: " .. tostring(roomGridIndex))
142
141
  ____exports.log("Current room list index: " .. tostring(roomListIndex))
143
142
  end
@@ -14,7 +14,10 @@ export declare function getAllRoomGridIndexes(): int[];
14
14
  * tricky to properly detect.
15
15
  */
16
16
  export declare function getCurrentDimension(): Dimension;
17
- /** Alias for the `Level.GetCurrentRoomDesc()` method. */
17
+ /**
18
+ * Alias for the `Level.GetCurrentRoomDesc()` method. Use this to make it more clear what type of
19
+ * `RoomDescriptor` object that you are retrieving.
20
+ */
18
21
  export declare function getCurrentRoomDescriptorReadOnly(): RoomDescriptorReadOnly;
19
22
  /**
20
23
  * Helper function to get the room data for the provided room.
@@ -25,9 +28,10 @@ export declare function getRoomData(roomGridIndex?: int): RoomConfig | undefined
25
28
  /**
26
29
  * Helper function for getting the type of the room with the given grid index.
27
30
  *
31
+ * @param roomGridIndex Optional. Equal to the current room index by default.
28
32
  * @returns The room data type. Returns -1 if the type was not found.
29
33
  */
30
- export declare function getRoomType(roomGridIndex: int): RoomType;
34
+ export declare function getRoomType(roomGridIndex?: int): RoomType;
31
35
  /**
32
36
  * Helper function to get the descriptor for a room.
33
37
  *
@@ -10,8 +10,6 @@ local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
10
10
  local Map = ____lualib.Map
11
11
  local ____exports = {}
12
12
  local ____constants = require("constants")
13
- local GENESIS_ROOM_SUBTYPE = ____constants.GENESIS_ROOM_SUBTYPE
14
- local GENESIS_ROOM_VARIANT = ____constants.GENESIS_ROOM_VARIANT
15
13
  local MAX_ROOM_INDEX = ____constants.MAX_ROOM_INDEX
16
14
  local NUM_DIMENSIONS = ____constants.NUM_DIMENSIONS
17
15
  local ____doors = require("functions.doors")
@@ -43,11 +41,20 @@ function ____exports.getRoomDescriptor(self, roomGridIndex)
43
41
  local game = Game()
44
42
  local level = game:GetLevel()
45
43
  if roomGridIndex == nil then
46
- local currentRoomDescriptor = ____exports.getCurrentRoomDescriptorReadOnly(nil)
47
- roomGridIndex = currentRoomDescriptor.SafeGridIndex
44
+ roomGridIndex = ____exports.getRoomGridIndex(nil)
48
45
  end
49
46
  return level:GetRoomByIdx(roomGridIndex)
50
47
  end
48
+ function ____exports.getRoomGridIndex(self)
49
+ local game = Game()
50
+ local level = game:GetLevel()
51
+ local currentRoomIndex = level:GetCurrentRoomIndex()
52
+ if currentRoomIndex < 0 then
53
+ return currentRoomIndex
54
+ end
55
+ local roomDescriptor = ____exports.getCurrentRoomDescriptorReadOnly(nil)
56
+ return roomDescriptor.SafeGridIndex
57
+ end
51
58
  function ____exports.getRoomStageID(self, roomGridIndex)
52
59
  local roomData = ____exports.getRoomData(nil, roomGridIndex)
53
60
  return roomData == nil and -1 or roomData.StageID
@@ -133,16 +140,6 @@ function ____exports.getRoomType(self, roomGridIndex)
133
140
  local roomData = ____exports.getRoomData(nil, roomGridIndex)
134
141
  return roomData == nil and -1 or roomData.Type
135
142
  end
136
- function ____exports.getRoomGridIndex(self)
137
- local game = Game()
138
- local level = game:GetLevel()
139
- local currentRoomIndex = level:GetCurrentRoomIndex()
140
- if currentRoomIndex < 0 then
141
- return currentRoomIndex
142
- end
143
- local roomDescriptor = ____exports.getCurrentRoomDescriptorReadOnly(nil)
144
- return roomDescriptor.SafeGridIndex
145
- end
146
143
  function ____exports.getRoomGridIndexesForType(self, ...)
147
144
  local roomTypes = {...}
148
145
  local rooms = ____exports.getRooms(nil)
@@ -239,9 +236,8 @@ function ____exports.inGenesisRoom(self)
239
236
  local game = Game()
240
237
  local room = game:GetRoom()
241
238
  local roomType = room:GetType()
242
- local roomVariant = ____exports.getRoomVariant(nil)
243
239
  local roomSubType = ____exports.getRoomSubType(nil)
244
- return roomType == RoomType.ROOM_ISAACS and roomVariant == GENESIS_ROOM_VARIANT and roomSubType == GENESIS_ROOM_SUBTYPE
240
+ return roomType == RoomType.ROOM_ISAACS and roomSubType == 99
245
241
  end
246
242
  function ____exports.inMegaSatanRoom(self)
247
243
  local roomGridIndex = ____exports.getRoomGridIndex(nil)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.103",
3
+ "version": "1.2.104",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",