isaacscript-common 43.1.0 → 44.1.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.
Files changed (66) hide show
  1. package/dist/index.rollup.d.ts +53 -43
  2. package/dist/isaacscript-common.lua +5368 -5246
  3. package/dist/src/classes/features/other/ItemPoolDetection.d.ts.map +1 -1
  4. package/dist/src/classes/features/other/ItemPoolDetection.lua +2 -1
  5. package/dist/src/classes/features/other/Pause.lua +2 -2
  6. package/dist/src/classes/features/other/PlayerCollectibleTracking.d.ts +41 -0
  7. package/dist/src/classes/features/other/PlayerCollectibleTracking.d.ts.map +1 -0
  8. package/dist/src/classes/features/other/PlayerCollectibleTracking.lua +63 -0
  9. package/dist/src/classes/features/other/extraConsoleCommands/commands.lua +4 -3
  10. package/dist/src/enums/ISCFeature.d.ts +1 -1
  11. package/dist/src/enums/ISCFeature.d.ts.map +1 -1
  12. package/dist/src/enums/ISCFeature.lua +2 -2
  13. package/dist/src/features.d.ts +3 -3
  14. package/dist/src/features.d.ts.map +1 -1
  15. package/dist/src/features.lua +3 -3
  16. package/dist/src/functions/characters.d.ts +9 -2
  17. package/dist/src/functions/characters.d.ts.map +1 -1
  18. package/dist/src/functions/characters.lua +13 -4
  19. package/dist/src/functions/charge.lua +2 -2
  20. package/dist/src/functions/playerCollectibles.d.ts +127 -0
  21. package/dist/src/functions/playerCollectibles.d.ts.map +1 -0
  22. package/dist/src/functions/playerCollectibles.lua +308 -0
  23. package/dist/src/functions/playerHealth.d.ts.map +1 -1
  24. package/dist/src/functions/playerHealth.lua +3 -2
  25. package/dist/src/functions/playerTrinkets.d.ts +69 -0
  26. package/dist/src/functions/playerTrinkets.d.ts.map +1 -0
  27. package/dist/src/functions/playerTrinkets.lua +160 -0
  28. package/dist/src/functions/players.d.ts +5 -166
  29. package/dist/src/functions/players.d.ts.map +1 -1
  30. package/dist/src/functions/players.lua +20 -389
  31. package/dist/src/functions/trinketGive.lua +2 -2
  32. package/dist/src/functions/trinkets.d.ts +0 -30
  33. package/dist/src/functions/trinkets.d.ts.map +1 -1
  34. package/dist/src/functions/trinkets.lua +0 -71
  35. package/dist/src/index.d.ts +2 -0
  36. package/dist/src/index.d.ts.map +1 -1
  37. package/dist/src/index.lua +16 -0
  38. package/dist/src/objects/{characterStartingCollectibles.d.ts → characterStartingCollectibleTypes.d.ts} +2 -2
  39. package/dist/src/objects/characterStartingCollectibleTypes.d.ts.map +1 -0
  40. package/dist/src/objects/{characterStartingCollectibles.lua → characterStartingCollectibleTypes.lua} +1 -1
  41. package/dist/src/objects/characterStartingTrinketTypes.d.ts +46 -0
  42. package/dist/src/objects/characterStartingTrinketTypes.d.ts.map +1 -0
  43. package/dist/src/objects/characterStartingTrinketTypes.lua +49 -0
  44. package/package.json +1 -1
  45. package/src/classes/features/other/ItemPoolDetection.ts +2 -4
  46. package/src/classes/features/other/Pause.ts +1 -1
  47. package/src/classes/features/other/PlayerCollectibleTracking.ts +126 -0
  48. package/src/classes/features/other/extraConsoleCommands/commands.ts +3 -3
  49. package/src/enums/ISCFeature.ts +1 -1
  50. package/src/features.ts +3 -3
  51. package/src/functions/characters.ts +20 -4
  52. package/src/functions/charge.ts +1 -1
  53. package/src/functions/playerCollectibles.ts +372 -0
  54. package/src/functions/playerHealth.ts +2 -6
  55. package/src/functions/playerTrinkets.ts +184 -0
  56. package/src/functions/players.ts +16 -481
  57. package/src/functions/trinketGive.ts +1 -1
  58. package/src/functions/trinkets.ts +1 -84
  59. package/src/index.ts +2 -0
  60. package/src/objects/{characterStartingCollectibles.ts → characterStartingCollectibleTypes.ts} +1 -1
  61. package/src/objects/characterStartingTrinketTypes.ts +129 -0
  62. package/dist/src/classes/features/other/PlayerInventory.d.ts +0 -39
  63. package/dist/src/classes/features/other/PlayerInventory.d.ts.map +0 -1
  64. package/dist/src/classes/features/other/PlayerInventory.lua +0 -64
  65. package/dist/src/objects/characterStartingCollectibles.d.ts.map +0 -1
  66. package/src/classes/features/other/PlayerInventory.ts +0 -124
@@ -1,13 +1,6 @@
1
- local ____lualib = require("lualib_bundle")
2
- local __TS__ArrayMap = ____lualib.__TS__ArrayMap
3
- local __TS__ArraySome = ____lualib.__TS__ArraySome
4
1
  local ____exports = {}
5
2
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
6
- local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
7
- local TrinketSlot = ____isaac_2Dtypescript_2Ddefinitions.TrinketSlot
8
3
  local TrinketType = ____isaac_2Dtypescript_2Ddefinitions.TrinketType
9
- local ____cachedEnumValues = require("src.arrays.cachedEnumValues")
10
- local TRINKET_SLOT_VALUES = ____cachedEnumValues.TRINKET_SLOT_VALUES
11
4
  local ____cachedClasses = require("src.core.cachedClasses")
12
5
  local itemConfig = ____cachedClasses.itemConfig
13
6
  local ____constants = require("src.core.constants")
@@ -30,8 +23,6 @@ local ____flag = require("src.functions.flag")
30
23
  local hasFlag = ____flag.hasFlag
31
24
  local ____pickupVariants = require("src.functions.pickupVariants")
32
25
  local isTrinket = ____pickupVariants.isTrinket
33
- local ____players = require("src.functions.players")
34
- local isCharacter = ____players.isCharacter
35
26
  local ____sprites = require("src.functions.sprites")
36
27
  local clearSprite = ____sprites.clearSprite
37
28
  local ____types = require("src.functions.types")
@@ -82,45 +73,6 @@ function ____exports.getMysteriousPaperEffectForFrame(self, player, frameCount)
82
73
  end
83
74
  return frameCount % NUM_MYSTERIOUS_PAPER_EFFECTS
84
75
  end
85
- --- Returns the slot number corresponding to where a trinket can be safely inserted.
86
- --
87
- -- For example:
88
- --
89
- -- ```ts
90
- -- const player = Isaac.GetPlayer();
91
- -- const trinketSlot = getOpenTrinketSlotNum(player);
92
- -- if (trinketSlot !== undefined) {
93
- -- // They have one or more open trinket slots
94
- -- player.AddTrinket(TrinketType.SWALLOWED_PENNY);
95
- -- }
96
- -- ```
97
- function ____exports.getOpenTrinketSlot(self, player)
98
- local maxTrinkets = player:GetMaxTrinkets()
99
- local trinketType1 = player:GetTrinket(TrinketSlot.SLOT_1)
100
- local trinketType2 = player:GetTrinket(TrinketSlot.SLOT_2)
101
- if maxTrinkets == 1 then
102
- return trinketType1 == TrinketType.NULL and 0 or nil
103
- end
104
- if maxTrinkets == 2 then
105
- if trinketType1 == TrinketType.NULL then
106
- return 0
107
- end
108
- return trinketType2 == TrinketType.NULL and 1 or nil
109
- end
110
- error("The player has an unknown number of trinket slots: " .. tostring(maxTrinkets))
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
124
76
  --- Helper function to get the in-game description for a trinket. Returns "Unknown" if the provided
125
77
  -- trinket type was not valid.
126
78
  --
@@ -166,29 +118,6 @@ function ____exports.getTrinketName(self, trinketType)
166
118
  end
167
119
  return DEFAULT_TRINKET_NAME
168
120
  end
169
- --- Helper function to check to see if the player is holding one or more trinkets.
170
- function ____exports.hasAnyTrinket(self, player)
171
- local playerTrinketTypes = __TS__ArrayMap(
172
- TRINKET_SLOT_VALUES,
173
- function(____, trinketSlot) return player:GetTrinket(trinketSlot) end
174
- )
175
- return __TS__ArraySome(
176
- playerTrinketTypes,
177
- function(____, trinketType) return trinketType ~= TrinketType.NULL end
178
- )
179
- end
180
- --- Returns whether the player can hold an additional trinket, beyond what they are currently
181
- -- carrying. This takes into account items that modify the max number of trinkets, like Mom's Purse.
182
- --
183
- -- If the player is the Tainted Soul, this always returns false, since that character cannot pick up
184
- -- items. (Only Tainted Forgotten can pick up items.)
185
- function ____exports.hasOpenTrinketSlot(self, player)
186
- if isCharacter(nil, player, PlayerType.SOUL_B) then
187
- return false
188
- end
189
- local openTrinketSlot = ____exports.getOpenTrinketSlot(nil, player)
190
- return openTrinketSlot ~= nil
191
- end
192
121
  function ____exports.isGoldenTrinketType(self, trinketType)
193
122
  return asNumber(nil, trinketType) > GOLDEN_TRINKET_ADJUSTMENT
194
123
  end
@@ -86,9 +86,11 @@ export * from "./functions/pickups";
86
86
  export * from "./functions/pickupsSpecific";
87
87
  export * from "./functions/pills";
88
88
  export * from "./functions/playerCenter";
89
+ export * from "./functions/playerCollectibles";
89
90
  export * from "./functions/playerDataStructures";
90
91
  export * from "./functions/playerHealth";
91
92
  export * from "./functions/playerIndex";
93
+ export * from "./functions/playerTrinkets";
92
94
  export * from "./functions/players";
93
95
  export * from "./functions/pocketItems";
94
96
  export * from "./functions/positionVelocity";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc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qB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yCAAyC,CAAC;AACxD,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC"}
@@ -703,6 +703,14 @@ do
703
703
  end
704
704
  end
705
705
  end
706
+ do
707
+ local ____export = require("src.functions.playerCollectibles")
708
+ for ____exportKey, ____exportValue in pairs(____export) do
709
+ if ____exportKey ~= "default" then
710
+ ____exports[____exportKey] = ____exportValue
711
+ end
712
+ end
713
+ end
706
714
  do
707
715
  local ____export = require("src.functions.playerDataStructures")
708
716
  for ____exportKey, ____exportValue in pairs(____export) do
@@ -727,6 +735,14 @@ do
727
735
  end
728
736
  end
729
737
  end
738
+ do
739
+ local ____export = require("src.functions.playerTrinkets")
740
+ for ____exportKey, ____exportValue in pairs(____export) do
741
+ if ____exportKey ~= "default" then
742
+ ____exports[____exportKey] = ____exportValue
743
+ end
744
+ end
745
+ end
730
746
  do
731
747
  local ____export = require("src.functions.players")
732
748
  for ____exportKey, ____exportValue in pairs(____export) do
@@ -1,5 +1,5 @@
1
1
  import { CollectibleType } from "isaac-typescript-definitions";
2
- export declare const CHARACTER_STARTING_COLLECTIBLES: {
2
+ export declare const CHARACTER_STARTING_COLLECTIBLE_TYPES: {
3
3
  readonly [-1]: readonly [];
4
4
  readonly 0: readonly [CollectibleType.D6];
5
5
  readonly 1: readonly [CollectibleType.YUM_HEART];
@@ -43,4 +43,4 @@ export declare const CHARACTER_STARTING_COLLECTIBLES: {
43
43
  readonly 39: readonly [CollectibleType.ANIMA_SOLA];
44
44
  readonly 40: readonly [];
45
45
  };
46
- //# sourceMappingURL=characterStartingCollectibles.d.ts.map
46
+ //# sourceMappingURL=characterStartingCollectibleTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"characterStartingCollectibleTypes.d.ts","sourceRoot":"","sources":["../../../src/objects/characterStartingCollectibleTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAc,MAAM,8BAA8B,CAAC;AAE3E,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6IkB,CAAC"}
@@ -2,7 +2,7 @@ local ____exports = {}
2
2
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
3
3
  local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
4
4
  local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
5
- ____exports.CHARACTER_STARTING_COLLECTIBLES = {
5
+ ____exports.CHARACTER_STARTING_COLLECTIBLE_TYPES = {
6
6
  [PlayerType.POSSESSOR] = {},
7
7
  [PlayerType.ISAAC] = {CollectibleType.D6},
8
8
  [PlayerType.MAGDALENE] = {CollectibleType.YUM_HEART},
@@ -0,0 +1,46 @@
1
+ import { TrinketType } from "isaac-typescript-definitions";
2
+ export declare const CHARACTER_STARTING_TRINKET_TYPE: {
3
+ readonly [-1]: undefined;
4
+ readonly 0: undefined;
5
+ readonly 1: undefined;
6
+ readonly 2: TrinketType.PAPER_CLIP;
7
+ readonly 3: undefined;
8
+ readonly 4: undefined;
9
+ readonly 5: undefined;
10
+ readonly 6: TrinketType.CHILDS_HEART;
11
+ readonly 7: undefined;
12
+ readonly 8: undefined;
13
+ readonly 9: undefined;
14
+ readonly 10: undefined;
15
+ readonly 11: undefined;
16
+ readonly 12: undefined;
17
+ readonly 13: undefined;
18
+ readonly 14: TrinketType.STORE_KEY;
19
+ readonly 15: undefined;
20
+ readonly 16: undefined;
21
+ readonly 17: undefined;
22
+ readonly 18: undefined;
23
+ readonly 19: undefined;
24
+ readonly 20: undefined;
25
+ readonly 21: undefined;
26
+ readonly 22: undefined;
27
+ readonly 23: undefined;
28
+ readonly 24: undefined;
29
+ readonly 25: undefined;
30
+ readonly 26: undefined;
31
+ readonly 27: undefined;
32
+ readonly 28: undefined;
33
+ readonly 29: undefined;
34
+ readonly 30: undefined;
35
+ readonly 31: undefined;
36
+ readonly 32: undefined;
37
+ readonly 33: undefined;
38
+ readonly 34: undefined;
39
+ readonly 35: undefined;
40
+ readonly 36: undefined;
41
+ readonly 37: undefined;
42
+ readonly 38: undefined;
43
+ readonly 39: undefined;
44
+ readonly 40: undefined;
45
+ };
46
+ //# sourceMappingURL=characterStartingTrinketTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"characterStartingTrinketTypes.d.ts","sourceRoot":"","sources":["../../../src/objects/characterStartingTrinketTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAEvE,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8HoB,CAAC"}
@@ -0,0 +1,49 @@
1
+ local ____exports = {}
2
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
3
+ local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
4
+ local TrinketType = ____isaac_2Dtypescript_2Ddefinitions.TrinketType
5
+ ____exports.CHARACTER_STARTING_TRINKET_TYPE = {
6
+ [PlayerType.POSSESSOR] = nil,
7
+ [PlayerType.ISAAC] = nil,
8
+ [PlayerType.MAGDALENE] = nil,
9
+ [PlayerType.CAIN] = TrinketType.PAPER_CLIP,
10
+ [PlayerType.JUDAS] = nil,
11
+ [PlayerType.BLUE_BABY] = nil,
12
+ [PlayerType.EVE] = nil,
13
+ [PlayerType.SAMSON] = TrinketType.CHILDS_HEART,
14
+ [PlayerType.AZAZEL] = nil,
15
+ [PlayerType.LAZARUS] = nil,
16
+ [PlayerType.EDEN] = nil,
17
+ [PlayerType.LOST] = nil,
18
+ [PlayerType.LAZARUS_2] = nil,
19
+ [PlayerType.DARK_JUDAS] = nil,
20
+ [PlayerType.LILITH] = nil,
21
+ [PlayerType.KEEPER] = TrinketType.STORE_KEY,
22
+ [PlayerType.APOLLYON] = nil,
23
+ [PlayerType.FORGOTTEN] = nil,
24
+ [PlayerType.SOUL] = nil,
25
+ [PlayerType.BETHANY] = nil,
26
+ [PlayerType.JACOB] = nil,
27
+ [PlayerType.ESAU] = nil,
28
+ [PlayerType.ISAAC_B] = nil,
29
+ [PlayerType.MAGDALENE_B] = nil,
30
+ [PlayerType.CAIN_B] = nil,
31
+ [PlayerType.JUDAS_B] = nil,
32
+ [PlayerType.BLUE_BABY_B] = nil,
33
+ [PlayerType.EVE_B] = nil,
34
+ [PlayerType.SAMSON_B] = nil,
35
+ [PlayerType.AZAZEL_B] = nil,
36
+ [PlayerType.LAZARUS_B] = nil,
37
+ [PlayerType.EDEN_B] = nil,
38
+ [PlayerType.LOST_B] = nil,
39
+ [PlayerType.LILITH_B] = nil,
40
+ [PlayerType.KEEPER_B] = nil,
41
+ [PlayerType.APOLLYON_B] = nil,
42
+ [PlayerType.FORGOTTEN_B] = nil,
43
+ [PlayerType.BETHANY_B] = nil,
44
+ [PlayerType.JACOB_B] = nil,
45
+ [PlayerType.LAZARUS_2_B] = nil,
46
+ [PlayerType.JACOB_2_B] = nil,
47
+ [PlayerType.SOUL_B] = nil
48
+ }
49
+ return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "43.1.0",
3
+ "version": "44.1.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -9,15 +9,13 @@ import { game } from "../../../core/cachedClasses";
9
9
  import { Exported } from "../../../decorators";
10
10
  import { ISCFeature } from "../../../enums/ISCFeature";
11
11
  import { collectibleHasTag } from "../../../functions/collectibleTag";
12
+ import { anyPlayerHasCollectible } from "../../../functions/playerCollectibles";
12
13
  import {
13
14
  mapGetPlayer,
14
15
  mapSetPlayer,
15
16
  } from "../../../functions/playerDataStructures";
16
17
  import { getAllPlayers } from "../../../functions/playerIndex";
17
- import {
18
- anyPlayerHasCollectible,
19
- getPlayersOfType,
20
- } from "../../../functions/players";
18
+ import { getPlayersOfType } from "../../../functions/players";
21
19
  import { repeat } from "../../../functions/utils";
22
20
  import type { PlayerIndex } from "../../../types/PlayerIndex";
23
21
  import { Feature } from "../../private/Feature";
@@ -14,8 +14,8 @@ import {
14
14
  } from "../../../functions/entitiesSpecific";
15
15
  import { isTear } from "../../../functions/isaacAPIClass";
16
16
  import { logError } from "../../../functions/logMisc";
17
+ import { useActiveItemTemp } from "../../../functions/playerCollectibles";
17
18
  import { getAllPlayers } from "../../../functions/playerIndex";
18
- import { useActiveItemTemp } from "../../../functions/players";
19
19
  import { getTSTLClassName } from "../../../functions/tstlClass";
20
20
  import { assertDefined } from "../../../functions/utils";
21
21
  import { ReadonlySet } from "../../../types/ReadonlySet";
@@ -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
+ }
@@ -107,13 +107,13 @@ import {
107
107
  spawnTrinket as spawnTrinketFunction,
108
108
  } from "../../../../functions/pickupsSpecific";
109
109
  import { getPillEffectName } from "../../../../functions/pills";
110
- import { getPlayers } from "../../../../functions/playerIndex";
111
110
  import {
112
111
  addCollectibleCostume,
113
- getPlayerName,
114
112
  removeCollectibleCostume,
115
113
  useActiveItemTemp,
116
- } from "../../../../functions/players";
114
+ } from "../../../../functions/playerCollectibles";
115
+ import { getPlayers } from "../../../../functions/playerIndex";
116
+ import { getPlayerName } from "../../../../functions/players";
117
117
  import { gridCoordinatesToWorldPosition } from "../../../../functions/roomGrid";
118
118
  import { reloadRoom as reloadRoomFunction } from "../../../../functions/roomTransition";
119
119
  import { changeRoom } from "../../../../functions/rooms";
@@ -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,10 +1,14 @@
1
- import type { CollectibleType } from "isaac-typescript-definitions";
1
+ import type {
2
+ CollectibleType,
3
+ TrinketType,
4
+ } from "isaac-typescript-definitions";
2
5
  import { PlayerType } from "isaac-typescript-definitions";
3
6
  import { FLYING_CHARACTERS, MAIN_CHARACTERS } from "../core/constants";
4
7
  import { LAST_VANILLA_CHARACTER } from "../core/constantsFirstLast";
5
8
  import { CHARACTER_DAMAGE_MULTIPLIERS } from "../objects/characterDamageMultipliers";
6
9
  import { CHARACTER_NAMES } from "../objects/characterNames";
7
- import { CHARACTER_STARTING_COLLECTIBLES } from "../objects/characterStartingCollectibles";
10
+ import { CHARACTER_STARTING_COLLECTIBLE_TYPES } from "../objects/characterStartingCollectibleTypes";
11
+ import { CHARACTER_STARTING_TRINKET_TYPE } from "../objects/characterStartingTrinketTypes";
8
12
  import { CHARACTERS_THAT_START_WITH_AN_ACTIVE_ITEM_SET } from "../sets/charactersThatStartWithAnActiveItemSet";
9
13
  import { CHARACTERS_WITH_BLACK_HEART_FROM_ETERNAL_HEART_SET } from "../sets/charactersWithBlackHeartFromEternalHeartSet";
10
14
  import { CHARACTERS_WITH_FREE_DEVIL_DEALS_SET } from "../sets/charactersWithFreeDevilDealsSet";
@@ -137,10 +141,22 @@ export function getCharacterName(character: PlayerType): string {
137
141
  *
138
142
  * Note that this will return an empty array for Eden and Tainted Eden.
139
143
  */
140
- export function getCharacterStartingCollectibles(
144
+ export function getCharacterStartingCollectibleTypes(
141
145
  character: PlayerType,
142
146
  ): readonly CollectibleType[] {
143
- return CHARACTER_STARTING_COLLECTIBLES[character];
147
+ return CHARACTER_STARTING_COLLECTIBLE_TYPES[character];
148
+ }
149
+
150
+ /**
151
+ * Helper function to get the trinket that is granted to a particular character at the beginning of
152
+ * a run. Returns undefined if the character does not start with a trinket.
153
+ *
154
+ * Note that this will return undefined for Eden and Tainted Eden.
155
+ */
156
+ export function getCharacterStartingTrinketType(
157
+ character: PlayerType,
158
+ ): TrinketType | undefined {
159
+ return CHARACTER_STARTING_TRINKET_TYPE[character];
144
160
  }
145
161
 
146
162
  export function isFlyingCharacter(character: PlayerType): boolean {
@@ -10,8 +10,8 @@ import {
10
10
  getCollectibleChargeType,
11
11
  getCollectibleMaxCharges,
12
12
  } from "./collectibles";
13
+ import { getActiveItemSlots } from "./playerCollectibles";
13
14
  import { getPlayers } from "./playerIndex";
14
- import { getActiveItemSlots } from "./players";
15
15
  import { getRoomShapeCharges } from "./roomShape";
16
16
 
17
17
  /**