isaacscript-common 2.0.22 → 2.0.25

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.
@@ -23,3 +23,5 @@ export declare const FIRST_CHARACTER = PlayerType.ISAAC;
23
23
  export declare const MAX_VANILLA_CHARACTER: PlayerType;
24
24
  export declare const FIRST_PILL_COLOR = PillColor.BLUE_BLUE;
25
25
  export declare const MAX_NORMAL_PILL_COLOR = PillColor.WHITE_YELLOW;
26
+ export declare const FIRST_HORSE_PILL_COLOR = PillColor.HORSE_BLUE_BLUE;
27
+ export declare const MAX_HORSE_PILL_COLOR = PillColor.HORSE_WHITE_YELLOW;
@@ -35,4 +35,6 @@ ____exports.FIRST_CHARACTER = PlayerType.ISAAC
35
35
  ____exports.MAX_VANILLA_CHARACTER = getLastEnumValue(nil, PlayerType)
36
36
  ____exports.FIRST_PILL_COLOR = PillColor.BLUE_BLUE
37
37
  ____exports.MAX_NORMAL_PILL_COLOR = PillColor.WHITE_YELLOW
38
+ ____exports.FIRST_HORSE_PILL_COLOR = PillColor.HORSE_BLUE_BLUE
39
+ ____exports.MAX_HORSE_PILL_COLOR = PillColor.HORSE_WHITE_YELLOW
38
40
  return ____exports
@@ -7,7 +7,17 @@ export declare function isCoin(pickup: EntityPickup): pickup is EntityPickupCoin
7
7
  export declare function isKey(pickup: EntityPickup): pickup is EntityPickupKey;
8
8
  /** For PickupVariant.BOMB (40) */
9
9
  export declare function isBomb(pickup: EntityPickup): pickup is EntityPickupBomb;
10
+ /** For PickupVariant.POOP (42) */
11
+ export declare function isPoop(pickup: EntityPickup): pickup is EntityPickupPoop;
12
+ /** For PickupVariant.POOP (42) */
13
+ export declare function isSack(pickup: EntityPickup): pickup is EntityPickupSack;
14
+ /** For PickupVariant.PILL (70) */
15
+ export declare function isPill(pickup: EntityPickup): pickup is EntityPickupPill;
16
+ /** For PickupVariant.LIL_BATTERY (90) */
17
+ export declare function isBattery(pickup: EntityPickup): pickup is EntityPickupBattery;
10
18
  /** For PickupVariant.COLLECTIBLE (100) */
11
19
  export declare function isCollectible(pickup: EntityPickup): pickup is EntityPickupCollectible;
20
+ /** For PickupVariant.TAROT_CARD (300) */
21
+ export declare function isCardPickup(pickup: EntityPickup): pickup is EntityPickupCard;
12
22
  /** For PickupVariant.TRINKET (350) */
13
23
  export declare function isTrinket(pickup: EntityPickup): pickup is EntityPickupTrinket;
@@ -13,9 +13,24 @@ end
13
13
  function ____exports.isBomb(self, pickup)
14
14
  return pickup.Variant == PickupVariant.BOMB
15
15
  end
16
+ function ____exports.isPoop(self, pickup)
17
+ return pickup.Variant == PickupVariant.POOP
18
+ end
19
+ function ____exports.isSack(self, pickup)
20
+ return pickup.Variant == PickupVariant.SACK
21
+ end
22
+ function ____exports.isPill(self, pickup)
23
+ return pickup.Variant == PickupVariant.PILL
24
+ end
25
+ function ____exports.isBattery(self, pickup)
26
+ return pickup.Variant == PickupVariant.LIL_BATTERY
27
+ end
16
28
  function ____exports.isCollectible(self, pickup)
17
29
  return pickup.Variant == PickupVariant.COLLECTIBLE
18
30
  end
31
+ function ____exports.isCardPickup(self, pickup)
32
+ return pickup.Variant == PickupVariant.TAROT_CARD
33
+ end
19
34
  function ____exports.isTrinket(self, pickup)
20
35
  return pickup.Variant == PickupVariant.TRINKET
21
36
  end
@@ -1,4 +1,17 @@
1
1
  import { ItemConfigPillEffectClass, ItemConfigPillEffectType, PillColor, PillEffect } from "isaac-typescript-definitions";
2
+ /** Helper function to get an array with every non-gold horse pill color. */
3
+ export declare function getAllHorsePillColors(): PillColor[];
4
+ /** Helper function to get an array with every non-gold and non-horse pill color. */
5
+ export declare function getAllNormalPillColors(): PillColor[];
6
+ /**
7
+ * Helper function to get an array with every non-null pill color. This includes all gold colors and
8
+ * all horse colors.
9
+ */
10
+ export declare function getAllPillColors(): PillColor[];
11
+ /**
12
+ * Helper function to get an array with every valid pill effect. This includes modded pill effects.
13
+ */
14
+ export declare function getAllPillEffects(): PillEffect[];
2
15
  /**
3
16
  * Helper function to get the corresponding horse pill color from a normal pill color.
4
17
  *
@@ -1,8 +1,17 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__ArraySlice = ____lualib.__TS__ArraySlice
1
3
  local ____exports = {}
2
4
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
3
5
  local PillColor = ____isaac_2Dtypescript_2Ddefinitions.PillColor
4
6
  local ____cachedClasses = require("cachedClasses")
5
7
  local itemConfig = ____cachedClasses.itemConfig
8
+ local ____constantsMax = require("constantsMax")
9
+ local FIRST_HORSE_PILL_COLOR = ____constantsMax.FIRST_HORSE_PILL_COLOR
10
+ local FIRST_PILL_COLOR = ____constantsMax.FIRST_PILL_COLOR
11
+ local FIRST_PILL_EFFECT = ____constantsMax.FIRST_PILL_EFFECT
12
+ local MAX_HORSE_PILL_COLOR = ____constantsMax.MAX_HORSE_PILL_COLOR
13
+ local MAX_NORMAL_PILL_COLOR = ____constantsMax.MAX_NORMAL_PILL_COLOR
14
+ local MAX_PILL_EFFECT = ____constantsMax.MAX_PILL_EFFECT
6
15
  local ____pillEffectClasses = require("objects.pillEffectClasses")
7
16
  local DEFAULT_PILL_EFFECT_CLASS = ____pillEffectClasses.DEFAULT_PILL_EFFECT_CLASS
8
17
  local PILL_EFFECT_CLASSES = ____pillEffectClasses.PILL_EFFECT_CLASSES
@@ -12,10 +21,28 @@ local PILL_EFFECT_NAMES = ____pillEffectNames.PILL_EFFECT_NAMES
12
21
  local ____pillEffectTypes = require("objects.pillEffectTypes")
13
22
  local DEFAULT_PILL_EFFECT_TYPE = ____pillEffectTypes.DEFAULT_PILL_EFFECT_TYPE
14
23
  local PILL_EFFECT_TYPES = ____pillEffectTypes.PILL_EFFECT_TYPES
24
+ local ____enums = require("functions.enums")
25
+ local getEnumValues = ____enums.getEnumValues
15
26
  local ____flag = require("functions.flag")
16
27
  local hasFlag = ____flag.hasFlag
28
+ local ____utils = require("functions.utils")
29
+ local irange = ____utils.irange
17
30
  local HORSE_PILL_FLAG = 2047
18
31
  local HORSE_PILL_ADJUSTMENT = 2048
32
+ function ____exports.getAllHorsePillColors(self)
33
+ return irange(nil, FIRST_HORSE_PILL_COLOR, MAX_HORSE_PILL_COLOR)
34
+ end
35
+ function ____exports.getAllNormalPillColors(self)
36
+ return irange(nil, FIRST_PILL_COLOR, MAX_NORMAL_PILL_COLOR)
37
+ end
38
+ function ____exports.getAllPillColors(self)
39
+ local pillColors = getEnumValues(nil, PillColor)
40
+ __TS__ArraySlice(pillColors)
41
+ return pillColors
42
+ end
43
+ function ____exports.getAllPillEffects(self)
44
+ return irange(nil, FIRST_PILL_EFFECT, MAX_PILL_EFFECT)
45
+ end
19
46
  function ____exports.getHorsePillColor(self, pillColor)
20
47
  return pillColor + HORSE_PILL_ADJUSTMENT
21
48
  end
@@ -13,8 +13,9 @@ import { CollectibleType } from "isaac-typescript-definitions";
13
13
  * collectible. Default is false.
14
14
  * @param forceFreeItem Optional. Set to true to disable the logic that gives the item a price for
15
15
  * Tainted Keeper. Default is false.
16
+ * @param spawner Optional.
16
17
  */
17
- export declare function spawnCollectible(collectibleType: CollectibleType, position: Vector, seedOrRNG?: Seed | RNG, options?: boolean, forceFreeItem?: boolean): EntityPickup;
18
+ export declare function spawnCollectible(collectibleType: CollectibleType, position: Vector, seedOrRNG?: Seed | RNG, options?: boolean, forceFreeItem?: boolean, spawner?: Entity): EntityPickupCollectible;
18
19
  /**
19
20
  * Helper function to spawn an empty collectible. Doing this is tricky since spawning a collectible
20
21
  * with `CollectibleType.NULL` will result in spawning a collectible with a random type from the
@@ -3,6 +3,8 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitio
3
3
  local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
4
4
  local PickupVariant = ____isaac_2Dtypescript_2Ddefinitions.PickupVariant
5
5
  local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
6
+ local ____constants = require("constants")
7
+ local VectorZero = ____constants.VectorZero
6
8
  local ____preventCollectibleRotate = require("features.preventCollectibleRotate")
7
9
  local preventCollectibleRotate = ____preventCollectibleRotate.preventCollectibleRotate
8
10
  local ____featuresInitialized = require("featuresInitialized")
@@ -18,7 +20,7 @@ local anyPlayerIs = ____player.anyPlayerIs
18
20
  local ____rng = require("functions.rng")
19
21
  local getRandomSeed = ____rng.getRandomSeed
20
22
  local isRNG = ____rng.isRNG
21
- function ____exports.spawnCollectible(self, collectibleType, position, seedOrRNG, options, forceFreeItem)
23
+ function ____exports.spawnCollectible(self, collectibleType, position, seedOrRNG, options, forceFreeItem, spawner)
22
24
  if seedOrRNG == nil then
23
25
  seedOrRNG = getRandomSeed(nil)
24
26
  end
@@ -34,7 +36,9 @@ function ____exports.spawnCollectible(self, collectibleType, position, seedOrRNG
34
36
  PickupVariant.COLLECTIBLE,
35
37
  collectibleType,
36
38
  position,
37
- seed
39
+ seed,
40
+ VectorZero,
41
+ spawner
38
42
  )
39
43
  if options then
40
44
  collectible.OptionsPickupIndex = 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "2.0.22",
3
+ "version": "2.0.25",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",
@@ -25,7 +25,7 @@
25
25
  "dist/**/*.d.ts"
26
26
  ],
27
27
  "dependencies": {
28
- "isaac-typescript-definitions": "^2.0.38"
28
+ "isaac-typescript-definitions": "^2.0.45"
29
29
  },
30
30
  "devDependencies": {
31
31
  "isaacscript-lint": "^1.0.157",