isaacscript-common 1.2.67 → 1.2.68

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.
@@ -8,7 +8,7 @@ local __TS__Iterator = ____lualib.__TS__Iterator
8
8
  local ____exports = {}
9
9
  local ____collectibles = require("functions.collectibles")
10
10
  local collectibleHasCacheFlag = ____collectibles.collectibleHasCacheFlag
11
- local getMaxCollectibleID = ____collectibles.getMaxCollectibleID
11
+ local getMaxCollectibleType = ____collectibles.getMaxCollectibleType
12
12
  local ____math = require("functions.math")
13
13
  local range = ____math.range
14
14
  local ____set = require("functions.set")
@@ -17,10 +17,10 @@ local ____utils = require("functions.utils")
17
17
  local getEnumValues = ____utils.getEnumValues
18
18
  local CACHE_FLAG_TO_COLLECTIBLES_MAP = __TS__New(Map)
19
19
  local function initCacheFlagMap(self)
20
- local maxCollectibleID = getMaxCollectibleID(nil)
20
+ local maxCollectibleType = getMaxCollectibleType(nil)
21
21
  for ____, cacheFlag in ipairs(getEnumValues(nil, CacheFlag)) do
22
22
  local collectiblesSet = __TS__New(Set)
23
- for ____, collectibleType in ipairs(range(nil, 1, maxCollectibleID)) do
23
+ for ____, collectibleType in ipairs(range(nil, 1, maxCollectibleType)) do
24
24
  if collectibleHasCacheFlag(nil, collectibleType, cacheFlag) then
25
25
  collectiblesSet:add(collectibleType)
26
26
  end
@@ -4,7 +4,7 @@ local Set = ____lualib.Set
4
4
  local __TS__New = ____lualib.__TS__New
5
5
  local ____exports = {}
6
6
  local ____collectibles = require("functions.collectibles")
7
- local getMaxCollectibleID = ____collectibles.getMaxCollectibleID
7
+ local getMaxCollectibleType = ____collectibles.getMaxCollectibleType
8
8
  local ____math = require("functions.math")
9
9
  local range = ____math.range
10
10
  local ____set = require("functions.set")
@@ -12,8 +12,8 @@ local copySet = ____set.copySet
12
12
  local COLLECTIBLE_SET = __TS__New(Set)
13
13
  local function initCollectibleSet(self)
14
14
  local itemConfig = Isaac.GetItemConfig()
15
- local maxCollectibleID = getMaxCollectibleID(nil)
16
- for ____, collectibleType in ipairs(range(nil, 1, maxCollectibleID)) do
15
+ local maxCollectibleType = getMaxCollectibleType(nil)
16
+ for ____, collectibleType in ipairs(range(nil, 1, maxCollectibleType)) do
17
17
  local itemConfigItem = itemConfig:GetCollectible(collectibleType)
18
18
  if itemConfigItem ~= nil then
19
19
  COLLECTIBLE_SET:add(collectibleType)
@@ -49,7 +49,7 @@ export declare function getCollectibleMaxCharges(collectibleType: CollectibleTyp
49
49
  export declare function getCollectibleName(collectibleType: CollectibleType | int): string;
50
50
  /** Helper function to get all of the collectible entities in the room. */
51
51
  export declare function getCollectibles(matchingSubType?: number): EntityPickup[];
52
- export declare function getMaxCollectibleID(): int;
52
+ export declare function getMaxCollectibleType(): int;
53
53
  /**
54
54
  * Returns whether or not the given collectible is a "glitched" item. All items are replaced by
55
55
  * glitched items once a player has TMTRAINER. However, glitched items can also "naturally" appear
@@ -141,7 +141,7 @@ function ____exports.getCollectibles(self, matchingSubType)
141
141
  end
142
142
  return getPickups(nil, PickupVariant.PICKUP_COLLECTIBLE, matchingSubType)
143
143
  end
144
- function ____exports.getMaxCollectibleID(self)
144
+ function ____exports.getMaxCollectibleType(self)
145
145
  local itemConfig = Isaac.GetItemConfig()
146
146
  return itemConfig:GetCollectibles().Size - 1
147
147
  end
@@ -88,3 +88,9 @@ export declare function openDoorFast(door: GridEntityDoor): void;
88
88
  * @returns The number of doors removed.
89
89
  */
90
90
  export declare function removeAllDoors(...roomTypes: RoomType[]): int;
91
+ /**
92
+ * Helper function to remove the door(s) provided.
93
+ *
94
+ * This function is variadic, meaning that you can specify as many doors as you want to remove.
95
+ */
96
+ export declare function removeDoors(...doors: GridEntityDoor[]): void;
@@ -191,4 +191,12 @@ function ____exports.removeAllDoors(self, ...)
191
191
  end
192
192
  return numDoorsRemoved
193
193
  end
194
+ function ____exports.removeDoors(self, ...)
195
+ local doors = {...}
196
+ local game = Game()
197
+ local room = game:GetRoom()
198
+ for ____, door in ipairs(doors) do
199
+ room:RemoveDoor(door.Slot)
200
+ end
201
+ end
194
202
  return ____exports
@@ -9,7 +9,7 @@ local ____transformationNameMap = require("maps.transformationNameMap")
9
9
  local TRANSFORMATION_NAME_MAP = ____transformationNameMap.TRANSFORMATION_NAME_MAP
10
10
  local ____collectibles = require("functions.collectibles")
11
11
  local collectibleHasTag = ____collectibles.collectibleHasTag
12
- local getMaxCollectibleID = ____collectibles.getMaxCollectibleID
12
+ local getMaxCollectibleType = ____collectibles.getMaxCollectibleType
13
13
  local ____math = require("functions.math")
14
14
  local range = ____math.range
15
15
  local ____set = require("functions.set")
@@ -33,14 +33,14 @@ local TRANSFORMATIONS_THAT_GRANT_FLYING = __TS__New(Set, {PlayerForm.PLAYERFORM_
33
33
  local TRANSFORMATION_TO_COLLECTIBLE_TYPES_MAP = __TS__New(Map)
34
34
  local COLLECTIBLE_TYPE_TO_TRANSFORMATION_MAP = __TS__New(Map)
35
35
  local function initMaps(self)
36
- local maxCollectibleID = getMaxCollectibleID(nil)
36
+ local maxCollectibleType = getMaxCollectibleType(nil)
37
37
  for ____, playerForm in __TS__Iterator(TRANSFORMATION_TO_TAG_MAP:keys()) do
38
38
  TRANSFORMATION_TO_COLLECTIBLE_TYPES_MAP:set(
39
39
  playerForm,
40
40
  __TS__New(Set)
41
41
  )
42
42
  end
43
- for ____, collectibleType in ipairs(range(nil, 1, maxCollectibleID)) do
43
+ for ____, collectibleType in ipairs(range(nil, 1, maxCollectibleType)) do
44
44
  for ____, ____value in __TS__Iterator(TRANSFORMATION_TO_TAG_MAP:entries()) do
45
45
  local playerForm = ____value[1]
46
46
  local tag = ____value[2]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.67",
3
+ "version": "1.2.68",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",