isaacscript-common 43.0.1 → 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.
@@ -6393,6 +6393,12 @@ export declare function getPlayersWithTrinket(...trinketTypes: TrinketType[]): E
6393
6393
  /** Returns a set of the player's current transformations. */
6394
6394
  export declare function getPlayerTransformations(player: EntityPlayer): Set<PlayerForm>;
6395
6395
 
6396
+ /**
6397
+ * Helper function to get all of the trinkets that the player is currently holding. This will not
6398
+ * include any smelted trinkets.
6399
+ */
6400
+ export declare function getPlayerTrinkets(player: EntityPlayer): TrinketType[];
6401
+
6396
6402
  /**
6397
6403
  * Use this helper function as a workaround for the `EntityPlayer.GetPocketItem` method not working
6398
6404
  * correctly.
@@ -8329,7 +8335,7 @@ export declare enum ISCFeature {
8329
8335
  PAUSE = 37,
8330
8336
  PERSISTENT_ENTITIES = 38,
8331
8337
  PICKUP_INDEX_CREATION = 39,
8332
- PLAYER_INVENTORY = 40,
8338
+ PLAYER_COLLECTIBLE_TRACKING = 40,
8333
8339
  PONY_DETECTION = 41,
8334
8340
  PRESS_INPUT = 42,
8335
8341
  PREVENT_CHILD_ENTITIES = 43,
@@ -8394,7 +8400,7 @@ declare interface ISCFeatureToClass {
8394
8400
  [ISCFeature.PAUSE]: Pause;
8395
8401
  [ISCFeature.PERSISTENT_ENTITIES]: PersistentEntities;
8396
8402
  [ISCFeature.PICKUP_INDEX_CREATION]: PickupIndexCreation;
8397
- [ISCFeature.PLAYER_INVENTORY]: PlayerInventory;
8403
+ [ISCFeature.PLAYER_COLLECTIBLE_TRACKING]: PlayerCollectibleTracking;
8398
8404
  [ISCFeature.PONY_DETECTION]: PonyDetection;
8399
8405
  [ISCFeature.PRESS_INPUT]: PressInput;
8400
8406
  [ISCFeature.PREVENT_CHILD_ENTITIES]: PreventChildEntities;
@@ -14242,6 +14248,45 @@ declare class PlayerCollectibleDetection extends Feature {
14242
14248
  private checkActiveItemsChanged;
14243
14249
  }
14244
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
+
14245
14290
  /**
14246
14291
  * Helper function to remove all of a player's black hearts and add the corresponding amount of soul
14247
14292
  * hearts.
@@ -14297,43 +14342,6 @@ export declare type PlayerIndex = int & {
14297
14342
  readonly __playerIndexBrand: symbol;
14298
14343
  };
14299
14344
 
14300
- declare class PlayerInventory extends Feature {
14301
- private readonly postCollectibleAdded;
14302
- private readonly postCollectibleRemoved;
14303
- /**
14304
- * Helper function to get all of the collectibles that the player has gotten so far on this run,
14305
- * in order.
14306
- *
14307
- * In the case of inventory initialization or the case where the player rerolls their build in the
14308
- * middle of the run (e.g. with D4), the order of the inventory will not correspond to the order
14309
- * that the items were actually given to the player. In this case, the inventory will be in the
14310
- * order of the lowest `CollectibleType` to the highest.
14311
- *
14312
- * Under the hood, the inventory tracking works by tracking the number of collectibles that a
14313
- * player has on every frame. Thus, in a situation where a collectible was both added and removed
14314
- * to the player on the same frame, the amount of total collectibles would stay the same, and the
14315
- * inventory would not be updated. In vanilla, this situation would never happen, but another mod
14316
- * might do this for some reason. (With that said, the next time that a collectible is normally
14317
- * added or removed, it would trigger a re-scan, and the previous changes would be picked up.)
14318
- *
14319
- * In order to use this function, you must upgrade your mod with `ISCFeature.PLAYER_INVENTORY`.
14320
- *
14321
- * @param player The player to get the inventory for.
14322
- * @param includeActiveCollectibles Optional. If true, will include all active collectibles.
14323
- * Default is true.
14324
- */
14325
- getPlayerInventory(player: EntityPlayer, includeActiveCollectibles?: boolean): CollectibleType[];
14326
- /**
14327
- * Helper function to get the last passive collectible that the player picked up. In most cases,
14328
- * this will be the passive that is removed when the player would use Clicker.
14329
- *
14330
- * Returns undefined if the player does not have any passive collectibles.
14331
- *
14332
- * In order to use this function, you must upgrade your mod with `ISCFeature.PLAYER_INVENTORY`.
14333
- */
14334
- getPlayerLastPassiveCollectible(player: EntityPlayer): CollectibleType | undefined;
14335
- }
14336
-
14337
14345
  declare class PlayerReorderedCallbacks extends Feature {
14338
14346
  v: {
14339
14347
  run: {
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 43.0.1
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
@@ -29680,6 +29680,16 @@ function ____exports.getOpenTrinketSlot(self, player)
29680
29680
  end
29681
29681
  error("The player has an unknown number of trinket slots: " .. tostring(maxTrinkets))
29682
29682
  end
29683
+ function ____exports.getPlayerTrinkets(self, player)
29684
+ local trinketTypes = {}
29685
+ for ____, trinketSlot in ipairs(TRINKET_SLOT_VALUES) do
29686
+ local trinketType = player:GetTrinket(trinketSlot)
29687
+ if trinketType ~= TrinketType.NULL then
29688
+ trinketTypes[#trinketTypes + 1] = trinketType
29689
+ end
29690
+ end
29691
+ return trinketTypes
29692
+ end
29683
29693
  function ____exports.getTrinketDescription(self, trinketType)
29684
29694
  local trinketDescription = TRINKET_DESCRIPTION_MAP:get(trinketType)
29685
29695
  if trinketDescription ~= nil then
@@ -50133,7 +50143,7 @@ function ____exports.character(self, params)
50133
50143
  playerType = match[2]
50134
50144
  else
50135
50145
  if num < FIRST_CHARACTER or num > LAST_VANILLA_CHARACTER then
50136
- print("Invalid player sub-type: " .. tostring(num))
50146
+ print("Invalid character number: " .. tostring(num))
50137
50147
  return
50138
50148
  end
50139
50149
  playerType = num
@@ -51615,7 +51625,7 @@ end
51615
51625
  __TS__DecorateLegacy({Exported}, PersistentEntities.prototype, "spawnPersistentEntity", true)
51616
51626
  return ____exports
51617
51627
  end,
51618
- ["src.classes.features.other.PlayerInventory"] = function(...)
51628
+ ["src.classes.features.other.PlayerCollectibleTracking"] = function(...)
51619
51629
  local ____lualib = require("lualib_bundle")
51620
51630
  local __TS__New = ____lualib.__TS__New
51621
51631
  local __TS__Class = ____lualib.__TS__Class
@@ -51630,7 +51640,6 @@ local ____ModCallbackCustom = require("src.enums.ModCallbackCustom")
51630
51640
  local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
51631
51641
  local ____array = require("src.functions.array")
51632
51642
  local arrayRemoveInPlace = ____array.arrayRemoveInPlace
51633
- local copyArray = ____array.copyArray
51634
51643
  local ____collectibles = require("src.functions.collectibles")
51635
51644
  local isActiveCollectible = ____collectibles.isActiveCollectible
51636
51645
  local ____playerDataStructures = require("src.functions.playerDataStructures")
@@ -51639,46 +51648,46 @@ local ____DefaultMap = require("src.classes.DefaultMap")
51639
51648
  local DefaultMap = ____DefaultMap.DefaultMap
51640
51649
  local ____Feature = require("src.classes.private.Feature")
51641
51650
  local Feature = ____Feature.Feature
51642
- local v = {run = {playersInventory = __TS__New(
51651
+ local v = {run = {playersCollectibleTypes = __TS__New(
51643
51652
  DefaultMap,
51644
51653
  function() return {} end
51645
51654
  )}}
51646
- ____exports.PlayerInventory = __TS__Class()
51647
- local PlayerInventory = ____exports.PlayerInventory
51648
- PlayerInventory.name = "PlayerInventory"
51649
- __TS__ClassExtends(PlayerInventory, Feature)
51650
- 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)
51651
51660
  Feature.prototype.____constructor(self)
51652
51661
  self.v = v
51653
- self.postCollectibleAdded = function(____, player, collectibleType)
51654
- local inventory = defaultMapGetPlayer(nil, v.run.playersInventory, player, player)
51655
- 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
51656
51665
  end
51657
- self.postCollectibleRemoved = function(____, player, collectibleType)
51658
- local inventory = defaultMapGetPlayer(nil, v.run.playersInventory, player, player)
51659
- 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)
51660
51669
  end
51661
- 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}}
51662
51671
  end
51663
- function PlayerInventory.prototype.getPlayerInventory(self, player, includeActiveCollectibles)
51672
+ function PlayerCollectibleTracking.prototype.getPlayerCollectibleTypes(self, player, includeActiveCollectibles)
51664
51673
  if includeActiveCollectibles == nil then
51665
51674
  includeActiveCollectibles = true
51666
51675
  end
51667
- local inventory = defaultMapGetPlayer(nil, v.run.playersInventory, player, player)
51676
+ local collectibleTypes = defaultMapGetPlayer(nil, v.run.playersCollectibleTypes, player, player)
51668
51677
  if includeActiveCollectibles then
51669
- return copyArray(nil, inventory)
51678
+ return collectibleTypes
51670
51679
  end
51671
51680
  return __TS__ArrayFilter(
51672
- inventory,
51681
+ collectibleTypes,
51673
51682
  function(____, collectibleType) return not isActiveCollectible(nil, collectibleType) end
51674
51683
  )
51675
51684
  end
51676
- __TS__DecorateLegacy({Exported}, PlayerInventory.prototype, "getPlayerInventory", true)
51677
- function PlayerInventory.prototype.getPlayerLastPassiveCollectible(self, player)
51678
- local inventory = self:getPlayerInventory(player, false)
51679
- 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)
51680
51689
  end
51681
- __TS__DecorateLegacy({Exported}, PlayerInventory.prototype, "getPlayerLastPassiveCollectible", true)
51690
+ __TS__DecorateLegacy({Exported}, PlayerCollectibleTracking.prototype, "getPlayerLastPassiveCollectibleType", true)
51682
51691
  return ____exports
51683
51692
  end,
51684
51693
  ["src.classes.features.other.PreventChildEntities"] = function(...)
@@ -52446,8 +52455,8 @@ local ____PersistentEntities = require("src.classes.features.other.PersistentEnt
52446
52455
  local PersistentEntities = ____PersistentEntities.PersistentEntities
52447
52456
  local ____PickupIndexCreation = require("src.classes.features.other.PickupIndexCreation")
52448
52457
  local PickupIndexCreation = ____PickupIndexCreation.PickupIndexCreation
52449
- local ____PlayerInventory = require("src.classes.features.other.PlayerInventory")
52450
- local PlayerInventory = ____PlayerInventory.PlayerInventory
52458
+ local ____PlayerCollectibleTracking = require("src.classes.features.other.PlayerCollectibleTracking")
52459
+ local PlayerCollectibleTracking = ____PlayerCollectibleTracking.PlayerCollectibleTracking
52451
52460
  local ____PonyDetection = require("src.classes.features.other.PonyDetection")
52452
52461
  local PonyDetection = ____PonyDetection.PonyDetection
52453
52462
  local ____PressInput = require("src.classes.features.other.PressInput")
@@ -52590,7 +52599,7 @@ function ____exports.getFeatures(self, mod, callbacks)
52590
52599
  [ISCFeature.PAUSE] = pause,
52591
52600
  [ISCFeature.PERSISTENT_ENTITIES] = __TS__New(PersistentEntities, roomHistory),
52592
52601
  [ISCFeature.PICKUP_INDEX_CREATION] = pickupIndexCreation,
52593
- [ISCFeature.PLAYER_INVENTORY] = __TS__New(PlayerInventory),
52602
+ [ISCFeature.PLAYER_COLLECTIBLE_TRACKING] = __TS__New(PlayerCollectibleTracking),
52594
52603
  [ISCFeature.PONY_DETECTION] = ponyDetection,
52595
52604
  [ISCFeature.PRESS_INPUT] = pressInput,
52596
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
@@ -550,7 +550,7 @@ function ____exports.character(self, params)
550
550
  playerType = match[2]
551
551
  else
552
552
  if num < FIRST_CHARACTER or num > LAST_VANILLA_CHARACTER then
553
- print("Invalid player sub-type: " .. tostring(num))
553
+ print("Invalid character number: " .. tostring(num))
554
554
  return
555
555
  end
556
556
  playerType = num
@@ -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,EA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AAC,EAAE,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),
@@ -44,6 +44,11 @@ export declare function getMysteriousPaperEffectForFrame(player: EntityPlayer, f
44
44
  * ```
45
45
  */
46
46
  export declare function getOpenTrinketSlot(player: EntityPlayer): int | undefined;
47
+ /**
48
+ * Helper function to get all of the trinkets that the player is currently holding. This will not
49
+ * include any smelted trinkets.
50
+ */
51
+ export declare function getPlayerTrinkets(player: EntityPlayer): TrinketType[];
47
52
  /**
48
53
  * Helper function to get the in-game description for a trinket. Returns "Unknown" if the provided
49
54
  * trinket type was not valid.
@@ -1 +1 @@
1
- {"version":3,"file":"trinkets.d.ts","sourceRoot":"","sources":["../../../src/functions/trinkets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAGL,WAAW,EACZ,MAAM,8BAA8B,CAA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AAO,CAErE;AAED,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAEtE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAYjE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,IAAI,CAiBN;AAED,6FAA6F;AAC7F,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,GACnB,OAAO,CAOT"}
@@ -109,6 +109,18 @@ function ____exports.getOpenTrinketSlot(self, player)
109
109
  end
110
110
  error("The player has an unknown number of trinket slots: " .. tostring(maxTrinkets))
111
111
  end
112
+ --- Helper function to get all of the trinkets that the player is currently holding. This will not
113
+ -- include any smelted trinkets.
114
+ function ____exports.getPlayerTrinkets(self, player)
115
+ local trinketTypes = {}
116
+ for ____, trinketSlot in ipairs(TRINKET_SLOT_VALUES) do
117
+ local trinketType = player:GetTrinket(trinketSlot)
118
+ if trinketType ~= TrinketType.NULL then
119
+ trinketTypes[#trinketTypes + 1] = trinketType
120
+ end
121
+ end
122
+ return trinketTypes
123
+ end
112
124
  --- Helper function to get the in-game description for a trinket. Returns "Unknown" if the provided
113
125
  -- trinket type was not valid.
114
126
  --
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "43.0.1",
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
+ }
@@ -446,7 +446,7 @@ export function character(params: string): void {
446
446
  playerType = match[1];
447
447
  } else {
448
448
  if (num < FIRST_CHARACTER || num > LAST_VANILLA_CHARACTER) {
449
- print(`Invalid player sub-type: ${num}`);
449
+ print(`Invalid character number: ${num}`);
450
450
  return;
451
451
  }
452
452
 
@@ -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(),
@@ -118,6 +118,23 @@ export function getOpenTrinketSlot(player: EntityPlayer): int | undefined {
118
118
  error(`The player has an unknown number of trinket slots: ${maxTrinkets}`);
119
119
  }
120
120
 
121
+ /**
122
+ * Helper function to get all of the trinkets that the player is currently holding. This will not
123
+ * include any smelted trinkets.
124
+ */
125
+ export function getPlayerTrinkets(player: EntityPlayer): TrinketType[] {
126
+ const trinketTypes: TrinketType[] = [];
127
+
128
+ for (const trinketSlot of TRINKET_SLOT_VALUES) {
129
+ const trinketType = player.GetTrinket(trinketSlot);
130
+ if (trinketType !== TrinketType.NULL) {
131
+ trinketTypes.push(trinketType);
132
+ }
133
+ }
134
+
135
+ return trinketTypes;
136
+ }
137
+
121
138
  /**
122
139
  * Helper function to get the in-game description for a trinket. Returns "Unknown" if the provided
123
140
  * trinket type was not valid.
@@ -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
- }