isaacscript-common 28.4.0 → 28.6.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.
@@ -9103,6 +9103,19 @@ export declare function mapGetPlayer<V>(map: Map<PlayerIndex, V>, player: Entity
9103
9103
  */
9104
9104
  export declare function mapHasPlayer<V>(map: Map<PlayerIndex, V>, player: EntityPlayer): boolean;
9105
9105
 
9106
+ /**
9107
+ * All of the collectibles that grant vision on the map.
9108
+ *
9109
+ * Note that:
9110
+ * - Book of Shadows is included, which is an "active mapping" instead of passive.
9111
+ * - Spelunker Hat is included. Historically, Spelunker Hat was not considered to be mapping, but it
9112
+ * was buffed in Repentance to show rooms two or more away.
9113
+ * - Luna is included, even though it is not a very powerful mapping item.
9114
+ * - Cracked Orb is included, even though it requires the player to be damaged in order for it to be
9115
+ * activated.
9116
+ */
9117
+ export declare const MAPPING_COLLECTIBLES: readonly [CollectibleType.COMPASS, CollectibleType.TREASURE_MAP, CollectibleType.BOOK_OF_SHADOWS, CollectibleType.SPELUNKER_HAT, CollectibleType.CRYSTAL_BALL, CollectibleType.BLUE_MAP, CollectibleType.MIND, CollectibleType.SOL, CollectibleType.LUNA, CollectibleType.CRACKED_ORB];
9118
+
9106
9119
  /**
9107
9120
  * Helper function to set a value for a `DefaultMap` that corresponds to an entity, assuming that
9108
9121
  * the map uses `PtrHash` as an index.
@@ -15132,6 +15145,15 @@ export declare function setFloorDisplayFlags(displayFlagsMap: Map<int, BitFlags<
15132
15145
  */
15133
15146
  export declare function setGridEntityInvisible(gridEntity: GridEntity): void;
15134
15147
 
15148
+ /**
15149
+ * Helper function to check for one or more elements in a set at once without having to repeatedly
15150
+ * call the `Set.has` method.
15151
+ *
15152
+ * This function is variadic, meaning that you can pass as many things as you want to check for. It
15153
+ * will return true if one or more elements are found.
15154
+ */
15155
+ export declare function setHas<T>(set: Set<T> | ReadonlySet<T>, ...elements: T[]): boolean;
15156
+
15135
15157
  /**
15136
15158
  * Helper function to make using sets with an type of `PlayerIndex` easier. Use this instead of the
15137
15159
  * `Set.has` method if you have a set of this type.
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 28.4.0
3
+ isaacscript-common 28.6.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -17614,6 +17614,7 @@ return ____exports
17614
17614
  ["src.core.constants"] = function(...)
17615
17615
  local ____exports = {}
17616
17616
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
17617
+ local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
17617
17618
  local Dimension = ____isaac_2Dtypescript_2Ddefinitions.Dimension
17618
17619
  local DisplayFlag = ____isaac_2Dtypescript_2Ddefinitions.DisplayFlag
17619
17620
  local ItemPoolType = ____isaac_2Dtypescript_2Ddefinitions.ItemPoolType
@@ -17649,6 +17650,18 @@ ____exports.RENDER_FRAMES_PER_MINUTE = ____exports.RENDER_FRAMES_PER_SECOND * 60
17649
17650
  ____exports.GRID_INDEX_CENTER_OF_1X1_ROOM = 67
17650
17651
  ____exports.LEVEL_GRID_COLUMN_HEIGHT = 13
17651
17652
  ____exports.LEVEL_GRID_ROW_WIDTH = 13
17653
+ ____exports.MAPPING_COLLECTIBLES = {
17654
+ CollectibleType.COMPASS,
17655
+ CollectibleType.TREASURE_MAP,
17656
+ CollectibleType.BOOK_OF_SHADOWS,
17657
+ CollectibleType.SPELUNKER_HAT,
17658
+ CollectibleType.CRYSTAL_BALL,
17659
+ CollectibleType.BLUE_MAP,
17660
+ CollectibleType.MIND,
17661
+ CollectibleType.SOL,
17662
+ CollectibleType.LUNA,
17663
+ CollectibleType.CRACKED_ORB
17664
+ }
17652
17665
  ____exports.MAX_LEVEL_GRID_INDEX = 168
17653
17666
  ____exports.MAX_NUM_FAMILIARS = 64
17654
17667
  ____exports.MAX_NUM_INPUTS = 4
@@ -28287,6 +28300,7 @@ local __TS__New = ____lualib.__TS__New
28287
28300
  local __TS__ArrayMap = ____lualib.__TS__ArrayMap
28288
28301
  local __TS__Spread = ____lualib.__TS__Spread
28289
28302
  local __TS__ArraySort = ____lualib.__TS__ArraySort
28303
+ local __TS__ArraySome = ____lualib.__TS__ArraySome
28290
28304
  local ____exports = {}
28291
28305
  local ____ReadonlySet = require("src.types.ReadonlySet")
28292
28306
  local ReadonlySet = ____ReadonlySet.ReadonlySet
@@ -28368,6 +28382,13 @@ function ____exports.setAdd(self, set, ...)
28368
28382
  set:add(element)
28369
28383
  end
28370
28384
  end
28385
+ function ____exports.setHas(self, set, ...)
28386
+ local elements = {...}
28387
+ return __TS__ArraySome(
28388
+ elements,
28389
+ function(____, element) return set:has(element) end
28390
+ )
28391
+ end
28371
28392
  function ____exports.sumSet(self, set)
28372
28393
  local values = {__TS__Spread(set:values())}
28373
28394
  return sumArray(nil, values)
@@ -1,4 +1,4 @@
1
- import { ItemPoolType } from "isaac-typescript-definitions";
1
+ import { CollectibleType, ItemPoolType } from "isaac-typescript-definitions";
2
2
  /**
3
3
  * The combination of the following flags:
4
4
  * - `DisplayFlag.VISIBLE` (1 << 0)
@@ -47,7 +47,7 @@ export declare const EMPTY_PNG_PATH = "gfx/none.png";
47
47
  *
48
48
  * This is equal to 4294967295.
49
49
  */
50
- export declare const FIRST_GLITCHED_COLLECTIBLE_TYPE: import("isaac-typescript-definitions").CollectibleType;
50
+ export declare const FIRST_GLITCHED_COLLECTIBLE_TYPE: CollectibleType;
51
51
  /** Game frames are what is returned by the `Game.GetFrameCount` method. */
52
52
  export declare const GAME_FRAMES_PER_SECOND = 30;
53
53
  /** Game frames are what is returned by the `Game.GetFrameCount` method. */
@@ -68,6 +68,18 @@ export declare const LEVEL_GRID_COLUMN_HEIGHT = 13;
68
68
  * on.
69
69
  */
70
70
  export declare const LEVEL_GRID_ROW_WIDTH = 13;
71
+ /**
72
+ * All of the collectibles that grant vision on the map.
73
+ *
74
+ * Note that:
75
+ * - Book of Shadows is included, which is an "active mapping" instead of passive.
76
+ * - Spelunker Hat is included. Historically, Spelunker Hat was not considered to be mapping, but it
77
+ * was buffed in Repentance to show rooms two or more away.
78
+ * - Luna is included, even though it is not a very powerful mapping item.
79
+ * - Cracked Orb is included, even though it requires the player to be damaged in order for it to be
80
+ * activated.
81
+ */
82
+ export declare const MAPPING_COLLECTIBLES: readonly [CollectibleType.COMPASS, CollectibleType.TREASURE_MAP, CollectibleType.BOOK_OF_SHADOWS, CollectibleType.SPELUNKER_HAT, CollectibleType.CRYSTAL_BALL, CollectibleType.BLUE_MAP, CollectibleType.MIND, CollectibleType.SOL, CollectibleType.LUNA, CollectibleType.CRACKED_ORB];
71
83
  /**
72
84
  * The floor is represented by a 13x13 grid. Room indexes start at 0. The first row is represented
73
85
  * by grid indexes from 0 to 12. The second row is represented by grid indexes from 13 to 25, and so
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/core/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EAEb,MAAM,8BAA8B,CAAC;AAWtC;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB;;;;EAI7B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iCAAiC,SAAS,CAAC;AAExD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,4CAA4C,CAAC;AAE7E,mEAAmE;AACnE,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,iGAAiG;AACjG,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAE3C,eAAO,MAAM,sBAAsB,wBAAwB,CAAC;AAE5D,gGAAgG;AAChG,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC;;;;GAIG;AACH,eAAO,MAAM,gCAAgC,KAAK,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,cAAc,iBAAiB,CAAC;AAE7C;;;;;;GAMG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,eAAO,MAAM,iCAAiC,SAAS,CAAC;AAExD,eAAO,MAAM,cAAc,QAA+B,CAAC;AAE3D;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAAyB,CAAC;AAExD,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAE7C,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAC3C,eAAO,MAAM,sBAAsB,QAA8B,CAAC;AAElE,mGAAmG;AACnG,eAAO,MAAM,sBAAsB,QAAmB,CAAC;AAEvD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,QAAmB,CAAC;AAEpD,6FAA6F;AAC7F,eAAO,MAAM,gDAAgD,QAAQ,CAAC;AAEtE,4CAA4C;AAC5C,eAAO,MAAM,8BAA8B,QAA4B,CAAC;AAExE,kEAAkE;AAClE,eAAO,MAAM,gBAAgB,QAAkB,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,cAAc,KAAK,CAAC;AAEjC;;;;;GAKG;AACH,eAAO,MAAM,SAAS,kBAA0B,CAAC;AAEjD;;;;;GAKG;AACH,eAAO,MAAM,UAAU,kBAA0B,CAAC;AAElD;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,iBAA4B,CAAC;AAEtD;;;;GAIG;AACH,eAAO,MAAM,aAAa,kBAAgC,CAAC"}
@@ -1,5 +1,6 @@
1
1
  local ____exports = {}
2
2
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
3
+ local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
3
4
  local Dimension = ____isaac_2Dtypescript_2Ddefinitions.Dimension
4
5
  local DisplayFlag = ____isaac_2Dtypescript_2Ddefinitions.DisplayFlag
5
6
  local ItemPoolType = ____isaac_2Dtypescript_2Ddefinitions.ItemPoolType
@@ -65,6 +66,27 @@ ____exports.LEVEL_GRID_COLUMN_HEIGHT = 13
65
66
  -- by grid indexes from 0 to 12. The second row is represented by grid indexes from 13 to 25, and so
66
67
  -- on.
67
68
  ____exports.LEVEL_GRID_ROW_WIDTH = 13
69
+ --- All of the collectibles that grant vision on the map.
70
+ --
71
+ -- Note that:
72
+ -- - Book of Shadows is included, which is an "active mapping" instead of passive.
73
+ -- - Spelunker Hat is included. Historically, Spelunker Hat was not considered to be mapping, but it
74
+ -- was buffed in Repentance to show rooms two or more away.
75
+ -- - Luna is included, even though it is not a very powerful mapping item.
76
+ -- - Cracked Orb is included, even though it requires the player to be damaged in order for it to be
77
+ -- activated.
78
+ ____exports.MAPPING_COLLECTIBLES = {
79
+ CollectibleType.COMPASS,
80
+ CollectibleType.TREASURE_MAP,
81
+ CollectibleType.BOOK_OF_SHADOWS,
82
+ CollectibleType.SPELUNKER_HAT,
83
+ CollectibleType.CRYSTAL_BALL,
84
+ CollectibleType.BLUE_MAP,
85
+ CollectibleType.MIND,
86
+ CollectibleType.SOL,
87
+ CollectibleType.LUNA,
88
+ CollectibleType.CRACKED_ORB
89
+ }
68
90
  --- The floor is represented by a 13x13 grid. Room indexes start at 0. The first row is represented
69
91
  -- by grid indexes from 0 to 12. The second row is represented by grid indexes from 13 to 25, and so
70
92
  -- on. The maximum room index possible is 168. (It is not 169 because we start at 0 instead of 1.)
@@ -65,6 +65,14 @@ export declare function getSortedSetValues<T>(set: Set<T> | ReadonlySet<T>): T[]
65
65
  * This function is variadic, meaning that you can pass as many things as you want to add.
66
66
  */
67
67
  export declare function setAdd<T>(set: Set<T>, ...elements: T[]): void;
68
+ /**
69
+ * Helper function to check for one or more elements in a set at once without having to repeatedly
70
+ * call the `Set.has` method.
71
+ *
72
+ * This function is variadic, meaning that you can pass as many things as you want to check for. It
73
+ * will return true if one or more elements are found.
74
+ */
75
+ export declare function setHas<T>(set: Set<T> | ReadonlySet<T>, ...elements: T[]): boolean;
68
76
  /** Helper function to sum every value in a set together. */
69
77
  export declare function sumSet(set: Set<number> | ReadonlySet<number>): number;
70
78
  //# sourceMappingURL=set.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../../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MN;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,EAC5B,SAAS,GAAE,IAAI,GAAG,GAAqB,EACvC,UAAU,GAAE,CAAC,EAAE,GAAG,SAAS,CAAC,EAAO,GAClC,CAAC,CAGH;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,EAC5B,iBAAiB,EAAE,OAAO,GACzB,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAK/B;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAkBvE;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,QAAQ,EAAE,CAAC,EAAE,GAAG,IAAI,CAI7D;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,CAAC,EACtB,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,EAC5B,GAAG,QAAQ,EAAE,CAAC,EAAE,GACf,OAAO,CAET;AAED,4DAA4D;AAC5D,wBAAgB,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,GAAG,MAAM,CAGrE"}
@@ -5,6 +5,7 @@ local __TS__New = ____lualib.__TS__New
5
5
  local __TS__ArrayMap = ____lualib.__TS__ArrayMap
6
6
  local __TS__Spread = ____lualib.__TS__Spread
7
7
  local __TS__ArraySort = ____lualib.__TS__ArraySort
8
+ local __TS__ArraySome = ____lualib.__TS__ArraySome
8
9
  local ____exports = {}
9
10
  local ____ReadonlySet = require("src.types.ReadonlySet")
10
11
  local ReadonlySet = ____ReadonlySet.ReadonlySet
@@ -129,6 +130,18 @@ function ____exports.setAdd(self, set, ...)
129
130
  set:add(element)
130
131
  end
131
132
  end
133
+ --- Helper function to check for one or more elements in a set at once without having to repeatedly
134
+ -- call the `Set.has` method.
135
+ --
136
+ -- This function is variadic, meaning that you can pass as many things as you want to check for. It
137
+ -- will return true if one or more elements are found.
138
+ function ____exports.setHas(self, set, ...)
139
+ local elements = {...}
140
+ return __TS__ArraySome(
141
+ elements,
142
+ function(____, element) return set:has(element) end
143
+ )
144
+ end
132
145
  --- Helper function to sum every value in a set together.
133
146
  function ____exports.sumSet(self, set)
134
147
  local values = {__TS__Spread(set:values())}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "28.4.0",
3
+ "version": "28.6.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -1,4 +1,5 @@
1
1
  import {
2
+ CollectibleType,
2
3
  Dimension,
3
4
  DisplayFlag,
4
5
  ItemPoolType,
@@ -103,6 +104,30 @@ export const LEVEL_GRID_COLUMN_HEIGHT = 13;
103
104
  */
104
105
  export const LEVEL_GRID_ROW_WIDTH = 13;
105
106
 
107
+ /**
108
+ * All of the collectibles that grant vision on the map.
109
+ *
110
+ * Note that:
111
+ * - Book of Shadows is included, which is an "active mapping" instead of passive.
112
+ * - Spelunker Hat is included. Historically, Spelunker Hat was not considered to be mapping, but it
113
+ * was buffed in Repentance to show rooms two or more away.
114
+ * - Luna is included, even though it is not a very powerful mapping item.
115
+ * - Cracked Orb is included, even though it requires the player to be damaged in order for it to be
116
+ * activated.
117
+ */
118
+ export const MAPPING_COLLECTIBLES = [
119
+ CollectibleType.COMPASS, // 21
120
+ CollectibleType.TREASURE_MAP, // 54
121
+ CollectibleType.BOOK_OF_SHADOWS, // 58
122
+ CollectibleType.SPELUNKER_HAT, // 91
123
+ CollectibleType.CRYSTAL_BALL, // 158
124
+ CollectibleType.BLUE_MAP, // 246
125
+ CollectibleType.MIND, // 333
126
+ CollectibleType.SOL, // 588
127
+ CollectibleType.LUNA, // 589
128
+ CollectibleType.CRACKED_ORB, // 675
129
+ ] as const;
130
+
106
131
  /**
107
132
  * The floor is represented by a 13x13 grid. Room indexes start at 0. The first row is represented
108
133
  * by grid indexes from 0 to 12. The second row is represented by grid indexes from 13 to 25, and so
@@ -149,6 +149,20 @@ export function setAdd<T>(set: Set<T>, ...elements: T[]): void {
149
149
  }
150
150
  }
151
151
 
152
+ /**
153
+ * Helper function to check for one or more elements in a set at once without having to repeatedly
154
+ * call the `Set.has` method.
155
+ *
156
+ * This function is variadic, meaning that you can pass as many things as you want to check for. It
157
+ * will return true if one or more elements are found.
158
+ */
159
+ export function setHas<T>(
160
+ set: Set<T> | ReadonlySet<T>,
161
+ ...elements: T[]
162
+ ): boolean {
163
+ return elements.some((element) => set.has(element));
164
+ }
165
+
152
166
  /** Helper function to sum every value in a set together. */
153
167
  export function sumSet(set: Set<number> | ReadonlySet<number>): number {
154
168
  const values = [...set.values()];