isaacscript-common 1.2.254 → 1.2.257

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.
@@ -116,5 +116,13 @@ export declare const TRINKET_ID_MASK = 32767;
116
116
  * corner.
117
117
  */
118
118
  export declare const UI_HEART_WIDTH = 12;
119
+ /**
120
+ * This is a safer version of the `Vector.One` constant. (Other mods can mutate this vector, so it
121
+ * is not safe to use.)
122
+ */
119
123
  export declare const VectorOne: ReadonlyVector;
124
+ /**
125
+ * This is a safer version of the `Vector.Zero` constant. (Other mods can mutate this vector, so it
126
+ * is not safe to use.)
127
+ */
120
128
  export declare const VectorZero: ReadonlyVector;
@@ -19,6 +19,7 @@ export declare function colorEquals(color1: Color, color2: Color): boolean;
19
19
  */
20
20
  export declare function copyColor<C extends Color | SerializedColor, S extends SerializationType>(color: C, serializationType: S): CopyColorReturn[S];
21
21
  export declare function copyColor<C extends Color | SerializedColor>(color: C): CopyColorReturn[SerializationType.NONE];
22
+ /** Returns `Color(1, 1, 1)`. */
22
23
  export declare function getDefaultColor(): Color;
23
24
  /** Helper function to check if something is an instantiated Color object. */
24
25
  export declare function isColor(object: unknown): object is Color;
@@ -66,7 +66,7 @@ export declare function isEntityMoving(entity: Entity, threshold?: number): bool
66
66
  * Baby, Mega Satan, The Beast, and so on. This is useful because certain effects should only apply
67
67
  * to non-story bosses, like Vanishing Twin. Also see the `STORY_BOSSES` constant.
68
68
  */
69
- export declare function isStoryBoss(entity: Entity): boolean;
69
+ export declare function isStoryBoss(entityType: EntityType | int): boolean;
70
70
  /**
71
71
  * Helper function to remove all of the matching entities in the room.
72
72
  *
@@ -108,8 +108,8 @@ function ____exports.isEntityMoving(self, entity, threshold)
108
108
  end
109
109
  return entity.Velocity:Length() >= threshold
110
110
  end
111
- function ____exports.isStoryBoss(self, entity)
112
- return STORY_BOSSES_SET:has(entity.Type)
111
+ function ____exports.isStoryBoss(self, entityType)
112
+ return STORY_BOSSES_SET:has(entityType)
113
113
  end
114
114
  function ____exports.removeAllMatchingEntities(self, entityType, entityVariant, entitySubType, cap)
115
115
  if entityVariant == nil then
@@ -1,4 +1,5 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
+ import { EntityTypeNonNPC } from "../types/EntityTypeNonNPC";
2
3
  /**
3
4
  * Helper function to get all of the `EntityType.ENTITY_BOMB` in the room.
4
5
  *
@@ -218,7 +219,7 @@ export declare function spawnLaser(variant: LaserVariant | int, subType: int, po
218
219
  /** Helper function to spawn a `EntityType.ENTITY_LASER` (7) with a specific seed. */
219
220
  export declare function spawnLaserWithSeed(variant: LaserVariant | int, subType: int, position: Vector, seed: Seed, velocity?: Readonly<Vector>, spawner?: Entity | undefined): EntityLaser;
220
221
  /** Helper function to spawn an NPC. */
221
- export declare function spawnNPC(entityType: EntityType | int, variant: int, subType: int, position: Vector, velocity?: Readonly<Vector>, spawner?: Entity | undefined, seed?: Seed | undefined): EntityNPC;
222
+ export declare function spawnNPC<T extends number>(entityType: T extends EntityTypeNonNPC ? never : T, variant: int, subType: int, position: Vector, velocity?: Readonly<Vector>, spawner?: Entity | undefined, seed?: Seed | undefined): EntityNPC;
222
223
  /** Helper function to spawn an NPC with a specific seed. */
223
224
  export declare function spawnNPCWithSeed(entityType: EntityType | int, variant: int, subType: int, position: Vector, seed: Seed, velocity?: Readonly<Vector>, spawner?: Entity | undefined): EntityNPC;
224
225
  /** Helper function to spawn a `EntityType.ENTITY_PICKUP` (5). */
@@ -18,6 +18,7 @@ interface CopyKColorReturn {
18
18
  */
19
19
  export declare function copyKColor<K extends KColor | SerializedKColor, S extends SerializationType>(kColor: K, serializationType: S): CopyKColorReturn[S];
20
20
  export declare function copyKColor<K extends KColor | SerializedKColor>(kColor: K): CopyKColorReturn[SerializationType.NONE];
21
+ /** Returns `KColor(1, 1, 1, 1)`. */
21
22
  export declare function getDefaultKColor(): KColor;
22
23
  /** Helper function to check if something is an instantiated KColor object. */
23
24
  export declare function isKColor(object: unknown): object is KColor;
@@ -3,6 +3,11 @@
3
3
  export declare function getBatteries(matchingSubType?: number): EntityPickup[];
4
4
  /** Helper function to get all of the card entities in the room. */
5
5
  export declare function getCards(matchingSubType?: number): EntityPickup[];
6
+ /**
7
+ * Helper function to get the corresponding coin amount from a `CoinSubType`. Returns 1 for modded
8
+ * sub-types.
9
+ */
10
+ export declare function getCoinValue(coinSubType: CoinSubType): int;
6
11
  /** Helper function to get all of the coin pickup entities in the room. */
7
12
  export declare function getCoins(matchingSubType?: number): EntityPickup[];
8
13
  /** Helper function to get all of the collectible entities in the room. */
@@ -3,6 +3,9 @@ local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
3
3
  local ____exports = {}
4
4
  local ____constants = require("constants")
5
5
  local VectorZero = ____constants.VectorZero
6
+ local ____coinSubTypeToValue = require("objects.coinSubTypeToValue")
7
+ local COIN_SUBTYPE_TO_VALUE = ____coinSubTypeToValue.COIN_SUBTYPE_TO_VALUE
8
+ local DEFAULT_COIN_VALUE = ____coinSubTypeToValue.DEFAULT_COIN_VALUE
6
9
  local ____chestPickupVariantsSet = require("sets.chestPickupVariantsSet")
7
10
  local CHEST_PICKUP_VARIANTS = ____chestPickupVariantsSet.CHEST_PICKUP_VARIANTS
8
11
  local ____redHeartSubTypesSet = require("sets.redHeartSubTypesSet")
@@ -23,6 +26,10 @@ function ____exports.getCards(self, matchingSubType)
23
26
  end
24
27
  return getPickups(nil, 300, matchingSubType)
25
28
  end
29
+ function ____exports.getCoinValue(self, coinSubType)
30
+ local value = COIN_SUBTYPE_TO_VALUE[coinSubType]
31
+ return value == nil and DEFAULT_COIN_VALUE or value
32
+ end
26
33
  function ____exports.getCoins(self, matchingSubType)
27
34
  if matchingSubType == nil then
28
35
  matchingSubType = -1
@@ -0,0 +1,5 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare const DEFAULT_COIN_VALUE = 1;
3
+ export declare const COIN_SUBTYPE_TO_VALUE: {
4
+ readonly [key in CoinSubType]: int;
5
+ };
@@ -0,0 +1,13 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____exports = {}
3
+ ____exports.DEFAULT_COIN_VALUE = 1
4
+ ____exports.COIN_SUBTYPE_TO_VALUE = {
5
+ [CoinSubType.COIN_PENNY] = 1,
6
+ [CoinSubType.COIN_NICKEL] = 5,
7
+ [CoinSubType.COIN_DIME] = 10,
8
+ [CoinSubType.COIN_DOUBLEPACK] = 2,
9
+ [CoinSubType.COIN_LUCKYPENNY] = 1,
10
+ [CoinSubType.COIN_STICKYNICKEL] = 5,
11
+ [CoinSubType.COIN_GOLDEN] = 1
12
+ }
13
+ return ____exports
@@ -0,0 +1,2 @@
1
+ /** We cannot use EntityType values directly since it will break the exclusion hack. */
2
+ export declare type EntityTypeNonNPC = 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 | 1000;
@@ -0,0 +1,3 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____exports = {}
3
+ return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.254",
3
+ "version": "1.2.257",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",