isaacscript-common 21.8.4 → 21.9.0

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.
@@ -1292,6 +1292,16 @@ export declare function clearCollectibleSprite(collectible: EntityPickup): void;
1292
1292
  */
1293
1293
  export declare function clearFloorDisplayFlags(): void;
1294
1294
 
1295
+ /**
1296
+ * Helper function to set the value of `DisplayFlag` for a room 0.
1297
+ *
1298
+ * This function automatically accounts for whether or not MinimapAPI is being used.
1299
+ *
1300
+ * This function automatically calls the `Level.UpdateVisibility` after setting the flags so that
1301
+ * the changes will be immediately visible.
1302
+ */
1303
+ export declare function clearRoomDisplayFlags(roomGridIndex: int): void;
1304
+
1295
1305
  /**
1296
1306
  * Helper function to clear all layers or specific layers from a sprite without unloading the
1297
1307
  * attached anm2 file.
@@ -14377,16 +14387,6 @@ export declare function setRoomDisplayFlags(roomGridIndex: int | undefined, disp
14377
14387
  */
14378
14388
  export declare function setRoomUncleared(): void;
14379
14389
 
14380
- /**
14381
- * Helper function to make a single room visible in a similar way to how the Compass makes a Boss
14382
- * Room visible (e.g. by adding `DisplayFlag.SHOW_ICON`).
14383
- *
14384
- * @param roomGridIndex Set to undefined to use the current room index.
14385
- * @param updateVisibility Optional. Whether to call the `Level.UpdateVisibility` method in order to
14386
- * make the changes immediately visible. Default is true.
14387
- */
14388
- export declare function setRoomVisible(roomGridIndex: int | undefined, updateVisibility?: boolean): void;
14389
-
14390
14390
  /** Helper function to set a seed to an RNG object using Blade's recommended shift index. */
14391
14391
  export declare function setSeed(rng: RNG, seed: Seed): void;
14392
14392
 
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 21.8.4
3
+ isaacscript-common 21.9.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -51536,7 +51536,6 @@ local __TS__New = ____lualib.__TS__New
51536
51536
  local __TS__Iterator = ____lualib.__TS__Iterator
51537
51537
  local ____exports = {}
51538
51538
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
51539
- local DisplayFlag = ____isaac_2Dtypescript_2Ddefinitions.DisplayFlag
51540
51539
  local DisplayFlagZero = ____isaac_2Dtypescript_2Ddefinitions.DisplayFlagZero
51541
51540
  local ____cachedClasses = require("src.core.cachedClasses")
51542
51541
  local game = ____cachedClasses.game
@@ -51587,9 +51586,15 @@ function ____exports.setRoomDisplayFlags(self, roomGridIndex, displayFlags, upda
51587
51586
  else
51588
51587
  local minimapAPIRoomDescriptor = MinimapAPI:GetRoomByIdx(roomGridIndex)
51589
51588
  if minimapAPIRoomDescriptor == nil then
51589
+ if displayFlags == DisplayFlagZero then
51590
+ return
51591
+ end
51590
51592
  error("Failed to get the MinimapAPI room descriptor for the room at index: " .. tostring(roomGridIndex))
51591
51593
  end
51592
51594
  minimapAPIRoomDescriptor:SetDisplayFlags(displayFlags)
51595
+ if displayFlags == DisplayFlagZero then
51596
+ minimapAPIRoomDescriptor:Remove()
51597
+ end
51593
51598
  end
51594
51599
  end
51595
51600
  function ____exports.addRoomDisplayFlag(self, roomGridIndex, displayFlag, updateVisibility)
@@ -51603,6 +51608,9 @@ end
51603
51608
  function ____exports.clearFloorDisplayFlags(self)
51604
51609
  ____exports.setAllDisplayFlags(nil, DisplayFlagZero)
51605
51610
  end
51611
+ function ____exports.clearRoomDisplayFlags(self, roomGridIndex)
51612
+ ____exports.setRoomDisplayFlags(nil, roomGridIndex, DisplayFlagZero)
51613
+ end
51606
51614
  function ____exports.getFloorDisplayFlags(self)
51607
51615
  local displayFlagsMap = __TS__New(Map)
51608
51616
  for ____, roomDescriptor in ipairs(getRoomsInsideGrid(nil)) do
@@ -51623,12 +51631,6 @@ function ____exports.setFloorDisplayFlags(self, displayFlagsMap)
51623
51631
  level:UpdateVisibility()
51624
51632
  end
51625
51633
  end
51626
- function ____exports.setRoomVisible(self, roomGridIndex, updateVisibility)
51627
- if updateVisibility == nil then
51628
- updateVisibility = true
51629
- end
51630
- ____exports.addRoomDisplayFlag(nil, roomGridIndex, DisplayFlag.SHOW_ICON, updateVisibility)
51631
- end
51632
51634
  return ____exports
51633
51635
  end,
51634
51636
  ["src.functions.modFeatures"] = function(...)
@@ -20,6 +20,15 @@ export declare function addRoomDisplayFlag(roomGridIndex: int | undefined, displ
20
20
  * the changes will be immediately visible.
21
21
  */
22
22
  export declare function clearFloorDisplayFlags(): void;
23
+ /**
24
+ * Helper function to set the value of `DisplayFlag` for a room 0.
25
+ *
26
+ * This function automatically accounts for whether or not MinimapAPI is being used.
27
+ *
28
+ * This function automatically calls the `Level.UpdateVisibility` after setting the flags so that
29
+ * the changes will be immediately visible.
30
+ */
31
+ export declare function clearRoomDisplayFlags(roomGridIndex: int): void;
23
32
  /**
24
33
  * Helper function to get the minimap `DisplayFlag` value for every room on the floor. Returns a map
25
34
  * that is indexed by the room's safe grid index.
@@ -70,13 +79,4 @@ export declare function setFloorDisplayFlags(displayFlagsMap: Map<int, BitFlags<
70
79
  * the `Level.UpdateVisibility` method after you are done.
71
80
  */
72
81
  export declare function setRoomDisplayFlags(roomGridIndex: int | undefined, displayFlags: BitFlags<DisplayFlag>, updateVisibility?: boolean): void;
73
- /**
74
- * Helper function to make a single room visible in a similar way to how the Compass makes a Boss
75
- * Room visible (e.g. by adding `DisplayFlag.SHOW_ICON`).
76
- *
77
- * @param roomGridIndex Set to undefined to use the current room index.
78
- * @param updateVisibility Optional. Whether to call the `Level.UpdateVisibility` method in order to
79
- * make the changes immediately visible. Default is true.
80
- */
81
- export declare function setRoomVisible(roomGridIndex: int | undefined, updateVisibility?: boolean): void;
82
82
  //# sourceMappingURL=minimap.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"minimap.d.ts","sourceRoot":"","sources":["../../../src/functions/minimap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAmB,MAAM,8BAA8B,CAAC;AAM5E;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAk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;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,GAAG,GAAG,IAAI,CAE9D;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC,CAUtE;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,CAAC,EAAE,GAAG,GAClB,QAAQ,CAAC,WAAW,CAAC,CAiBvB;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,IAAI,CAW5E;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,eAAe,EAAE,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC,GAC/C,IAAI,CAWN;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,GAAG,GAAG,SAAS,EAC9B,YAAY,EAAE,QAAQ,CAAC,WAAW,CAAC,EACnC,gBAAgB,UAAO,GACtB,IAAI,CAiCN"}
@@ -4,7 +4,6 @@ local __TS__New = ____lualib.__TS__New
4
4
  local __TS__Iterator = ____lualib.__TS__Iterator
5
5
  local ____exports = {}
6
6
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
7
- local DisplayFlag = ____isaac_2Dtypescript_2Ddefinitions.DisplayFlag
8
7
  local DisplayFlagZero = ____isaac_2Dtypescript_2Ddefinitions.DisplayFlagZero
9
8
  local ____cachedClasses = require("src.core.cachedClasses")
10
9
  local game = ____cachedClasses.game
@@ -78,9 +77,15 @@ function ____exports.setRoomDisplayFlags(self, roomGridIndex, displayFlags, upda
78
77
  else
79
78
  local minimapAPIRoomDescriptor = MinimapAPI:GetRoomByIdx(roomGridIndex)
80
79
  if minimapAPIRoomDescriptor == nil then
80
+ if displayFlags == DisplayFlagZero then
81
+ return
82
+ end
81
83
  error("Failed to get the MinimapAPI room descriptor for the room at index: " .. tostring(roomGridIndex))
82
84
  end
83
85
  minimapAPIRoomDescriptor:SetDisplayFlags(displayFlags)
86
+ if displayFlags == DisplayFlagZero then
87
+ minimapAPIRoomDescriptor:Remove()
88
+ end
84
89
  end
85
90
  end
86
91
  --- Helper function to add a `DisplayFlag` to a particular room's minimap display flags (e.g. whether
@@ -109,6 +114,15 @@ end
109
114
  function ____exports.clearFloorDisplayFlags(self)
110
115
  ____exports.setAllDisplayFlags(nil, DisplayFlagZero)
111
116
  end
117
+ --- Helper function to set the value of `DisplayFlag` for a room 0.
118
+ --
119
+ -- This function automatically accounts for whether or not MinimapAPI is being used.
120
+ --
121
+ -- This function automatically calls the `Level.UpdateVisibility` after setting the flags so that
122
+ -- the changes will be immediately visible.
123
+ function ____exports.clearRoomDisplayFlags(self, roomGridIndex)
124
+ ____exports.setRoomDisplayFlags(nil, roomGridIndex, DisplayFlagZero)
125
+ end
112
126
  --- Helper function to get the minimap `DisplayFlag` value for every room on the floor. Returns a map
113
127
  -- that is indexed by the room's safe grid index.
114
128
  --
@@ -141,16 +155,4 @@ function ____exports.setFloorDisplayFlags(self, displayFlagsMap)
141
155
  level:UpdateVisibility()
142
156
  end
143
157
  end
144
- --- Helper function to make a single room visible in a similar way to how the Compass makes a Boss
145
- -- Room visible (e.g. by adding `DisplayFlag.SHOW_ICON`).
146
- --
147
- -- @param roomGridIndex Set to undefined to use the current room index.
148
- -- @param updateVisibility Optional. Whether to call the `Level.UpdateVisibility` method in order to
149
- -- make the changes immediately visible. Default is true.
150
- function ____exports.setRoomVisible(self, roomGridIndex, updateVisibility)
151
- if updateVisibility == nil then
152
- updateVisibility = true
153
- end
154
- ____exports.addRoomDisplayFlag(nil, roomGridIndex, DisplayFlag.SHOW_ICON, updateVisibility)
155
- end
156
158
  return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "21.8.4",
3
+ "version": "21.9.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -37,6 +37,18 @@ export function clearFloorDisplayFlags(): void {
37
37
  setAllDisplayFlags(DisplayFlagZero);
38
38
  }
39
39
 
40
+ /**
41
+ * Helper function to set the value of `DisplayFlag` for a room 0.
42
+ *
43
+ * This function automatically accounts for whether or not MinimapAPI is being used.
44
+ *
45
+ * This function automatically calls the `Level.UpdateVisibility` after setting the flags so that
46
+ * the changes will be immediately visible.
47
+ */
48
+ export function clearRoomDisplayFlags(roomGridIndex: int): void {
49
+ setRoomDisplayFlags(roomGridIndex, DisplayFlagZero);
50
+ }
51
+
40
52
  /**
41
53
  * Helper function to get the minimap `DisplayFlag` value for every room on the floor. Returns a map
42
54
  * that is indexed by the room's safe grid index.
@@ -163,25 +175,21 @@ export function setRoomDisplayFlags(
163
175
  } else {
164
176
  const minimapAPIRoomDescriptor = MinimapAPI.GetRoomByIdx(roomGridIndex);
165
177
  if (minimapAPIRoomDescriptor === undefined) {
178
+ // The room might have already been removed previously.
179
+ if (displayFlags === DisplayFlagZero) {
180
+ return;
181
+ }
182
+
166
183
  error(
167
184
  `Failed to get the MinimapAPI room descriptor for the room at index: ${roomGridIndex}`,
168
185
  );
169
186
  }
170
187
  minimapAPIRoomDescriptor.SetDisplayFlags(displayFlags);
171
- }
172
- }
173
188
 
174
- /**
175
- * Helper function to make a single room visible in a similar way to how the Compass makes a Boss
176
- * Room visible (e.g. by adding `DisplayFlag.SHOW_ICON`).
177
- *
178
- * @param roomGridIndex Set to undefined to use the current room index.
179
- * @param updateVisibility Optional. Whether to call the `Level.UpdateVisibility` method in order to
180
- * make the changes immediately visible. Default is true.
181
- */
182
- export function setRoomVisible(
183
- roomGridIndex: int | undefined,
184
- updateVisibility = true,
185
- ): void {
186
- addRoomDisplayFlag(roomGridIndex, DisplayFlag.SHOW_ICON, updateVisibility);
189
+ // MinimapAPI is bugged such that setting the display flags to 0 does not make the room
190
+ // invisible. We delete the room to work around this.
191
+ if (displayFlags === DisplayFlagZero) {
192
+ minimapAPIRoomDescriptor.Remove();
193
+ }
194
+ }
187
195
  }