isaacscript-common 29.7.0 → 29.9.0

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.
@@ -5106,8 +5106,11 @@ export declare function getFlagName<T extends BitFlag | BitFlag128>(flag: BitFla
5106
5106
  * that is indexed by the room's safe grid index.
5107
5107
  *
5108
5108
  * This function automatically accounts for whether or not MinimapAPI is being used.
5109
+ *
5110
+ * @param minimapAPI Optional. Whether or not MinimapAPI should be used, if present. Default is
5111
+ * true.
5109
5112
  */
5110
- export declare function getFloorDisplayFlags(): Map<int, BitFlags<DisplayFlag>>;
5113
+ export declare function getFloorDisplayFlags(minimapAPI?: boolean): Map<int, BitFlags<DisplayFlag>>;
5111
5114
 
5112
5115
  /**
5113
5116
  * Helper function to get the corresponding golden trinket type from a normal trinket type.
@@ -6312,8 +6315,10 @@ export declare function getRoomDescriptorsForType(...roomTypes: RoomType[]): Roo
6312
6315
  * This function automatically accounts for whether or not MinimapAPI is being used.
6313
6316
  *
6314
6317
  * @param roomGridIndex Optional. Default is the current room index.
6318
+ * @param minimapAPI Optional. Whether or not MinimapAPI should be used, if present. Default is
6319
+ * true.
6315
6320
  */
6316
- export declare function getRoomDisplayFlags(roomGridIndex?: int): BitFlags<DisplayFlag>;
6321
+ export declare function getRoomDisplayFlags(roomGridIndex?: int, minimapAPI?: boolean): BitFlags<DisplayFlag>;
6317
6322
 
6318
6323
  /**
6319
6324
  * Helper function to get the grid index of the current room.
@@ -6915,6 +6920,13 @@ export declare function getTSTLClassName(object: unknown): string | undefined;
6915
6920
  */
6916
6921
  export declare function getUnusedDoorSlots(): DoorSlot[];
6917
6922
 
6923
+ /**
6924
+ * Helper function to find the active slots that the player has the corresponding collectible type
6925
+ * in and have enough charge to be used. Returns an empty array if the player does not have the
6926
+ * collectible in any active slot or does not have enough charges.
6927
+ */
6928
+ export declare function getUsableActiveItemSlots(player: EntityPlayer, collectibleType: CollectibleType): ActiveSlot[];
6929
+
6918
6930
  /**
6919
6931
  * Helper function to get an array with every valid vanilla card sub-type.
6920
6932
  *
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 29.7.0
3
+ isaacscript-common 29.9.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -25339,6 +25339,8 @@ end
25339
25339
  return ____exports
25340
25340
  end,
25341
25341
  ["src.functions.charge"] = function(...)
25342
+ local ____lualib = require("lualib_bundle")
25343
+ local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
25342
25344
  local ____exports = {}
25343
25345
  local getChargesToAddWithAAAModifier, shouldPlayFullRechargeSound
25344
25346
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
@@ -25355,6 +25357,8 @@ local getCollectibleChargeType = ____collectibles.getCollectibleChargeType
25355
25357
  local getCollectibleMaxCharges = ____collectibles.getCollectibleMaxCharges
25356
25358
  local ____playerIndex = require("src.functions.playerIndex")
25357
25359
  local getPlayers = ____playerIndex.getPlayers
25360
+ local ____players = require("src.functions.players")
25361
+ local getActiveItemSlots = ____players.getActiveItemSlots
25358
25362
  local ____roomShape = require("src.functions.roomShape")
25359
25363
  local getRoomShapeCharges = ____roomShape.getRoomShapeCharges
25360
25364
  function ____exports.addCharge(self, player, activeSlot, numCharges, playSoundEffect)
@@ -25489,6 +25493,17 @@ function ____exports.addRoomClearCharges(self, bigRoomDoubleCharge)
25489
25493
  ____exports.addRoomClearCharge(nil, player, bigRoomDoubleCharge)
25490
25494
  end
25491
25495
  end
25496
+ function ____exports.getUsableActiveItemSlots(self, player, collectibleType)
25497
+ local maxCharges = getCollectibleMaxCharges(nil, collectibleType)
25498
+ local activeSlots = getActiveItemSlots(nil, player, collectibleType)
25499
+ return __TS__ArrayFilter(
25500
+ activeSlots,
25501
+ function(____, activeSlot)
25502
+ local totalCharge = ____exports.getTotalCharge(nil, player, activeSlot)
25503
+ return totalCharge >= maxCharges
25504
+ end
25505
+ )
25506
+ end
25492
25507
  function ____exports.isActiveSlotDoubleCharged(self, player, activeSlot)
25493
25508
  if activeSlot == nil then
25494
25509
  activeSlot = ActiveSlot.PRIMARY
@@ -53181,11 +53196,14 @@ local getRoomDescriptor = ____roomData.getRoomDescriptor
53181
53196
  local getRoomGridIndex = ____roomData.getRoomGridIndex
53182
53197
  local ____rooms = require("src.functions.rooms")
53183
53198
  local getRoomsInsideGrid = ____rooms.getRoomsInsideGrid
53184
- function ____exports.getRoomDisplayFlags(self, roomGridIndex)
53199
+ function ____exports.getRoomDisplayFlags(self, roomGridIndex, minimapAPI)
53200
+ if minimapAPI == nil then
53201
+ minimapAPI = true
53202
+ end
53185
53203
  if roomGridIndex == nil then
53186
53204
  roomGridIndex = getRoomGridIndex(nil)
53187
53205
  end
53188
- if MinimapAPI == nil then
53206
+ if MinimapAPI == nil or not minimapAPI then
53189
53207
  local roomDescriptor = getRoomDescriptor(nil, roomGridIndex)
53190
53208
  return roomDescriptor.DisplayFlags
53191
53209
  end
@@ -53240,11 +53258,14 @@ end
53240
53258
  function ____exports.clearRoomDisplayFlags(self, roomGridIndex)
53241
53259
  ____exports.setRoomDisplayFlags(nil, roomGridIndex, DisplayFlagZero)
53242
53260
  end
53243
- function ____exports.getFloorDisplayFlags(self)
53261
+ function ____exports.getFloorDisplayFlags(self, minimapAPI)
53262
+ if minimapAPI == nil then
53263
+ minimapAPI = true
53264
+ end
53244
53265
  local displayFlagsMap = __TS__New(Map)
53245
53266
  for ____, roomDescriptor in ipairs(getRoomsInsideGrid(nil)) do
53246
53267
  local roomGridIndex = roomDescriptor.SafeGridIndex
53247
- local displayFlags = ____exports.getRoomDisplayFlags(nil, roomGridIndex)
53268
+ local displayFlags = ____exports.getRoomDisplayFlags(nil, roomGridIndex, minimapAPI)
53248
53269
  displayFlagsMap:set(roomGridIndex, displayFlags)
53249
53270
  end
53250
53271
  return displayFlagsMap
@@ -1,4 +1,4 @@
1
- import { ActiveSlot } from "isaac-typescript-definitions";
1
+ import { ActiveSlot, CollectibleType } from "isaac-typescript-definitions";
2
2
  /**
3
3
  * Helper function to add a charge to the player's active item. Will flash the HUD and play the
4
4
  * appropriate sound effect, depending on whether the charge is partially full or completely full.
@@ -90,6 +90,12 @@ export declare function getChargesAwayFromMax(player: EntityPlayer, activeSlot?:
90
90
  * @param activeSlot Optional. The slot to get the charges from. Default is `ActiveSlot.PRIMARY`.
91
91
  */
92
92
  export declare function getTotalCharge(player: EntityPlayer, activeSlot?: ActiveSlot): int;
93
+ /**
94
+ * Helper function to find the active slots that the player has the corresponding collectible type
95
+ * in and have enough charge to be used. Returns an empty array if the player does not have the
96
+ * collectible in any active slot or does not have enough charges.
97
+ */
98
+ export declare function getUsableActiveItemSlots(player: EntityPlayer, collectibleType: CollectibleType): ActiveSlot[];
93
99
  /**
94
100
  * Helper function to check if a player's active item is "double charged", meaning that it has both
95
101
  * a full normal charge and a full charge from The Battery.
@@ -1 +1 @@
1
- {"version":3,"file":"charge.d.ts","sourceRoot":"","sources":["../../../src/functions/charge.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAKX,MAAM,8BAA8B,CAAC;AAStC;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,SAAS,CACvB,MAAM,EAAE,YAAY,EACpB,UAAU,aAAqB,EAC/B,UAAU,SAAI,EACd,eAAe,UAAO,GACrB,GAAG,CA+BL;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,YAAY,EACpB,mBAAmB,UAAO,EAC1B,eAAe,UAAO,GACrB,IAAI,CAaN;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,YAAY,EACpB,UAAU,aAAqB,EAC/B,mBAAmB,UAAO,EAC1B,eAAe,UAAO,GACrB,IAAI,CA4BN;AAqBD;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,mBAAmB,UAAO,GAAG,IAAI,CAIpE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,EAAE,YAAY,EACpB,UAAU,aAAqB,GAC9B,GAAG,CAKL;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,UAAU,EAAE,CAOd;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,YAAY,EACpB,UAAU,aAAqB,GAC9B,OAAO,CAMT;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,YAAY,EACpB,UAAU,aAAqB,GAC9B,IAAI,CAYN"}
@@ -1,3 +1,5 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
1
3
  local ____exports = {}
2
4
  local getChargesToAddWithAAAModifier, shouldPlayFullRechargeSound
3
5
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
@@ -14,6 +16,8 @@ local getCollectibleChargeType = ____collectibles.getCollectibleChargeType
14
16
  local getCollectibleMaxCharges = ____collectibles.getCollectibleMaxCharges
15
17
  local ____playerIndex = require("src.functions.playerIndex")
16
18
  local getPlayers = ____playerIndex.getPlayers
19
+ local ____players = require("src.functions.players")
20
+ local getActiveItemSlots = ____players.getActiveItemSlots
17
21
  local ____roomShape = require("src.functions.roomShape")
18
22
  local getRoomShapeCharges = ____roomShape.getRoomShapeCharges
19
23
  --- Helper function to add a charge to the player's active item. Will flash the HUD and play the
@@ -227,6 +231,20 @@ function ____exports.addRoomClearCharges(self, bigRoomDoubleCharge)
227
231
  ____exports.addRoomClearCharge(nil, player, bigRoomDoubleCharge)
228
232
  end
229
233
  end
234
+ --- Helper function to find the active slots that the player has the corresponding collectible type
235
+ -- in and have enough charge to be used. Returns an empty array if the player does not have the
236
+ -- collectible in any active slot or does not have enough charges.
237
+ function ____exports.getUsableActiveItemSlots(self, player, collectibleType)
238
+ local maxCharges = getCollectibleMaxCharges(nil, collectibleType)
239
+ local activeSlots = getActiveItemSlots(nil, player, collectibleType)
240
+ return __TS__ArrayFilter(
241
+ activeSlots,
242
+ function(____, activeSlot)
243
+ local totalCharge = ____exports.getTotalCharge(nil, player, activeSlot)
244
+ return totalCharge >= maxCharges
245
+ end
246
+ )
247
+ end
230
248
  --- Helper function to check if a player's active item is "double charged", meaning that it has both
231
249
  -- a full normal charge and a full charge from The Battery.
232
250
  --
@@ -38,8 +38,11 @@ export declare function clearRoomDisplayFlags(roomGridIndex: int): void;
38
38
  * that is indexed by the room's safe grid index.
39
39
  *
40
40
  * This function automatically accounts for whether or not MinimapAPI is being used.
41
+ *
42
+ * @param minimapAPI Optional. Whether or not MinimapAPI should be used, if present. Default is
43
+ * true.
41
44
  */
42
- export declare function getFloorDisplayFlags(): Map<int, BitFlags<DisplayFlag>>;
45
+ export declare function getFloorDisplayFlags(minimapAPI?: boolean): Map<int, BitFlags<DisplayFlag>>;
43
46
  /**
44
47
  * Helper function to get a particular room's minimap display flags (e.g. whether or not it is
45
48
  * visible and so on).
@@ -47,8 +50,10 @@ export declare function getFloorDisplayFlags(): Map<int, BitFlags<DisplayFlag>>;
47
50
  * This function automatically accounts for whether or not MinimapAPI is being used.
48
51
  *
49
52
  * @param roomGridIndex Optional. Default is the current room index.
53
+ * @param minimapAPI Optional. Whether or not MinimapAPI should be used, if present. Default is
54
+ * true.
50
55
  */
51
- export declare function getRoomDisplayFlags(roomGridIndex?: int): BitFlags<DisplayFlag>;
56
+ export declare function getRoomDisplayFlags(roomGridIndex?: int, minimapAPI?: boolean): BitFlags<DisplayFlag>;
52
57
  /**
53
58
  * Helper function to hide a specific room on the minimap.
54
59
  *
@@ -1 +1 @@
1
- {"version":3,"file":"minimap.d.ts","sourceRoot":"","sources":["../../../src/functions/minimap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAmB,MAAM,8BAA8B,CAAC;AAM5E;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,aAAa,EAAE,GAAG,GAAG,SAAS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I,IAAI,CAE7C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,GAAG,GAAG,IAAI,CAE9D;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,UAAO,GAChB,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC,CAUjC;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,CAAC,EAAE,GAAG,EACnB,UAAU,UAAO,GAChB,QAAQ,CAAC,WAAW,CAAC,CAiBvB;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,GAAG,GAAG,IAAI,CAe1D;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,IAAI,CAW5E;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,eAAe,EAAE,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC,GAC/C,IAAI,CAWN;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,GAAG,GAAG,SAAS,EAC9B,YAAY,EAAE,QAAQ,CAAC,WAAW,CAAC,EACnC,gBAAgB,UAAO,GACtB,IAAI,CAsBN"}
@@ -20,11 +20,16 @@ local getRoomsInsideGrid = ____rooms.getRoomsInsideGrid
20
20
  -- This function automatically accounts for whether or not MinimapAPI is being used.
21
21
  --
22
22
  -- @param roomGridIndex Optional. Default is the current room index.
23
- function ____exports.getRoomDisplayFlags(self, roomGridIndex)
23
+ -- @param minimapAPI Optional. Whether or not MinimapAPI should be used, if present. Default is
24
+ -- true.
25
+ function ____exports.getRoomDisplayFlags(self, roomGridIndex, minimapAPI)
26
+ if minimapAPI == nil then
27
+ minimapAPI = true
28
+ end
24
29
  if roomGridIndex == nil then
25
30
  roomGridIndex = getRoomGridIndex(nil)
26
31
  end
27
- if MinimapAPI == nil then
32
+ if MinimapAPI == nil or not minimapAPI then
28
33
  local roomDescriptor = getRoomDescriptor(nil, roomGridIndex)
29
34
  return roomDescriptor.DisplayFlags
30
35
  end
@@ -125,11 +130,17 @@ end
125
130
  -- that is indexed by the room's safe grid index.
126
131
  --
127
132
  -- This function automatically accounts for whether or not MinimapAPI is being used.
128
- function ____exports.getFloorDisplayFlags(self)
133
+ --
134
+ -- @param minimapAPI Optional. Whether or not MinimapAPI should be used, if present. Default is
135
+ -- true.
136
+ function ____exports.getFloorDisplayFlags(self, minimapAPI)
137
+ if minimapAPI == nil then
138
+ minimapAPI = true
139
+ end
129
140
  local displayFlagsMap = __TS__New(Map)
130
141
  for ____, roomDescriptor in ipairs(getRoomsInsideGrid(nil)) do
131
142
  local roomGridIndex = roomDescriptor.SafeGridIndex
132
- local displayFlags = ____exports.getRoomDisplayFlags(nil, roomGridIndex)
143
+ local displayFlags = ____exports.getRoomDisplayFlags(nil, roomGridIndex, minimapAPI)
133
144
  displayFlagsMap:set(roomGridIndex, displayFlags)
134
145
  end
135
146
  return displayFlagsMap
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "29.7.0",
3
+ "version": "29.9.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -11,6 +11,7 @@ import {
11
11
  getCollectibleMaxCharges,
12
12
  } from "./collectibles";
13
13
  import { getPlayers } from "./playerIndex";
14
+ import { getActiveItemSlots } from "./players";
14
15
  import { getRoomShapeCharges } from "./roomShape";
15
16
 
16
17
  /**
@@ -238,6 +239,23 @@ export function getTotalCharge(
238
239
  return activeCharge + batteryCharge;
239
240
  }
240
241
 
242
+ /**
243
+ * Helper function to find the active slots that the player has the corresponding collectible type
244
+ * in and have enough charge to be used. Returns an empty array if the player does not have the
245
+ * collectible in any active slot or does not have enough charges.
246
+ */
247
+ export function getUsableActiveItemSlots(
248
+ player: EntityPlayer,
249
+ collectibleType: CollectibleType,
250
+ ): ActiveSlot[] {
251
+ const maxCharges = getCollectibleMaxCharges(collectibleType);
252
+ const activeSlots = getActiveItemSlots(player, collectibleType);
253
+ return activeSlots.filter((activeSlot) => {
254
+ const totalCharge = getTotalCharge(player, activeSlot);
255
+ return totalCharge >= maxCharges;
256
+ });
257
+ }
258
+
241
259
  /**
242
260
  * Helper function to check if a player's active item is "double charged", meaning that it has both
243
261
  * a full normal charge and a full charge from The Battery.
@@ -58,13 +58,18 @@ export function clearRoomDisplayFlags(roomGridIndex: int): void {
58
58
  * that is indexed by the room's safe grid index.
59
59
  *
60
60
  * This function automatically accounts for whether or not MinimapAPI is being used.
61
+ *
62
+ * @param minimapAPI Optional. Whether or not MinimapAPI should be used, if present. Default is
63
+ * true.
61
64
  */
62
- export function getFloorDisplayFlags(): Map<int, BitFlags<DisplayFlag>> {
65
+ export function getFloorDisplayFlags(
66
+ minimapAPI = true,
67
+ ): Map<int, BitFlags<DisplayFlag>> {
63
68
  const displayFlagsMap = new Map<int, BitFlags<DisplayFlag>>();
64
69
 
65
70
  for (const roomDescriptor of getRoomsInsideGrid()) {
66
71
  const roomGridIndex = roomDescriptor.SafeGridIndex;
67
- const displayFlags = getRoomDisplayFlags(roomGridIndex);
72
+ const displayFlags = getRoomDisplayFlags(roomGridIndex, minimapAPI);
68
73
  displayFlagsMap.set(roomGridIndex, displayFlags);
69
74
  }
70
75
 
@@ -78,15 +83,18 @@ export function getFloorDisplayFlags(): Map<int, BitFlags<DisplayFlag>> {
78
83
  * This function automatically accounts for whether or not MinimapAPI is being used.
79
84
  *
80
85
  * @param roomGridIndex Optional. Default is the current room index.
86
+ * @param minimapAPI Optional. Whether or not MinimapAPI should be used, if present. Default is
87
+ * true.
81
88
  */
82
89
  export function getRoomDisplayFlags(
83
90
  roomGridIndex?: int,
91
+ minimapAPI = true,
84
92
  ): BitFlags<DisplayFlag> {
85
93
  if (roomGridIndex === undefined) {
86
94
  roomGridIndex = getRoomGridIndex();
87
95
  }
88
96
 
89
- if (MinimapAPI === undefined) {
97
+ if (MinimapAPI === undefined || !minimapAPI) {
90
98
  const roomDescriptor = getRoomDescriptor(roomGridIndex);
91
99
  return roomDescriptor.DisplayFlags;
92
100
  }