isaacscript-common 9.2.1 → 9.4.1
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/core/constants.d.ts +2 -0
- package/dist/core/constants.d.ts.map +1 -1
- package/dist/core/constants.lua +2 -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/pickupVariants.d.ts +11 -11
- package/dist/functions/pickupVariants.d.ts.map +1 -1
- package/dist/functions/pickupVariants.lua +11 -11
- package/dist/index.d.ts +78 -41
- package/package.json +2 -2
- package/src/callbacks/subscriptions/postGridEntityCollision.ts +21 -1
- package/src/callbacks/subscriptions/postGridEntityCustomCollision.ts +25 -2
- package/src/core/constants.ts +3 -0
- 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/pickupVariants.ts +11 -11
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;
|
|
@@ -5559,7 +5559,7 @@ export declare function isArrayContiguous(array: int[]): boolean;
|
|
|
5559
5559
|
/** Checks if an array is in the provided 2-dimensional array. */
|
|
5560
5560
|
export declare function isArrayInArray<T>(arrayToMatch: T[] | readonly T[], parentArray: Array<T[] | readonly T[]>): boolean;
|
|
5561
5561
|
|
|
5562
|
-
/** For `PickupVariant.LIL_BATTERY` (90) */
|
|
5562
|
+
/** For `PickupVariant.LIL_BATTERY` (90). */
|
|
5563
5563
|
export declare function isBattery(pickup: EntityPickup): pickup is EntityPickupBattery;
|
|
5564
5564
|
|
|
5565
5565
|
/**
|
|
@@ -5578,7 +5578,7 @@ export declare function isBlindCollectible(collectible: EntityPickup): boolean;
|
|
|
5578
5578
|
/** Helper function to detect if a variable is of type `EntityBomb`. */
|
|
5579
5579
|
export declare function isBomb(variable: unknown): variable is EntityBomb;
|
|
5580
5580
|
|
|
5581
|
-
/** For `PickupVariant.BOMB` (40) */
|
|
5581
|
+
/** For `PickupVariant.BOMB` (40). */
|
|
5582
5582
|
export declare function isBombPickup(pickup: EntityPickup): pickup is EntityPickupBomb;
|
|
5583
5583
|
|
|
5584
5584
|
export declare function isBoolean(variable: unknown): variable is boolean;
|
|
@@ -5592,7 +5592,7 @@ export declare function isBoolean(variable: unknown): variable is boolean;
|
|
|
5592
5592
|
*/
|
|
5593
5593
|
export declare function isCard(cardType: CardType): boolean;
|
|
5594
5594
|
|
|
5595
|
-
/** For `PickupVariant.TAROT_CARD` (300) */
|
|
5595
|
+
/** For `PickupVariant.TAROT_CARD` (300). */
|
|
5596
5596
|
export declare function isCardPickup(pickup: EntityPickup): pickup is EntityPickupCard;
|
|
5597
5597
|
|
|
5598
5598
|
/** Returns whether or not the given card type matches the specified item config card type. */
|
|
@@ -5622,10 +5622,10 @@ export declare function isCircleIntersectingRectangle(circleCenter: Vector, circ
|
|
|
5622
5622
|
/** Helper function to see if a player is close enough to activate a Dice Room floor. */
|
|
5623
5623
|
export declare function isCloseEnoughToTriggerDiceFloor(player: EntityPlayer, diceFloor: EntityEffect): boolean;
|
|
5624
5624
|
|
|
5625
|
-
/** For `PickupVariant.COIN` (20) */
|
|
5625
|
+
/** For `PickupVariant.COIN` (20). */
|
|
5626
5626
|
export declare function isCoin(pickup: EntityPickup): pickup is EntityPickupCoin;
|
|
5627
5627
|
|
|
5628
|
-
/** For `PickupVariant.COLLECTIBLE` (100) */
|
|
5628
|
+
/** For `PickupVariant.COLLECTIBLE` (100). */
|
|
5629
5629
|
export declare function isCollectible(pickup: EntityPickup): pickup is EntityPickupCollectible;
|
|
5630
5630
|
|
|
5631
5631
|
/**
|
|
@@ -5784,6 +5784,10 @@ export declare function isEntity(variable: unknown): variable is Entity;
|
|
|
5784
5784
|
/**
|
|
5785
5785
|
* Helper function to measure an entity's velocity to see if it is moving.
|
|
5786
5786
|
*
|
|
5787
|
+
* Use this helper function over checking if the velocity length is equal to 0 because entities can
|
|
5788
|
+
* look like they are completely immobile but yet still have a non zero velocity. Thus, using a
|
|
5789
|
+
* threshold is needed.
|
|
5790
|
+
*
|
|
5787
5791
|
* @param entity The entity whose velocity to measure.
|
|
5788
5792
|
* @param threshold Optional. The threshold from 0 to consider to be moving. Default is 0.01.
|
|
5789
5793
|
*/
|
|
@@ -5836,7 +5840,7 @@ export declare function isGridEntityBreakableByExplosion(gridEntity: GridEntity)
|
|
|
5836
5840
|
*/
|
|
5837
5841
|
export declare function isGridEntityBroken(gridEntity: GridEntity): boolean;
|
|
5838
5842
|
|
|
5839
|
-
/** For `PickupVariant.HEART` (10) */
|
|
5843
|
+
/** For `PickupVariant.HEART` (10). */
|
|
5840
5844
|
export declare function isHeart(pickup: EntityPickup): pickup is EntityPickupHeart;
|
|
5841
5845
|
|
|
5842
5846
|
/**
|
|
@@ -5880,7 +5884,7 @@ export declare function isKColor(object: unknown): object is KColor;
|
|
|
5880
5884
|
*/
|
|
5881
5885
|
export declare function isKeeper(player: EntityPlayer): boolean;
|
|
5882
5886
|
|
|
5883
|
-
/** For `PickupVariant.KEY` (30) */
|
|
5887
|
+
/** For `PickupVariant.KEY` (30). */
|
|
5884
5888
|
export declare function isKey(pickup: EntityPickup): pickup is EntityPickupKey;
|
|
5885
5889
|
|
|
5886
5890
|
/**
|
|
@@ -5979,7 +5983,7 @@ export declare function isPickingUpItemTrinket(pickingUpItem: PickingUpItem): pi
|
|
|
5979
5983
|
/** Helper function to detect if a variable is of type `EntityPickup`. */
|
|
5980
5984
|
export declare function isPickup(variable: unknown): variable is EntityPickup;
|
|
5981
5985
|
|
|
5982
|
-
/** For `PickupVariant.PILL` (70) */
|
|
5986
|
+
/** For `PickupVariant.PILL` (70). */
|
|
5983
5987
|
export declare function isPill(pickup: EntityPickup): pickup is EntityPickupPill;
|
|
5984
5988
|
|
|
5985
5989
|
/** Helper function to detect if a variable is of type `GridEntityPit`. */
|
|
@@ -6000,7 +6004,7 @@ export declare function isPocketItemObject(cardType: CardType): boolean;
|
|
|
6000
6004
|
/** Helper function to detect if a variable is of type `GridEntityPoop`. */
|
|
6001
6005
|
export declare function isPoop(variable: unknown): variable is GridEntityPoop;
|
|
6002
6006
|
|
|
6003
|
-
/** For `PickupVariant.POOP` (42) */
|
|
6007
|
+
/** For `PickupVariant.POOP` (42). */
|
|
6004
6008
|
export declare function isPoopPickup(pickup: EntityPickup): pickup is EntityPickupPoop;
|
|
6005
6009
|
|
|
6006
6010
|
/**
|
|
@@ -6085,7 +6089,7 @@ export declare function isRoomShapeDoubleCharge(roomShape: RoomShape): boolean;
|
|
|
6085
6089
|
/** Returns true for cards that have `CardType.RUNE`. */
|
|
6086
6090
|
export declare function isRune(cardType: CardType): boolean;
|
|
6087
6091
|
|
|
6088
|
-
/** For `PickupVariant.SACK` (69) */
|
|
6092
|
+
/** For `PickupVariant.SACK` (69). */
|
|
6089
6093
|
export declare function isSack(pickup: EntityPickup): pickup is EntityPickupSack;
|
|
6090
6094
|
|
|
6091
6095
|
/**
|
|
@@ -6156,7 +6160,7 @@ export declare function isSin(npc: EntityNPC): boolean;
|
|
|
6156
6160
|
*/
|
|
6157
6161
|
export declare function isSingleUseCollectible(collectibleType: CollectibleType): boolean;
|
|
6158
6162
|
|
|
6159
|
-
/** For `EntityType.SLOT` (6) */
|
|
6163
|
+
/** For `EntityType.SLOT` (6). */
|
|
6160
6164
|
export declare function isSlot(entity: Entity): entity is EntitySlot;
|
|
6161
6165
|
|
|
6162
6166
|
/** Returns true for cards that have `CardType.SPECIAL`. */
|
|
@@ -6196,7 +6200,7 @@ export declare function isTNT(variable: unknown): variable is GridEntityTNT;
|
|
|
6196
6200
|
|
|
6197
6201
|
export declare function isTransformationFlying(playerForm: PlayerForm): boolean;
|
|
6198
6202
|
|
|
6199
|
-
/** For `PickupVariant.TRINKET` (350) */
|
|
6203
|
+
/** For `PickupVariant.TRINKET` (350). */
|
|
6200
6204
|
export declare function isTrinket(pickup: EntityPickup): pickup is EntityPickupTrinket;
|
|
6201
6205
|
|
|
6202
6206
|
/**
|
|
@@ -7019,8 +7023,10 @@ export declare enum ModCallbackCustom {
|
|
|
7019
7023
|
* For grid entities created with `spawnCustomGridEntity`, use the
|
|
7020
7024
|
* `POST_GRID_ENTITY_CUSTOM_BROKEN` callback instead.
|
|
7021
7025
|
*
|
|
7022
|
-
* When registering the callback, takes an optional second argument that will make the callback
|
|
7023
|
-
*
|
|
7026
|
+
* - When registering the callback, takes an optional second argument that will make the callback
|
|
7027
|
+
* only fire if it matches the `GridEntityType` provided.
|
|
7028
|
+
* - When registering the callback, takes an optional third argument that will make the callback
|
|
7029
|
+
* only fire if it matches the variant provided.
|
|
7024
7030
|
*
|
|
7025
7031
|
* ```ts
|
|
7026
7032
|
* function postGridEntityBroken(gridEntity: GridEntity): void {}
|
|
@@ -7035,8 +7041,14 @@ export declare enum ModCallbackCustom {
|
|
|
7035
7041
|
* For grid entities created with `spawnCustomGridEntity`, use the
|
|
7036
7042
|
* `POST_GRID_ENTITY_CUSTOM_COLLISION` callback instead.
|
|
7037
7043
|
*
|
|
7038
|
-
* When registering the callback, takes an optional second argument that will make the callback
|
|
7039
|
-
*
|
|
7044
|
+
* - When registering the callback, takes an optional second argument that will make the callback
|
|
7045
|
+
* only fire if it matches the `GridEntityType` provided.
|
|
7046
|
+
* - When registering the callback, takes an optional third argument that will make the callback
|
|
7047
|
+
* only fire if it matches the variant provided (for the grid entity).
|
|
7048
|
+
* - When registering the callback, takes an optional fourth argument that will make the callback
|
|
7049
|
+
* only fire if the colliding entity matches the `EntityType` provided.
|
|
7050
|
+
* - When registering the callback, takes an optional fifth argument that will make the callback
|
|
7051
|
+
* only fire if the colliding entity matches the variant provided.
|
|
7040
7052
|
*
|
|
7041
7053
|
* ```ts
|
|
7042
7054
|
* function postGridEntityCollision(
|
|
@@ -7051,7 +7063,8 @@ export declare enum ModCallbackCustom {
|
|
|
7051
7063
|
* with the `spawnCustomGridEntity` helper function.
|
|
7052
7064
|
*
|
|
7053
7065
|
* When registering the callback, takes an optional second argument that will make the callback
|
|
7054
|
-
* only fire if it matches the `GridEntityType` provided.
|
|
7066
|
+
* only fire if it matches the `GridEntityType` provided. (Custom grid entities do not have
|
|
7067
|
+
* variants, so there is no need for an optional third argument to filter by variant.)
|
|
7055
7068
|
*
|
|
7056
7069
|
* ```ts
|
|
7057
7070
|
* function postGridEntityCustomBroken(
|
|
@@ -7065,8 +7078,13 @@ export declare enum ModCallbackCustom {
|
|
|
7065
7078
|
* The same as the `POST_GRID_ENTITY_COLLISION` callback, but only fires for grid entities created
|
|
7066
7079
|
* with the `spawnCustomGridEntity` helper function.
|
|
7067
7080
|
*
|
|
7068
|
-
* When registering the callback, takes an optional second argument that will make the callback
|
|
7069
|
-
*
|
|
7081
|
+
* - When registering the callback, takes an optional second argument that will make the callback
|
|
7082
|
+
* only fire if it matches the `GridEntityType` provided. (Custom grid entities do not have
|
|
7083
|
+
* variants, so there is no need for an optional third argument to filter by variant.)
|
|
7084
|
+
* - When registering the callback, takes an optional third argument that will make the callback
|
|
7085
|
+
* only fire if the the colliding entity matches the `EntityType` provided.
|
|
7086
|
+
* - When registering the callback, takes an optional fourth argument that will make the callback
|
|
7087
|
+
* only fire if the the colliding entity matches the variant provided.
|
|
7070
7088
|
*
|
|
7071
7089
|
* ```ts
|
|
7072
7090
|
* function postGridEntityCustomCollision(
|
|
@@ -7082,7 +7100,8 @@ export declare enum ModCallbackCustom {
|
|
|
7082
7100
|
* the `spawnCustomGridEntity` helper function.
|
|
7083
7101
|
*
|
|
7084
7102
|
* When registering the callback, takes an optional second argument that will make the callback
|
|
7085
|
-
* only fire if it matches the `GridEntityType` provided.
|
|
7103
|
+
* only fire if it matches the `GridEntityType` provided. (Custom grid entities do not have
|
|
7104
|
+
* variants, so there is no need for an optional third argument to filter by variant.)
|
|
7086
7105
|
*
|
|
7087
7106
|
* ```ts
|
|
7088
7107
|
* function postGridEntityCustomInit(
|
|
@@ -7097,7 +7116,8 @@ export declare enum ModCallbackCustom {
|
|
|
7097
7116
|
* with the `spawnCustomGridEntity` helper function.
|
|
7098
7117
|
*
|
|
7099
7118
|
* When registering the callback, takes an optional second argument that will make the callback
|
|
7100
|
-
* only fire if it matches the `GridEntityType` provided.
|
|
7119
|
+
* only fire if it matches the `GridEntityType` provided. (Custom grid entities do not have
|
|
7120
|
+
* variants, so there is no need for an optional third argument to filter by variant.)
|
|
7101
7121
|
*
|
|
7102
7122
|
* ```ts
|
|
7103
7123
|
* function postGridEntityCustomRemove(
|
|
@@ -7112,7 +7132,8 @@ export declare enum ModCallbackCustom {
|
|
|
7112
7132
|
* with the `spawnCustomGridEntity` helper function.
|
|
7113
7133
|
*
|
|
7114
7134
|
* When registering the callback, takes an optional second argument that will make the callback
|
|
7115
|
-
* only fire if it matches the `GridEntityType` provided.
|
|
7135
|
+
* only fire if it matches the `GridEntityType` provided. (Custom grid entities do not have
|
|
7136
|
+
* variants, so there is no need for an optional third argument to filter by variant.)
|
|
7116
7137
|
*
|
|
7117
7138
|
* ```ts
|
|
7118
7139
|
* function postGridEntityCustomRender(
|
|
@@ -7127,7 +7148,8 @@ export declare enum ModCallbackCustom {
|
|
|
7127
7148
|
* created with the `spawnCustomGridEntity` helper function.
|
|
7128
7149
|
*
|
|
7129
7150
|
* When registering the callback, takes an optional second argument that will make the callback
|
|
7130
|
-
* only fire if it matches the `GridEntityType` provided.
|
|
7151
|
+
* only fire if it matches the `GridEntityType` provided. (Custom grid entities do not have
|
|
7152
|
+
* variants, so there is no need for an optional third argument to filter by variant.)
|
|
7131
7153
|
*
|
|
7132
7154
|
* ```ts
|
|
7133
7155
|
* function postGridEntityCustomStateChanged(
|
|
@@ -7144,7 +7166,8 @@ export declare enum ModCallbackCustom {
|
|
|
7144
7166
|
* with the `spawnCustomGridEntity` helper function.
|
|
7145
7167
|
*
|
|
7146
7168
|
* When registering the callback, takes an optional second argument that will make the callback
|
|
7147
|
-
* only fire if it matches the `GridEntityType` provided.
|
|
7169
|
+
* only fire if it matches the `GridEntityType` provided. (Custom grid entities do not have
|
|
7170
|
+
* variants, so there is no need for an optional third argument to filter by variant.)
|
|
7148
7171
|
*
|
|
7149
7172
|
* ```ts
|
|
7150
7173
|
* function postGridEntityCustomUpdate(
|
|
@@ -7165,8 +7188,10 @@ export declare enum ModCallbackCustom {
|
|
|
7165
7188
|
* For grid entities created with `spawnCustomGridEntity`, use the `POST_GRID_ENTITY_CUSTOM_INIT`
|
|
7166
7189
|
* callback instead.
|
|
7167
7190
|
*
|
|
7168
|
-
* When registering the callback, takes an optional second argument that will make the callback
|
|
7169
|
-
*
|
|
7191
|
+
* - When registering the callback, takes an optional second argument that will make the callback
|
|
7192
|
+
* only fire if it matches the `GridEntityType` provided.
|
|
7193
|
+
* - When registering the callback, takes an optional third argument that will make the callback
|
|
7194
|
+
* only fire if it matches the variant provided.
|
|
7170
7195
|
*
|
|
7171
7196
|
* ```ts
|
|
7172
7197
|
* function postGridEntityInit(gridEntity: GridEntity): void {}
|
|
@@ -7184,8 +7209,10 @@ export declare enum ModCallbackCustom {
|
|
|
7184
7209
|
* For grid entities created with `spawnCustomGridEntity`, use the
|
|
7185
7210
|
* `POST_GRID_ENTITY_CUSTOM_REMOVE` callback instead.
|
|
7186
7211
|
*
|
|
7187
|
-
* When registering the callback, takes an optional second argument that will make the callback
|
|
7188
|
-
*
|
|
7212
|
+
* - When registering the callback, takes an optional second argument that will make the callback
|
|
7213
|
+
* only fire if it matches the `GridEntityType` provided.
|
|
7214
|
+
* - When registering the callback, takes an optional third argument that will make the callback
|
|
7215
|
+
* only fire if it matches the variant provided.
|
|
7189
7216
|
*
|
|
7190
7217
|
* ```ts
|
|
7191
7218
|
* function postGridEntityRemove(
|
|
@@ -7198,14 +7225,14 @@ export declare enum ModCallbackCustom {
|
|
|
7198
7225
|
/**
|
|
7199
7226
|
* Fires from the `POST_RENDER` callback on every frame that a grid entity exists.
|
|
7200
7227
|
*
|
|
7228
|
+
* For grid entities created with `spawnCustomGridEntity`, use the
|
|
7229
|
+
* `POST_GRID_ENTITY_CUSTOM_RENDER` callback instead.
|
|
7230
|
+
*
|
|
7201
7231
|
* - When registering the callback, takes an optional second argument that will make the callback
|
|
7202
7232
|
* only fire if it matches the `GridEntityType` provided.
|
|
7203
7233
|
* - When registering the callback, takes an optional third argument that will make the callback
|
|
7204
7234
|
* only fire if it matches the variant provided.
|
|
7205
7235
|
*
|
|
7206
|
-
* For grid entities created with `spawnCustomGridEntity`, use the
|
|
7207
|
-
* `POST_GRID_ENTITY_CUSTOM_RENDER` callback instead.
|
|
7208
|
-
*
|
|
7209
7236
|
* ```ts
|
|
7210
7237
|
* function postGridEntityRender(gridEntity: GridEntity): void {}
|
|
7211
7238
|
* ```
|
|
@@ -7215,12 +7242,14 @@ export declare enum ModCallbackCustom {
|
|
|
7215
7242
|
* Fires from the `POST_UPDATE` callback when a grid entity changes its state. (In this context,
|
|
7216
7243
|
* "state" refers to the `GridEntity.State` field.)
|
|
7217
7244
|
*
|
|
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
7245
|
* For grid entities created with `spawnCustomGridEntity`, use the
|
|
7222
7246
|
* `POST_GRID_ENTITY_CUSTOM_STATE_CHANGED` callback instead.
|
|
7223
7247
|
*
|
|
7248
|
+
* - When registering the callback, takes an optional second argument that will make the callback
|
|
7249
|
+
* only fire if it matches the `GridEntityType` provided.
|
|
7250
|
+
* - When registering the callback, takes an optional third argument that will make the callback
|
|
7251
|
+
* only fire if it matches the variant provided.
|
|
7252
|
+
*
|
|
7224
7253
|
* ```ts
|
|
7225
7254
|
* function postGridEntityStateChanged(
|
|
7226
7255
|
* gridEntity: GridEntity,
|
|
@@ -7233,14 +7262,14 @@ export declare enum ModCallbackCustom {
|
|
|
7233
7262
|
/**
|
|
7234
7263
|
* Fires from the `POST_UPDATE` callback on every frame that a grid entity exists.
|
|
7235
7264
|
*
|
|
7265
|
+
* For grid entities created with `spawnCustomGridEntity`, use the
|
|
7266
|
+
* `POST_GRID_ENTITY_CUSTOM_UPDATE` callback instead.
|
|
7267
|
+
*
|
|
7236
7268
|
* - When registering the callback, takes an optional second argument that will make the callback
|
|
7237
7269
|
* only fire if it matches the `GridEntityType` provided.
|
|
7238
7270
|
* - When registering the callback, takes an optional third argument that will make the callback
|
|
7239
7271
|
* only fire if it matches the variant provided.
|
|
7240
7272
|
*
|
|
7241
|
-
* For grid entities created with `spawnCustomGridEntity`, use the
|
|
7242
|
-
* `POST_GRID_ENTITY_CUSTOM_UPDATE` callback instead.
|
|
7243
|
-
*
|
|
7244
7273
|
* ```ts
|
|
7245
7274
|
* function postGridEntityUpdate(gridEntity: GridEntity): void {}
|
|
7246
7275
|
* ```
|
|
@@ -7862,7 +7891,8 @@ export declare enum ModCallbackCustom {
|
|
|
7862
7891
|
* certain conditions, like if the slot entity is playing the "Idle" animation, and so on.
|
|
7863
7892
|
*
|
|
7864
7893
|
* When registering the callback, takes an optional second argument that will make the callback
|
|
7865
|
-
* only fire if it matches the `SlotVariant` provided.
|
|
7894
|
+
* only fire if it matches the `SlotVariant` provided. (There is no need for any additional
|
|
7895
|
+
* arguments, since only players will cause this callback to fire.)
|
|
7866
7896
|
*
|
|
7867
7897
|
* ```ts
|
|
7868
7898
|
* function postSlotCollision(
|
|
@@ -8580,7 +8610,9 @@ gridEntityVariant?: int
|
|
|
8580
8610
|
declare type PostGridEntityCollisionRegisterParameters = [
|
|
8581
8611
|
callback: (gridEntity: GridEntity, entity: Entity) => void,
|
|
8582
8612
|
gridEntityType?: GridEntityType,
|
|
8583
|
-
gridEntityVariant?: int
|
|
8613
|
+
gridEntityVariant?: int,
|
|
8614
|
+
entityType?: EntityType,
|
|
8615
|
+
entityVariant?: int
|
|
8584
8616
|
];
|
|
8585
8617
|
|
|
8586
8618
|
declare type PostGridEntityCustomBrokenRegisterParameters = [
|
|
@@ -8590,7 +8622,9 @@ gridEntityTypeCustom?: GridEntityType
|
|
|
8590
8622
|
|
|
8591
8623
|
declare type PostGridEntityCustomCollisionRegisterParameters = [
|
|
8592
8624
|
callback: (gridEntity: GridEntity, gridEntityTypeCustom: GridEntityType, entity: Entity) => void,
|
|
8593
|
-
gridEntityTypeCustom?: GridEntityType
|
|
8625
|
+
gridEntityTypeCustom?: GridEntityType,
|
|
8626
|
+
entityType?: EntityType,
|
|
8627
|
+
entityVariant?: int
|
|
8594
8628
|
];
|
|
8595
8629
|
|
|
8596
8630
|
declare type PostGridEntityCustomInitRegisterParameters = [
|
|
@@ -11294,6 +11328,9 @@ export declare function tanh(x: number): number;
|
|
|
11294
11328
|
*/
|
|
11295
11329
|
export declare function teleport(roomGridIndex: int, direction?: Direction, roomTransitionAnim?: RoomTransitionAnim, force?: boolean): void;
|
|
11296
11330
|
|
|
11331
|
+
/** For `GridEntityType.TELEPORTER` (23). */
|
|
11332
|
+
export declare const TELEPORTER_ACTIVATION_DISTANCE: number;
|
|
11333
|
+
|
|
11297
11334
|
/**
|
|
11298
11335
|
* Helper function to temporarily remove a specific kind of trinket from the player. Use this in
|
|
11299
11336
|
* combination with the `giveTrinketsBack` function to take away and give back a trinket on the same
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.4.1",
|
|
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
|
}
|
package/src/core/constants.ts
CHANGED
|
@@ -161,6 +161,9 @@ export const ONE_BY_ONE_ROOM_GRID_SIZE = 135;
|
|
|
161
161
|
/** After taking damage, `EntityPlayer.SamsonBerserkCharge` is incremented by this amount. */
|
|
162
162
|
export const TAINTED_SAMSON_BERSERK_CHARGE_FROM_TAKING_DAMAGE = 10000;
|
|
163
163
|
|
|
164
|
+
/** For `GridEntityType.TELEPORTER` (23). */
|
|
165
|
+
export const TELEPORTER_ACTIVATION_DISTANCE = DISTANCE_OF_GRID_TILE / 2;
|
|
166
|
+
|
|
164
167
|
/**
|
|
165
168
|
* This is the number of draw coordinates that each heart spans on the UI in the upper left hand
|
|
166
169
|
* corner.
|
|
@@ -356,8 +356,10 @@ export enum ModCallbackCustom {
|
|
|
356
356
|
* For grid entities created with `spawnCustomGridEntity`, use the
|
|
357
357
|
* `POST_GRID_ENTITY_CUSTOM_BROKEN` callback instead.
|
|
358
358
|
*
|
|
359
|
-
* When registering the callback, takes an optional second argument that will make the callback
|
|
360
|
-
*
|
|
359
|
+
* - When registering the callback, takes an optional second argument that will make the callback
|
|
360
|
+
* only fire if it matches the `GridEntityType` provided.
|
|
361
|
+
* - When registering the callback, takes an optional third argument that will make the callback
|
|
362
|
+
* only fire if it matches the variant provided.
|
|
361
363
|
*
|
|
362
364
|
* ```ts
|
|
363
365
|
* function postGridEntityBroken(gridEntity: GridEntity): void {}
|
|
@@ -373,8 +375,14 @@ export enum ModCallbackCustom {
|
|
|
373
375
|
* For grid entities created with `spawnCustomGridEntity`, use the
|
|
374
376
|
* `POST_GRID_ENTITY_CUSTOM_COLLISION` callback instead.
|
|
375
377
|
*
|
|
376
|
-
* When registering the callback, takes an optional second argument that will make the callback
|
|
377
|
-
*
|
|
378
|
+
* - When registering the callback, takes an optional second argument that will make the callback
|
|
379
|
+
* only fire if it matches the `GridEntityType` provided.
|
|
380
|
+
* - When registering the callback, takes an optional third argument that will make the callback
|
|
381
|
+
* only fire if it matches the variant provided (for the grid entity).
|
|
382
|
+
* - When registering the callback, takes an optional fourth argument that will make the callback
|
|
383
|
+
* only fire if the colliding entity matches the `EntityType` provided.
|
|
384
|
+
* - When registering the callback, takes an optional fifth argument that will make the callback
|
|
385
|
+
* only fire if the colliding entity matches the variant provided.
|
|
378
386
|
*
|
|
379
387
|
* ```ts
|
|
380
388
|
* function postGridEntityCollision(
|
|
@@ -390,7 +398,8 @@ export enum ModCallbackCustom {
|
|
|
390
398
|
* with the `spawnCustomGridEntity` helper function.
|
|
391
399
|
*
|
|
392
400
|
* When registering the callback, takes an optional second argument that will make the callback
|
|
393
|
-
* only fire if it matches the `GridEntityType` provided.
|
|
401
|
+
* only fire if it matches the `GridEntityType` provided. (Custom grid entities do not have
|
|
402
|
+
* variants, so there is no need for an optional third argument to filter by variant.)
|
|
394
403
|
*
|
|
395
404
|
* ```ts
|
|
396
405
|
* function postGridEntityCustomBroken(
|
|
@@ -405,8 +414,13 @@ export enum ModCallbackCustom {
|
|
|
405
414
|
* The same as the `POST_GRID_ENTITY_COLLISION` callback, but only fires for grid entities created
|
|
406
415
|
* with the `spawnCustomGridEntity` helper function.
|
|
407
416
|
*
|
|
408
|
-
* When registering the callback, takes an optional second argument that will make the callback
|
|
409
|
-
*
|
|
417
|
+
* - When registering the callback, takes an optional second argument that will make the callback
|
|
418
|
+
* only fire if it matches the `GridEntityType` provided. (Custom grid entities do not have
|
|
419
|
+
* variants, so there is no need for an optional third argument to filter by variant.)
|
|
420
|
+
* - When registering the callback, takes an optional third argument that will make the callback
|
|
421
|
+
* only fire if the the colliding entity matches the `EntityType` provided.
|
|
422
|
+
* - When registering the callback, takes an optional fourth argument that will make the callback
|
|
423
|
+
* only fire if the the colliding entity matches the variant provided.
|
|
410
424
|
*
|
|
411
425
|
* ```ts
|
|
412
426
|
* function postGridEntityCustomCollision(
|
|
@@ -423,7 +437,8 @@ export enum ModCallbackCustom {
|
|
|
423
437
|
* the `spawnCustomGridEntity` helper function.
|
|
424
438
|
*
|
|
425
439
|
* When registering the callback, takes an optional second argument that will make the callback
|
|
426
|
-
* only fire if it matches the `GridEntityType` provided.
|
|
440
|
+
* only fire if it matches the `GridEntityType` provided. (Custom grid entities do not have
|
|
441
|
+
* variants, so there is no need for an optional third argument to filter by variant.)
|
|
427
442
|
*
|
|
428
443
|
* ```ts
|
|
429
444
|
* function postGridEntityCustomInit(
|
|
@@ -439,7 +454,8 @@ export enum ModCallbackCustom {
|
|
|
439
454
|
* with the `spawnCustomGridEntity` helper function.
|
|
440
455
|
*
|
|
441
456
|
* When registering the callback, takes an optional second argument that will make the callback
|
|
442
|
-
* only fire if it matches the `GridEntityType` provided.
|
|
457
|
+
* only fire if it matches the `GridEntityType` provided. (Custom grid entities do not have
|
|
458
|
+
* variants, so there is no need for an optional third argument to filter by variant.)
|
|
443
459
|
*
|
|
444
460
|
* ```ts
|
|
445
461
|
* function postGridEntityCustomRemove(
|
|
@@ -455,7 +471,8 @@ export enum ModCallbackCustom {
|
|
|
455
471
|
* with the `spawnCustomGridEntity` helper function.
|
|
456
472
|
*
|
|
457
473
|
* When registering the callback, takes an optional second argument that will make the callback
|
|
458
|
-
* only fire if it matches the `GridEntityType` provided.
|
|
474
|
+
* only fire if it matches the `GridEntityType` provided. (Custom grid entities do not have
|
|
475
|
+
* variants, so there is no need for an optional third argument to filter by variant.)
|
|
459
476
|
*
|
|
460
477
|
* ```ts
|
|
461
478
|
* function postGridEntityCustomRender(
|
|
@@ -471,7 +488,8 @@ export enum ModCallbackCustom {
|
|
|
471
488
|
* created with the `spawnCustomGridEntity` helper function.
|
|
472
489
|
*
|
|
473
490
|
* When registering the callback, takes an optional second argument that will make the callback
|
|
474
|
-
* only fire if it matches the `GridEntityType` provided.
|
|
491
|
+
* only fire if it matches the `GridEntityType` provided. (Custom grid entities do not have
|
|
492
|
+
* variants, so there is no need for an optional third argument to filter by variant.)
|
|
475
493
|
*
|
|
476
494
|
* ```ts
|
|
477
495
|
* function postGridEntityCustomStateChanged(
|
|
@@ -489,7 +507,8 @@ export enum ModCallbackCustom {
|
|
|
489
507
|
* with the `spawnCustomGridEntity` helper function.
|
|
490
508
|
*
|
|
491
509
|
* When registering the callback, takes an optional second argument that will make the callback
|
|
492
|
-
* only fire if it matches the `GridEntityType` provided.
|
|
510
|
+
* only fire if it matches the `GridEntityType` provided. (Custom grid entities do not have
|
|
511
|
+
* variants, so there is no need for an optional third argument to filter by variant.)
|
|
493
512
|
*
|
|
494
513
|
* ```ts
|
|
495
514
|
* function postGridEntityCustomUpdate(
|
|
@@ -511,8 +530,10 @@ export enum ModCallbackCustom {
|
|
|
511
530
|
* For grid entities created with `spawnCustomGridEntity`, use the `POST_GRID_ENTITY_CUSTOM_INIT`
|
|
512
531
|
* callback instead.
|
|
513
532
|
*
|
|
514
|
-
* When registering the callback, takes an optional second argument that will make the callback
|
|
515
|
-
*
|
|
533
|
+
* - When registering the callback, takes an optional second argument that will make the callback
|
|
534
|
+
* only fire if it matches the `GridEntityType` provided.
|
|
535
|
+
* - When registering the callback, takes an optional third argument that will make the callback
|
|
536
|
+
* only fire if it matches the variant provided.
|
|
516
537
|
*
|
|
517
538
|
* ```ts
|
|
518
539
|
* function postGridEntityInit(gridEntity: GridEntity): void {}
|
|
@@ -531,8 +552,10 @@ export enum ModCallbackCustom {
|
|
|
531
552
|
* For grid entities created with `spawnCustomGridEntity`, use the
|
|
532
553
|
* `POST_GRID_ENTITY_CUSTOM_REMOVE` callback instead.
|
|
533
554
|
*
|
|
534
|
-
* When registering the callback, takes an optional second argument that will make the callback
|
|
535
|
-
*
|
|
555
|
+
* - When registering the callback, takes an optional second argument that will make the callback
|
|
556
|
+
* only fire if it matches the `GridEntityType` provided.
|
|
557
|
+
* - When registering the callback, takes an optional third argument that will make the callback
|
|
558
|
+
* only fire if it matches the variant provided.
|
|
536
559
|
*
|
|
537
560
|
* ```ts
|
|
538
561
|
* function postGridEntityRemove(
|
|
@@ -546,14 +569,14 @@ export enum ModCallbackCustom {
|
|
|
546
569
|
/**
|
|
547
570
|
* Fires from the `POST_RENDER` callback on every frame that a grid entity exists.
|
|
548
571
|
*
|
|
572
|
+
* For grid entities created with `spawnCustomGridEntity`, use the
|
|
573
|
+
* `POST_GRID_ENTITY_CUSTOM_RENDER` callback instead.
|
|
574
|
+
*
|
|
549
575
|
* - When registering the callback, takes an optional second argument that will make the callback
|
|
550
576
|
* only fire if it matches the `GridEntityType` provided.
|
|
551
577
|
* - When registering the callback, takes an optional third argument that will make the callback
|
|
552
578
|
* only fire if it matches the variant provided.
|
|
553
579
|
*
|
|
554
|
-
* For grid entities created with `spawnCustomGridEntity`, use the
|
|
555
|
-
* `POST_GRID_ENTITY_CUSTOM_RENDER` callback instead.
|
|
556
|
-
*
|
|
557
580
|
* ```ts
|
|
558
581
|
* function postGridEntityRender(gridEntity: GridEntity): void {}
|
|
559
582
|
* ```
|
|
@@ -564,12 +587,14 @@ export enum ModCallbackCustom {
|
|
|
564
587
|
* Fires from the `POST_UPDATE` callback when a grid entity changes its state. (In this context,
|
|
565
588
|
* "state" refers to the `GridEntity.State` field.)
|
|
566
589
|
*
|
|
567
|
-
* When registering the callback, takes an optional second argument that will make the callback
|
|
568
|
-
* only fire if it matches the `GridEntityType` provided.
|
|
569
|
-
*
|
|
570
590
|
* For grid entities created with `spawnCustomGridEntity`, use the
|
|
571
591
|
* `POST_GRID_ENTITY_CUSTOM_STATE_CHANGED` callback instead.
|
|
572
592
|
*
|
|
593
|
+
* - When registering the callback, takes an optional second argument that will make the callback
|
|
594
|
+
* only fire if it matches the `GridEntityType` provided.
|
|
595
|
+
* - When registering the callback, takes an optional third argument that will make the callback
|
|
596
|
+
* only fire if it matches the variant provided.
|
|
597
|
+
*
|
|
573
598
|
* ```ts
|
|
574
599
|
* function postGridEntityStateChanged(
|
|
575
600
|
* gridEntity: GridEntity,
|
|
@@ -583,14 +608,14 @@ export enum ModCallbackCustom {
|
|
|
583
608
|
/**
|
|
584
609
|
* Fires from the `POST_UPDATE` callback on every frame that a grid entity exists.
|
|
585
610
|
*
|
|
611
|
+
* For grid entities created with `spawnCustomGridEntity`, use the
|
|
612
|
+
* `POST_GRID_ENTITY_CUSTOM_UPDATE` callback instead.
|
|
613
|
+
*
|
|
586
614
|
* - When registering the callback, takes an optional second argument that will make the callback
|
|
587
615
|
* only fire if it matches the `GridEntityType` provided.
|
|
588
616
|
* - When registering the callback, takes an optional third argument that will make the callback
|
|
589
617
|
* only fire if it matches the variant provided.
|
|
590
618
|
*
|
|
591
|
-
* For grid entities created with `spawnCustomGridEntity`, use the
|
|
592
|
-
* `POST_GRID_ENTITY_CUSTOM_UPDATE` callback instead.
|
|
593
|
-
*
|
|
594
619
|
* ```ts
|
|
595
620
|
* function postGridEntityUpdate(gridEntity: GridEntity): void {}
|
|
596
621
|
* ```
|
|
@@ -1251,7 +1276,8 @@ export enum ModCallbackCustom {
|
|
|
1251
1276
|
* certain conditions, like if the slot entity is playing the "Idle" animation, and so on.
|
|
1252
1277
|
*
|
|
1253
1278
|
* When registering the callback, takes an optional second argument that will make the callback
|
|
1254
|
-
* only fire if it matches the `SlotVariant` provided.
|
|
1279
|
+
* only fire if it matches the `SlotVariant` provided. (There is no need for any additional
|
|
1280
|
+
* arguments, since only players will cause this callback to fire.)
|
|
1255
1281
|
*
|
|
1256
1282
|
* ```ts
|
|
1257
1283
|
* function postSlotCollision(
|