isaacscript-common 32.2.0 → 33.0.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/index.rollup.d.ts +7 -2
- package/dist/isaacscript-common.lua +20 -13
- package/dist/src/functions/gridEntities.d.ts +7 -2
- package/dist/src/functions/gridEntities.d.ts.map +1 -1
- package/dist/src/functions/gridEntities.lua +17 -5
- package/package.json +2 -2
- package/src/functions/gridEntities.ts +45 -12
package/dist/index.rollup.d.ts
CHANGED
|
@@ -5004,7 +5004,10 @@ export declare function getCollectibleTags(collectibleOrCollectibleType: EntityP
|
|
|
5004
5004
|
* Gets the entities that have a hitbox that overlaps with any part of the square that the grid
|
|
5005
5005
|
* entity is on.
|
|
5006
5006
|
*
|
|
5007
|
-
*
|
|
5007
|
+
* This function is useful because the vanilla collision callbacks do not work with grid entities.
|
|
5008
|
+
* This is used by `POST_GRID_ENTITY_COLLISION` custom callback.
|
|
5009
|
+
*
|
|
5010
|
+
* Note that this function will not work properly in the `POST_NEW_ROOM` callback since entities do
|
|
5008
5011
|
* not have collision yet in that callback.
|
|
5009
5012
|
*/
|
|
5010
5013
|
export declare function getCollidingEntitiesWithGridEntity(gridEntity: GridEntity): Entity[];
|
|
@@ -16566,8 +16569,10 @@ export declare function spawnFamiliarWithSeed(familiarVariant: FamiliarVariant,
|
|
|
16566
16569
|
/**
|
|
16567
16570
|
* Helper function to spawn a giant poop. This is performed by spawning each of the four quadrant
|
|
16568
16571
|
* grid entities in the appropriate positions.
|
|
16572
|
+
*
|
|
16573
|
+
* @returns Whether spawning the four quadrants was successful.
|
|
16569
16574
|
*/
|
|
16570
|
-
export declare function spawnGiantPoop(topLeftGridIndex: int):
|
|
16575
|
+
export declare function spawnGiantPoop(topLeftGridIndex: int): boolean;
|
|
16571
16576
|
|
|
16572
16577
|
/**
|
|
16573
16578
|
* Helper function to spawn a grid entity.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common
|
|
3
|
+
isaacscript-common 33.0.1
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -10081,14 +10081,14 @@ ____exports.PoopGridEntityVariant.BLACK = 5
|
|
|
10081
10081
|
____exports.PoopGridEntityVariant[____exports.PoopGridEntityVariant.BLACK] = "BLACK"
|
|
10082
10082
|
____exports.PoopGridEntityVariant.WHITE = 6
|
|
10083
10083
|
____exports.PoopGridEntityVariant[____exports.PoopGridEntityVariant.WHITE] = "WHITE"
|
|
10084
|
-
____exports.PoopGridEntityVariant.
|
|
10085
|
-
____exports.PoopGridEntityVariant[____exports.PoopGridEntityVariant.
|
|
10086
|
-
____exports.PoopGridEntityVariant.
|
|
10087
|
-
____exports.PoopGridEntityVariant[____exports.PoopGridEntityVariant.
|
|
10088
|
-
____exports.PoopGridEntityVariant.
|
|
10089
|
-
____exports.PoopGridEntityVariant[____exports.PoopGridEntityVariant.
|
|
10090
|
-
____exports.PoopGridEntityVariant.
|
|
10091
|
-
____exports.PoopGridEntityVariant[____exports.PoopGridEntityVariant.
|
|
10084
|
+
____exports.PoopGridEntityVariant.GIANT_TOP_LEFT = 7
|
|
10085
|
+
____exports.PoopGridEntityVariant[____exports.PoopGridEntityVariant.GIANT_TOP_LEFT] = "GIANT_TOP_LEFT"
|
|
10086
|
+
____exports.PoopGridEntityVariant.GIANT_TOP_RIGHT = 8
|
|
10087
|
+
____exports.PoopGridEntityVariant[____exports.PoopGridEntityVariant.GIANT_TOP_RIGHT] = "GIANT_TOP_RIGHT"
|
|
10088
|
+
____exports.PoopGridEntityVariant.GIANT_BOTTOM_LEFT = 9
|
|
10089
|
+
____exports.PoopGridEntityVariant[____exports.PoopGridEntityVariant.GIANT_BOTTOM_LEFT] = "GIANT_BOTTOM_LEFT"
|
|
10090
|
+
____exports.PoopGridEntityVariant.GIANT_BOTTOM_RIGHT = 10
|
|
10091
|
+
____exports.PoopGridEntityVariant[____exports.PoopGridEntityVariant.GIANT_BOTTOM_RIGHT] = "GIANT_BOTTOM_RIGHT"
|
|
10092
10092
|
____exports.PoopGridEntityVariant.CHARMING = 11
|
|
10093
10093
|
____exports.PoopGridEntityVariant[____exports.PoopGridEntityVariant.CHARMING] = "CHARMING"
|
|
10094
10094
|
--- For `GridEntityType.DOOR` (16).
|
|
@@ -28326,10 +28326,17 @@ function ____exports.spawnGiantPoop(self, topLeftGridIndex)
|
|
|
28326
28326
|
local topRightGridIndex = topLeftGridIndex + 1
|
|
28327
28327
|
local bottomLeftGridIndex = topLeftGridIndex + gridWidth
|
|
28328
28328
|
local bottomRightGridIndex = bottomLeftGridIndex + 1
|
|
28329
|
-
|
|
28330
|
-
|
|
28331
|
-
|
|
28332
|
-
|
|
28329
|
+
for ____, gridIndex in ipairs({topLeftGridIndex, topRightGridIndex, bottomLeftGridIndex, bottomRightGridIndex}) do
|
|
28330
|
+
local gridEntity = room:GetGridEntity(gridIndex)
|
|
28331
|
+
if gridEntity ~= nil then
|
|
28332
|
+
return false
|
|
28333
|
+
end
|
|
28334
|
+
end
|
|
28335
|
+
local topLeft = ____exports.spawnGridEntityWithVariant(nil, GridEntityType.POOP, PoopGridEntityVariant.GIANT_TOP_LEFT, topLeftGridIndex)
|
|
28336
|
+
local topRight = ____exports.spawnGridEntityWithVariant(nil, GridEntityType.POOP, PoopGridEntityVariant.GIANT_TOP_RIGHT, topRightGridIndex)
|
|
28337
|
+
local bottomLeft = ____exports.spawnGridEntityWithVariant(nil, GridEntityType.POOP, PoopGridEntityVariant.GIANT_BOTTOM_LEFT, bottomLeftGridIndex)
|
|
28338
|
+
local bottomRight = ____exports.spawnGridEntityWithVariant(nil, GridEntityType.POOP, PoopGridEntityVariant.GIANT_BOTTOM_RIGHT, bottomRightGridIndex)
|
|
28339
|
+
return topLeft ~= nil and topLeft:GetType() == GridEntityType.POOP and topLeft:GetVariant() == PoopGridEntityVariant.GIANT_TOP_LEFT and topRight ~= nil and topRight:GetType() == GridEntityType.POOP and topRight:GetVariant() == PoopGridEntityVariant.GIANT_TOP_RIGHT and bottomLeft ~= nil and bottomLeft:GetType() == GridEntityType.POOP and bottomLeft:GetVariant() == PoopGridEntityVariant.GIANT_BOTTOM_LEFT and bottomRight ~= nil and bottomRight:GetType() == GridEntityType.POOP and bottomRight:GetVariant() == PoopGridEntityVariant.GIANT_BOTTOM_RIGHT
|
|
28333
28340
|
end
|
|
28334
28341
|
function ____exports.spawnGridEntity(self, gridEntityType, gridIndexOrPosition)
|
|
28335
28342
|
return ____exports.spawnGridEntityWithVariant(nil, gridEntityType, 0, gridIndexOrPosition)
|
|
@@ -26,7 +26,10 @@ export declare function getAllGridIndexes(): int[];
|
|
|
26
26
|
* Gets the entities that have a hitbox that overlaps with any part of the square that the grid
|
|
27
27
|
* entity is on.
|
|
28
28
|
*
|
|
29
|
-
*
|
|
29
|
+
* This function is useful because the vanilla collision callbacks do not work with grid entities.
|
|
30
|
+
* This is used by `POST_GRID_ENTITY_COLLISION` custom callback.
|
|
31
|
+
*
|
|
32
|
+
* Note that this function will not work properly in the `POST_NEW_ROOM` callback since entities do
|
|
30
33
|
* not have collision yet in that callback.
|
|
31
34
|
*/
|
|
32
35
|
export declare function getCollidingEntitiesWithGridEntity(gridEntity: GridEntity): Entity[];
|
|
@@ -208,8 +211,10 @@ export declare function setGridEntityInvisible(gridEntity: GridEntity): void;
|
|
|
208
211
|
/**
|
|
209
212
|
* Helper function to spawn a giant poop. This is performed by spawning each of the four quadrant
|
|
210
213
|
* grid entities in the appropriate positions.
|
|
214
|
+
*
|
|
215
|
+
* @returns Whether spawning the four quadrants was successful.
|
|
211
216
|
*/
|
|
212
|
-
export declare function spawnGiantPoop(topLeftGridIndex: int):
|
|
217
|
+
export declare function spawnGiantPoop(topLeftGridIndex: int): boolean;
|
|
213
218
|
/**
|
|
214
219
|
* Helper function to spawn a grid entity.
|
|
215
220
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gridEntities.d.ts","sourceRoot":"","sources":["../../../src/functions/gridEntities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAGL,cAAc,EAIf,MAAM,8BAA8B,CAAC;AAUtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAgC1D;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,iBAAiB,EAAE,iBAAiB,EACpC,oBAAoB,EAAE,GAAG,GACxB,CAAC,cAAc,EAAE,GAAG,CAAC,GAAG,SAAS,CAqBnC;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,cAAc,EAAE,cAAc,EAC9B,OAAO,SAAK,GACX,OAAO,CAiBT;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,GAAG,EAAE,CAKzC;AAED
|
|
1
|
+
{"version":3,"file":"gridEntities.d.ts","sourceRoot":"","sources":["../../../src/functions/gridEntities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAGL,cAAc,EAIf,MAAM,8BAA8B,CAAC;AAUtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAgC1D;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,iBAAiB,EAAE,iBAAiB,EACpC,oBAAoB,EAAE,GAAG,GACxB,CAAC,cAAc,EAAE,GAAG,CAAC,GAAG,SAAS,CAqBnC;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,cAAc,EAAE,cAAc,EAC9B,OAAO,SAAK,GACX,OAAO,CAiBT;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,GAAG,EAAE,C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,EAAE,cAAc,EAC9B,mBAAmB,EAAE,GAAG,GAAG,MAAM,GAChC,UAAU,GAAG,SAAS,CAExB;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,GAAG,EACZ,mBAAmB,EAAE,GAAG,GAAG,MAAM,GAChC,UAAU,GAAG,SAAS,CAgCxB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,GAAG,GAAG,UAAU,GAAG,SAAS,CAkBtE"}
|
|
@@ -217,7 +217,10 @@ end
|
|
|
217
217
|
--- Gets the entities that have a hitbox that overlaps with any part of the square that the grid
|
|
218
218
|
-- entity is on.
|
|
219
219
|
--
|
|
220
|
-
--
|
|
220
|
+
-- This function is useful because the vanilla collision callbacks do not work with grid entities.
|
|
221
|
+
-- This is used by `POST_GRID_ENTITY_COLLISION` custom callback.
|
|
222
|
+
--
|
|
223
|
+
-- Note that this function will not work properly in the `POST_NEW_ROOM` callback since entities do
|
|
221
224
|
-- not have collision yet in that callback.
|
|
222
225
|
function ____exports.getCollidingEntitiesWithGridEntity(self, gridEntity)
|
|
223
226
|
local topLeft, bottomRight = table.unpack(____exports.getGridEntityCollisionPoints(nil, gridEntity))
|
|
@@ -555,16 +558,25 @@ function ____exports.setGridEntityInvisible(self, gridEntity)
|
|
|
555
558
|
end
|
|
556
559
|
--- Helper function to spawn a giant poop. This is performed by spawning each of the four quadrant
|
|
557
560
|
-- grid entities in the appropriate positions.
|
|
561
|
+
--
|
|
562
|
+
-- @returns Whether spawning the four quadrants was successful.
|
|
558
563
|
function ____exports.spawnGiantPoop(self, topLeftGridIndex)
|
|
559
564
|
local room = game:GetRoom()
|
|
560
565
|
local gridWidth = room:GetGridWidth()
|
|
561
566
|
local topRightGridIndex = topLeftGridIndex + 1
|
|
562
567
|
local bottomLeftGridIndex = topLeftGridIndex + gridWidth
|
|
563
568
|
local bottomRightGridIndex = bottomLeftGridIndex + 1
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
569
|
+
for ____, gridIndex in ipairs({topLeftGridIndex, topRightGridIndex, bottomLeftGridIndex, bottomRightGridIndex}) do
|
|
570
|
+
local gridEntity = room:GetGridEntity(gridIndex)
|
|
571
|
+
if gridEntity ~= nil then
|
|
572
|
+
return false
|
|
573
|
+
end
|
|
574
|
+
end
|
|
575
|
+
local topLeft = ____exports.spawnGridEntityWithVariant(nil, GridEntityType.POOP, PoopGridEntityVariant.GIANT_TOP_LEFT, topLeftGridIndex)
|
|
576
|
+
local topRight = ____exports.spawnGridEntityWithVariant(nil, GridEntityType.POOP, PoopGridEntityVariant.GIANT_TOP_RIGHT, topRightGridIndex)
|
|
577
|
+
local bottomLeft = ____exports.spawnGridEntityWithVariant(nil, GridEntityType.POOP, PoopGridEntityVariant.GIANT_BOTTOM_LEFT, bottomLeftGridIndex)
|
|
578
|
+
local bottomRight = ____exports.spawnGridEntityWithVariant(nil, GridEntityType.POOP, PoopGridEntityVariant.GIANT_BOTTOM_RIGHT, bottomRightGridIndex)
|
|
579
|
+
return topLeft ~= nil and topLeft:GetType() == GridEntityType.POOP and topLeft:GetVariant() == PoopGridEntityVariant.GIANT_TOP_LEFT and topRight ~= nil and topRight:GetType() == GridEntityType.POOP and topRight:GetVariant() == PoopGridEntityVariant.GIANT_TOP_RIGHT and bottomLeft ~= nil and bottomLeft:GetType() == GridEntityType.POOP and bottomLeft:GetVariant() == PoopGridEntityVariant.GIANT_BOTTOM_LEFT and bottomRight ~= nil and bottomRight:GetType() == GridEntityType.POOP and bottomRight:GetVariant() == PoopGridEntityVariant.GIANT_BOTTOM_RIGHT
|
|
568
580
|
end
|
|
569
581
|
--- Helper function to spawn a grid entity.
|
|
570
582
|
--
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "33.0.1",
|
|
4
4
|
"description": "Helper functions and features for IsaacScript mods.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -25,6 +25,6 @@
|
|
|
25
25
|
"main": "dist/src/index",
|
|
26
26
|
"types": "dist/index.rollup.d.ts",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"isaac-typescript-definitions": "^
|
|
28
|
+
"isaac-typescript-definitions": "^16.0.0"
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -125,7 +125,10 @@ export function getAllGridIndexes(): int[] {
|
|
|
125
125
|
* Gets the entities that have a hitbox that overlaps with any part of the square that the grid
|
|
126
126
|
* entity is on.
|
|
127
127
|
*
|
|
128
|
-
*
|
|
128
|
+
* This function is useful because the vanilla collision callbacks do not work with grid entities.
|
|
129
|
+
* This is used by `POST_GRID_ENTITY_COLLISION` custom callback.
|
|
130
|
+
*
|
|
131
|
+
* Note that this function will not work properly in the `POST_NEW_ROOM` callback since entities do
|
|
129
132
|
* not have collision yet in that callback.
|
|
130
133
|
*/
|
|
131
134
|
export function getCollidingEntitiesWithGridEntity(
|
|
@@ -681,8 +684,10 @@ export function setGridEntityInvisible(gridEntity: GridEntity): void {
|
|
|
681
684
|
/**
|
|
682
685
|
* Helper function to spawn a giant poop. This is performed by spawning each of the four quadrant
|
|
683
686
|
* grid entities in the appropriate positions.
|
|
687
|
+
*
|
|
688
|
+
* @returns Whether spawning the four quadrants was successful.
|
|
684
689
|
*/
|
|
685
|
-
export function spawnGiantPoop(topLeftGridIndex: int):
|
|
690
|
+
export function spawnGiantPoop(topLeftGridIndex: int): boolean {
|
|
686
691
|
const room = game.GetRoom();
|
|
687
692
|
const gridWidth = room.GetGridWidth();
|
|
688
693
|
|
|
@@ -690,26 +695,54 @@ export function spawnGiantPoop(topLeftGridIndex: int): void {
|
|
|
690
695
|
const bottomLeftGridIndex = topLeftGridIndex + gridWidth;
|
|
691
696
|
const bottomRightGridIndex = bottomLeftGridIndex + 1;
|
|
692
697
|
|
|
693
|
-
|
|
698
|
+
// First, check to see if all of the tiles are open.
|
|
699
|
+
for (const gridIndex of [
|
|
700
|
+
topLeftGridIndex,
|
|
701
|
+
topRightGridIndex,
|
|
702
|
+
bottomLeftGridIndex,
|
|
703
|
+
bottomRightGridIndex,
|
|
704
|
+
]) {
|
|
705
|
+
const gridEntity = room.GetGridEntity(gridIndex);
|
|
706
|
+
if (gridEntity !== undefined) {
|
|
707
|
+
return false;
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
const topLeft = spawnGridEntityWithVariant(
|
|
694
712
|
GridEntityType.POOP,
|
|
695
|
-
PoopGridEntityVariant.
|
|
713
|
+
PoopGridEntityVariant.GIANT_TOP_LEFT,
|
|
696
714
|
topLeftGridIndex,
|
|
697
715
|
);
|
|
698
|
-
spawnGridEntityWithVariant(
|
|
716
|
+
const topRight = spawnGridEntityWithVariant(
|
|
699
717
|
GridEntityType.POOP,
|
|
700
|
-
PoopGridEntityVariant.
|
|
718
|
+
PoopGridEntityVariant.GIANT_TOP_RIGHT,
|
|
701
719
|
topRightGridIndex,
|
|
702
720
|
);
|
|
703
|
-
spawnGridEntityWithVariant(
|
|
721
|
+
const bottomLeft = spawnGridEntityWithVariant(
|
|
704
722
|
GridEntityType.POOP,
|
|
705
|
-
PoopGridEntityVariant.
|
|
723
|
+
PoopGridEntityVariant.GIANT_BOTTOM_LEFT,
|
|
706
724
|
bottomLeftGridIndex,
|
|
707
725
|
);
|
|
708
|
-
spawnGridEntityWithVariant(
|
|
726
|
+
const bottomRight = spawnGridEntityWithVariant(
|
|
709
727
|
GridEntityType.POOP,
|
|
710
|
-
PoopGridEntityVariant.
|
|
728
|
+
PoopGridEntityVariant.GIANT_BOTTOM_RIGHT,
|
|
711
729
|
bottomRightGridIndex,
|
|
712
730
|
);
|
|
731
|
+
|
|
732
|
+
return (
|
|
733
|
+
topLeft !== undefined &&
|
|
734
|
+
topLeft.GetType() === GridEntityType.POOP &&
|
|
735
|
+
topLeft.GetVariant() === PoopGridEntityVariant.GIANT_TOP_LEFT &&
|
|
736
|
+
topRight !== undefined &&
|
|
737
|
+
topRight.GetType() === GridEntityType.POOP &&
|
|
738
|
+
topRight.GetVariant() === PoopGridEntityVariant.GIANT_TOP_RIGHT &&
|
|
739
|
+
bottomLeft !== undefined &&
|
|
740
|
+
bottomLeft.GetType() === GridEntityType.POOP &&
|
|
741
|
+
bottomLeft.GetVariant() === PoopGridEntityVariant.GIANT_BOTTOM_LEFT &&
|
|
742
|
+
bottomRight !== undefined &&
|
|
743
|
+
bottomRight.GetType() === GridEntityType.POOP &&
|
|
744
|
+
bottomRight.GetVariant() === PoopGridEntityVariant.GIANT_BOTTOM_RIGHT
|
|
745
|
+
);
|
|
713
746
|
}
|
|
714
747
|
|
|
715
748
|
/**
|
|
@@ -761,14 +794,14 @@ export function spawnGridEntityWithVariant(
|
|
|
761
794
|
}
|
|
762
795
|
|
|
763
796
|
if (gridEntityType === GridEntityType.PIT) {
|
|
764
|
-
// For some reason, spawned pits start with a collision class of NONE
|
|
797
|
+
// For some reason, spawned pits start with a collision class of `NONE`, so we have to manually
|
|
765
798
|
// set it.
|
|
766
799
|
const pit = gridEntity.ToPit();
|
|
767
800
|
if (pit !== undefined) {
|
|
768
801
|
pit.UpdateCollision();
|
|
769
802
|
}
|
|
770
803
|
} else if (gridEntityType === GridEntityType.WALL) {
|
|
771
|
-
// For some reason, spawned walls start with a collision class of NONE
|
|
804
|
+
// For some reason, spawned walls start with a collision class of `NONE`, so we have to manually
|
|
772
805
|
// set it.
|
|
773
806
|
gridEntity.CollisionClass = GridCollisionClass.WALL;
|
|
774
807
|
}
|