isaacscript-common 1.0.457 → 1.0.458

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.
@@ -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
  *
@@ -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()
@@ -75,6 +78,13 @@ function ____exports.getRoomIndexesForType(self, roomType)
75
78
  end
76
79
  return roomIndexes
77
80
  end
81
+ function ____exports.getRoomItemPoolType(self)
82
+ local game = Game()
83
+ local room = game:GetRoom()
84
+ local roomType = room:GetType()
85
+ local itemPoolType = ROOM_TYPE_TO_ITEM_POOL_TYPE_MAP:get(roomType)
86
+ return ((itemPoolType == nil) and DEFAULT_ITEM_POOL_TYPE) or itemPoolType
87
+ end
78
88
  function ____exports.getRoomName(self)
79
89
  local roomData = ____exports.getRoomData(nil)
80
90
  if roomData == nil then
@@ -169,7 +179,8 @@ function ____exports.inGenesisRoom(self)
169
179
  local room = game:GetRoom()
170
180
  local roomType = room:GetType()
171
181
  local roomVariant = ____exports.getRoomVariant(nil)
172
- return (roomType == RoomType.ROOM_ISAACS) or (roomVariant == GENESIS_ROOM_VARIANT)
182
+ local roomSubType = ____exports.getRoomSubType(nil)
183
+ return ((roomType == RoomType.ROOM_ISAACS) and (roomVariant == GENESIS_ROOM_VARIANT)) and (roomSubType == GENESIS_ROOM_SUBTYPE)
173
184
  end
174
185
  function ____exports.inItLivesRoom(self)
175
186
  local roomStageID = ____exports.getRoomStageID(nil)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.0.457",
3
+ "version": "1.0.458",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",