isaacscript-common 27.6.3 → 27.7.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.
@@ -1315,6 +1315,10 @@ export declare function clearFloorDisplayFlags(): void;
1315
1315
  *
1316
1316
  * This function automatically calls the `Level.UpdateVisibility` after setting the flags so that
1317
1317
  * the changes will be immediately visible.
1318
+ *
1319
+ * Note that if you clear the display flags of a room but then the player travels to the room (or an
1320
+ * adjacent room), the room will appear on the minimap again. If you want to permanently hide the
1321
+ * room even in this circumstance, use the `hideRoomOnMinimap` helper function instead.
1318
1322
  */
1319
1323
  export declare function clearRoomDisplayFlags(roomGridIndex: int): void;
1320
1324
 
@@ -7097,6 +7101,17 @@ export declare function hexToColor(hexString: string, alpha?: number): Readonly<
7097
7101
  */
7098
7102
  export declare function hexToKColor(hexString: string, alpha?: number): Readonly<KColor>;
7099
7103
 
7104
+ /**
7105
+ * Helper function to hide a specific room on the minimap.
7106
+ *
7107
+ * If you want the room to be permanently hidden, you must to call this function on every new room.
7108
+ * This is because if the player enters into the room or walks into an adjacent room, the room will
7109
+ * reappear on the minimap.
7110
+ *
7111
+ * This function automatically accounts for whether or not MinimapAPI is being used.
7112
+ */
7113
+ export declare function hideRoomOnMinimap(roomGridIndex: int): void;
7114
+
7100
7115
  /**
7101
7116
  * Helper type to make the given array/map/set/object recursively read-only.
7102
7117
  *
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 27.6.3
3
+ isaacscript-common 27.7.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -51921,13 +51921,9 @@ function ____exports.setRoomDisplayFlags(self, roomGridIndex, displayFlags, upda
51921
51921
  else
51922
51922
  local minimapAPIRoomDescriptor = MinimapAPI:GetRoomByIdx(roomGridIndex)
51923
51923
  if minimapAPIRoomDescriptor == nil then
51924
- if displayFlags == DisplayFlagZero then
51925
- return
51926
- end
51927
51924
  error("Failed to get the MinimapAPI room descriptor for the room at grid index: " .. tostring(roomGridIndex))
51928
51925
  end
51929
51926
  minimapAPIRoomDescriptor:SetDisplayFlags(displayFlags)
51930
- minimapAPIRoomDescriptor.Hidden = displayFlags == DisplayFlagZero
51931
51927
  end
51932
51928
  end
51933
51929
  function ____exports.addRoomDisplayFlag(self, roomGridIndex, displayFlag, updateVisibility)
@@ -51953,6 +51949,16 @@ function ____exports.getFloorDisplayFlags(self)
51953
51949
  end
51954
51950
  return displayFlagsMap
51955
51951
  end
51952
+ function ____exports.hideRoomOnMinimap(self, roomGridIndex)
51953
+ ____exports.clearRoomDisplayFlags(nil, roomGridIndex)
51954
+ if MinimapAPI ~= nil then
51955
+ local minimapAPIRoomDescriptor = MinimapAPI:GetRoomByIdx(roomGridIndex)
51956
+ if minimapAPIRoomDescriptor == nil then
51957
+ error("Failed to get the MinimapAPI room descriptor for the room at grid index: " .. tostring(roomGridIndex))
51958
+ end
51959
+ minimapAPIRoomDescriptor.Hidden = true
51960
+ end
51961
+ end
51956
51962
  function ____exports.setFloorDisplayFlags(self, displayFlagsMap)
51957
51963
  for ____, ____value in __TS__Iterator(displayFlagsMap) do
51958
51964
  local roomGridIndex = ____value[1]
@@ -27,6 +27,10 @@ export declare function clearFloorDisplayFlags(): void;
27
27
  *
28
28
  * This function automatically calls the `Level.UpdateVisibility` after setting the flags so that
29
29
  * the changes will be immediately visible.
30
+ *
31
+ * Note that if you clear the display flags of a room but then the player travels to the room (or an
32
+ * adjacent room), the room will appear on the minimap again. If you want to permanently hide the
33
+ * room even in this circumstance, use the `hideRoomOnMinimap` helper function instead.
30
34
  */
31
35
  export declare function clearRoomDisplayFlags(roomGridIndex: int): void;
32
36
  /**
@@ -45,6 +49,16 @@ export declare function getFloorDisplayFlags(): Map<int, BitFlags<DisplayFlag>>;
45
49
  * @param roomGridIndex Optional. Default is the current room index.
46
50
  */
47
51
  export declare function getRoomDisplayFlags(roomGridIndex?: int): BitFlags<DisplayFlag>;
52
+ /**
53
+ * Helper function to hide a specific room on the minimap.
54
+ *
55
+ * If you want the room to be permanently hidden, you must to call this function on every new room.
56
+ * This is because if the player enters into the room or walks into an adjacent room, the room will
57
+ * reappear on the minimap.
58
+ *
59
+ * This function automatically accounts for whether or not MinimapAPI is being used.
60
+ */
61
+ export declare function hideRoomOnMinimap(roomGridIndex: int): void;
48
62
  /**
49
63
  * Helper function to set the minimap `DisplayFlag` value for every room on the floor at once.
50
64
  *
@@ -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,kBAAkB,CAChC,aAAa,EAAE,GAAG,GAAG,SAAS,EAC9B,WAAW,EAAE,WAAW,EACxB,gBAAgB,UAAO,GACtB,IAAI,CAIN;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAE7C;AAED;;;;;;;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,S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@ function ____exports.setRoomDisplayFlags(self, roomGridIndex, displayFlags, upda
77
77
  else
78
78
  local minimapAPIRoomDescriptor = MinimapAPI:GetRoomByIdx(roomGridIndex)
79
79
  if minimapAPIRoomDescriptor == nil then
80
- if displayFlags == DisplayFlagZero then
81
- return
82
- end
83
80
  error("Failed to get the MinimapAPI room descriptor for the room at grid index: " .. tostring(roomGridIndex))
84
81
  end
85
82
  minimapAPIRoomDescriptor:SetDisplayFlags(displayFlags)
86
- minimapAPIRoomDescriptor.Hidden = displayFlags == DisplayFlagZero
87
83
  end
88
84
  end
89
85
  --- Helper function to add a `DisplayFlag` to a particular room's minimap display flags (e.g. whether
@@ -118,6 +114,10 @@ end
118
114
  --
119
115
  -- This function automatically calls the `Level.UpdateVisibility` after setting the flags so that
120
116
  -- the changes will be immediately visible.
117
+ --
118
+ -- Note that if you clear the display flags of a room but then the player travels to the room (or an
119
+ -- adjacent room), the room will appear on the minimap again. If you want to permanently hide the
120
+ -- room even in this circumstance, use the `hideRoomOnMinimap` helper function instead.
121
121
  function ____exports.clearRoomDisplayFlags(self, roomGridIndex)
122
122
  ____exports.setRoomDisplayFlags(nil, roomGridIndex, DisplayFlagZero)
123
123
  end
@@ -134,6 +134,23 @@ function ____exports.getFloorDisplayFlags(self)
134
134
  end
135
135
  return displayFlagsMap
136
136
  end
137
+ --- Helper function to hide a specific room on the minimap.
138
+ --
139
+ -- If you want the room to be permanently hidden, you must to call this function on every new room.
140
+ -- This is because if the player enters into the room or walks into an adjacent room, the room will
141
+ -- reappear on the minimap.
142
+ --
143
+ -- This function automatically accounts for whether or not MinimapAPI is being used.
144
+ function ____exports.hideRoomOnMinimap(self, roomGridIndex)
145
+ ____exports.clearRoomDisplayFlags(nil, roomGridIndex)
146
+ if MinimapAPI ~= nil then
147
+ local minimapAPIRoomDescriptor = MinimapAPI:GetRoomByIdx(roomGridIndex)
148
+ if minimapAPIRoomDescriptor == nil then
149
+ error("Failed to get the MinimapAPI room descriptor for the room at grid index: " .. tostring(roomGridIndex))
150
+ end
151
+ minimapAPIRoomDescriptor.Hidden = true
152
+ end
153
+ end
137
154
  --- Helper function to set the minimap `DisplayFlag` value for multiple rooms at once.
138
155
  --
139
156
  -- This function automatically calls the `Level.UpdateVisibility` after setting the flags so that
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "27.6.3",
3
+ "version": "27.7.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -44,6 +44,10 @@ export function clearFloorDisplayFlags(): void {
44
44
  *
45
45
  * This function automatically calls the `Level.UpdateVisibility` after setting the flags so that
46
46
  * the changes will be immediately visible.
47
+ *
48
+ * Note that if you clear the display flags of a room but then the player travels to the room (or an
49
+ * adjacent room), the room will appear on the minimap again. If you want to permanently hide the
50
+ * room even in this circumstance, use the `hideRoomOnMinimap` helper function instead.
47
51
  */
48
52
  export function clearRoomDisplayFlags(roomGridIndex: int): void {
49
53
  setRoomDisplayFlags(roomGridIndex, DisplayFlagZero);
@@ -96,6 +100,32 @@ export function getRoomDisplayFlags(
96
100
  return minimapAPIRoomDescriptor.GetDisplayFlags();
97
101
  }
98
102
 
103
+ /**
104
+ * Helper function to hide a specific room on the minimap.
105
+ *
106
+ * If you want the room to be permanently hidden, you must to call this function on every new room.
107
+ * This is because if the player enters into the room or walks into an adjacent room, the room will
108
+ * reappear on the minimap.
109
+ *
110
+ * This function automatically accounts for whether or not MinimapAPI is being used.
111
+ */
112
+ export function hideRoomOnMinimap(roomGridIndex: int): void {
113
+ clearRoomDisplayFlags(roomGridIndex);
114
+
115
+ // In vanilla, the map only updates at the beginning of every room. In MinimapAPI, it constant
116
+ // updates, so we must specifically tell MinimapAPI that the room should be hidden using the
117
+ // `Hidden` property.
118
+ if (MinimapAPI !== undefined) {
119
+ const minimapAPIRoomDescriptor = MinimapAPI.GetRoomByIdx(roomGridIndex);
120
+ if (minimapAPIRoomDescriptor === undefined) {
121
+ error(
122
+ `Failed to get the MinimapAPI room descriptor for the room at grid index: ${roomGridIndex}`,
123
+ );
124
+ }
125
+ minimapAPIRoomDescriptor.Hidden = true;
126
+ }
127
+ }
128
+
99
129
  /**
100
130
  * Helper function to set the minimap `DisplayFlag` value for every room on the floor at once.
101
131
  *
@@ -175,16 +205,10 @@ export function setRoomDisplayFlags(
175
205
  } else {
176
206
  const minimapAPIRoomDescriptor = MinimapAPI.GetRoomByIdx(roomGridIndex);
177
207
  if (minimapAPIRoomDescriptor === undefined) {
178
- // The room might have already been removed previously.
179
- if (displayFlags === DisplayFlagZero) {
180
- return;
181
- }
182
-
183
208
  error(
184
209
  `Failed to get the MinimapAPI room descriptor for the room at grid index: ${roomGridIndex}`,
185
210
  );
186
211
  }
187
212
  minimapAPIRoomDescriptor.SetDisplayFlags(displayFlags);
188
- minimapAPIRoomDescriptor.Hidden = displayFlags === DisplayFlagZero;
189
213
  }
190
214
  }