isaacscript-common 1.0.467 → 1.0.471

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.
@@ -28,8 +28,8 @@ export declare function deployRandomJSONRoom(jsonRooms: JSONRoom[], seed?: numbe
28
28
  /**
29
29
  * Helper function to remove all naturally spawning entities and grid entities from a room. Notably,
30
30
  * this will not remove players (1), tears (2), familiars (3), lasers (7), knives (8),
31
- * projectiles (9), blacklisted NPCs such as Dark Esau, charmed NPCs, friendly NPCs, and persistent
32
- * NPCs.
31
+ * projectiles (9), blacklisted NPCs such as Dark Esau, charmed NPCs, friendly NPCs, persistent
32
+ * NPCs, most effects (1000), doors, and walls.
33
33
  *
34
34
  * @param fillWithDecorations Optional. Set to true to fill every grid tile with an invisible
35
35
  * decoration, which prevents vanilla entities in the room from respawning the next time that the
@@ -11,6 +11,7 @@ local removeAllPickups = ____entity.removeAllPickups
11
11
  local ____gridEntity = require("functions.gridEntity")
12
12
  local convertXMLGridEntityType = ____gridEntity.convertXMLGridEntityType
13
13
  local getGridEntities = ____gridEntity.getGridEntities
14
+ local removeAllGridEntitiesExceptFor = ____gridEntity.removeAllGridEntitiesExceptFor
14
15
  local setGridEntityInvisible = ____gridEntity.setGridEntityInvisible
15
16
  local ____jsonRoom = require("functions.jsonRoom")
16
17
  local getRandomJSONRoom = ____jsonRoom.getRandomJSONRoom
@@ -74,6 +75,9 @@ function ____exports.emptyRoom(self, fillWithDecorations)
74
75
  removeAllPickups(nil)
75
76
  removeAllMatchingEntities(nil, EntityType.ENTITY_SLOT)
76
77
  removeSpecificNPCs(nil)
78
+ removeAllMatchingEntities(nil, EntityType.ENTITY_EFFECT, EffectVariant.DEVIL)
79
+ removeAllMatchingEntities(nil, EntityType.ENTITY_EFFECT, EffectVariant.ANGEL)
80
+ removeAllGridEntitiesExceptFor(nil, GridEntityType.GRID_WALL, GridEntityType.GRID_DOOR)
77
81
  setRoomCleared(nil)
78
82
  if fillWithDecorations then
79
83
  fillRoomWithDecorations(nil)
@@ -143,19 +147,23 @@ function spawnAllEntities(self, jsonRoom, seed)
143
147
  if y == nil then
144
148
  error("Failed to convert the following y coordinate to a number (for a spawn): " .. yString)
145
149
  end
146
- local entityTypeString = spawn.entity["$"].type
150
+ if #spawn.entity > 1 then
151
+ error("Stacked entities are not implemented for JSON rooms.")
152
+ end
153
+ local xmlEntity = spawn.entity[1]
154
+ local entityTypeString = xmlEntity["$"].type
147
155
  local entityType = tonumber(entityTypeString)
148
156
  if entityType == nil then
149
157
  error("Failed to convert the entity type to a number: " .. entityTypeString)
150
158
  end
151
- local variantString = spawn.entity["$"].variant
159
+ local variantString = xmlEntity["$"].variant
152
160
  local variant = tonumber(variantString)
153
161
  if variant == nil then
154
162
  error(
155
163
  "Failed to convert the entity variant to a number: " .. tostring(variant)
156
164
  )
157
165
  end
158
- local subTypeString = spawn.entity["$"].subtype
166
+ local subTypeString = xmlEntity["$"].subtype
159
167
  local subType = tonumber(subTypeString)
160
168
  if subType == nil then
161
169
  error(
@@ -6,5 +6,5 @@ export interface JSONSpawn {
6
6
  /** Needs to be converted to an int. */
7
7
  y: string;
8
8
  };
9
- entity: JSONEntity;
9
+ entity: JSONEntity[];
10
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.0.467",
3
+ "version": "1.0.471",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",