isaacscript-common 1.0.468 → 1.0.472

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.
@@ -29,7 +29,7 @@ export declare function deployRandomJSONRoom(jsonRooms: JSONRoom[], seed?: numbe
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
31
  * projectiles (9), blacklisted NPCs such as Dark Esau, charmed NPCs, friendly NPCs, persistent
32
- * NPCs, doors, and walls.
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
@@ -1,7 +1,7 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  require("lualib_bundle");
3
3
  local ____exports = {}
4
- local postNewRoom, setDecorationsInvisible, respawnPersistentEntities, removeSpecificNPCs, fillRoomWithDecorations, spawnAllEntities, spawnGridEntity, spawnNormalEntity, storePersistentEntity, fixPitGraphics, getPitMap, getPitFrame, FEATURE_NAME, NPCS_TO_NOT_REMOVE, PERSISTENT_ENTITY_TYPES, initialized, v
4
+ local postNewRoom, setDecorationsInvisible, respawnPersistentEntities, removeSpecificNPCs, fillRoomWithDecorations, spawnAllEntities, spawnGridEntity, spawnNormalEntity, storePersistentEntity, fixPitGraphics, getPitMap, getPitFrame, FEATURE_NAME, NPC_TYPES_TO_NOT_REMOVE, PERSISTENT_ENTITY_TYPES, initialized, v
5
5
  local ____errors = require("errors")
6
6
  local getUpgradeErrorMsg = ____errors.getUpgradeErrorMsg
7
7
  local ____entity = require("functions.entity")
@@ -75,6 +75,8 @@ function ____exports.emptyRoom(self, fillWithDecorations)
75
75
  removeAllPickups(nil)
76
76
  removeAllMatchingEntities(nil, EntityType.ENTITY_SLOT)
77
77
  removeSpecificNPCs(nil)
78
+ removeAllMatchingEntities(nil, EntityType.ENTITY_EFFECT, EffectVariant.DEVIL)
79
+ removeAllMatchingEntities(nil, EntityType.ENTITY_EFFECT, EffectVariant.ANGEL)
78
80
  removeAllGridEntitiesExceptFor(nil, GridEntityType.GRID_WALL, GridEntityType.GRID_DOOR)
79
81
  setRoomCleared(nil)
80
82
  if fillWithDecorations then
@@ -88,7 +90,7 @@ function removeSpecificNPCs(self)
88
90
  getNPCs(nil)
89
91
  ) do
90
92
  do
91
- if NPCS_TO_NOT_REMOVE:has(npc.Type) then
93
+ if NPC_TYPES_TO_NOT_REMOVE:has(npc.Type) then
92
94
  goto __continue20
93
95
  end
94
96
  if (npc:HasEntityFlags(EntityFlag.FLAG_CHARM) or npc:HasEntityFlags(EntityFlag.FLAG_FRIENDLY)) or npc:HasEntityFlags(EntityFlag.FLAG_PERSISTENT) then
@@ -145,19 +147,23 @@ function spawnAllEntities(self, jsonRoom, seed)
145
147
  if y == nil then
146
148
  error("Failed to convert the following y coordinate to a number (for a spawn): " .. yString)
147
149
  end
148
- 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
149
155
  local entityType = tonumber(entityTypeString)
150
156
  if entityType == nil then
151
157
  error("Failed to convert the entity type to a number: " .. entityTypeString)
152
158
  end
153
- local variantString = spawn.entity["$"].variant
159
+ local variantString = xmlEntity["$"].variant
154
160
  local variant = tonumber(variantString)
155
161
  if variant == nil then
156
162
  error(
157
163
  "Failed to convert the entity variant to a number: " .. tostring(variant)
158
164
  )
159
165
  end
160
- local subTypeString = spawn.entity["$"].subtype
166
+ local subTypeString = xmlEntity["$"].subtype
161
167
  local subType = tonumber(subTypeString)
162
168
  if subType == nil then
163
169
  error(
@@ -344,7 +350,7 @@ function getPitFrame(self, L, R, U, D, UL, UR, DL, DR)
344
350
  return F
345
351
  end
346
352
  FEATURE_NAME = "JSON room deployer"
347
- NPCS_TO_NOT_REMOVE = __TS__New(Set, {EntityType.ENTITY_DARK_ESAU})
353
+ NPC_TYPES_TO_NOT_REMOVE = __TS__New(Set, {EntityType.ENTITY_DARK_ESAU})
348
354
  PERSISTENT_ENTITY_TYPES = __TS__New(Set, {EntityType.ENTITY_WALL_HUGGER})
349
355
  initialized = false
350
356
  v = {
@@ -1,5 +1,5 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  import { JSONRoom } from "../types/JSONRoom";
3
- export declare function getJSONRoomOfVariant(jsonRooms: JSONRoom[], variant: int): JSONRoom | null;
3
+ export declare function getJSONRoomOfVariant(jsonRooms: JSONRoom[], variant: int): JSONRoom | undefined;
4
4
  export declare function getJSONRoomsOfSubType(jsonRooms: JSONRoom[], subType: int): JSONRoom[];
5
5
  export declare function getRandomJSONRoom(jsonRooms: JSONRoom[], seed?: number): JSONRoom;
@@ -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.468",
3
+ "version": "1.0.472",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",