isaacscript-common 1.0.585 → 1.0.589

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
@@ -39,6 +43,8 @@ function ____exports.spawnGridEntityWithVariant(self, gridEntityType, variant, g
39
43
  if pit ~= nil then
40
44
  pit:UpdateCollision()
41
45
  end
46
+ elseif gridEntityType == GridEntityType.GRID_WALL then
47
+ gridEntity.CollisionClass = GridCollisionClass.COLLISION_WALL
42
48
  end
43
49
  return gridEntity
44
50
  end
@@ -183,4 +189,10 @@ end
183
189
  function ____exports.spawnGridEntity(self, gridEntityType, gridIndex)
184
190
  return ____exports.spawnGridEntityWithVariant(nil, gridEntityType, 0, gridIndex)
185
191
  end
192
+ function ____exports.spawnVoidPortal(self, gridIndex)
193
+ local voidPortal = ____exports.spawnGridEntityWithVariant(nil, GridEntityType.GRID_TRAPDOOR, 1, gridIndex)
194
+ voidPortal.VarData = 1
195
+ local sprite = voidPortal:GetSprite()
196
+ sprite:Load("gfx/grid/voidtrapdoor.anm2", true)
197
+ end
186
198
  return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.0.585",
3
+ "version": "1.0.589",
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.327",
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",