isaacscript-common 9.3.0 → 9.5.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.
- package/dist/callbacks/subscriptions/postGridEntityCollision.d.ts +4 -2
- package/dist/callbacks/subscriptions/postGridEntityCollision.d.ts.map +1 -1
- package/dist/callbacks/subscriptions/postGridEntityCollision.lua +8 -0
- package/dist/callbacks/subscriptions/postGridEntityCustomCollision.d.ts +4 -2
- package/dist/callbacks/subscriptions/postGridEntityCustomCollision.d.ts.map +1 -1
- package/dist/callbacks/subscriptions/postGridEntityCustomCollision.lua +8 -0
- package/dist/enums/ModCallbackCustom.d.ts +52 -26
- package/dist/enums/ModCallbackCustom.d.ts.map +1 -1
- package/dist/features/customStage/customStageGridEntities.d.ts +4 -4
- package/dist/features/customStage/customStageGridEntities.d.ts.map +1 -1
- package/dist/features/customStage/customStageGridEntities.lua +4 -4
- package/dist/functions/effects.d.ts +1 -1
- package/dist/functions/effects.d.ts.map +1 -1
- package/dist/functions/effects.lua +1 -1
- package/dist/functions/entities.d.ts +4 -0
- package/dist/functions/entities.d.ts.map +1 -1
- package/dist/functions/entities.lua +4 -0
- package/dist/functions/entityTypes.d.ts +1 -1
- package/dist/functions/entityTypes.d.ts.map +1 -1
- package/dist/functions/entityTypes.lua +1 -1
- package/dist/functions/gridEntitiesSpecific.d.ts +24 -0
- package/dist/functions/gridEntitiesSpecific.d.ts.map +1 -1
- package/dist/functions/gridEntitiesSpecific.lua +41 -0
- package/dist/functions/pickupVariants.d.ts +11 -11
- package/dist/functions/pickupVariants.d.ts.map +1 -1
- package/dist/functions/pickupVariants.lua +11 -11
- package/dist/functions/pickups.d.ts +2 -0
- package/dist/functions/pickups.d.ts.map +1 -1
- package/dist/functions/pickups.lua +2 -0
- package/dist/index.d.ts +105 -41
- package/package.json +2 -2
- package/src/callbacks/subscriptions/postGridEntityCollision.ts +21 -1
- package/src/callbacks/subscriptions/postGridEntityCustomCollision.ts +25 -2
- package/src/enums/ModCallbackCustom.ts +52 -26
- package/src/features/customStage/customStageGridEntities.ts +4 -4
- package/src/functions/effects.ts +1 -1
- package/src/functions/entities.ts +4 -0
- package/src/functions/entityTypes.ts +1 -1
- package/src/functions/gridEntitiesSpecific.ts +54 -0
- package/src/functions/pickupVariants.ts +11 -11
- package/src/functions/pickups.ts +2 -0
|
@@ -1,47 +1,47 @@
|
|
|
1
1
|
local ____exports = {}
|
|
2
2
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
3
3
|
local PickupVariant = ____isaac_2Dtypescript_2Ddefinitions.PickupVariant
|
|
4
|
-
--- For `PickupVariant.HEART` (10)
|
|
4
|
+
--- For `PickupVariant.HEART` (10).
|
|
5
5
|
function ____exports.isHeart(self, pickup)
|
|
6
6
|
return pickup.Variant == PickupVariant.HEART
|
|
7
7
|
end
|
|
8
|
-
--- For `PickupVariant.COIN` (20)
|
|
8
|
+
--- For `PickupVariant.COIN` (20).
|
|
9
9
|
function ____exports.isCoin(self, pickup)
|
|
10
10
|
return pickup.Variant == PickupVariant.COIN
|
|
11
11
|
end
|
|
12
|
-
--- For `PickupVariant.KEY` (30)
|
|
12
|
+
--- For `PickupVariant.KEY` (30).
|
|
13
13
|
function ____exports.isKey(self, pickup)
|
|
14
14
|
return pickup.Variant == PickupVariant.KEY
|
|
15
15
|
end
|
|
16
|
-
--- For `PickupVariant.BOMB` (40)
|
|
16
|
+
--- For `PickupVariant.BOMB` (40).
|
|
17
17
|
function ____exports.isBombPickup(self, pickup)
|
|
18
18
|
return pickup.Variant == PickupVariant.BOMB
|
|
19
19
|
end
|
|
20
|
-
--- For `PickupVariant.POOP` (42)
|
|
20
|
+
--- For `PickupVariant.POOP` (42).
|
|
21
21
|
function ____exports.isPoopPickup(self, pickup)
|
|
22
22
|
return pickup.Variant == PickupVariant.POOP
|
|
23
23
|
end
|
|
24
|
-
--- For `PickupVariant.SACK` (69)
|
|
24
|
+
--- For `PickupVariant.SACK` (69).
|
|
25
25
|
function ____exports.isSack(self, pickup)
|
|
26
26
|
return pickup.Variant == PickupVariant.SACK
|
|
27
27
|
end
|
|
28
|
-
--- For `PickupVariant.PILL` (70)
|
|
28
|
+
--- For `PickupVariant.PILL` (70).
|
|
29
29
|
function ____exports.isPill(self, pickup)
|
|
30
30
|
return pickup.Variant == PickupVariant.PILL
|
|
31
31
|
end
|
|
32
|
-
--- For `PickupVariant.LIL_BATTERY` (90)
|
|
32
|
+
--- For `PickupVariant.LIL_BATTERY` (90).
|
|
33
33
|
function ____exports.isBattery(self, pickup)
|
|
34
34
|
return pickup.Variant == PickupVariant.LIL_BATTERY
|
|
35
35
|
end
|
|
36
|
-
--- For `PickupVariant.COLLECTIBLE` (100)
|
|
36
|
+
--- For `PickupVariant.COLLECTIBLE` (100).
|
|
37
37
|
function ____exports.isCollectible(self, pickup)
|
|
38
38
|
return pickup.Variant == PickupVariant.COLLECTIBLE
|
|
39
39
|
end
|
|
40
|
-
--- For `PickupVariant.TAROT_CARD` (300)
|
|
40
|
+
--- For `PickupVariant.TAROT_CARD` (300).
|
|
41
41
|
function ____exports.isCardPickup(self, pickup)
|
|
42
42
|
return pickup.Variant == PickupVariant.TAROT_CARD
|
|
43
43
|
end
|
|
44
|
-
--- For `PickupVariant.TRINKET` (350)
|
|
44
|
+
--- For `PickupVariant.TRINKET` (350).
|
|
45
45
|
function ____exports.isTrinket(self, pickup)
|
|
46
46
|
return pickup.Variant == PickupVariant.TRINKET
|
|
47
47
|
end
|
|
@@ -6,7 +6,9 @@ import { CoinSubType } from "isaac-typescript-definitions";
|
|
|
6
6
|
export declare function getCoinValue(coinSubType: CoinSubType): int;
|
|
7
7
|
/** Helper function to get all of the red heart pickup entities in the room. */
|
|
8
8
|
export declare function getRedHearts(): EntityPickupHeart[];
|
|
9
|
+
/** Helper function to test if the provided pickup matches one of the various chest variants. */
|
|
9
10
|
export declare function isChest(pickup: EntityPickup): boolean;
|
|
11
|
+
/** Helper function to test if the provided pickup matches on of the various red heart sub types. */
|
|
10
12
|
export declare function isRedHeart(pickup: EntityPickup): boolean;
|
|
11
13
|
/**
|
|
12
14
|
* Helper function to remove all of the red heart pickup entities in the room.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pickups.d.ts","sourceRoot":"","sources":["../../src/functions/pickups.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAW3D;;;GAGG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,WAAW,GAAG,GAAG,CAK1D;AAED,+EAA+E;AAC/E,wBAAgB,YAAY,IAAI,iBAAiB,EAAE,CAGlD;AAED,wBAAgB,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAErD;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAExD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,iBAAiB,EAAE,CAGjE"}
|
|
1
|
+
{"version":3,"file":"pickups.d.ts","sourceRoot":"","sources":["../../src/functions/pickups.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAW3D;;;GAGG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,WAAW,GAAG,GAAG,CAK1D;AAED,+EAA+E;AAC/E,wBAAgB,YAAY,IAAI,iBAAiB,EAAE,CAGlD;AAED,gGAAgG;AAChG,wBAAgB,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAErD;AAED,oGAAoG;AACpG,wBAAgB,UAAU,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAExD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,iBAAiB,EAAE,CAGjE"}
|
|
@@ -28,9 +28,11 @@ function ____exports.getRedHearts(self)
|
|
|
28
28
|
function(____, heart) return RED_HEART_SUB_TYPES_SET:has(heart.SubType) end
|
|
29
29
|
)
|
|
30
30
|
end
|
|
31
|
+
--- Helper function to test if the provided pickup matches one of the various chest variants.
|
|
31
32
|
function ____exports.isChest(self, pickup)
|
|
32
33
|
return CHEST_PICKUP_VARIANTS:has(pickup.Variant)
|
|
33
34
|
end
|
|
35
|
+
--- Helper function to test if the provided pickup matches on of the various red heart sub types.
|
|
34
36
|
function ____exports.isRedHeart(self, pickup)
|
|
35
37
|
return isHeart(nil, pickup) and RED_HEART_SUB_TYPES_SET:has(pickup.SubType)
|
|
36
38
|
end
|
package/dist/index.d.ts
CHANGED
|
@@ -1748,7 +1748,7 @@ export declare function deserializeRNG(rng: SerializedRNG): RNG;
|
|
|
1748
1748
|
*/
|
|
1749
1749
|
export declare function deserializeVector(vector: SerializedVector): Vector;
|
|
1750
1750
|
|
|
1751
|
-
/** For `EntityType.EFFECT` (1000), `EffectVariant.DICE_FLOOR` (76) */
|
|
1751
|
+
/** For `EntityType.EFFECT` (1000), `EffectVariant.DICE_FLOOR` (76). */
|
|
1752
1752
|
export declare const DICE_FLOOR_TRIGGER_SQUARE_SIZE = 75;
|
|
1753
1753
|
|
|
1754
1754
|
export declare function directionToDegrees(direction: Direction): int;
|
|
@@ -4969,6 +4969,15 @@ export declare function getTears(tearVariant?: TearVariant, subType?: number): E
|
|
|
4969
4969
|
*/
|
|
4970
4970
|
export declare function getTearsStat(fireDelay: float): float;
|
|
4971
4971
|
|
|
4972
|
+
/**
|
|
4973
|
+
* Helper function to get all of the grid entities of type `GridEntityType.TELEPORTER` (23) in the
|
|
4974
|
+
* room.
|
|
4975
|
+
*
|
|
4976
|
+
* @param variant Optional. If specified, will only get the teleporters that match the variant.
|
|
4977
|
+
* Default is -1, which matches every variant.
|
|
4978
|
+
*/
|
|
4979
|
+
export declare function getTeleporters(variant?: number): GridEntity[];
|
|
4980
|
+
|
|
4972
4981
|
/** Helper function to get all of the `GridEntityTNT` in the room. */
|
|
4973
4982
|
export declare function getTNT(variant?: number): GridEntityTNT[];
|
|
4974
4983
|
|
|
@@ -5559,7 +5568,7 @@ export declare function isArrayContiguous(array: int[]): boolean;
|
|
|
5559
5568
|
/** Checks if an array is in the provided 2-dimensional array. */
|
|
5560
5569
|
export declare function isArrayInArray<T>(arrayToMatch: T[] | readonly T[], parentArray: Array<T[] | readonly T[]>): boolean;
|
|
5561
5570
|
|
|
5562
|
-
/** For `PickupVariant.LIL_BATTERY` (90) */
|
|
5571
|
+
/** For `PickupVariant.LIL_BATTERY` (90). */
|
|
5563
5572
|
export declare function isBattery(pickup: EntityPickup): pickup is EntityPickupBattery;
|
|
5564
5573
|
|
|
5565
5574
|
/**
|
|
@@ -5578,7 +5587,7 @@ export declare function isBlindCollectible(collectible: EntityPickup): boolean;
|
|
|
5578
5587
|
/** Helper function to detect if a variable is of type `EntityBomb`. */
|
|
5579
5588
|
export declare function isBomb(variable: unknown): variable is EntityBomb;
|
|
5580
5589
|
|
|
5581
|
-
/** For `PickupVariant.BOMB` (40) */
|
|
5590
|
+
/** For `PickupVariant.BOMB` (40). */
|
|
5582
5591
|
export declare function isBombPickup(pickup: EntityPickup): pickup is EntityPickupBomb;
|
|
5583
5592
|
|
|
5584
5593
|
export declare function isBoolean(variable: unknown): variable is boolean;
|
|
@@ -5592,7 +5601,7 @@ export declare function isBoolean(variable: unknown): variable is boolean;
|
|
|
5592
5601
|
*/
|
|
5593
5602
|
export declare function isCard(cardType: CardType): boolean;
|
|
5594
5603
|
|
|
5595
|
-
/** For `PickupVariant.TAROT_CARD` (300) */
|
|
5604
|
+
/** For `PickupVariant.TAROT_CARD` (300). */
|
|
5596
5605
|
export declare function isCardPickup(pickup: EntityPickup): pickup is EntityPickupCard;
|
|
5597
5606
|
|
|
5598
5607
|
/** Returns whether or not the given card type matches the specified item config card type. */
|
|
@@ -5606,6 +5615,7 @@ export declare function isCardType(cardType: CardType, itemConfigCardType: ItemC
|
|
|
5606
5615
|
*/
|
|
5607
5616
|
export declare function isCharacter(player: EntityPlayer, ...characters: PlayerType[]): boolean;
|
|
5608
5617
|
|
|
5618
|
+
/** Helper function to test if the provided pickup matches one of the various chest variants. */
|
|
5609
5619
|
export declare function isChest(pickup: EntityPickup): boolean;
|
|
5610
5620
|
|
|
5611
5621
|
/**
|
|
@@ -5622,10 +5632,10 @@ export declare function isCircleIntersectingRectangle(circleCenter: Vector, circ
|
|
|
5622
5632
|
/** Helper function to see if a player is close enough to activate a Dice Room floor. */
|
|
5623
5633
|
export declare function isCloseEnoughToTriggerDiceFloor(player: EntityPlayer, diceFloor: EntityEffect): boolean;
|
|
5624
5634
|
|
|
5625
|
-
/** For `PickupVariant.COIN` (20) */
|
|
5635
|
+
/** For `PickupVariant.COIN` (20). */
|
|
5626
5636
|
export declare function isCoin(pickup: EntityPickup): pickup is EntityPickupCoin;
|
|
5627
5637
|
|
|
5628
|
-
/** For `PickupVariant.COLLECTIBLE` (100) */
|
|
5638
|
+
/** For `PickupVariant.COLLECTIBLE` (100). */
|
|
5629
5639
|
export declare function isCollectible(pickup: EntityPickup): pickup is EntityPickupCollectible;
|
|
5630
5640
|
|
|
5631
5641
|
/**
|
|
@@ -5784,6 +5794,10 @@ export declare function isEntity(variable: unknown): variable is Entity;
|
|
|
5784
5794
|
/**
|
|
5785
5795
|
* Helper function to measure an entity's velocity to see if it is moving.
|
|
5786
5796
|
*
|
|
5797
|
+
* Use this helper function over checking if the velocity length is equal to 0 because entities can
|
|
5798
|
+
* look like they are completely immobile but yet still have a non zero velocity. Thus, using a
|
|
5799
|
+
* threshold is needed.
|
|
5800
|
+
*
|
|
5787
5801
|
* @param entity The entity whose velocity to measure.
|
|
5788
5802
|
* @param threshold Optional. The threshold from 0 to consider to be moving. Default is 0.01.
|
|
5789
5803
|
*/
|
|
@@ -5836,7 +5850,7 @@ export declare function isGridEntityBreakableByExplosion(gridEntity: GridEntity)
|
|
|
5836
5850
|
*/
|
|
5837
5851
|
export declare function isGridEntityBroken(gridEntity: GridEntity): boolean;
|
|
5838
5852
|
|
|
5839
|
-
/** For `PickupVariant.HEART` (10) */
|
|
5853
|
+
/** For `PickupVariant.HEART` (10). */
|
|
5840
5854
|
export declare function isHeart(pickup: EntityPickup): pickup is EntityPickupHeart;
|
|
5841
5855
|
|
|
5842
5856
|
/**
|
|
@@ -5880,7 +5894,7 @@ export declare function isKColor(object: unknown): object is KColor;
|
|
|
5880
5894
|
*/
|
|
5881
5895
|
export declare function isKeeper(player: EntityPlayer): boolean;
|
|
5882
5896
|
|
|
5883
|
-
/** For `PickupVariant.KEY` (30) */
|
|
5897
|
+
/** For `PickupVariant.KEY` (30). */
|
|
5884
5898
|
export declare function isKey(pickup: EntityPickup): pickup is EntityPickupKey;
|
|
5885
5899
|
|
|
5886
5900
|
/**
|
|
@@ -5979,7 +5993,7 @@ export declare function isPickingUpItemTrinket(pickingUpItem: PickingUpItem): pi
|
|
|
5979
5993
|
/** Helper function to detect if a variable is of type `EntityPickup`. */
|
|
5980
5994
|
export declare function isPickup(variable: unknown): variable is EntityPickup;
|
|
5981
5995
|
|
|
5982
|
-
/** For `PickupVariant.PILL` (70) */
|
|
5996
|
+
/** For `PickupVariant.PILL` (70). */
|
|
5983
5997
|
export declare function isPill(pickup: EntityPickup): pickup is EntityPickupPill;
|
|
5984
5998
|
|
|
5985
5999
|
/** Helper function to detect if a variable is of type `GridEntityPit`. */
|
|
@@ -6000,7 +6014,7 @@ export declare function isPocketItemObject(cardType: CardType): boolean;
|
|
|
6000
6014
|
/** Helper function to detect if a variable is of type `GridEntityPoop`. */
|
|
6001
6015
|
export declare function isPoop(variable: unknown): variable is GridEntityPoop;
|
|
6002
6016
|
|
|
6003
|
-
/** For `PickupVariant.POOP` (42) */
|
|
6017
|
+
/** For `PickupVariant.POOP` (42). */
|
|
6004
6018
|
export declare function isPoopPickup(pickup: EntityPickup): pickup is EntityPickupPoop;
|
|
6005
6019
|
|
|
6006
6020
|
/**
|
|
@@ -6028,6 +6042,7 @@ export declare function isQuestCollectible(collectibleType: CollectibleType): bo
|
|
|
6028
6042
|
*/
|
|
6029
6043
|
export declare function isRaglingDeathPatch(npc: EntityNPC): boolean;
|
|
6030
6044
|
|
|
6045
|
+
/** Helper function to test if the provided pickup matches on of the various red heart sub types. */
|
|
6031
6046
|
export declare function isRedHeart(pickup: EntityPickup): boolean;
|
|
6032
6047
|
|
|
6033
6048
|
/**
|
|
@@ -6085,7 +6100,7 @@ export declare function isRoomShapeDoubleCharge(roomShape: RoomShape): boolean;
|
|
|
6085
6100
|
/** Returns true for cards that have `CardType.RUNE`. */
|
|
6086
6101
|
export declare function isRune(cardType: CardType): boolean;
|
|
6087
6102
|
|
|
6088
|
-
/** For `PickupVariant.SACK` (69) */
|
|
6103
|
+
/** For `PickupVariant.SACK` (69). */
|
|
6089
6104
|
export declare function isSack(pickup: EntityPickup): pickup is EntityPickupSack;
|
|
6090
6105
|
|
|
6091
6106
|
/**
|
|
@@ -6156,7 +6171,7 @@ export declare function isSin(npc: EntityNPC): boolean;
|
|
|
6156
6171
|
*/
|
|
6157
6172
|
export declare function isSingleUseCollectible(collectibleType: CollectibleType): boolean;
|
|
6158
6173
|
|
|
6159
|
-
/** For `EntityType.SLOT` (6) */
|
|
6174
|
+
/** For `EntityType.SLOT` (6). */
|
|
6160
6175
|
export declare function isSlot(entity: Entity): entity is EntitySlot;
|
|
6161
6176
|
|
|
6162
6177
|
/** Returns true for cards that have `CardType.SPECIAL`. */
|
|
@@ -6196,7 +6211,7 @@ export declare function isTNT(variable: unknown): variable is GridEntityTNT;
|
|
|
6196
6211
|
|
|
6197
6212
|
export declare function isTransformationFlying(playerForm: PlayerForm): boolean;
|
|
6198
6213
|
|
|
6199
|
-
/** For `PickupVariant.TRINKET` (350) */
|
|
6214
|
+
/** For `PickupVariant.TRINKET` (350). */
|
|
6200
6215
|
export declare function isTrinket(pickup: EntityPickup): pickup is EntityPickupTrinket;
|
|
6201
6216
|
|
|
6202
6217
|
/**
|
|
@@ -7019,8 +7034,10 @@ export declare enum ModCallbackCustom {
|
|
|
7019
7034
|
* For grid entities created with `spawnCustomGridEntity`, use the
|
|
7020
7035
|
* `POST_GRID_ENTITY_CUSTOM_BROKEN` callback instead.
|
|
7021
7036
|
*
|
|
7022
|
-
* When registering the callback, takes an optional second argument that will make the callback
|
|
7023
|
-
*
|
|
7037
|
+
* - When registering the callback, takes an optional second argument that will make the callback
|
|
7038
|
+
* only fire if it matches the `GridEntityType` provided.
|
|
7039
|
+
* - When registering the callback, takes an optional third argument that will make the callback
|
|
7040
|
+
* only fire if it matches the variant provided.
|
|
7024
7041
|
*
|
|
7025
7042
|
* ```ts
|
|
7026
7043
|
* function postGridEntityBroken(gridEntity: GridEntity): void {}
|
|
@@ -7035,8 +7052,14 @@ export declare enum ModCallbackCustom {
|
|
|
7035
7052
|
* For grid entities created with `spawnCustomGridEntity`, use the
|
|
7036
7053
|
* `POST_GRID_ENTITY_CUSTOM_COLLISION` callback instead.
|
|
7037
7054
|
*
|
|
7038
|
-
* When registering the callback, takes an optional second argument that will make the callback
|
|
7039
|
-
*
|
|
7055
|
+
* - When registering the callback, takes an optional second argument that will make the callback
|
|
7056
|
+
* only fire if it matches the `GridEntityType` provided.
|
|
7057
|
+
* - When registering the callback, takes an optional third argument that will make the callback
|
|
7058
|
+
* only fire if it matches the variant provided (for the grid entity).
|
|
7059
|
+
* - When registering the callback, takes an optional fourth argument that will make the callback
|
|
7060
|
+
* only fire if the colliding entity matches the `EntityType` provided.
|
|
7061
|
+
* - When registering the callback, takes an optional fifth argument that will make the callback
|
|
7062
|
+
* only fire if the colliding entity matches the variant provided.
|
|
7040
7063
|
*
|
|
7041
7064
|
* ```ts
|
|
7042
7065
|
* function postGridEntityCollision(
|
|
@@ -7051,7 +7074,8 @@ export declare enum ModCallbackCustom {
|
|
|
7051
7074
|
* with the `spawnCustomGridEntity` helper function.
|
|
7052
7075
|
*
|
|
7053
7076
|
* When registering the callback, takes an optional second argument that will make the callback
|
|
7054
|
-
* only fire if it matches the `GridEntityType` provided.
|
|
7077
|
+
* only fire if it matches the `GridEntityType` provided. (Custom grid entities do not have
|
|
7078
|
+
* variants, so there is no need for an optional third argument to filter by variant.)
|
|
7055
7079
|
*
|
|
7056
7080
|
* ```ts
|
|
7057
7081
|
* function postGridEntityCustomBroken(
|
|
@@ -7065,8 +7089,13 @@ export declare enum ModCallbackCustom {
|
|
|
7065
7089
|
* The same as the `POST_GRID_ENTITY_COLLISION` callback, but only fires for grid entities created
|
|
7066
7090
|
* with the `spawnCustomGridEntity` helper function.
|
|
7067
7091
|
*
|
|
7068
|
-
* When registering the callback, takes an optional second argument that will make the callback
|
|
7069
|
-
*
|
|
7092
|
+
* - When registering the callback, takes an optional second argument that will make the callback
|
|
7093
|
+
* only fire if it matches the `GridEntityType` provided. (Custom grid entities do not have
|
|
7094
|
+
* variants, so there is no need for an optional third argument to filter by variant.)
|
|
7095
|
+
* - When registering the callback, takes an optional third argument that will make the callback
|
|
7096
|
+
* only fire if the the colliding entity matches the `EntityType` provided.
|
|
7097
|
+
* - When registering the callback, takes an optional fourth argument that will make the callback
|
|
7098
|
+
* only fire if the the colliding entity matches the variant provided.
|
|
7070
7099
|
*
|
|
7071
7100
|
* ```ts
|
|
7072
7101
|
* function postGridEntityCustomCollision(
|
|
@@ -7082,7 +7111,8 @@ export declare enum ModCallbackCustom {
|
|
|
7082
7111
|
* the `spawnCustomGridEntity` helper function.
|
|
7083
7112
|
*
|
|
7084
7113
|
* When registering the callback, takes an optional second argument that will make the callback
|
|
7085
|
-
* only fire if it matches the `GridEntityType` provided.
|
|
7114
|
+
* only fire if it matches the `GridEntityType` provided. (Custom grid entities do not have
|
|
7115
|
+
* variants, so there is no need for an optional third argument to filter by variant.)
|
|
7086
7116
|
*
|
|
7087
7117
|
* ```ts
|
|
7088
7118
|
* function postGridEntityCustomInit(
|
|
@@ -7097,7 +7127,8 @@ export declare enum ModCallbackCustom {
|
|
|
7097
7127
|
* with the `spawnCustomGridEntity` helper function.
|
|
7098
7128
|
*
|
|
7099
7129
|
* When registering the callback, takes an optional second argument that will make the callback
|
|
7100
|
-
* only fire if it matches the `GridEntityType` provided.
|
|
7130
|
+
* only fire if it matches the `GridEntityType` provided. (Custom grid entities do not have
|
|
7131
|
+
* variants, so there is no need for an optional third argument to filter by variant.)
|
|
7101
7132
|
*
|
|
7102
7133
|
* ```ts
|
|
7103
7134
|
* function postGridEntityCustomRemove(
|
|
@@ -7112,7 +7143,8 @@ export declare enum ModCallbackCustom {
|
|
|
7112
7143
|
* with the `spawnCustomGridEntity` helper function.
|
|
7113
7144
|
*
|
|
7114
7145
|
* When registering the callback, takes an optional second argument that will make the callback
|
|
7115
|
-
* only fire if it matches the `GridEntityType` provided.
|
|
7146
|
+
* only fire if it matches the `GridEntityType` provided. (Custom grid entities do not have
|
|
7147
|
+
* variants, so there is no need for an optional third argument to filter by variant.)
|
|
7116
7148
|
*
|
|
7117
7149
|
* ```ts
|
|
7118
7150
|
* function postGridEntityCustomRender(
|
|
@@ -7127,7 +7159,8 @@ export declare enum ModCallbackCustom {
|
|
|
7127
7159
|
* created with the `spawnCustomGridEntity` helper function.
|
|
7128
7160
|
*
|
|
7129
7161
|
* When registering the callback, takes an optional second argument that will make the callback
|
|
7130
|
-
* only fire if it matches the `GridEntityType` provided.
|
|
7162
|
+
* only fire if it matches the `GridEntityType` provided. (Custom grid entities do not have
|
|
7163
|
+
* variants, so there is no need for an optional third argument to filter by variant.)
|
|
7131
7164
|
*
|
|
7132
7165
|
* ```ts
|
|
7133
7166
|
* function postGridEntityCustomStateChanged(
|
|
@@ -7144,7 +7177,8 @@ export declare enum ModCallbackCustom {
|
|
|
7144
7177
|
* with the `spawnCustomGridEntity` helper function.
|
|
7145
7178
|
*
|
|
7146
7179
|
* When registering the callback, takes an optional second argument that will make the callback
|
|
7147
|
-
* only fire if it matches the `GridEntityType` provided.
|
|
7180
|
+
* only fire if it matches the `GridEntityType` provided. (Custom grid entities do not have
|
|
7181
|
+
* variants, so there is no need for an optional third argument to filter by variant.)
|
|
7148
7182
|
*
|
|
7149
7183
|
* ```ts
|
|
7150
7184
|
* function postGridEntityCustomUpdate(
|
|
@@ -7165,8 +7199,10 @@ export declare enum ModCallbackCustom {
|
|
|
7165
7199
|
* For grid entities created with `spawnCustomGridEntity`, use the `POST_GRID_ENTITY_CUSTOM_INIT`
|
|
7166
7200
|
* callback instead.
|
|
7167
7201
|
*
|
|
7168
|
-
* When registering the callback, takes an optional second argument that will make the callback
|
|
7169
|
-
*
|
|
7202
|
+
* - When registering the callback, takes an optional second argument that will make the callback
|
|
7203
|
+
* only fire if it matches the `GridEntityType` provided.
|
|
7204
|
+
* - When registering the callback, takes an optional third argument that will make the callback
|
|
7205
|
+
* only fire if it matches the variant provided.
|
|
7170
7206
|
*
|
|
7171
7207
|
* ```ts
|
|
7172
7208
|
* function postGridEntityInit(gridEntity: GridEntity): void {}
|
|
@@ -7184,8 +7220,10 @@ export declare enum ModCallbackCustom {
|
|
|
7184
7220
|
* For grid entities created with `spawnCustomGridEntity`, use the
|
|
7185
7221
|
* `POST_GRID_ENTITY_CUSTOM_REMOVE` callback instead.
|
|
7186
7222
|
*
|
|
7187
|
-
* When registering the callback, takes an optional second argument that will make the callback
|
|
7188
|
-
*
|
|
7223
|
+
* - When registering the callback, takes an optional second argument that will make the callback
|
|
7224
|
+
* only fire if it matches the `GridEntityType` provided.
|
|
7225
|
+
* - When registering the callback, takes an optional third argument that will make the callback
|
|
7226
|
+
* only fire if it matches the variant provided.
|
|
7189
7227
|
*
|
|
7190
7228
|
* ```ts
|
|
7191
7229
|
* function postGridEntityRemove(
|
|
@@ -7198,14 +7236,14 @@ export declare enum ModCallbackCustom {
|
|
|
7198
7236
|
/**
|
|
7199
7237
|
* Fires from the `POST_RENDER` callback on every frame that a grid entity exists.
|
|
7200
7238
|
*
|
|
7239
|
+
* For grid entities created with `spawnCustomGridEntity`, use the
|
|
7240
|
+
* `POST_GRID_ENTITY_CUSTOM_RENDER` callback instead.
|
|
7241
|
+
*
|
|
7201
7242
|
* - When registering the callback, takes an optional second argument that will make the callback
|
|
7202
7243
|
* only fire if it matches the `GridEntityType` provided.
|
|
7203
7244
|
* - When registering the callback, takes an optional third argument that will make the callback
|
|
7204
7245
|
* only fire if it matches the variant provided.
|
|
7205
7246
|
*
|
|
7206
|
-
* For grid entities created with `spawnCustomGridEntity`, use the
|
|
7207
|
-
* `POST_GRID_ENTITY_CUSTOM_RENDER` callback instead.
|
|
7208
|
-
*
|
|
7209
7247
|
* ```ts
|
|
7210
7248
|
* function postGridEntityRender(gridEntity: GridEntity): void {}
|
|
7211
7249
|
* ```
|
|
@@ -7215,12 +7253,14 @@ export declare enum ModCallbackCustom {
|
|
|
7215
7253
|
* Fires from the `POST_UPDATE` callback when a grid entity changes its state. (In this context,
|
|
7216
7254
|
* "state" refers to the `GridEntity.State` field.)
|
|
7217
7255
|
*
|
|
7218
|
-
* When registering the callback, takes an optional second argument that will make the callback
|
|
7219
|
-
* only fire if it matches the `GridEntityType` provided.
|
|
7220
|
-
*
|
|
7221
7256
|
* For grid entities created with `spawnCustomGridEntity`, use the
|
|
7222
7257
|
* `POST_GRID_ENTITY_CUSTOM_STATE_CHANGED` callback instead.
|
|
7223
7258
|
*
|
|
7259
|
+
* - When registering the callback, takes an optional second argument that will make the callback
|
|
7260
|
+
* only fire if it matches the `GridEntityType` provided.
|
|
7261
|
+
* - When registering the callback, takes an optional third argument that will make the callback
|
|
7262
|
+
* only fire if it matches the variant provided.
|
|
7263
|
+
*
|
|
7224
7264
|
* ```ts
|
|
7225
7265
|
* function postGridEntityStateChanged(
|
|
7226
7266
|
* gridEntity: GridEntity,
|
|
@@ -7233,14 +7273,14 @@ export declare enum ModCallbackCustom {
|
|
|
7233
7273
|
/**
|
|
7234
7274
|
* Fires from the `POST_UPDATE` callback on every frame that a grid entity exists.
|
|
7235
7275
|
*
|
|
7276
|
+
* For grid entities created with `spawnCustomGridEntity`, use the
|
|
7277
|
+
* `POST_GRID_ENTITY_CUSTOM_UPDATE` callback instead.
|
|
7278
|
+
*
|
|
7236
7279
|
* - When registering the callback, takes an optional second argument that will make the callback
|
|
7237
7280
|
* only fire if it matches the `GridEntityType` provided.
|
|
7238
7281
|
* - When registering the callback, takes an optional third argument that will make the callback
|
|
7239
7282
|
* only fire if it matches the variant provided.
|
|
7240
7283
|
*
|
|
7241
|
-
* For grid entities created with `spawnCustomGridEntity`, use the
|
|
7242
|
-
* `POST_GRID_ENTITY_CUSTOM_UPDATE` callback instead.
|
|
7243
|
-
*
|
|
7244
7284
|
* ```ts
|
|
7245
7285
|
* function postGridEntityUpdate(gridEntity: GridEntity): void {}
|
|
7246
7286
|
* ```
|
|
@@ -7862,7 +7902,8 @@ export declare enum ModCallbackCustom {
|
|
|
7862
7902
|
* certain conditions, like if the slot entity is playing the "Idle" animation, and so on.
|
|
7863
7903
|
*
|
|
7864
7904
|
* When registering the callback, takes an optional second argument that will make the callback
|
|
7865
|
-
* only fire if it matches the `SlotVariant` provided.
|
|
7905
|
+
* only fire if it matches the `SlotVariant` provided. (There is no need for any additional
|
|
7906
|
+
* arguments, since only players will cause this callback to fire.)
|
|
7866
7907
|
*
|
|
7867
7908
|
* ```ts
|
|
7868
7909
|
* function postSlotCollision(
|
|
@@ -8580,7 +8621,9 @@ gridEntityVariant?: int
|
|
|
8580
8621
|
declare type PostGridEntityCollisionRegisterParameters = [
|
|
8581
8622
|
callback: (gridEntity: GridEntity, entity: Entity) => void,
|
|
8582
8623
|
gridEntityType?: GridEntityType,
|
|
8583
|
-
gridEntityVariant?: int
|
|
8624
|
+
gridEntityVariant?: int,
|
|
8625
|
+
entityType?: EntityType,
|
|
8626
|
+
entityVariant?: int
|
|
8584
8627
|
];
|
|
8585
8628
|
|
|
8586
8629
|
declare type PostGridEntityCustomBrokenRegisterParameters = [
|
|
@@ -8590,7 +8633,9 @@ gridEntityTypeCustom?: GridEntityType
|
|
|
8590
8633
|
|
|
8591
8634
|
declare type PostGridEntityCustomCollisionRegisterParameters = [
|
|
8592
8635
|
callback: (gridEntity: GridEntity, gridEntityTypeCustom: GridEntityType, entity: Entity) => void,
|
|
8593
|
-
gridEntityTypeCustom?: GridEntityType
|
|
8636
|
+
gridEntityTypeCustom?: GridEntityType,
|
|
8637
|
+
entityType?: EntityType,
|
|
8638
|
+
entityVariant?: int
|
|
8594
8639
|
];
|
|
8595
8640
|
|
|
8596
8641
|
declare type PostGridEntityCustomInitRegisterParameters = [
|
|
@@ -9430,6 +9475,19 @@ export declare function removeAllSpikes(variant?: number, updateRoom?: boolean,
|
|
|
9430
9475
|
*/
|
|
9431
9476
|
export declare function removeAllTears(tearVariant?: TearVariant, subType?: number, cap?: int): EntityTear[];
|
|
9432
9477
|
|
|
9478
|
+
/**
|
|
9479
|
+
* Helper function to remove all of the `GridEntityType.TELEPORTER` (23) in the room.
|
|
9480
|
+
*
|
|
9481
|
+
* @param variant Optional. If specified, will only remove the teleporters that match this variant.
|
|
9482
|
+
* Default is -1, which matches every variant.
|
|
9483
|
+
* @param updateRoom Optional. Whether or not to update the room after the teleporters are removed.
|
|
9484
|
+
* Default is false. For more information, see the description of the
|
|
9485
|
+
* `removeGridEntities` helper function.
|
|
9486
|
+
* @param cap Optional. If specified, will only remove the given amount of teleporters.
|
|
9487
|
+
* @returns The teleporters that were removed.
|
|
9488
|
+
*/
|
|
9489
|
+
export declare function removeAllTeleporters(variant?: number, updateRoom?: boolean, cap?: int): GridEntity[];
|
|
9490
|
+
|
|
9433
9491
|
/**
|
|
9434
9492
|
* Helper function to remove all of the `GridEntityTNT` in the room.
|
|
9435
9493
|
*
|
|
@@ -11137,6 +11195,12 @@ export declare function spawnTear(tearVariant: TearVariant, subType: int, positi
|
|
|
11137
11195
|
/** Helper function to spawn a `EntityType.EntityType` (2) with a specific seed. */
|
|
11138
11196
|
export declare function spawnTearWithSeed(tearVariant: TearVariant, subType: int, position: Vector, seedOrRNG: Seed | RNG, velocity?: Vector, spawner?: Entity | undefined): EntityTear;
|
|
11139
11197
|
|
|
11198
|
+
/** Helper function to spawn a `GridEntityType.TELEPORTER` (23). */
|
|
11199
|
+
export declare function spawnTeleporter(gridIndexOrPosition: int | Vector): GridEntity | undefined;
|
|
11200
|
+
|
|
11201
|
+
/** Helper function to spawn a `GridEntityType.TELEPORTER` (23) with a specific variant. */
|
|
11202
|
+
export declare function spawnTeleporterWithVariant(variant: int, gridIndexOrPosition: int | Vector): GridEntity | undefined;
|
|
11203
|
+
|
|
11140
11204
|
/** Helper function to spawn a `GridEntityType.TNT` (12). */
|
|
11141
11205
|
export declare function spawnTNT(gridIndexOrPosition: int | Vector): GridEntityTNT | undefined;
|
|
11142
11206
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.5.0",
|
|
4
4
|
"description": "Helper functions and features for IsaacScript mods.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -22,6 +22,6 @@
|
|
|
22
22
|
"main": "dist/index",
|
|
23
23
|
"types": "dist/index.d.ts",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"isaac-typescript-definitions": "^4.0.
|
|
25
|
+
"isaac-typescript-definitions": "^4.0.1"
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { GridEntityType } from "isaac-typescript-definitions";
|
|
1
|
+
import { EntityType, GridEntityType } from "isaac-typescript-definitions";
|
|
2
2
|
|
|
3
3
|
export type PostGridEntityCollisionRegisterParameters = [
|
|
4
4
|
callback: (gridEntity: GridEntity, entity: Entity) => void,
|
|
5
5
|
gridEntityType?: GridEntityType,
|
|
6
6
|
gridEntityVariant?: int,
|
|
7
|
+
entityType?: EntityType,
|
|
8
|
+
entityVariant?: int,
|
|
7
9
|
];
|
|
8
10
|
|
|
9
11
|
const subscriptions: PostGridEntityCollisionRegisterParameters[] = [];
|
|
@@ -29,6 +31,8 @@ export function postGridEntityCollisionFire(
|
|
|
29
31
|
callback,
|
|
30
32
|
callbackGridEntityType,
|
|
31
33
|
callbackGridEntityVariant,
|
|
34
|
+
callbackEntityType,
|
|
35
|
+
callbackEntityVariant,
|
|
32
36
|
] of subscriptions) {
|
|
33
37
|
// Handle the optional 2nd callback argument.
|
|
34
38
|
if (
|
|
@@ -46,6 +50,22 @@ export function postGridEntityCollisionFire(
|
|
|
46
50
|
continue;
|
|
47
51
|
}
|
|
48
52
|
|
|
53
|
+
// Handle the optional 4th callback argument.
|
|
54
|
+
if (
|
|
55
|
+
callbackEntityType !== undefined &&
|
|
56
|
+
callbackEntityType !== entity.Type
|
|
57
|
+
) {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Handle the optional 5th callback argument.
|
|
62
|
+
if (
|
|
63
|
+
callbackEntityVariant !== undefined &&
|
|
64
|
+
callbackEntityVariant !== entity.Variant
|
|
65
|
+
) {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
|
|
49
69
|
callback(gridEntity, entity);
|
|
50
70
|
}
|
|
51
71
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GridEntityType } from "isaac-typescript-definitions";
|
|
1
|
+
import { EntityType, GridEntityType } from "isaac-typescript-definitions";
|
|
2
2
|
|
|
3
3
|
export type PostGridEntityCustomCollisionRegisterParameters = [
|
|
4
4
|
callback: (
|
|
@@ -7,6 +7,8 @@ export type PostGridEntityCustomCollisionRegisterParameters = [
|
|
|
7
7
|
entity: Entity,
|
|
8
8
|
) => void,
|
|
9
9
|
gridEntityTypeCustom?: GridEntityType,
|
|
10
|
+
entityType?: EntityType,
|
|
11
|
+
entityVariant?: int,
|
|
10
12
|
];
|
|
11
13
|
|
|
12
14
|
const subscriptions: PostGridEntityCustomCollisionRegisterParameters[] = [];
|
|
@@ -26,7 +28,12 @@ export function postGridEntityCustomCollisionFire(
|
|
|
26
28
|
gridEntityTypeCustom: GridEntityType,
|
|
27
29
|
entity: Entity,
|
|
28
30
|
): void {
|
|
29
|
-
for (const [
|
|
31
|
+
for (const [
|
|
32
|
+
callback,
|
|
33
|
+
callbackGridEntityTypeCustom,
|
|
34
|
+
callbackEntityType,
|
|
35
|
+
callbackEntityVariant,
|
|
36
|
+
] of subscriptions) {
|
|
30
37
|
// Handle the optional 2nd callback argument.
|
|
31
38
|
if (
|
|
32
39
|
callbackGridEntityTypeCustom !== undefined &&
|
|
@@ -35,6 +42,22 @@ export function postGridEntityCustomCollisionFire(
|
|
|
35
42
|
continue;
|
|
36
43
|
}
|
|
37
44
|
|
|
45
|
+
// Handle the optional 3rd callback argument.
|
|
46
|
+
if (
|
|
47
|
+
callbackEntityType !== undefined &&
|
|
48
|
+
callbackEntityType !== entity.Type
|
|
49
|
+
) {
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Handle the optional 4th callback argument.
|
|
54
|
+
if (
|
|
55
|
+
callbackEntityVariant !== undefined &&
|
|
56
|
+
callbackEntityVariant !== entity.Variant
|
|
57
|
+
) {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
|
|
38
61
|
callback(gridEntity, gridEntityTypeCustom, entity);
|
|
39
62
|
}
|
|
40
63
|
}
|