isaacscript-common 1.0.465 → 1.0.469

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, 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,7 @@ function ____exports.emptyRoom(self, fillWithDecorations)
74
75
  removeAllPickups(nil)
75
76
  removeAllMatchingEntities(nil, EntityType.ENTITY_SLOT)
76
77
  removeSpecificNPCs(nil)
78
+ removeAllGridEntitiesExceptFor(nil, GridEntityType.GRID_WALL, GridEntityType.GRID_DOOR)
77
79
  setRoomCleared(nil)
78
80
  if fillWithDecorations then
79
81
  fillRoomWithDecorations(nil)
@@ -143,19 +145,23 @@ function spawnAllEntities(self, jsonRoom, seed)
143
145
  if y == nil then
144
146
  error("Failed to convert the following y coordinate to a number (for a spawn): " .. yString)
145
147
  end
146
- local entityTypeString = spawn.entity["$"].type
148
+ if #spawn.entity > 1 then
149
+ error("Stacked entities are not implemented for JSON rooms.")
150
+ end
151
+ local xmlEntity = spawn.entity[1]
152
+ local entityTypeString = xmlEntity["$"].type
147
153
  local entityType = tonumber(entityTypeString)
148
154
  if entityType == nil then
149
155
  error("Failed to convert the entity type to a number: " .. entityTypeString)
150
156
  end
151
- local variantString = spawn.entity["$"].variant
157
+ local variantString = xmlEntity["$"].variant
152
158
  local variant = tonumber(variantString)
153
159
  if variant == nil then
154
160
  error(
155
161
  "Failed to convert the entity variant to a number: " .. tostring(variant)
156
162
  )
157
163
  end
158
- local subTypeString = spawn.entity["$"].subtype
164
+ local subTypeString = xmlEntity["$"].subtype
159
165
  local subType = tonumber(subTypeString)
160
166
  if subType == nil then
161
167
  error(
@@ -34,6 +34,11 @@ export declare function isGlitchedCollectible(entity: Entity): boolean;
34
34
  export declare function isPassiveCollectible(collectibleType: CollectibleType | int): boolean;
35
35
  export declare function isQuestCollectible(collectibleType: CollectibleType | int): boolean;
36
36
  export declare function removeAllCollectibles(): void;
37
+ /**
38
+ * Helper function to remove all pickup delay on a collectible. By default, collectibles have a 20
39
+ * frame delay before they can be picked up by a player.
40
+ */
41
+ export declare function removeCollectiblePickupDelay(collectible: EntityPickup): void;
37
42
  /**
38
43
  * Helper function to put a message in the log.txt file to let the Rebirth Item Tracker know that it
39
44
  * should remove an item.
@@ -115,6 +115,14 @@ end
115
115
  function ____exports.removeAllCollectibles(self)
116
116
  removeAllMatchingEntities(nil, EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE)
117
117
  end
118
+ function ____exports.removeCollectiblePickupDelay(self, collectible)
119
+ if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
120
+ error(
121
+ "You cannot remove pickup delay for pickups of variant: " .. tostring(collectible.Variant)
122
+ )
123
+ end
124
+ collectible.Wait = 0
125
+ end
118
126
  function ____exports.removeCollectibleFromItemTracker(self, collectibleType)
119
127
  local collectibleName = ____exports.getCollectibleName(nil, collectibleType)
120
128
  Isaac.DebugString(
@@ -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.465",
3
+ "version": "1.0.469",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",