isaacscript-common 1.0.546 → 1.0.547

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.
@@ -90,7 +90,7 @@ export declare function removeGridEntity(gridEntity: GridEntity, updateRoom?: bo
90
90
  * Helper function to make a grid entity invisible. This is accomplished by setting its sprite to
91
91
  * an empty/missing PNG file.
92
92
  *
93
- * For more information, see the documentation for the "EMPTY_PNG_FILENAME" constant.
93
+ * For more information, see the documentation for the `clearSprite()` helper function.
94
94
  */
95
95
  export declare function setGridEntityInvisible(gridEntity: GridEntity): void;
96
96
  export declare function spawnGiantPoop(topLeftGridIndex: int): void;
@@ -1,8 +1,8 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  require("lualib_bundle");
3
3
  local ____exports = {}
4
- local ____constants = require("constants")
5
- local EMPTY_PNG_PATH = ____constants.EMPTY_PNG_PATH
4
+ local _____2E_2E = require("index")
5
+ local clearSprite = _____2E_2E.clearSprite
6
6
  local ____gridEntityXMLMap = require("maps.gridEntityXMLMap")
7
7
  local GRID_ENTITY_XML_MAP = ____gridEntityXMLMap.GRID_ENTITY_XML_MAP
8
8
  local ____roomShapeToTopLeftWallGridIndexMap = require("maps.roomShapeToTopLeftWallGridIndexMap")
@@ -161,15 +161,7 @@ function ____exports.removeAllMatchingGridEntities(self, ...)
161
161
  end
162
162
  function ____exports.setGridEntityInvisible(self, gridEntity)
163
163
  local sprite = gridEntity:GetSprite()
164
- local numLayers = sprite:GetLayerCount()
165
- do
166
- local i = 0
167
- while i < numLayers do
168
- sprite:ReplaceSpritesheet(i, EMPTY_PNG_PATH)
169
- i = i + 1
170
- end
171
- end
172
- sprite:LoadGraphics()
164
+ clearSprite(nil, sprite)
173
165
  end
174
166
  function ____exports.spawnGiantPoop(self, topLeftGridIndex)
175
167
  local game = Game()
@@ -1,7 +1,7 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  /**
3
3
  * Helper function to clear a specific layer from a sprite. This function is variadic, so pass as
4
- * many layer IDs as you want to clear.
4
+ * many layer IDs as you want to clear. If no specific layers are passed, it will clear every layer.
5
5
  *
6
6
  * Since there is no official API method to "clear" a sprite, we can work around it by setting the
7
7
  * spritesheet to a non-existent or completely transparent file. If the path to the spritesheet does
@@ -1,9 +1,21 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ require("lualib_bundle");
2
3
  local ____exports = {}
3
4
  local ____constants = require("constants")
4
5
  local EMPTY_PNG_PATH = ____constants.EMPTY_PNG_PATH
5
6
  function ____exports.clearSprite(self, sprite, ...)
6
7
  local layerIDs = {...}
8
+ if #layerIDs == 0 then
9
+ layerIDs = {}
10
+ local numLayers = sprite:GetLayerCount()
11
+ do
12
+ local i = 0
13
+ while i < numLayers do
14
+ __TS__ArrayPush(layerIDs, i)
15
+ i = i + 1
16
+ end
17
+ end
18
+ end
7
19
  for ____, layerID in ipairs(layerIDs) do
8
20
  sprite:ReplaceSpritesheet(layerID, EMPTY_PNG_PATH)
9
21
  end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.0.546",
3
+ "version": "1.0.547",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",