isaacscript-common 9.8.4 → 9.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -71,6 +71,12 @@ export declare function getEntities(entityType?: EntityType, variant?: number, s
71
71
  * as comparing other types is non-trivial.
72
72
  */
73
73
  export declare function getEntityFields(entity: Entity): LuaMap<string, boolean | number | string>;
74
+ /**
75
+ * Helper function to get an entity from a `PtrHash`. Note that doing this is very expensive, so you
76
+ * should only use this function when debugging. (Normally, if you need to work backwards from a
77
+ * reference, you would use an `EntityPtr` instead of a `PtrHash`.
78
+ */
79
+ export declare function getEntityFromPtrHash(ptrHash: PtrHash): Entity | undefined;
74
80
  /** Helper function to return a string containing the entity's type, variant, and sub-type. */
75
81
  export declare function getEntityID(entity: Entity): string;
76
82
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../src/functions/entities.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAI1D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAO/C;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC3B,UAAU,GAAE,UAAe,EAC3B,OAAO,SAAK,EACZ,OAAO,SAAK,EACZ,cAAc,UAAQ,GACrB,GAAG,CAcL;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,UAAU,GAAE,UAAe,EAC3B,OAAO,SAAK,EACZ,OAAO,SAAK,EACZ,cAAc,UAAQ,GACrB,OAAO,CAGT;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,SAAS,EACpD,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,CAAC,EAAE,GACZ,CAAC,GAAG,SAAS,CAaf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,WAAW,CACzB,UAAU,GAAE,UAAe,EAC3B,OAAO,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Find
2
3
  local Set = ____lualib.Set
3
4
  local __TS__New = ____lualib.__TS__New
4
5
  local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
@@ -208,6 +209,16 @@ function ____exports.getEntityFields(self, entity)
208
209
  setPrimitiveEntityFields(nil, entity, parentTable, entityFields)
209
210
  return entityFields
210
211
  end
212
+ --- Helper function to get an entity from a `PtrHash`. Note that doing this is very expensive, so you
213
+ -- should only use this function when debugging. (Normally, if you need to work backwards from a
214
+ -- reference, you would use an `EntityPtr` instead of a `PtrHash`.
215
+ function ____exports.getEntityFromPtrHash(self, ptrHash)
216
+ local entities = ____exports.getEntities(nil)
217
+ return __TS__ArrayFind(
218
+ entities,
219
+ function(____, entity) return GetPtrHash(entity) == ptrHash end
220
+ )
221
+ end
211
222
  --- Helper function to return a string containing the entity's type, variant, and sub-type.
212
223
  function ____exports.getEntityID(self, entity)
213
224
  return (((tostring(entity.Type) .. ".") .. tostring(entity.Variant)) .. ".") .. tostring(entity.SubType)
@@ -13,4 +13,14 @@ export declare function logEntity(this: void, entity: Entity): void;
13
13
  export declare function logGridEntities(this: void, gridEntities: GridEntity[]): void;
14
14
  /** Helper function for log information about a specific grid entity. */
15
15
  export declare function logGridEntity(this: void, gridEntity: GridEntity): void;
16
+ /**
17
+ * Helper function to log information about the entity that corresponding to a pointer hash. (Only
18
+ * use this when debugging, since retrieving the corresponding entity is expensive.)
19
+ */
20
+ export declare function logPtrHash(this: void, ptrHash: PtrHash): void;
21
+ /**
22
+ * Helper function to log information about the entity that corresponding to one or more pointer
23
+ * hashes. (Only use this when debugging, since retrieving the corresponding entity is expensive.)
24
+ */
25
+ export declare function logPtrHashes(this: void, ptrHashes: PtrHash[]): void;
16
26
  //# sourceMappingURL=logEntities.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"logEntities.d.ts","sourceRoot":"","sources":["../../src/functions/logEntities.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,cAAc,EACf,MAAM,8BAA8B,CAA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AAClE,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAG1D;AA2ED,sEAAsE;AACtE,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,GAAG,IAAI,CAI5E;AAED,wEAAwE;AACxE,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI,CAGtE;AA2DD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAQ7D;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,IAAI,CAInE"}
@@ -9,6 +9,7 @@ local EffectVariant = ____isaac_2Dtypescript_2Ddefinitions.EffectVariant
9
9
  local GridEntityType = ____isaac_2Dtypescript_2Ddefinitions.GridEntityType
10
10
  local ____entities = require("functions.entities")
11
11
  local getEntities = ____entities.getEntities
12
+ local getEntityFromPtrHash = ____entities.getEntityFromPtrHash
12
13
  local getEntityID = ____entities.getEntityID
13
14
  local ____gridEntities = require("functions.gridEntities")
14
15
  local getGridEntities = ____gridEntities.getGridEntities
@@ -217,4 +218,22 @@ function ____exports.logGridEntities(gridEntities)
217
218
  ____exports.logGridEntity(gridEntity)
218
219
  end
219
220
  end
221
+ --- Helper function to log information about the entity that corresponding to a pointer hash. (Only
222
+ -- use this when debugging, since retrieving the corresponding entity is expensive.)
223
+ function ____exports.logPtrHash(ptrHash)
224
+ log("PtrHash: " .. tostring(ptrHash))
225
+ local entity = getEntityFromPtrHash(nil, ptrHash)
226
+ if entity == nil then
227
+ log("No corresponding entity found.")
228
+ else
229
+ ____exports.logEntity(entity)
230
+ end
231
+ end
232
+ --- Helper function to log information about the entity that corresponding to one or more pointer
233
+ -- hashes. (Only use this when debugging, since retrieving the corresponding entity is expensive.)
234
+ function ____exports.logPtrHashes(ptrHashes)
235
+ for ____, ptrHash in ipairs(ptrHashes) do
236
+ ____exports.logPtrHash(ptrHash)
237
+ end
238
+ end
220
239
  return ____exports
@@ -33,6 +33,9 @@ export declare function setFloorDisplayFlags(displayFlagsMap: Map<int, BitFlags<
33
33
  * Helper function to set a particular room's minimap display flags (e.g. whether or not it is
34
34
  * visible and so on).
35
35
  *
36
+ * You must call the `Level.UpdateVisibility` method after using this function for the changes to
37
+ * take effect.
38
+ *
36
39
  * @param roomGridIndex Set to undefined to use the current room index.
37
40
  * @param displayFlags The bit flags value to set. (See the `DisplayFlag` enum.)
38
41
  */
@@ -1 +1 @@
1
- {"version":3,"file":"minimap.d.ts","sourceRoot":"","sources":["../../src/functions/minimap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAmB,MAAM,8BAA8B,CAAC;AAK5E;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAS7C;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC,CAYtE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,CAAC,EAAE,GAAG,GAClB,QAAQ,CAAC,WAAW,CAAC,CAGvB;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,eAAe,EAAE,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC,GAC/C,IAAI,CAgBN;AAED,gDAAgD;AAChD,wBAAgB,oBAAoB,CAClC,eAAe,EAAE,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC,GAC/C,IAAI,CAEN;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,GAAG,GAAG,SAAS,EAC9B,YAAY,EAAE,QAAQ,CAAC,WAAW,CAAC,GAClC,IAAI,CAGN"}
1
+ {"version":3,"file":"minimap.d.ts","sourceRoot":"","sources":["../../src/functions/minimap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAmB,MAAM,8BAA8B,CAAC;AAK5E;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAS7C;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC,CAYtE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,CAAC,EAAE,GAAG,GAClB,QAAQ,CAAC,WAAW,CAAC,CAGvB;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,eAAe,EAAE,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC,GAC/C,IAAI,CAgBN;AAED,gDAAgD;AAChD,wBAAgB,oBAAoB,CAClC,eAAe,EAAE,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC,GAC/C,IAAI,CAEN;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,GAAG,GAAG,SAAS,EAC9B,YAAY,EAAE,QAAQ,CAAC,WAAW,CAAC,GAClC,IAAI,CAGN"}
@@ -14,6 +14,9 @@ local getRoomsInsideGrid = ____rooms.getRoomsInsideGrid
14
14
  --- Helper function to set a particular room's minimap display flags (e.g. whether or not it is
15
15
  -- visible and so on).
16
16
  --
17
+ -- You must call the `Level.UpdateVisibility` method after using this function for the changes to
18
+ -- take effect.
19
+ --
17
20
  -- @param roomGridIndex Set to undefined to use the current room index.
18
21
  -- @param displayFlags The bit flags value to set. (See the `DisplayFlag` enum.)
19
22
  function ____exports.setRoomDisplayFlags(self, roomGridIndex, displayFlags)
package/dist/index.d.ts CHANGED
@@ -2983,6 +2983,13 @@ export declare function getEntities(entityType?: EntityType, variant?: number, s
2983
2983
  */
2984
2984
  export declare function getEntityFields(entity: Entity): LuaMap<string, boolean | number | string>;
2985
2985
 
2986
+ /**
2987
+ * Helper function to get an entity from a `PtrHash`. Note that doing this is very expensive, so you
2988
+ * should only use this function when debugging. (Normally, if you need to work backwards from a
2989
+ * reference, you would use an `EntityPtr` instead of a `PtrHash`.
2990
+ */
2991
+ export declare function getEntityFromPtrHash(ptrHash: PtrHash): Entity | undefined;
2992
+
2986
2993
  /** Helper function to return a string containing the entity's type, variant, and sub-type. */
2987
2994
  export declare function getEntityID(entity: Entity): string;
2988
2995
 
@@ -6588,6 +6595,18 @@ export declare function logPlayerHealth(this: void, player: EntityPlayer): void;
6588
6595
  */
6589
6596
  export declare function logProjectileFlags(this: void, flags: ProjectileFlag | BitFlags<ProjectileFlag>): void;
6590
6597
 
6598
+ /**
6599
+ * Helper function to log information about the entity that corresponding to a pointer hash. (Only
6600
+ * use this when debugging, since retrieving the corresponding entity is expensive.)
6601
+ */
6602
+ export declare function logPtrHash(this: void, ptrHash: PtrHash): void;
6603
+
6604
+ /**
6605
+ * Helper function to log information about the entity that corresponding to one or more pointer
6606
+ * hashes. (Only use this when debugging, since retrieving the corresponding entity is expensive.)
6607
+ */
6608
+ export declare function logPtrHashes(this: void, ptrHashes: PtrHash[]): void;
6609
+
6591
6610
  /** Helper function for logging information about the current room. */
6592
6611
  export declare function logRoom(this: void): void;
6593
6612
 
@@ -10630,6 +10649,9 @@ export declare function setRoomData(roomGridIndex: int, roomData: Readonly<RoomC
10630
10649
  * Helper function to set a particular room's minimap display flags (e.g. whether or not it is
10631
10650
  * visible and so on).
10632
10651
  *
10652
+ * You must call the `Level.UpdateVisibility` method after using this function for the changes to
10653
+ * take effect.
10654
+ *
10633
10655
  * @param roomGridIndex Set to undefined to use the current room index.
10634
10656
  * @param displayFlags The bit flags value to set. (See the `DisplayFlag` enum.)
10635
10657
  */
@@ -73,8 +73,8 @@ ____exports.CARD_MAP = __TS__New(Map, {
73
73
  {"algiz", CardType.RUNE_ALGIZ},
74
74
  {"resistance", CardType.RUNE_ALGIZ},
75
75
  {"shield", CardType.RUNE_ALGIZ},
76
- {"blank", CardType.RUNE_BLANK},
77
- {"black", CardType.RUNE_BLACK},
76
+ {"blankRune", CardType.RUNE_BLANK},
77
+ {"blackRune", CardType.RUNE_BLACK},
78
78
  {"chaos", CardType.CHAOS},
79
79
  {"credit", CardType.CREDIT},
80
80
  {"rules", CardType.RULES},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "9.8.4",
3
+ "version": "9.9.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -194,6 +194,16 @@ function setPrimitiveEntityFields(
194
194
  }
195
195
  }
196
196
 
197
+ /**
198
+ * Helper function to get an entity from a `PtrHash`. Note that doing this is very expensive, so you
199
+ * should only use this function when debugging. (Normally, if you need to work backwards from a
200
+ * reference, you would use an `EntityPtr` instead of a `PtrHash`.
201
+ */
202
+ export function getEntityFromPtrHash(ptrHash: PtrHash): Entity | undefined {
203
+ const entities = getEntities();
204
+ return entities.find((entity) => GetPtrHash(entity) === ptrHash);
205
+ }
206
+
197
207
  /** Helper function to return a string containing the entity's type, variant, and sub-type. */
198
208
  export function getEntityID(entity: Entity): string {
199
209
  return `${entity.Type}.${entity.Variant}.${entity.SubType}`;
@@ -3,7 +3,7 @@ import {
3
3
  EntityType,
4
4
  GridEntityType,
5
5
  } from "isaac-typescript-definitions";
6
- import { getEntities, getEntityID } from "./entities";
6
+ import { getEntities, getEntityFromPtrHash, getEntityID } from "./entities";
7
7
  import { getGridEntities, getGridEntityID } from "./gridEntities";
8
8
  import { log } from "./log";
9
9
 
@@ -274,3 +274,27 @@ function getGridEntityLogLine(gridEntity: GridEntity, num?: int): string {
274
274
 
275
275
  return msg;
276
276
  }
277
+
278
+ /**
279
+ * Helper function to log information about the entity that corresponding to a pointer hash. (Only
280
+ * use this when debugging, since retrieving the corresponding entity is expensive.)
281
+ */
282
+ export function logPtrHash(this: void, ptrHash: PtrHash): void {
283
+ log(`PtrHash: ${ptrHash}`);
284
+ const entity = getEntityFromPtrHash(ptrHash);
285
+ if (entity === undefined) {
286
+ log("No corresponding entity found.");
287
+ } else {
288
+ logEntity(entity);
289
+ }
290
+ }
291
+
292
+ /**
293
+ * Helper function to log information about the entity that corresponding to one or more pointer
294
+ * hashes. (Only use this when debugging, since retrieving the corresponding entity is expensive.)
295
+ */
296
+ export function logPtrHashes(this: void, ptrHashes: PtrHash[]): void {
297
+ for (const ptrHash of ptrHashes) {
298
+ logPtrHash(ptrHash);
299
+ }
300
+ }
@@ -90,6 +90,9 @@ export function setFloorDisplayFlags(
90
90
  * Helper function to set a particular room's minimap display flags (e.g. whether or not it is
91
91
  * visible and so on).
92
92
  *
93
+ * You must call the `Level.UpdateVisibility` method after using this function for the changes to
94
+ * take effect.
95
+ *
93
96
  * @param roomGridIndex Set to undefined to use the current room index.
94
97
  * @param displayFlags The bit flags value to set. (See the `DisplayFlag` enum.)
95
98
  */
@@ -71,8 +71,8 @@ export const CARD_MAP: ReadonlyMap<string, CardType> = new Map([
71
71
  ["algiz", CardType.RUNE_ALGIZ], // 39
72
72
  ["resistance", CardType.RUNE_ALGIZ], // 39
73
73
  ["shield", CardType.RUNE_ALGIZ], // 39
74
- ["blank", CardType.RUNE_BLANK], // 40
75
- ["black", CardType.RUNE_BLACK], // 41
74
+ ["blankRune", CardType.RUNE_BLANK], // 40
75
+ ["blackRune", CardType.RUNE_BLACK], // 41
76
76
  ["chaos", CardType.CHAOS], // 42
77
77
  ["credit", CardType.CREDIT], // 43
78
78
  ["rules", CardType.RULES], // 44