isaacscript-common 1.0.584 → 1.0.588
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.
|
@@ -93,6 +93,29 @@ export declare function removeGridEntity(gridEntity: GridEntity, updateRoom?: bo
|
|
|
93
93
|
* For more information, see the documentation for the `clearSprite()` helper function.
|
|
94
94
|
*/
|
|
95
95
|
export declare function setGridEntityInvisible(gridEntity: GridEntity): void;
|
|
96
|
+
/**
|
|
97
|
+
* Helper function to spawn a giant poop. This is performed by spawning each of the four quadrant
|
|
98
|
+
* grid entities in the appropriate positions.
|
|
99
|
+
*/
|
|
96
100
|
export declare function spawnGiantPoop(topLeftGridIndex: int): void;
|
|
101
|
+
/**
|
|
102
|
+
* Helper function to spawn a grid entity. This function assumes you want to give the grid entity a
|
|
103
|
+
* variant of 0. Use this instead of the `Isaac.GridSpawn()` method since it:
|
|
104
|
+
* - handles giving pits collision
|
|
105
|
+
* - removes existing grid entities on the same tile, if any
|
|
106
|
+
* - allows you to specify the grid index instead of the position
|
|
107
|
+
*/
|
|
97
108
|
export declare function spawnGridEntity(gridEntityType: GridEntityType, gridIndex: int): GridEntity;
|
|
109
|
+
/**
|
|
110
|
+
* Helper function to spawn a grid entity with a specific variant. Use this instead of the
|
|
111
|
+
* `Isaac.GridSpawn()` method since it:
|
|
112
|
+
* - handles giving pits collision
|
|
113
|
+
* - removes existing grid entities on the same tile, if any
|
|
114
|
+
* - allows you to specify the grid index instead of the position
|
|
115
|
+
*/
|
|
98
116
|
export declare function spawnGridEntityWithVariant(gridEntityType: GridEntityType, variant: int, gridIndex: int): GridEntity;
|
|
117
|
+
/**
|
|
118
|
+
* Helper function to spawn a Void Portal. This is more complicated than simply spawning a trapdoor
|
|
119
|
+
* with the appropriate variant, as the game does not give it the correct sprite automatically.
|
|
120
|
+
*/
|
|
121
|
+
export declare function spawnVoidPortal(gridIndex: int): void;
|
|
@@ -32,6 +32,10 @@ end
|
|
|
32
32
|
function ____exports.spawnGridEntityWithVariant(self, gridEntityType, variant, gridIndex)
|
|
33
33
|
local game = Game()
|
|
34
34
|
local room = game:GetRoom()
|
|
35
|
+
local existingGridEntity = room:GetGridEntity(gridIndex)
|
|
36
|
+
if existingGridEntity ~= nil then
|
|
37
|
+
____exports.removeGridEntity(nil, existingGridEntity)
|
|
38
|
+
end
|
|
35
39
|
local position = room:GetGridPosition(gridIndex)
|
|
36
40
|
local gridEntity = Isaac.GridSpawn(gridEntityType, variant, position, true)
|
|
37
41
|
if gridEntityType == GridEntityType.GRID_PIT then
|
|
@@ -183,4 +187,10 @@ end
|
|
|
183
187
|
function ____exports.spawnGridEntity(self, gridEntityType, gridIndex)
|
|
184
188
|
return ____exports.spawnGridEntityWithVariant(nil, gridEntityType, 0, gridIndex)
|
|
185
189
|
end
|
|
190
|
+
function ____exports.spawnVoidPortal(self, gridIndex)
|
|
191
|
+
local voidPortal = ____exports.spawnGridEntityWithVariant(nil, GridEntityType.GRID_TRAPDOOR, 1, gridIndex)
|
|
192
|
+
voidPortal.VarData = 1
|
|
193
|
+
local sprite = voidPortal:GetSprite()
|
|
194
|
+
sprite:Load("gfx/grid/voidtrapdoor.anm2", true)
|
|
195
|
+
end
|
|
186
196
|
return ____exports
|
|
@@ -5,5 +5,9 @@
|
|
|
5
5
|
* with heaven doors and partially overlap with players, if the thing being spawned is bigger than a
|
|
6
6
|
* tile (like a Blood Donation Machine). Use this function instead if you want to account for those
|
|
7
7
|
* specific situations.
|
|
8
|
+
*
|
|
9
|
+
* @param startingPosition The position to start searching from. If this position is not overlapping
|
|
10
|
+
* with anything, then it will be returned.
|
|
11
|
+
* @param avoidActiveEntities Optional. False by default.
|
|
8
12
|
*/
|
|
9
|
-
export declare function findFreePosition(startingPosition: Vector): Vector;
|
|
13
|
+
export declare function findFreePosition(startingPosition: Vector, avoidActiveEntities?: boolean): Vector;
|
|
@@ -7,7 +7,10 @@ local anyEntityCloserThan = ____entity.anyEntityCloserThan
|
|
|
7
7
|
local getEffects = ____entity.getEffects
|
|
8
8
|
local ____player = require("functions.player")
|
|
9
9
|
local getPlayerCloserThan = ____player.getPlayerCloserThan
|
|
10
|
-
function ____exports.findFreePosition(self, startingPosition)
|
|
10
|
+
function ____exports.findFreePosition(self, startingPosition, avoidActiveEntities)
|
|
11
|
+
if avoidActiveEntities == nil then
|
|
12
|
+
avoidActiveEntities = false
|
|
13
|
+
end
|
|
11
14
|
local game = Game()
|
|
12
15
|
local room = game:GetRoom()
|
|
13
16
|
local heavenDoors = getEffects(nil, EffectVariant.HEAVEN_LIGHT_DOOR, 0)
|
|
@@ -15,7 +18,7 @@ function ____exports.findFreePosition(self, startingPosition)
|
|
|
15
18
|
local i = 0
|
|
16
19
|
while i < 100 do
|
|
17
20
|
do
|
|
18
|
-
local position = room:FindFreePickupSpawnPosition(startingPosition, i)
|
|
21
|
+
local position = room:FindFreePickupSpawnPosition(startingPosition, i, avoidActiveEntities)
|
|
19
22
|
local closePlayer = getPlayerCloserThan(nil, position, DISTANCE_OF_GRID_TILE)
|
|
20
23
|
if closePlayer ~= nil then
|
|
21
24
|
goto __continue3
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.588",
|
|
4
4
|
"description": "Helper functions for IsaacScript mods",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dist/**/*.d.ts"
|
|
26
26
|
],
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"isaac-typescript-definitions": "^1.0.
|
|
28
|
+
"isaac-typescript-definitions": "^1.0.329",
|
|
29
29
|
"isaacscript-lint": "^1.0.77",
|
|
30
30
|
"typedoc": "^0.22.10",
|
|
31
31
|
"typescript": "^4.5.4",
|