isaacscript-common 43.1.0 → 44.0.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.
@@ -8335,7 +8335,7 @@ export declare enum ISCFeature {
8335
8335
  PAUSE = 37,
8336
8336
  PERSISTENT_ENTITIES = 38,
8337
8337
  PICKUP_INDEX_CREATION = 39,
8338
- PLAYER_INVENTORY = 40,
8338
+ PLAYER_COLLECTIBLE_TRACKING = 40,
8339
8339
  PONY_DETECTION = 41,
8340
8340
  PRESS_INPUT = 42,
8341
8341
  PREVENT_CHILD_ENTITIES = 43,
@@ -8400,7 +8400,7 @@ declare interface ISCFeatureToClass {
8400
8400
  [ISCFeature.PAUSE]: Pause;
8401
8401
  [ISCFeature.PERSISTENT_ENTITIES]: PersistentEntities;
8402
8402
  [ISCFeature.PICKUP_INDEX_CREATION]: PickupIndexCreation;
8403
- [ISCFeature.PLAYER_INVENTORY]: PlayerInventory;
8403
+ [ISCFeature.PLAYER_COLLECTIBLE_TRACKING]: PlayerCollectibleTracking;
8404
8404
  [ISCFeature.PONY_DETECTION]: PonyDetection;
8405
8405
  [ISCFeature.PRESS_INPUT]: PressInput;
8406
8406
  [ISCFeature.PREVENT_CHILD_ENTITIES]: PreventChildEntities;
@@ -14248,6 +14248,45 @@ declare class PlayerCollectibleDetection extends Feature {
14248
14248
  private checkActiveItemsChanged;
14249
14249
  }
14250
14250
 
14251
+ declare class PlayerCollectibleTracking extends Feature {
14252
+ private readonly postPlayerCollectibleAdded;
14253
+ private readonly postPlayerCollectibleRemoved;
14254
+ /**
14255
+ * Helper function to get all of the collectible types that the player has gotten so far on this
14256
+ * run, in order.
14257
+ *
14258
+ * In the case of items given on the first frame of the run or the case where the player rerolls
14259
+ * their build in the middle of the run (e.g. with D4), the order of the collectible types will
14260
+ * not correspond to the order that the items were actually given to the player. In this case, the
14261
+ * order will be from the lowest `CollectibleType` to the highest.
14262
+ *
14263
+ * Under the hood, this feature works by tracking the number of collectibles that a player has on
14264
+ * every frame. Thus, in a situation where a collectible was both added and removed to the player
14265
+ * on the same frame, the amount of total collectibles would stay the same, and the collectible
14266
+ * types would not be updated. In vanilla, this situation would never happen, but another mod
14267
+ * might do this for some reason. (With that said, the next time that a collectible is normally
14268
+ * added or removed, it would trigger a re-scan, and the previous changes would be picked up.)
14269
+ *
14270
+ * In order to use this function, you must upgrade your mod with
14271
+ * `ISCFeature.PLAYER_COLLECTIBLE_TRACKING`.
14272
+ *
14273
+ * @param player The player to get the collectible types for.
14274
+ * @param includeActiveCollectibles Optional. If true, will include all active collectibles.
14275
+ * Default is true.
14276
+ */
14277
+ getPlayerCollectibleTypes(player: EntityPlayer, includeActiveCollectibles?: boolean): readonly CollectibleType[];
14278
+ /**
14279
+ * Helper function to get the last passive collectible type that the player picked up. In most
14280
+ * cases, this will be the passive that would be removed if the player used Clicker.
14281
+ *
14282
+ * Returns undefined if the player does not have any passive collectibles.
14283
+ *
14284
+ * In order to use this function, you must upgrade your mod with
14285
+ * `ISCFeature.PLAYER_COLLECTIBLE_TRACKING`.
14286
+ */
14287
+ getPlayerLastPassiveCollectibleType(player: EntityPlayer): CollectibleType | undefined;
14288
+ }
14289
+
14251
14290
  /**
14252
14291
  * Helper function to remove all of a player's black hearts and add the corresponding amount of soul
14253
14292
  * hearts.
@@ -14303,43 +14342,6 @@ export declare type PlayerIndex = int & {
14303
14342
  readonly __playerIndexBrand: symbol;
14304
14343
  };
14305
14344
 
14306
- declare class PlayerInventory extends Feature {
14307
- private readonly postCollectibleAdded;
14308
- private readonly postCollectibleRemoved;
14309
- /**
14310
- * Helper function to get all of the collectibles that the player has gotten so far on this run,
14311
- * in order.
14312
- *
14313
- * In the case of inventory initialization or the case where the player rerolls their build in the
14314
- * middle of the run (e.g. with D4), the order of the inventory will not correspond to the order
14315
- * that the items were actually given to the player. In this case, the inventory will be in the
14316
- * order of the lowest `CollectibleType` to the highest.
14317
- *
14318
- * Under the hood, the inventory tracking works by tracking the number of collectibles that a
14319
- * player has on every frame. Thus, in a situation where a collectible was both added and removed
14320
- * to the player on the same frame, the amount of total collectibles would stay the same, and the
14321
- * inventory would not be updated. In vanilla, this situation would never happen, but another mod
14322
- * might do this for some reason. (With that said, the next time that a collectible is normally
14323
- * added or removed, it would trigger a re-scan, and the previous changes would be picked up.)
14324
- *
14325
- * In order to use this function, you must upgrade your mod with `ISCFeature.PLAYER_INVENTORY`.
14326
- *
14327
- * @param player The player to get the inventory for.
14328
- * @param includeActiveCollectibles Optional. If true, will include all active collectibles.
14329
- * Default is true.
14330
- */
14331
- getPlayerInventory(player: EntityPlayer, includeActiveCollectibles?: boolean): CollectibleType[];
14332
- /**
14333
- * Helper function to get the last passive collectible that the player picked up. In most cases,
14334
- * this will be the passive that is removed when the player would use Clicker.
14335
- *
14336
- * Returns undefined if the player does not have any passive collectibles.
14337
- *
14338
- * In order to use this function, you must upgrade your mod with `ISCFeature.PLAYER_INVENTORY`.
14339
- */
14340
- getPlayerLastPassiveCollectible(player: EntityPlayer): CollectibleType | undefined;
14341
- }
14342
-
14343
14345
  declare class PlayerReorderedCallbacks extends Feature {
14344
14346
  v: {
14345
14347
  run: {
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 43.1.0
3
+ isaacscript-common 44.0.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -17477,8 +17477,8 @@ ____exports.ISCFeature.PERSISTENT_ENTITIES = 38
17477
17477
  ____exports.ISCFeature[____exports.ISCFeature.PERSISTENT_ENTITIES] = "PERSISTENT_ENTITIES"
17478
17478
  ____exports.ISCFeature.PICKUP_INDEX_CREATION = 39
17479
17479
  ____exports.ISCFeature[____exports.ISCFeature.PICKUP_INDEX_CREATION] = "PICKUP_INDEX_CREATION"
17480
- ____exports.ISCFeature.PLAYER_INVENTORY = 40
17481
- ____exports.ISCFeature[____exports.ISCFeature.PLAYER_INVENTORY] = "PLAYER_INVENTORY"
17480
+ ____exports.ISCFeature.PLAYER_COLLECTIBLE_TRACKING = 40
17481
+ ____exports.ISCFeature[____exports.ISCFeature.PLAYER_COLLECTIBLE_TRACKING] = "PLAYER_COLLECTIBLE_TRACKING"
17482
17482
  ____exports.ISCFeature.PONY_DETECTION = 41
17483
17483
  ____exports.ISCFeature[____exports.ISCFeature.PONY_DETECTION] = "PONY_DETECTION"
17484
17484
  ____exports.ISCFeature.PRESS_INPUT = 42
@@ -51625,7 +51625,7 @@ end
51625
51625
  __TS__DecorateLegacy({Exported}, PersistentEntities.prototype, "spawnPersistentEntity", true)
51626
51626
  return ____exports
51627
51627
  end,
51628
- ["src.classes.features.other.PlayerInventory"] = function(...)
51628
+ ["src.classes.features.other.PlayerCollectibleTracking"] = function(...)
51629
51629
  local ____lualib = require("lualib_bundle")
51630
51630
  local __TS__New = ____lualib.__TS__New
51631
51631
  local __TS__Class = ____lualib.__TS__Class
@@ -51640,7 +51640,6 @@ local ____ModCallbackCustom = require("src.enums.ModCallbackCustom")
51640
51640
  local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
51641
51641
  local ____array = require("src.functions.array")
51642
51642
  local arrayRemoveInPlace = ____array.arrayRemoveInPlace
51643
- local copyArray = ____array.copyArray
51644
51643
  local ____collectibles = require("src.functions.collectibles")
51645
51644
  local isActiveCollectible = ____collectibles.isActiveCollectible
51646
51645
  local ____playerDataStructures = require("src.functions.playerDataStructures")
@@ -51649,46 +51648,46 @@ local ____DefaultMap = require("src.classes.DefaultMap")
51649
51648
  local DefaultMap = ____DefaultMap.DefaultMap
51650
51649
  local ____Feature = require("src.classes.private.Feature")
51651
51650
  local Feature = ____Feature.Feature
51652
- local v = {run = {playersInventory = __TS__New(
51651
+ local v = {run = {playersCollectibleTypes = __TS__New(
51653
51652
  DefaultMap,
51654
51653
  function() return {} end
51655
51654
  )}}
51656
- ____exports.PlayerInventory = __TS__Class()
51657
- local PlayerInventory = ____exports.PlayerInventory
51658
- PlayerInventory.name = "PlayerInventory"
51659
- __TS__ClassExtends(PlayerInventory, Feature)
51660
- function PlayerInventory.prototype.____constructor(self)
51655
+ ____exports.PlayerCollectibleTracking = __TS__Class()
51656
+ local PlayerCollectibleTracking = ____exports.PlayerCollectibleTracking
51657
+ PlayerCollectibleTracking.name = "PlayerCollectibleTracking"
51658
+ __TS__ClassExtends(PlayerCollectibleTracking, Feature)
51659
+ function PlayerCollectibleTracking.prototype.____constructor(self)
51661
51660
  Feature.prototype.____constructor(self)
51662
51661
  self.v = v
51663
- self.postCollectibleAdded = function(____, player, collectibleType)
51664
- local inventory = defaultMapGetPlayer(nil, v.run.playersInventory, player, player)
51665
- inventory[#inventory + 1] = collectibleType
51662
+ self.postPlayerCollectibleAdded = function(____, player, collectibleType)
51663
+ local collectibleTypes = defaultMapGetPlayer(nil, v.run.playersCollectibleTypes, player, player)
51664
+ collectibleTypes[#collectibleTypes + 1] = collectibleType
51666
51665
  end
51667
- self.postCollectibleRemoved = function(____, player, collectibleType)
51668
- local inventory = defaultMapGetPlayer(nil, v.run.playersInventory, player, player)
51669
- arrayRemoveInPlace(nil, inventory, collectibleType)
51666
+ self.postPlayerCollectibleRemoved = function(____, player, collectibleType)
51667
+ local collectibleTypes = defaultMapGetPlayer(nil, v.run.playersCollectibleTypes, player, player)
51668
+ arrayRemoveInPlace(nil, collectibleTypes, collectibleType)
51670
51669
  end
51671
- self.customCallbacksUsed = {{ModCallbackCustom.POST_PLAYER_COLLECTIBLE_ADDED, self.postCollectibleAdded}, {ModCallbackCustom.POST_PLAYER_COLLECTIBLE_REMOVED, self.postCollectibleRemoved}}
51670
+ self.customCallbacksUsed = {{ModCallbackCustom.POST_PLAYER_COLLECTIBLE_ADDED, self.postPlayerCollectibleAdded}, {ModCallbackCustom.POST_PLAYER_COLLECTIBLE_REMOVED, self.postPlayerCollectibleRemoved}}
51672
51671
  end
51673
- function PlayerInventory.prototype.getPlayerInventory(self, player, includeActiveCollectibles)
51672
+ function PlayerCollectibleTracking.prototype.getPlayerCollectibleTypes(self, player, includeActiveCollectibles)
51674
51673
  if includeActiveCollectibles == nil then
51675
51674
  includeActiveCollectibles = true
51676
51675
  end
51677
- local inventory = defaultMapGetPlayer(nil, v.run.playersInventory, player, player)
51676
+ local collectibleTypes = defaultMapGetPlayer(nil, v.run.playersCollectibleTypes, player, player)
51678
51677
  if includeActiveCollectibles then
51679
- return copyArray(nil, inventory)
51678
+ return collectibleTypes
51680
51679
  end
51681
51680
  return __TS__ArrayFilter(
51682
- inventory,
51681
+ collectibleTypes,
51683
51682
  function(____, collectibleType) return not isActiveCollectible(nil, collectibleType) end
51684
51683
  )
51685
51684
  end
51686
- __TS__DecorateLegacy({Exported}, PlayerInventory.prototype, "getPlayerInventory", true)
51687
- function PlayerInventory.prototype.getPlayerLastPassiveCollectible(self, player)
51688
- local inventory = self:getPlayerInventory(player, false)
51689
- return __TS__ArrayAt(inventory, -1)
51685
+ __TS__DecorateLegacy({Exported}, PlayerCollectibleTracking.prototype, "getPlayerCollectibleTypes", true)
51686
+ function PlayerCollectibleTracking.prototype.getPlayerLastPassiveCollectibleType(self, player)
51687
+ local collectibleTypes = self:getPlayerCollectibleTypes(player, false)
51688
+ return __TS__ArrayAt(collectibleTypes, -1)
51690
51689
  end
51691
- __TS__DecorateLegacy({Exported}, PlayerInventory.prototype, "getPlayerLastPassiveCollectible", true)
51690
+ __TS__DecorateLegacy({Exported}, PlayerCollectibleTracking.prototype, "getPlayerLastPassiveCollectibleType", true)
51692
51691
  return ____exports
51693
51692
  end,
51694
51693
  ["src.classes.features.other.PreventChildEntities"] = function(...)
@@ -52456,8 +52455,8 @@ local ____PersistentEntities = require("src.classes.features.other.PersistentEnt
52456
52455
  local PersistentEntities = ____PersistentEntities.PersistentEntities
52457
52456
  local ____PickupIndexCreation = require("src.classes.features.other.PickupIndexCreation")
52458
52457
  local PickupIndexCreation = ____PickupIndexCreation.PickupIndexCreation
52459
- local ____PlayerInventory = require("src.classes.features.other.PlayerInventory")
52460
- local PlayerInventory = ____PlayerInventory.PlayerInventory
52458
+ local ____PlayerCollectibleTracking = require("src.classes.features.other.PlayerCollectibleTracking")
52459
+ local PlayerCollectibleTracking = ____PlayerCollectibleTracking.PlayerCollectibleTracking
52461
52460
  local ____PonyDetection = require("src.classes.features.other.PonyDetection")
52462
52461
  local PonyDetection = ____PonyDetection.PonyDetection
52463
52462
  local ____PressInput = require("src.classes.features.other.PressInput")
@@ -52600,7 +52599,7 @@ function ____exports.getFeatures(self, mod, callbacks)
52600
52599
  [ISCFeature.PAUSE] = pause,
52601
52600
  [ISCFeature.PERSISTENT_ENTITIES] = __TS__New(PersistentEntities, roomHistory),
52602
52601
  [ISCFeature.PICKUP_INDEX_CREATION] = pickupIndexCreation,
52603
- [ISCFeature.PLAYER_INVENTORY] = __TS__New(PlayerInventory),
52602
+ [ISCFeature.PLAYER_COLLECTIBLE_TRACKING] = __TS__New(PlayerCollectibleTracking),
52604
52603
  [ISCFeature.PONY_DETECTION] = ponyDetection,
52605
52604
  [ISCFeature.PRESS_INPUT] = pressInput,
52606
52605
  [ISCFeature.PREVENT_CHILD_ENTITIES] = __TS__New(PreventChildEntities),
@@ -0,0 +1,41 @@
1
+ import type { CollectibleType } from "isaac-typescript-definitions";
2
+ import { Feature } from "../../private/Feature";
3
+ export declare class PlayerCollectibleTracking extends Feature {
4
+ private readonly postPlayerCollectibleAdded;
5
+ private readonly postPlayerCollectibleRemoved;
6
+ /**
7
+ * Helper function to get all of the collectible types that the player has gotten so far on this
8
+ * run, in order.
9
+ *
10
+ * In the case of items given on the first frame of the run or the case where the player rerolls
11
+ * their build in the middle of the run (e.g. with D4), the order of the collectible types will
12
+ * not correspond to the order that the items were actually given to the player. In this case, the
13
+ * order will be from the lowest `CollectibleType` to the highest.
14
+ *
15
+ * Under the hood, this feature works by tracking the number of collectibles that a player has on
16
+ * every frame. Thus, in a situation where a collectible was both added and removed to the player
17
+ * on the same frame, the amount of total collectibles would stay the same, and the collectible
18
+ * types would not be updated. In vanilla, this situation would never happen, but another mod
19
+ * might do this for some reason. (With that said, the next time that a collectible is normally
20
+ * added or removed, it would trigger a re-scan, and the previous changes would be picked up.)
21
+ *
22
+ * In order to use this function, you must upgrade your mod with
23
+ * `ISCFeature.PLAYER_COLLECTIBLE_TRACKING`.
24
+ *
25
+ * @param player The player to get the collectible types for.
26
+ * @param includeActiveCollectibles Optional. If true, will include all active collectibles.
27
+ * Default is true.
28
+ */
29
+ getPlayerCollectibleTypes(player: EntityPlayer, includeActiveCollectibles?: boolean): readonly CollectibleType[];
30
+ /**
31
+ * Helper function to get the last passive collectible type that the player picked up. In most
32
+ * cases, this will be the passive that would be removed if the player used Clicker.
33
+ *
34
+ * Returns undefined if the player does not have any passive collectibles.
35
+ *
36
+ * In order to use this function, you must upgrade your mod with
37
+ * `ISCFeature.PLAYER_COLLECTIBLE_TRACKING`.
38
+ */
39
+ getPlayerLastPassiveCollectibleType(player: EntityPlayer): CollectibleType | undefined;
40
+ }
41
+ //# sourceMappingURL=PlayerCollectibleTracking.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlayerCollectibleTracking.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/PlayerCollectibleTracking.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAQpE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAYhD,qBAAa,yBAA0B,SAAQ,OAAO;IAqBpD,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAUzC;IAGF,OAAO,CAAC,QAAQ,CAAC,4BAA4B,CAU3C;IAEF;;;;;;;;;;;;;;;;;;;;;;OAsBG;IAEI,yBAAyB,CAC9B,MAAM,EAAE,YAAY,EACpB,yBAAyB,UAAO,GAC/B,SAAS,eAAe,EAAE;IAgB7B;;;;;;;;OAQG;IAEI,mCAAmC,CACxC,MAAM,EAAE,YAAY,GACnB,eAAe,GAAG,SAAS;CAI/B"}
@@ -0,0 +1,63 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__New = ____lualib.__TS__New
3
+ local __TS__Class = ____lualib.__TS__Class
4
+ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
5
+ local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
6
+ local __TS__DecorateLegacy = ____lualib.__TS__DecorateLegacy
7
+ local __TS__ArrayAt = ____lualib.__TS__ArrayAt
8
+ local ____exports = {}
9
+ local ____decorators = require("src.decorators")
10
+ local Exported = ____decorators.Exported
11
+ local ____ModCallbackCustom = require("src.enums.ModCallbackCustom")
12
+ local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
13
+ local ____array = require("src.functions.array")
14
+ local arrayRemoveInPlace = ____array.arrayRemoveInPlace
15
+ local ____collectibles = require("src.functions.collectibles")
16
+ local isActiveCollectible = ____collectibles.isActiveCollectible
17
+ local ____playerDataStructures = require("src.functions.playerDataStructures")
18
+ local defaultMapGetPlayer = ____playerDataStructures.defaultMapGetPlayer
19
+ local ____DefaultMap = require("src.classes.DefaultMap")
20
+ local DefaultMap = ____DefaultMap.DefaultMap
21
+ local ____Feature = require("src.classes.private.Feature")
22
+ local Feature = ____Feature.Feature
23
+ local v = {run = {playersCollectibleTypes = __TS__New(
24
+ DefaultMap,
25
+ function() return {} end
26
+ )}}
27
+ ____exports.PlayerCollectibleTracking = __TS__Class()
28
+ local PlayerCollectibleTracking = ____exports.PlayerCollectibleTracking
29
+ PlayerCollectibleTracking.name = "PlayerCollectibleTracking"
30
+ __TS__ClassExtends(PlayerCollectibleTracking, Feature)
31
+ function PlayerCollectibleTracking.prototype.____constructor(self)
32
+ Feature.prototype.____constructor(self)
33
+ self.v = v
34
+ self.postPlayerCollectibleAdded = function(____, player, collectibleType)
35
+ local collectibleTypes = defaultMapGetPlayer(nil, v.run.playersCollectibleTypes, player, player)
36
+ collectibleTypes[#collectibleTypes + 1] = collectibleType
37
+ end
38
+ self.postPlayerCollectibleRemoved = function(____, player, collectibleType)
39
+ local collectibleTypes = defaultMapGetPlayer(nil, v.run.playersCollectibleTypes, player, player)
40
+ arrayRemoveInPlace(nil, collectibleTypes, collectibleType)
41
+ end
42
+ self.customCallbacksUsed = {{ModCallbackCustom.POST_PLAYER_COLLECTIBLE_ADDED, self.postPlayerCollectibleAdded}, {ModCallbackCustom.POST_PLAYER_COLLECTIBLE_REMOVED, self.postPlayerCollectibleRemoved}}
43
+ end
44
+ function PlayerCollectibleTracking.prototype.getPlayerCollectibleTypes(self, player, includeActiveCollectibles)
45
+ if includeActiveCollectibles == nil then
46
+ includeActiveCollectibles = true
47
+ end
48
+ local collectibleTypes = defaultMapGetPlayer(nil, v.run.playersCollectibleTypes, player, player)
49
+ if includeActiveCollectibles then
50
+ return collectibleTypes
51
+ end
52
+ return __TS__ArrayFilter(
53
+ collectibleTypes,
54
+ function(____, collectibleType) return not isActiveCollectible(nil, collectibleType) end
55
+ )
56
+ end
57
+ __TS__DecorateLegacy({Exported}, PlayerCollectibleTracking.prototype, "getPlayerCollectibleTypes", true)
58
+ function PlayerCollectibleTracking.prototype.getPlayerLastPassiveCollectibleType(self, player)
59
+ local collectibleTypes = self:getPlayerCollectibleTypes(player, false)
60
+ return __TS__ArrayAt(collectibleTypes, -1)
61
+ end
62
+ __TS__DecorateLegacy({Exported}, PlayerCollectibleTracking.prototype, "getPlayerLastPassiveCollectibleType", true)
63
+ return ____exports
@@ -39,7 +39,7 @@ export declare enum ISCFeature {
39
39
  PAUSE = 37,
40
40
  PERSISTENT_ENTITIES = 38,
41
41
  PICKUP_INDEX_CREATION = 39,
42
- PLAYER_INVENTORY = 40,
42
+ PLAYER_COLLECTIBLE_TRACKING = 40,
43
43
  PONY_DETECTION = 41,
44
44
  PRESS_INPUT = 42,
45
45
  PREVENT_CHILD_ENTITIES = 43,
@@ -1 +1 @@
1
- {"version":3,"file":"ISCFeature.d.ts","sourceRoot":"","sources":["../../../src/enums/ISCFeature.ts"],"names":[],"mappings":"AAAA,oBAAY,UAAU;IAEpB,aAAa,IAAA;IACb,iBAAiB,IAAA;IACjB,cAAc,IAAA;IACd,+BAA+B,IAAA;IAC/B,4BAA4B,IAAA;IAC5B,4BAA4B,IAAA;IAC5B,wBAAwB,IAAA;IACxB,qBAAqB,IAAA;IACrB,uBAAuB,IAAA;IACvB,4BAA4B,IAAA;IAC5B,0BAA0B,KAAA;IAC1B,wBAAwB,KAAA;IACxB,qBAAqB,KAAA;IACrB,qBAAqB,KAAA;IAGrB,2BAA2B,KAAA;IAC3B,eAAe,KAAA;IACf,0BAA0B,KAAA;IAC1B,oBAAoB,KAAA;IACpB,iBAAiB,KAAA;IACjB,cAAc,KAAA;IACd,cAAc,KAAA;IACd,aAAa,KAAA;IACb,gBAAgB,KAAA;IAChB,aAAa,KAAA;IACb,gBAAgB,KAAA;IAChB,iBAAiB,KAAA;IACjB,cAAc,KAAA;IACd,mBAAmB,KAAA;IACnB,eAAe,KAAA;IACf,UAAU,KAAA;IACV,gBAAgB,KAAA;IAChB,gBAAgB,KAAA;IAChB,sBAAsB,KAAA;IACtB,mBAAmB,KAAA;IACnB,wBAAwB,KAAA;IACxB,mBAAmB,KAAA;IACnB,cAAc,KAAA;IACd,KAAK,KAAA;IACL,mBAAmB,KAAA;IACnB,qBAAqB,KAAA;IACrB,gBAAgB,KAAA;IAChB,cAAc,KAAA;IACd,WAAW,KAAA;IACX,sBAAsB,KAAA;IACtB,4BAA4B,KAAA;IAC5B,2BAA2B,KAAA;IAC3B,gBAAgB,KAAA;IAChB,YAAY,KAAA;IACZ,eAAe,KAAA;IACf,aAAa,KAAA;IACb,iBAAiB,KAAA;IACjB,sBAAsB,KAAA;IACtB,iBAAiB,KAAA;IACjB,aAAa,KAAA;IACb,YAAY,KAAA;IACZ,uBAAuB,KAAA;CACxB"}
1
+ {"version":3,"file":"ISCFeature.d.ts","sourceRoot":"","sources":["../../../src/enums/ISCFeature.ts"],"names":[],"mappings":"AAAA,oBAAY,UAAU;IAEpB,aAAa,IAAA;IACb,iBAAiB,IAAA;IACjB,cAAc,IAAA;IACd,+BAA+B,IAAA;IAC/B,4BAA4B,IAAA;IAC5B,4BAA4B,IAAA;IAC5B,wBAAwB,IAAA;IACxB,qBAAqB,IAAA;IACrB,uBAAuB,IAAA;IACvB,4BAA4B,IAAA;IAC5B,0BAA0B,KAAA;IAC1B,wBAAwB,KAAA;IACxB,qBAAqB,KAAA;IACrB,qBAAqB,KAAA;IAGrB,2BAA2B,KAAA;IAC3B,eAAe,KAAA;IACf,0BAA0B,KAAA;IAC1B,oBAAoB,KAAA;IACpB,iBAAiB,KAAA;IACjB,cAAc,KAAA;IACd,cAAc,KAAA;IACd,aAAa,KAAA;IACb,gBAAgB,KAAA;IAChB,aAAa,KAAA;IACb,gBAAgB,KAAA;IAChB,iBAAiB,KAAA;IACjB,cAAc,KAAA;IACd,mBAAmB,KAAA;IACnB,eAAe,KAAA;IACf,UAAU,KAAA;IACV,gBAAgB,KAAA;IAChB,gBAAgB,KAAA;IAChB,sBAAsB,KAAA;IACtB,mBAAmB,KAAA;IACnB,wBAAwB,KAAA;IACxB,mBAAmB,KAAA;IACnB,cAAc,KAAA;IACd,KAAK,KAAA;IACL,mBAAmB,KAAA;IACnB,qBAAqB,KAAA;IACrB,2BAA2B,KAAA;IAC3B,cAAc,KAAA;IACd,WAAW,KAAA;IACX,sBAAsB,KAAA;IACtB,4BAA4B,KAAA;IAC5B,2BAA2B,KAAA;IAC3B,gBAAgB,KAAA;IAChB,YAAY,KAAA;IACZ,eAAe,KAAA;IACf,aAAa,KAAA;IACb,iBAAiB,KAAA;IACjB,sBAAsB,KAAA;IACtB,iBAAiB,KAAA;IACjB,aAAa,KAAA;IACb,YAAY,KAAA;IACZ,uBAAuB,KAAA;CACxB"}
@@ -80,8 +80,8 @@ ____exports.ISCFeature.PERSISTENT_ENTITIES = 38
80
80
  ____exports.ISCFeature[____exports.ISCFeature.PERSISTENT_ENTITIES] = "PERSISTENT_ENTITIES"
81
81
  ____exports.ISCFeature.PICKUP_INDEX_CREATION = 39
82
82
  ____exports.ISCFeature[____exports.ISCFeature.PICKUP_INDEX_CREATION] = "PICKUP_INDEX_CREATION"
83
- ____exports.ISCFeature.PLAYER_INVENTORY = 40
84
- ____exports.ISCFeature[____exports.ISCFeature.PLAYER_INVENTORY] = "PLAYER_INVENTORY"
83
+ ____exports.ISCFeature.PLAYER_COLLECTIBLE_TRACKING = 40
84
+ ____exports.ISCFeature[____exports.ISCFeature.PLAYER_COLLECTIBLE_TRACKING] = "PLAYER_COLLECTIBLE_TRACKING"
85
85
  ____exports.ISCFeature.PONY_DETECTION = 41
86
86
  ____exports.ISCFeature[____exports.ISCFeature.PONY_DETECTION] = "PONY_DETECTION"
87
87
  ____exports.ISCFeature.PRESS_INPUT = 42
@@ -39,7 +39,7 @@ import { NoSirenSteal } from "./classes/features/other/NoSirenSteal";
39
39
  import { Pause } from "./classes/features/other/Pause";
40
40
  import { PersistentEntities } from "./classes/features/other/PersistentEntities";
41
41
  import { PickupIndexCreation } from "./classes/features/other/PickupIndexCreation";
42
- import { PlayerInventory } from "./classes/features/other/PlayerInventory";
42
+ import { PlayerCollectibleTracking } from "./classes/features/other/PlayerCollectibleTracking";
43
43
  import { PonyDetection } from "./classes/features/other/PonyDetection";
44
44
  import { PressInput } from "./classes/features/other/PressInput";
45
45
  import { PreventChildEntities } from "./classes/features/other/PreventChildEntities";
@@ -98,7 +98,7 @@ export interface ISCFeatureToClass {
98
98
  [ISCFeature.PAUSE]: Pause;
99
99
  [ISCFeature.PERSISTENT_ENTITIES]: PersistentEntities;
100
100
  [ISCFeature.PICKUP_INDEX_CREATION]: PickupIndexCreation;
101
- [ISCFeature.PLAYER_INVENTORY]: PlayerInventory;
101
+ [ISCFeature.PLAYER_COLLECTIBLE_TRACKING]: PlayerCollectibleTracking;
102
102
  [ISCFeature.PONY_DETECTION]: PonyDetection;
103
103
  [ISCFeature.PRESS_INPUT]: PressInput;
104
104
  [ISCFeature.PREVENT_CHILD_ENTITIES]: PreventChildEntities;
@@ -156,7 +156,7 @@ export declare function getFeatures(mod: ModUpgradedInterface, callbacks: ModCal
156
156
  readonly 37: Pause;
157
157
  readonly 38: PersistentEntities;
158
158
  readonly 39: PickupIndexCreation;
159
- readonly 40: PlayerInventory;
159
+ readonly 40: PlayerCollectibleTracking;
160
160
  readonly 41: PonyDetection;
161
161
  readonly 42: PressInput;
162
162
  readonly 43: PreventChildEntities;
@@ -1 +1 @@
1
- {"version":3,"file":"features.d.ts","sourceRoot":"","sources":["../../src/features.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,yDAAyD,CAAC;AACjG,OAAO,EAAE,4BAA4B,EAAE,MAAM,+DAA+D,CAAC;AAC7G,OAAO,EAAE,yBAAyB,EAAE,MAAM,4DAA4D,CAAC;AACvG,OAAO,EAAE,yBAAyB,EAAE,MAAM,4DAA4D,CAAC;AACvG,OAAO,EAAE,mBAAmB,EAAE,MAAM,sDAAsD,CAAC;AAC3F,OAAO,EAAE,qBAAqB,EAAE,MAAM,wDAAwD,CAAC;AAC/F,OAAO,EAAE,0BAA0B,EAAE,MAAM,6DAA6D,CAAC;AACzG,OAAO,EAAE,wBAAwB,EAAE,MAAM,2DAA2D,CAAC;AACrG,OAAO,EAAE,sBAAsB,EAAE,MAAM,yDAAyD,CAAC;AACjG,OAAO,EAAE,mBAAmB,EAAE,MAAM,sDAAsD,CAAC;AAC3F,OAAO,EAAE,mBAAmB,EAAE,MAAM,sDAAsD,CAAC;AAC3F,OAAO,EAAE,yBAAyB,EAAE,MAAM,oDAAoD,CAAC;AAC/F,OAAO,EAAE,cAAc,EAAE,MAAM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E,yBAAyB,CAAC;IACpE,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,aAAa,CAAC;IAC3C,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,UAAU,CAAC;IACrC,CAAC,UAAU,CAAC,sBAAsB,CAAC,EAAE,oBAAoB,CAAC;IAC1D,CAAC,UAAU,CAAC,4BAA4B,CAAC,EAAE,0BAA0B,CAAC;IACtE,CAAC,UAAU,CAAC,2BAA2B,CAAC,EAAE,wBAAwB,CAAC;IACnE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,cAAc,CAAC;IAC9C,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,WAAW,CAAC;IACvC,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,YAAY,CAAC;IAC3C,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,WAAW,CAAC;IACxC,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,eAAe,CAAC;IAChD,CAAC,UAAU,CAAC,sBAAsB,CAAC,EAAE,mBAAmB,CAAC;IACzD,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,gBAAgB,CAAC;IACjD,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,YAAY,CAAC;IACzC,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,WAAW,CAAC;IACvC,CAAC,UAAU,CAAC,uBAAuB,CAAC,EAAE,qBAAqB,CAAC;CAC7D;AAKD,wBAAgB,WAAW,CACzB,GAAG,EAAE,oBAAoB,EACzB,SAAS,EAAE,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoLpC"}
@@ -81,8 +81,8 @@ local ____PersistentEntities = require("src.classes.features.other.PersistentEnt
81
81
  local PersistentEntities = ____PersistentEntities.PersistentEntities
82
82
  local ____PickupIndexCreation = require("src.classes.features.other.PickupIndexCreation")
83
83
  local PickupIndexCreation = ____PickupIndexCreation.PickupIndexCreation
84
- local ____PlayerInventory = require("src.classes.features.other.PlayerInventory")
85
- local PlayerInventory = ____PlayerInventory.PlayerInventory
84
+ local ____PlayerCollectibleTracking = require("src.classes.features.other.PlayerCollectibleTracking")
85
+ local PlayerCollectibleTracking = ____PlayerCollectibleTracking.PlayerCollectibleTracking
86
86
  local ____PonyDetection = require("src.classes.features.other.PonyDetection")
87
87
  local PonyDetection = ____PonyDetection.PonyDetection
88
88
  local ____PressInput = require("src.classes.features.other.PressInput")
@@ -225,7 +225,7 @@ function ____exports.getFeatures(self, mod, callbacks)
225
225
  [ISCFeature.PAUSE] = pause,
226
226
  [ISCFeature.PERSISTENT_ENTITIES] = __TS__New(PersistentEntities, roomHistory),
227
227
  [ISCFeature.PICKUP_INDEX_CREATION] = pickupIndexCreation,
228
- [ISCFeature.PLAYER_INVENTORY] = __TS__New(PlayerInventory),
228
+ [ISCFeature.PLAYER_COLLECTIBLE_TRACKING] = __TS__New(PlayerCollectibleTracking),
229
229
  [ISCFeature.PONY_DETECTION] = ponyDetection,
230
230
  [ISCFeature.PRESS_INPUT] = pressInput,
231
231
  [ISCFeature.PREVENT_CHILD_ENTITIES] = __TS__New(PreventChildEntities),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "43.1.0",
3
+ "version": "44.0.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -0,0 +1,126 @@
1
+ import type { CollectibleType } from "isaac-typescript-definitions";
2
+ import { Exported } from "../../../decorators";
3
+ import { ModCallbackCustom } from "../../../enums/ModCallbackCustom";
4
+ import { arrayRemoveInPlace } from "../../../functions/array";
5
+ import { isActiveCollectible } from "../../../functions/collectibles";
6
+ import { defaultMapGetPlayer } from "../../../functions/playerDataStructures";
7
+ import type { PlayerIndex } from "../../../types/PlayerIndex";
8
+ import { DefaultMap } from "../../DefaultMap";
9
+ import { Feature } from "../../private/Feature";
10
+
11
+ const v = {
12
+ run: {
13
+ playersCollectibleTypes: new DefaultMap<
14
+ PlayerIndex,
15
+ CollectibleType[],
16
+ [player: EntityPlayer]
17
+ >(() => []),
18
+ },
19
+ };
20
+
21
+ export class PlayerCollectibleTracking extends Feature {
22
+ /** @internal */
23
+ public override v = v;
24
+
25
+ /** @internal */
26
+ constructor() {
27
+ super();
28
+
29
+ this.customCallbacksUsed = [
30
+ [
31
+ ModCallbackCustom.POST_PLAYER_COLLECTIBLE_ADDED,
32
+ this.postPlayerCollectibleAdded,
33
+ ],
34
+ [
35
+ ModCallbackCustom.POST_PLAYER_COLLECTIBLE_REMOVED,
36
+ this.postPlayerCollectibleRemoved,
37
+ ],
38
+ ];
39
+ }
40
+
41
+ // ModCallbackCustom.POST_PLAYER_COLLECTIBLE_ADDED
42
+ private readonly postPlayerCollectibleAdded = (
43
+ player: EntityPlayer,
44
+ collectibleType: CollectibleType,
45
+ ) => {
46
+ const collectibleTypes = defaultMapGetPlayer(
47
+ v.run.playersCollectibleTypes,
48
+ player,
49
+ player,
50
+ );
51
+ collectibleTypes.push(collectibleType);
52
+ };
53
+
54
+ // ModCallbackCustom.POST_PLAYER_COLLECTIBLE_REMOVED
55
+ private readonly postPlayerCollectibleRemoved = (
56
+ player: EntityPlayer,
57
+ collectibleType: CollectibleType,
58
+ ) => {
59
+ const collectibleTypes = defaultMapGetPlayer(
60
+ v.run.playersCollectibleTypes,
61
+ player,
62
+ player,
63
+ );
64
+ arrayRemoveInPlace(collectibleTypes, collectibleType);
65
+ };
66
+
67
+ /**
68
+ * Helper function to get all of the collectible types that the player has gotten so far on this
69
+ * run, in order.
70
+ *
71
+ * In the case of items given on the first frame of the run or the case where the player rerolls
72
+ * their build in the middle of the run (e.g. with D4), the order of the collectible types will
73
+ * not correspond to the order that the items were actually given to the player. In this case, the
74
+ * order will be from the lowest `CollectibleType` to the highest.
75
+ *
76
+ * Under the hood, this feature works by tracking the number of collectibles that a player has on
77
+ * every frame. Thus, in a situation where a collectible was both added and removed to the player
78
+ * on the same frame, the amount of total collectibles would stay the same, and the collectible
79
+ * types would not be updated. In vanilla, this situation would never happen, but another mod
80
+ * might do this for some reason. (With that said, the next time that a collectible is normally
81
+ * added or removed, it would trigger a re-scan, and the previous changes would be picked up.)
82
+ *
83
+ * In order to use this function, you must upgrade your mod with
84
+ * `ISCFeature.PLAYER_COLLECTIBLE_TRACKING`.
85
+ *
86
+ * @param player The player to get the collectible types for.
87
+ * @param includeActiveCollectibles Optional. If true, will include all active collectibles.
88
+ * Default is true.
89
+ */
90
+ @Exported
91
+ public getPlayerCollectibleTypes(
92
+ player: EntityPlayer,
93
+ includeActiveCollectibles = true,
94
+ ): readonly CollectibleType[] {
95
+ const collectibleTypes = defaultMapGetPlayer(
96
+ v.run.playersCollectibleTypes,
97
+ player,
98
+ player,
99
+ );
100
+
101
+ if (includeActiveCollectibles) {
102
+ return collectibleTypes;
103
+ }
104
+
105
+ return collectibleTypes.filter(
106
+ (collectibleType) => !isActiveCollectible(collectibleType),
107
+ );
108
+ }
109
+
110
+ /**
111
+ * Helper function to get the last passive collectible type that the player picked up. In most
112
+ * cases, this will be the passive that would be removed if the player used Clicker.
113
+ *
114
+ * Returns undefined if the player does not have any passive collectibles.
115
+ *
116
+ * In order to use this function, you must upgrade your mod with
117
+ * `ISCFeature.PLAYER_COLLECTIBLE_TRACKING`.
118
+ */
119
+ @Exported
120
+ public getPlayerLastPassiveCollectibleType(
121
+ player: EntityPlayer,
122
+ ): CollectibleType | undefined {
123
+ const collectibleTypes = this.getPlayerCollectibleTypes(player, false);
124
+ return collectibleTypes.at(-1);
125
+ }
126
+ }
@@ -42,7 +42,7 @@ export enum ISCFeature {
42
42
  PAUSE,
43
43
  PERSISTENT_ENTITIES,
44
44
  PICKUP_INDEX_CREATION,
45
- PLAYER_INVENTORY,
45
+ PLAYER_COLLECTIBLE_TRACKING,
46
46
  PONY_DETECTION,
47
47
  PRESS_INPUT,
48
48
  PREVENT_CHILD_ENTITIES,
package/src/features.ts CHANGED
@@ -39,7 +39,7 @@ import { NoSirenSteal } from "./classes/features/other/NoSirenSteal";
39
39
  import { Pause } from "./classes/features/other/Pause";
40
40
  import { PersistentEntities } from "./classes/features/other/PersistentEntities";
41
41
  import { PickupIndexCreation } from "./classes/features/other/PickupIndexCreation";
42
- import { PlayerInventory } from "./classes/features/other/PlayerInventory";
42
+ import { PlayerCollectibleTracking } from "./classes/features/other/PlayerCollectibleTracking";
43
43
  import { PonyDetection } from "./classes/features/other/PonyDetection";
44
44
  import { PressInput } from "./classes/features/other/PressInput";
45
45
  import { PreventChildEntities } from "./classes/features/other/PreventChildEntities";
@@ -105,7 +105,7 @@ export interface ISCFeatureToClass {
105
105
  [ISCFeature.PAUSE]: Pause;
106
106
  [ISCFeature.PERSISTENT_ENTITIES]: PersistentEntities;
107
107
  [ISCFeature.PICKUP_INDEX_CREATION]: PickupIndexCreation;
108
- [ISCFeature.PLAYER_INVENTORY]: PlayerInventory;
108
+ [ISCFeature.PLAYER_COLLECTIBLE_TRACKING]: PlayerCollectibleTracking;
109
109
  [ISCFeature.PONY_DETECTION]: PonyDetection;
110
110
  [ISCFeature.PRESS_INPUT]: PressInput;
111
111
  [ISCFeature.PREVENT_CHILD_ENTITIES]: PreventChildEntities;
@@ -287,7 +287,7 @@ export function getFeatures(
287
287
  [ISCFeature.PAUSE]: pause,
288
288
  [ISCFeature.PERSISTENT_ENTITIES]: new PersistentEntities(roomHistory),
289
289
  [ISCFeature.PICKUP_INDEX_CREATION]: pickupIndexCreation,
290
- [ISCFeature.PLAYER_INVENTORY]: new PlayerInventory(),
290
+ [ISCFeature.PLAYER_COLLECTIBLE_TRACKING]: new PlayerCollectibleTracking(),
291
291
  [ISCFeature.PONY_DETECTION]: ponyDetection,
292
292
  [ISCFeature.PRESS_INPUT]: pressInput,
293
293
  [ISCFeature.PREVENT_CHILD_ENTITIES]: new PreventChildEntities(),
@@ -1,39 +0,0 @@
1
- import type { CollectibleType } from "isaac-typescript-definitions";
2
- import { Feature } from "../../private/Feature";
3
- export declare class PlayerInventory extends Feature {
4
- private readonly postCollectibleAdded;
5
- private readonly postCollectibleRemoved;
6
- /**
7
- * Helper function to get all of the collectibles that the player has gotten so far on this run,
8
- * in order.
9
- *
10
- * In the case of inventory initialization or the case where the player rerolls their build in the
11
- * middle of the run (e.g. with D4), the order of the inventory will not correspond to the order
12
- * that the items were actually given to the player. In this case, the inventory will be in the
13
- * order of the lowest `CollectibleType` to the highest.
14
- *
15
- * Under the hood, the inventory tracking works by tracking the number of collectibles that a
16
- * player has on every frame. Thus, in a situation where a collectible was both added and removed
17
- * to the player on the same frame, the amount of total collectibles would stay the same, and the
18
- * inventory would not be updated. In vanilla, this situation would never happen, but another mod
19
- * might do this for some reason. (With that said, the next time that a collectible is normally
20
- * added or removed, it would trigger a re-scan, and the previous changes would be picked up.)
21
- *
22
- * In order to use this function, you must upgrade your mod with `ISCFeature.PLAYER_INVENTORY`.
23
- *
24
- * @param player The player to get the inventory for.
25
- * @param includeActiveCollectibles Optional. If true, will include all active collectibles.
26
- * Default is true.
27
- */
28
- getPlayerInventory(player: EntityPlayer, includeActiveCollectibles?: boolean): CollectibleType[];
29
- /**
30
- * Helper function to get the last passive collectible that the player picked up. In most cases,
31
- * this will be the passive that is removed when the player would use Clicker.
32
- *
33
- * Returns undefined if the player does not have any passive collectibles.
34
- *
35
- * In order to use this function, you must upgrade your mod with `ISCFeature.PLAYER_INVENTORY`.
36
- */
37
- getPlayerLastPassiveCollectible(player: EntityPlayer): CollectibleType | undefined;
38
- }
39
- //# sourceMappingURL=PlayerInventory.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlayerInventory.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/PlayerInventory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAQpE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAYhD,qBAAa,eAAgB,SAAQ,OAAO;IAqB1C,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAUnC;IAGF,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAUrC;IAEF;;;;;;;;;;;;;;;;;;;;;OAqBG;IAEI,kBAAkB,CACvB,MAAM,EAAE,YAAY,EACpB,yBAAyB,UAAO,GAC/B,eAAe,EAAE;IAgBpB;;;;;;;OAOG;IAEI,+BAA+B,CACpC,MAAM,EAAE,YAAY,GACnB,eAAe,GAAG,SAAS;CAI/B"}
@@ -1,64 +0,0 @@
1
- local ____lualib = require("lualib_bundle")
2
- local __TS__New = ____lualib.__TS__New
3
- local __TS__Class = ____lualib.__TS__Class
4
- local __TS__ClassExtends = ____lualib.__TS__ClassExtends
5
- local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
6
- local __TS__DecorateLegacy = ____lualib.__TS__DecorateLegacy
7
- local __TS__ArrayAt = ____lualib.__TS__ArrayAt
8
- local ____exports = {}
9
- local ____decorators = require("src.decorators")
10
- local Exported = ____decorators.Exported
11
- local ____ModCallbackCustom = require("src.enums.ModCallbackCustom")
12
- local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
13
- local ____array = require("src.functions.array")
14
- local arrayRemoveInPlace = ____array.arrayRemoveInPlace
15
- local copyArray = ____array.copyArray
16
- local ____collectibles = require("src.functions.collectibles")
17
- local isActiveCollectible = ____collectibles.isActiveCollectible
18
- local ____playerDataStructures = require("src.functions.playerDataStructures")
19
- local defaultMapGetPlayer = ____playerDataStructures.defaultMapGetPlayer
20
- local ____DefaultMap = require("src.classes.DefaultMap")
21
- local DefaultMap = ____DefaultMap.DefaultMap
22
- local ____Feature = require("src.classes.private.Feature")
23
- local Feature = ____Feature.Feature
24
- local v = {run = {playersInventory = __TS__New(
25
- DefaultMap,
26
- function() return {} end
27
- )}}
28
- ____exports.PlayerInventory = __TS__Class()
29
- local PlayerInventory = ____exports.PlayerInventory
30
- PlayerInventory.name = "PlayerInventory"
31
- __TS__ClassExtends(PlayerInventory, Feature)
32
- function PlayerInventory.prototype.____constructor(self)
33
- Feature.prototype.____constructor(self)
34
- self.v = v
35
- self.postCollectibleAdded = function(____, player, collectibleType)
36
- local inventory = defaultMapGetPlayer(nil, v.run.playersInventory, player, player)
37
- inventory[#inventory + 1] = collectibleType
38
- end
39
- self.postCollectibleRemoved = function(____, player, collectibleType)
40
- local inventory = defaultMapGetPlayer(nil, v.run.playersInventory, player, player)
41
- arrayRemoveInPlace(nil, inventory, collectibleType)
42
- end
43
- self.customCallbacksUsed = {{ModCallbackCustom.POST_PLAYER_COLLECTIBLE_ADDED, self.postCollectibleAdded}, {ModCallbackCustom.POST_PLAYER_COLLECTIBLE_REMOVED, self.postCollectibleRemoved}}
44
- end
45
- function PlayerInventory.prototype.getPlayerInventory(self, player, includeActiveCollectibles)
46
- if includeActiveCollectibles == nil then
47
- includeActiveCollectibles = true
48
- end
49
- local inventory = defaultMapGetPlayer(nil, v.run.playersInventory, player, player)
50
- if includeActiveCollectibles then
51
- return copyArray(nil, inventory)
52
- end
53
- return __TS__ArrayFilter(
54
- inventory,
55
- function(____, collectibleType) return not isActiveCollectible(nil, collectibleType) end
56
- )
57
- end
58
- __TS__DecorateLegacy({Exported}, PlayerInventory.prototype, "getPlayerInventory", true)
59
- function PlayerInventory.prototype.getPlayerLastPassiveCollectible(self, player)
60
- local inventory = self:getPlayerInventory(player, false)
61
- return __TS__ArrayAt(inventory, -1)
62
- end
63
- __TS__DecorateLegacy({Exported}, PlayerInventory.prototype, "getPlayerLastPassiveCollectible", true)
64
- return ____exports
@@ -1,124 +0,0 @@
1
- import type { CollectibleType } from "isaac-typescript-definitions";
2
- import { Exported } from "../../../decorators";
3
- import { ModCallbackCustom } from "../../../enums/ModCallbackCustom";
4
- import { arrayRemoveInPlace, copyArray } from "../../../functions/array";
5
- import { isActiveCollectible } from "../../../functions/collectibles";
6
- import { defaultMapGetPlayer } from "../../../functions/playerDataStructures";
7
- import type { PlayerIndex } from "../../../types/PlayerIndex";
8
- import { DefaultMap } from "../../DefaultMap";
9
- import { Feature } from "../../private/Feature";
10
-
11
- const v = {
12
- run: {
13
- playersInventory: new DefaultMap<
14
- PlayerIndex,
15
- CollectibleType[],
16
- [player: EntityPlayer]
17
- >(() => []),
18
- },
19
- };
20
-
21
- export class PlayerInventory extends Feature {
22
- /** @internal */
23
- public override v = v;
24
-
25
- /** @internal */
26
- constructor() {
27
- super();
28
-
29
- this.customCallbacksUsed = [
30
- [
31
- ModCallbackCustom.POST_PLAYER_COLLECTIBLE_ADDED,
32
- this.postCollectibleAdded,
33
- ],
34
- [
35
- ModCallbackCustom.POST_PLAYER_COLLECTIBLE_REMOVED,
36
- this.postCollectibleRemoved,
37
- ],
38
- ];
39
- }
40
-
41
- // ModCallbackCustom.POST_PLAYER_COLLECTIBLE_ADDED
42
- private readonly postCollectibleAdded = (
43
- player: EntityPlayer,
44
- collectibleType: CollectibleType,
45
- ) => {
46
- const inventory = defaultMapGetPlayer(
47
- v.run.playersInventory,
48
- player,
49
- player,
50
- );
51
- inventory.push(collectibleType);
52
- };
53
-
54
- // ModCallbackCustom.POST_PLAYER_COLLECTIBLE_REMOVED
55
- private readonly postCollectibleRemoved = (
56
- player: EntityPlayer,
57
- collectibleType: CollectibleType,
58
- ) => {
59
- const inventory = defaultMapGetPlayer(
60
- v.run.playersInventory,
61
- player,
62
- player,
63
- );
64
- arrayRemoveInPlace(inventory, collectibleType);
65
- };
66
-
67
- /**
68
- * Helper function to get all of the collectibles that the player has gotten so far on this run,
69
- * in order.
70
- *
71
- * In the case of inventory initialization or the case where the player rerolls their build in the
72
- * middle of the run (e.g. with D4), the order of the inventory will not correspond to the order
73
- * that the items were actually given to the player. In this case, the inventory will be in the
74
- * order of the lowest `CollectibleType` to the highest.
75
- *
76
- * Under the hood, the inventory tracking works by tracking the number of collectibles that a
77
- * player has on every frame. Thus, in a situation where a collectible was both added and removed
78
- * to the player on the same frame, the amount of total collectibles would stay the same, and the
79
- * inventory would not be updated. In vanilla, this situation would never happen, but another mod
80
- * might do this for some reason. (With that said, the next time that a collectible is normally
81
- * added or removed, it would trigger a re-scan, and the previous changes would be picked up.)
82
- *
83
- * In order to use this function, you must upgrade your mod with `ISCFeature.PLAYER_INVENTORY`.
84
- *
85
- * @param player The player to get the inventory for.
86
- * @param includeActiveCollectibles Optional. If true, will include all active collectibles.
87
- * Default is true.
88
- */
89
- @Exported
90
- public getPlayerInventory(
91
- player: EntityPlayer,
92
- includeActiveCollectibles = true,
93
- ): CollectibleType[] {
94
- const inventory = defaultMapGetPlayer(
95
- v.run.playersInventory,
96
- player,
97
- player,
98
- );
99
-
100
- if (includeActiveCollectibles) {
101
- return copyArray(inventory);
102
- }
103
-
104
- return inventory.filter(
105
- (collectibleType) => !isActiveCollectible(collectibleType),
106
- );
107
- }
108
-
109
- /**
110
- * Helper function to get the last passive collectible that the player picked up. In most cases,
111
- * this will be the passive that is removed when the player would use Clicker.
112
- *
113
- * Returns undefined if the player does not have any passive collectibles.
114
- *
115
- * In order to use this function, you must upgrade your mod with `ISCFeature.PLAYER_INVENTORY`.
116
- */
117
- @Exported
118
- public getPlayerLastPassiveCollectible(
119
- player: EntityPlayer,
120
- ): CollectibleType | undefined {
121
- const inventory = this.getPlayerInventory(player, false);
122
- return inventory.at(-1);
123
- }
124
- }