isaacscript-common 9.15.0 → 9.17.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.
@@ -53,7 +53,8 @@ export declare function getAllRoomGridIndexes(): int[];
53
53
  export declare function getNewRoomCandidate(seedOrRNG?: Seed | RNG): [adjacentRoomGridIndex: int, doorSlot: DoorSlot, newRoomGridIndex: int] | undefined;
54
54
  /**
55
55
  * Helper function to iterate through the possible doors for a room and see if any of them would be
56
- * a valid spot to insert a brand new room on the floor.
56
+ * a valid spot to insert a brand new room on the floor. (Any potential new rooms cannot be
57
+ * connected to any other existing rooms on the floor.)
57
58
  *
58
59
  * @param roomGridIndex Optional. Default is the current room index.
59
60
  * @returns A array of tuples of `DoorSlot` and room grid index.
@@ -63,7 +64,8 @@ export declare function getNewRoomCandidatesBesideRoom(roomGridIndex?: int): Arr
63
64
  * Helper function to search through all of the rooms on the floor for a spot to insert a brand new
64
65
  * room.
65
66
  *
66
- * @returns A array of tuples of adjacent room grid index, `DoorSlot`, and new room grid index.
67
+ * @returns A array of tuples containing the adjacent room grid index, the `DoorSlot`, and the new
68
+ * room grid index.
67
69
  */
68
70
  export declare function getNewRoomCandidatesForLevel(): Array<[
69
71
  adjacentRoomGridIndex: int,
@@ -1 +1 @@
1
- {"version":3,"file":"levelGrid.d.ts","sourceRoot":"","sources":["../../src/functions/levelGrid.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAEL,QAAQ,EAKR,SAAS,EACT,QAAQ,EACT,MAAM,8BAA8B,CAAC;AA8BtC;;;;;GAKG;AACH,wBAAgB,kCAAkC,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,GAAG,EAAE,CAK7E;AAED;;;;;;GAMG;AACH,wBAAgB,qCAAqC,CACnD,aAAa,CAAC,EAAE,GAAG,GAClB,GAAG,EAAE,CAKP;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,0BAA0B,CAAC,aAAa,CAAC,EA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7C,iBAAiB,EAAE,GAAG,EACtB,SAAS,EAAE,SAAS,GACnB,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAapB;AAED;;;;;;GAMG;AACH,wBAAgB,0CAA0C,CACxD,iBAAiB,EAAE,GAAG,EACtB,SAAS,EAAE,SAAS,GACnB,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAiBpB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,OAAO,CAKtD;AAED,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,GAAG,GACjB,OAAO,CAGT;AAED,wBAAgB,oCAAoC,CAClD,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,GAAG,GACjB,OAAO,CAqBT;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,OAAO,CAGzD;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,OAAO,CAM7D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,OAAO,CAAC,SAAS,CAAC,EAAE,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,SAAS,CAmD/D;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,aAAa,EAAE,GAAG,GAAG,OAAO,CAGtD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,GAAG,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,CAKtE"}
@@ -47,16 +47,15 @@ local ____roomShape = require("functions.roomShape")
47
47
  local getGridIndexDelta = ____roomShape.getGridIndexDelta
48
48
  local ____types = require("functions.types")
49
49
  local asNumber = ____types.asNumber
50
- --- Helper function to get only the adjacent room grid indexes that do not exist (i.e. do not have
51
- -- room data).
50
+ --- Helper function to get only the adjacent room grid indexes that exist (i.e. have room data).
52
51
  --
53
52
  -- This is just a filtering of the results of the `getAdjacentExistingRoomGridIndexes` function. See
54
53
  -- that function for more information.
55
- function ____exports.getAdjacentNonExistingRoomGridIndexes(self, roomGridIndex)
54
+ function ____exports.getAdjacentExistingRoomGridIndexes(self, roomGridIndex)
56
55
  local adjacentRoomGridIndexes = ____exports.getAdjacentRoomGridIndexes(nil, roomGridIndex)
57
56
  return __TS__ArrayFilter(
58
57
  adjacentRoomGridIndexes,
59
- function(____, adjacentRoomGridIndex) return getRoomData(nil, adjacentRoomGridIndex) == nil end
58
+ function(____, adjacentRoomGridIndex) return getRoomData(nil, adjacentRoomGridIndex) ~= nil end
60
59
  )
61
60
  end
62
61
  --- Helper function to get all of the room grid indexes that are adjacent to a given room grid index
@@ -87,7 +86,8 @@ function ____exports.getAdjacentRoomGridIndexes(self, roomGridIndex)
87
86
  )
88
87
  end
89
88
  --- Helper function to iterate through the possible doors for a room and see if any of them would be
90
- -- a valid spot to insert a brand new room on the floor.
89
+ -- a valid spot to insert a brand new room on the floor. (Any potential new rooms cannot be
90
+ -- connected to any other existing rooms on the floor.)
91
91
  --
92
92
  -- @param roomGridIndex Optional. Default is the current room index.
93
93
  -- @returns A array of tuples of `DoorSlot` and room grid index.
@@ -122,7 +122,8 @@ end
122
122
  --- Helper function to search through all of the rooms on the floor for a spot to insert a brand new
123
123
  -- room.
124
124
  --
125
- -- @returns A array of tuples of adjacent room grid index, `DoorSlot`, and new room grid index.
125
+ -- @returns A array of tuples containing the adjacent room grid index, the `DoorSlot`, and the new
126
+ -- room grid index.
126
127
  function ____exports.getNewRoomCandidatesForLevel(self)
127
128
  local rooms = getRoomsInsideGrid(nil)
128
129
  local normalRooms = __TS__ArrayFilter(
@@ -214,8 +215,8 @@ end
214
215
  --
215
216
  -- @param roomGridIndex Optional. Default is the current room index.
216
217
  function ____exports.isDeadEnd(self, roomGridIndex)
217
- local adjacentNonExistingRoomGridIndexes = ____exports.getAdjacentNonExistingRoomGridIndexes(nil, roomGridIndex)
218
- return #adjacentNonExistingRoomGridIndexes == 1
218
+ local adjacentExistingRoomGridIndexes = ____exports.getAdjacentExistingRoomGridIndexes(nil, roomGridIndex)
219
+ return #adjacentExistingRoomGridIndexes == 1
219
220
  end
220
221
  --- Helper function to determine if a given room grid index is inside of the normal 13x13 level grid.
221
222
  --
@@ -239,15 +240,16 @@ local UP = -LEVEL_GRID_ROW_WIDTH
239
240
  local RIGHT = 1
240
241
  local DOWN = LEVEL_GRID_ROW_WIDTH
241
242
  ADJACENT_ROOM_GRID_INDEX_DELTAS = {LEFT, UP, RIGHT, DOWN}
242
- --- Helper function to get only the adjacent room grid indexes that exist (i.e. have room data).
243
+ --- Helper function to get only the adjacent room grid indexes that do not exist (i.e. do not have
244
+ -- room data).
243
245
  --
244
246
  -- This is just a filtering of the results of the `getAdjacentExistingRoomGridIndexes` function. See
245
247
  -- that function for more information.
246
- function ____exports.getAdjacentExistingRoomGridIndexes(self, roomGridIndex)
248
+ function ____exports.getAdjacentNonExistingRoomGridIndexes(self, roomGridIndex)
247
249
  local adjacentRoomGridIndexes = ____exports.getAdjacentRoomGridIndexes(nil, roomGridIndex)
248
250
  return __TS__ArrayFilter(
249
251
  adjacentRoomGridIndexes,
250
- function(____, adjacentRoomGridIndex) return getRoomData(nil, adjacentRoomGridIndex) ~= nil end
252
+ function(____, adjacentRoomGridIndex) return getRoomData(nil, adjacentRoomGridIndex) == nil end
251
253
  )
252
254
  end
253
255
  --- Helper function to get the room safe grid index for every room on the entire floor.
@@ -1,4 +1,14 @@
1
1
  import { DisplayFlag } from "isaac-typescript-definitions";
2
+ /**
3
+ * Helper function to add a `DisplayFlag` to a particular room's minimap display flags (e.g. whether
4
+ * or not it is visible and so on).
5
+ *
6
+ * @param roomGridIndex Set to undefined to use the current room index.
7
+ * @param displayFlag The `DisplayFlag` to set. (See the `DisplayFlag` enum.)
8
+ * @param updateVisibility Optional. Whether to call the `Level.UpdateVisibility` method in order to
9
+ * make the changes immediately visible. Default is true.
10
+ */
11
+ export declare function addRoomDisplayFlag(roomGridIndex: int | undefined, displayFlag: DisplayFlag, updateVisibility?: boolean): void;
2
12
  /**
3
13
  * Helper function to set the value of `DisplayFlag` for every room on the floor to 0.
4
14
  *
@@ -33,11 +43,19 @@ export declare function setFloorDisplayFlags(displayFlagsMap: Map<int, BitFlags<
33
43
  * Helper function to set a particular room's minimap display flags (e.g. whether or not it is
34
44
  * visible and so on).
35
45
  *
36
- * You must call the `Level.UpdateVisibility` method after using this function for the changes to
37
- * take effect.
38
- *
39
46
  * @param roomGridIndex Set to undefined to use the current room index.
40
47
  * @param displayFlags The bit flags value to set. (See the `DisplayFlag` enum.)
48
+ * @param updateVisibility Optional. Whether to call the `Level.UpdateVisibility` method in order to
49
+ * make the changes immediately visible. Default is true.
50
+ */
51
+ export declare function setRoomDisplayFlags(roomGridIndex: int | undefined, displayFlags: BitFlags<DisplayFlag>, updateVisibility?: boolean): void;
52
+ /**
53
+ * Helper function to make a single room visible in a similar way to how the Compass makes a Boss
54
+ * Room visible (e.g. by adding `DisplayFlag.SHOW_ICON`).
55
+ *
56
+ * @param roomGridIndex Set to undefined to use the current room index.
57
+ * @param updateVisibility Optional. Whether to call the `Level.UpdateVisibility` method in order to
58
+ * make the changes immediately visible. Default is true.
41
59
  */
42
- export declare function setRoomDisplayFlags(roomGridIndex: int | undefined, displayFlags: BitFlags<DisplayFlag>): void;
60
+ export declare function setRoomVisible(roomGridIndex: int | undefined, updateVisibility?: boolean): void;
43
61
  //# 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;AAK5E;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAS7C;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,W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AAoB,CAClC,eAAe,EAAE,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC,GAC/C,IAAI,CAEN;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,GAAG,GAAG,SAAS,EAC9B,YAAY,EAAE,QAAQ,CAAC,WAAW,CAAC,EACnC,gBAAgB,UAAO,GACtB,IAAI,CAkBN;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,aAAa,EAAE,GAAG,GAAG,SAAS,EAC9B,gBAAgB,UAAO,GACtB,IAAI,CAEN"}
@@ -4,24 +4,72 @@ 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
7
8
  local DisplayFlagZero = ____isaac_2Dtypescript_2Ddefinitions.DisplayFlagZero
8
9
  local ____cachedClasses = require("core.cachedClasses")
9
10
  local game = ____cachedClasses.game
11
+ local ____flag = require("functions.flag")
12
+ local addFlag = ____flag.addFlag
10
13
  local ____roomData = require("functions.roomData")
11
14
  local getRoomDescriptor = ____roomData.getRoomDescriptor
15
+ local getRoomGridIndex = ____roomData.getRoomGridIndex
12
16
  local ____rooms = require("functions.rooms")
13
17
  local getRoomsInsideGrid = ____rooms.getRoomsInsideGrid
14
18
  --- Helper function to set a particular room's minimap display flags (e.g. whether or not it is
15
19
  -- visible and so on).
16
20
  --
17
- -- You must call the `Level.UpdateVisibility` method after using this function for the changes to
18
- -- take effect.
19
- --
20
21
  -- @param roomGridIndex Set to undefined to use the current room index.
21
22
  -- @param displayFlags The bit flags value to set. (See the `DisplayFlag` enum.)
22
- function ____exports.setRoomDisplayFlags(self, roomGridIndex, displayFlags)
23
- local roomDescriptor = getRoomDescriptor(nil, roomGridIndex)
24
- roomDescriptor.DisplayFlags = displayFlags
23
+ -- @param updateVisibility Optional. Whether to call the `Level.UpdateVisibility` method in order to
24
+ -- make the changes immediately visible. Default is true.
25
+ function ____exports.setRoomDisplayFlags(self, roomGridIndex, displayFlags, updateVisibility)
26
+ if updateVisibility == nil then
27
+ updateVisibility = true
28
+ end
29
+ if MinimapAPI == nil then
30
+ local roomDescriptor = getRoomDescriptor(nil, roomGridIndex)
31
+ roomDescriptor.DisplayFlags = displayFlags
32
+ else
33
+ if roomGridIndex == nil then
34
+ roomGridIndex = getRoomGridIndex(nil)
35
+ end
36
+ local roomDescriptor = MinimapAPI:GetRoomByIdx(roomGridIndex)
37
+ if roomDescriptor ~= nil then
38
+ roomDescriptor.DisplayFlags = displayFlags
39
+ end
40
+ end
41
+ if updateVisibility then
42
+ local level = game:GetLevel()
43
+ level:UpdateVisibility()
44
+ end
45
+ end
46
+ --- Helper function to add a `DisplayFlag` to a particular room's minimap display flags (e.g. whether
47
+ -- or not it is visible and so on).
48
+ --
49
+ -- @param roomGridIndex Set to undefined to use the current room index.
50
+ -- @param displayFlag The `DisplayFlag` to set. (See the `DisplayFlag` enum.)
51
+ -- @param updateVisibility Optional. Whether to call the `Level.UpdateVisibility` method in order to
52
+ -- make the changes immediately visible. Default is true.
53
+ function ____exports.addRoomDisplayFlag(self, roomGridIndex, displayFlag, updateVisibility)
54
+ if updateVisibility == nil then
55
+ updateVisibility = true
56
+ end
57
+ if MinimapAPI == nil then
58
+ local roomDescriptor = getRoomDescriptor(nil, roomGridIndex)
59
+ roomDescriptor.DisplayFlags = addFlag(nil, roomDescriptor.DisplayFlags, displayFlag)
60
+ else
61
+ if roomGridIndex == nil then
62
+ roomGridIndex = getRoomGridIndex(nil)
63
+ end
64
+ local roomDescriptor = MinimapAPI:GetRoomByIdx(roomGridIndex)
65
+ if roomDescriptor ~= nil then
66
+ roomDescriptor.DisplayFlags = addFlag(nil, roomDescriptor.DisplayFlags, displayFlag)
67
+ end
68
+ end
69
+ if updateVisibility then
70
+ local level = game:GetLevel()
71
+ level:UpdateVisibility()
72
+ end
25
73
  end
26
74
  --- Helper function to set the value of `DisplayFlag` for every room on the floor to 0.
27
75
  --
@@ -64,7 +112,7 @@ function ____exports.setDisplayFlags(self, displayFlagsMap)
64
112
  local roomGridIndex = ____value[1]
65
113
  local displayFlags = ____value[2]
66
114
  if MinimapAPI == nil then
67
- ____exports.setRoomDisplayFlags(nil, roomGridIndex, displayFlags)
115
+ ____exports.setRoomDisplayFlags(nil, roomGridIndex, displayFlags, false)
68
116
  else
69
117
  local roomDescriptor = MinimapAPI:GetRoomByIdx(roomGridIndex)
70
118
  if roomDescriptor ~= nil then
@@ -78,4 +126,16 @@ end
78
126
  function ____exports.setFloorDisplayFlags(self, displayFlagsMap)
79
127
  ____exports.setDisplayFlags(nil, displayFlagsMap)
80
128
  end
129
+ --- Helper function to make a single room visible in a similar way to how the Compass makes a Boss
130
+ -- Room visible (e.g. by adding `DisplayFlag.SHOW_ICON`).
131
+ --
132
+ -- @param roomGridIndex Set to undefined to use the current room index.
133
+ -- @param updateVisibility Optional. Whether to call the `Level.UpdateVisibility` method in order to
134
+ -- make the changes immediately visible. Default is true.
135
+ function ____exports.setRoomVisible(self, roomGridIndex, updateVisibility)
136
+ if updateVisibility == nil then
137
+ updateVisibility = true
138
+ end
139
+ ____exports.addRoomDisplayFlag(nil, roomGridIndex, DisplayFlag.SHOW_ICON, updateVisibility)
140
+ end
81
141
  return ____exports
@@ -3,6 +3,14 @@
3
3
  import { HealthType } from "../enums/HealthType";
4
4
  import { PlayerHealth } from "../interfaces/PlayerHealth";
5
5
  export declare function addPlayerHealthType(player: EntityPlayer, healthType: HealthType, numHearts: int): void;
6
+ /**
7
+ * Helper function to see if the provided player can pick up an eternal heart. (If a player already
8
+ * has an eternal heart and full heart containers, they are not able to pick up any additional
9
+ * eternal hearts.)
10
+ *
11
+ * This function's name matches the existing `EntityPlayer` methods.
12
+ */
13
+ export declare function canPickEternalHearts(player: EntityPlayer): boolean;
6
14
  /**
7
15
  * Returns whether or not all of the player's soul-heart-type hearts are black hearts.
8
16
  *
@@ -1 +1 @@
1
- {"version":3,"file":"playerHealth.d.ts","sourceRoot":"","sources":["../../src/functions/playerHealth.ts"],"names":[],"mappings":";;AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAiB,MAAM,4BAA4B,CAAC;AAQzE,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,GAAG,GACb,IAAI,CA+CN;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAK1E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAKzE;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAYtE;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAK9D;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,CA2ElE;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,GACrB,GAAG,CAmDL;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAKzD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,UAAU,CAoDnE;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAqCrE;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAK7D;AAED;;;;;;;;;GASG;AACH,wBAAgB,wCAAwC,CACtD,MAAM,EAAE,YAAY,GACnB,GAAG,CAML;AAED,sDAAsD;AACtD,wBAAgB,eAAe,IAAI,YAAY,CAc9C;AAED,wBAAgB,oCAAoC,CAClD,MAAM,EAAE,YAAY,GACnB,IAAI,CAQN;AAED,wBAAgB,oCAAoC,CAClD,MAAM,EAAE,YAAY,GACnB,IAAI,CAQN;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAMjE;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAwBhE;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,YAAY,GACzB,IAAI,CAsHN;AAED;;;;;;;;;GASG;AACH,wBAAgB,sDAAsD,CACpE,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,KAAK,GAClB,OAAO,CAyBT"}
1
+ {"version":3,"file":"playerHealth.d.ts","sourceRoot":"","sources":["../../src/functions/playerHealth.ts"],"names":[],"mappings":";;AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAiB,MAAM,4BAA4B,CAAC;AAQzE,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,GAAG,GACb,IAAI,CA+CN;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAMlE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAK1E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAKzE;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAYtE;AAED;;;;;;GAMG;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)
135
135
  addAmount = 1
136
136
  end
137
137
  repeat
138
- local ____switch71 = soulHeartType
139
- local ____cond71 = ____switch71 == HeartSubType.SOUL
140
- if ____cond71 then
138
+ local ____switch72 = soulHeartType
139
+ local ____cond72 = ____switch72 == HeartSubType.SOUL
140
+ if ____cond72 then
141
141
  do
142
142
  player:AddSoulHearts(addAmount)
143
143
  soulHeartsRemaining = soulHeartsRemaining - addAmount
144
144
  break
145
145
  end
146
146
  end
147
- ____cond71 = ____cond71 or ____switch71 == HeartSubType.BLACK
148
- if ____cond71 then
147
+ ____cond72 = ____cond72 or ____switch72 == HeartSubType.BLACK
148
+ if ____cond72 then
149
149
  do
150
150
  player:AddBlackHearts(addAmount)
151
151
  soulHeartsRemaining = soulHeartsRemaining - addAmount
152
152
  break
153
153
  end
154
154
  end
155
- ____cond71 = ____cond71 or ____switch71 == HeartSubType.BONE
156
- if ____cond71 then
155
+ ____cond72 = ____cond72 or ____switch72 == HeartSubType.BONE
156
+ if ____cond72 then
157
157
  do
158
158
  player:AddBoneHearts(addAmount)
159
159
  break
@@ -271,6 +271,17 @@ function ____exports.addPlayerHealthType(self, player, healthType, numHearts)
271
271
  end
272
272
  until true
273
273
  end
274
+ --- Helper function to see if the provided player can pick up an eternal heart. (If a player already
275
+ -- has an eternal heart and full heart containers, they are not able to pick up any additional
276
+ -- eternal hearts.)
277
+ --
278
+ -- This function's name matches the existing `EntityPlayer` methods.
279
+ function ____exports.canPickEternalHearts(self, player)
280
+ local eternalHearts = player:GetEternalHearts()
281
+ local maxHearts = player:GetMaxHearts()
282
+ local heartLimit = player:GetHeartLimit()
283
+ return eternalHearts == 0 or maxHearts ~= heartLimit
284
+ end
274
285
  --- Returns whether or not all of the player's soul-heart-type hearts are black hearts.
275
286
  --
276
287
  -- Note that this function does not consider red heart containers.
@@ -385,57 +396,57 @@ function ____exports.getPlayerHealth(self, player)
385
396
  end
386
397
  function ____exports.getPlayerHealthType(self, player, healthType)
387
398
  repeat
388
- local ____switch28 = healthType
389
- local ____cond28 = ____switch28 == HealthType.RED
390
- if ____cond28 then
399
+ local ____switch29 = healthType
400
+ local ____cond29 = ____switch29 == HealthType.RED
401
+ if ____cond29 then
391
402
  do
392
403
  return ____exports.getPlayerHearts(nil, player)
393
404
  end
394
405
  end
395
- ____cond28 = ____cond28 or ____switch28 == HealthType.SOUL
396
- if ____cond28 then
406
+ ____cond29 = ____cond29 or ____switch29 == HealthType.SOUL
407
+ if ____cond29 then
397
408
  do
398
409
  return ____exports.getPlayerSoulHearts(nil, player)
399
410
  end
400
411
  end
401
- ____cond28 = ____cond28 or ____switch28 == HealthType.ETERNAL
402
- if ____cond28 then
412
+ ____cond29 = ____cond29 or ____switch29 == HealthType.ETERNAL
413
+ if ____cond29 then
403
414
  do
404
415
  return player:GetEternalHearts()
405
416
  end
406
417
  end
407
- ____cond28 = ____cond28 or ____switch28 == HealthType.BLACK
408
- if ____cond28 then
418
+ ____cond29 = ____cond29 or ____switch29 == HealthType.BLACK
419
+ if ____cond29 then
409
420
  do
410
421
  return ____exports.getPlayerBlackHearts(nil, player)
411
422
  end
412
423
  end
413
- ____cond28 = ____cond28 or ____switch28 == HealthType.GOLDEN
414
- if ____cond28 then
424
+ ____cond29 = ____cond29 or ____switch29 == HealthType.GOLDEN
425
+ if ____cond29 then
415
426
  do
416
427
  return player:GetGoldenHearts()
417
428
  end
418
429
  end
419
- ____cond28 = ____cond28 or ____switch28 == HealthType.BONE
420
- if ____cond28 then
430
+ ____cond29 = ____cond29 or ____switch29 == HealthType.BONE
431
+ if ____cond29 then
421
432
  do
422
433
  return player:GetBoneHearts()
423
434
  end
424
435
  end
425
- ____cond28 = ____cond28 or ____switch28 == HealthType.ROTTEN
426
- if ____cond28 then
436
+ ____cond29 = ____cond29 or ____switch29 == HealthType.ROTTEN
437
+ if ____cond29 then
427
438
  do
428
439
  return player:GetRottenHearts()
429
440
  end
430
441
  end
431
- ____cond28 = ____cond28 or ____switch28 == HealthType.BROKEN
432
- if ____cond28 then
442
+ ____cond29 = ____cond29 or ____switch29 == HealthType.BROKEN
443
+ if ____cond29 then
433
444
  do
434
445
  return player:GetBrokenHearts()
435
446
  end
436
447
  end
437
- ____cond28 = ____cond28 or ____switch28 == HealthType.MAX_HEARTS
438
- if ____cond28 then
448
+ ____cond29 = ____cond29 or ____switch29 == HealthType.MAX_HEARTS
449
+ if ____cond29 then
439
450
  do
440
451
  return player:GetMaxHearts()
441
452
  end
package/dist/index.d.ts CHANGED
@@ -287,6 +287,17 @@ export declare function addRoomClearCharges(bigRoomDoubleCharge?: boolean): void
287
287
  */
288
288
  export declare function addRoomClearChargeToSlot(player: EntityPlayer, activeSlot: ActiveSlot, bigRoomDoubleCharge?: boolean, playSoundEffect?: boolean): void;
289
289
 
290
+ /**
291
+ * Helper function to add a `DisplayFlag` to a particular room's minimap display flags (e.g. whether
292
+ * or not it is visible and so on).
293
+ *
294
+ * @param roomGridIndex Set to undefined to use the current room index.
295
+ * @param displayFlag The `DisplayFlag` to set. (See the `DisplayFlag` enum.)
296
+ * @param updateVisibility Optional. Whether to call the `Level.UpdateVisibility` method in order to
297
+ * make the changes immediately visible. Default is true.
298
+ */
299
+ export declare function addRoomDisplayFlag(roomGridIndex: int | undefined, displayFlag: DisplayFlag, updateVisibility?: boolean): void;
300
+
290
301
  /**
291
302
  * Helper function to add all of the values in one set to another set. The first set passed will be
292
303
  * modified in place.
@@ -596,6 +607,15 @@ export declare function calculateStageType(stage: LevelStage): StageType;
596
607
  */
597
608
  export declare function calculateStageTypeRepentance(stage: LevelStage): StageType;
598
609
 
610
+ /**
611
+ * Helper function to see if the provided player can pick up an eternal heart. (If a player already
612
+ * has an eternal heart and full heart containers, they are not able to pick up any additional
613
+ * eternal hearts.)
614
+ *
615
+ * This function's name matches the existing `EntityPlayer` methods.
616
+ */
617
+ export declare function canPickEternalHearts(player: EntityPlayer): boolean;
618
+
599
619
  /**
600
620
  * Helper function to determine if a player will destroy a rock/pot/skull if they walk over it.
601
621
  *
@@ -3656,7 +3676,8 @@ export declare function getNewRoomCandidate(seedOrRNG?: Seed | RNG): [adjacentRo
3656
3676
 
3657
3677
  /**
3658
3678
  * Helper function to iterate through the possible doors for a room and see if any of them would be
3659
- * a valid spot to insert a brand new room on the floor.
3679
+ * a valid spot to insert a brand new room on the floor. (Any potential new rooms cannot be
3680
+ * connected to any other existing rooms on the floor.)
3660
3681
  *
3661
3682
  * @param roomGridIndex Optional. Default is the current room index.
3662
3683
  * @returns A array of tuples of `DoorSlot` and room grid index.
@@ -3667,7 +3688,8 @@ export declare function getNewRoomCandidatesBesideRoom(roomGridIndex?: int): Arr
3667
3688
  * Helper function to search through all of the rooms on the floor for a spot to insert a brand new
3668
3689
  * room.
3669
3690
  *
3670
- * @returns A array of tuples of adjacent room grid index, `DoorSlot`, and new room grid index.
3691
+ * @returns A array of tuples containing the adjacent room grid index, the `DoorSlot`, and the new
3692
+ * room grid index.
3671
3693
  */
3672
3694
  export declare function getNewRoomCandidatesForLevel(): Array<[
3673
3695
  adjacentRoomGridIndex: int,
@@ -10728,13 +10750,12 @@ export declare function setRoomData(roomGridIndex: int, roomData: Readonly<RoomC
10728
10750
  * Helper function to set a particular room's minimap display flags (e.g. whether or not it is
10729
10751
  * visible and so on).
10730
10752
  *
10731
- * You must call the `Level.UpdateVisibility` method after using this function for the changes to
10732
- * take effect.
10733
- *
10734
10753
  * @param roomGridIndex Set to undefined to use the current room index.
10735
10754
  * @param displayFlags The bit flags value to set. (See the `DisplayFlag` enum.)
10755
+ * @param updateVisibility Optional. Whether to call the `Level.UpdateVisibility` method in order to
10756
+ * make the changes immediately visible. Default is true.
10736
10757
  */
10737
- export declare function setRoomDisplayFlags(roomGridIndex: int | undefined, displayFlags: BitFlags<DisplayFlag>): void;
10758
+ export declare function setRoomDisplayFlags(roomGridIndex: int | undefined, displayFlags: BitFlags<DisplayFlag>, updateVisibility?: boolean): void;
10738
10759
 
10739
10760
  /**
10740
10761
  * Helper function to emulate what happens when you bomb an Angel Statue or push a Reward Plate that
@@ -10742,6 +10763,16 @@ export declare function setRoomDisplayFlags(roomGridIndex: int | undefined, disp
10742
10763
  */
10743
10764
  export declare function setRoomUncleared(): void;
10744
10765
 
10766
+ /**
10767
+ * Helper function to make a single room visible in a similar way to how the Compass makes a Boss
10768
+ * Room visible (e.g. by adding `DisplayFlag.SHOW_ICON`).
10769
+ *
10770
+ * @param roomGridIndex Set to undefined to use the current room index.
10771
+ * @param updateVisibility Optional. Whether to call the `Level.UpdateVisibility` method in order to
10772
+ * make the changes immediately visible. Default is true.
10773
+ */
10774
+ export declare function setRoomVisible(roomGridIndex: int | undefined, updateVisibility?: boolean): void;
10775
+
10745
10776
  /** Helper function to set a seed to an RNG object using Blade's recommended shift index. */
10746
10777
  export declare function setSeed(rng: RNG, seed: Seed): void;
10747
10778
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "9.15.0",
3
+ "version": "9.17.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -138,7 +138,8 @@ export function getNewRoomCandidate(
138
138
 
139
139
  /**
140
140
  * Helper function to iterate through the possible doors for a room and see if any of them would be
141
- * a valid spot to insert a brand new room on the floor.
141
+ * a valid spot to insert a brand new room on the floor. (Any potential new rooms cannot be
142
+ * connected to any other existing rooms on the floor.)
142
143
  *
143
144
  * @param roomGridIndex Optional. Default is the current room index.
144
145
  * @returns A array of tuples of `DoorSlot` and room grid index.
@@ -148,10 +149,14 @@ export function getNewRoomCandidatesBesideRoom(
148
149
  ): Array<[doorSlot: DoorSlot, roomGridIndex: int]> {
149
150
  const roomDescriptor = getRoomDescriptor(roomGridIndex);
150
151
 
152
+ // First, handle the case of rooms outside of the grid, which obviously cannot have any possible
153
+ // adjacent new room candidates.
151
154
  if (!isRoomInsideGrid(roomDescriptor.SafeGridIndex)) {
152
155
  return [];
153
156
  }
154
157
 
158
+ // Rooms without data are non-existent, so they obviously cannot have any possible adjacent new
159
+ // room candidates.
155
160
  const roomData = roomDescriptor.Data;
156
161
  if (roomData === undefined) {
157
162
  return [];
@@ -193,16 +198,22 @@ export function getNewRoomCandidatesBesideRoom(
193
198
  * Helper function to search through all of the rooms on the floor for a spot to insert a brand new
194
199
  * room.
195
200
  *
196
- * @returns A array of tuples of adjacent room grid index, `DoorSlot`, and new room grid index.
201
+ * @returns A array of tuples containing the adjacent room grid index, the `DoorSlot`, and the new
202
+ * room grid index.
197
203
  */
198
204
  export function getNewRoomCandidatesForLevel(): Array<
199
205
  [adjacentRoomGridIndex: int, doorSlot: DoorSlot, newRoomGridIndex: int]
200
206
  > {
207
+ // We want to iterate over every room on the floor and search for potential new room spots.
201
208
  const rooms = getRoomsInsideGrid();
209
+
210
+ // However, we want to filter out special rooms because they are supposed to be dead ends.
202
211
  const normalRooms = rooms.filter(
203
212
  (room) =>
204
213
  room.Data !== undefined &&
205
214
  room.Data.Type === RoomType.DEFAULT &&
215
+ // The mirror room and the mineshaft entrance count as normal rooms, but those are supposed to
216
+ // be dead ends as well.
206
217
  room.Data.Subtype !== asNumber(DownpourRoomSubType.MIRROR) &&
207
218
  room.Data.Subtype !== asNumber(MinesRoomSubType.MINESHAFT_ENTRANCE),
208
219
  );
@@ -385,10 +396,10 @@ export function getRoomShapeAdjacentNonExistingGridIndexes(
385
396
  * @param roomGridIndex Optional. Default is the current room index.
386
397
  */
387
398
  export function isDeadEnd(roomGridIndex?: int): boolean {
388
- const adjacentNonExistingRoomGridIndexes =
389
- getAdjacentNonExistingRoomGridIndexes(roomGridIndex);
399
+ const adjacentExistingRoomGridIndexes =
400
+ getAdjacentExistingRoomGridIndexes(roomGridIndex);
390
401
 
391
- return adjacentNonExistingRoomGridIndexes.length === 1;
402
+ return adjacentExistingRoomGridIndexes.length === 1;
392
403
  }
393
404
 
394
405
  export function isDoorSlotValidAtGridIndex(
@@ -1,8 +1,48 @@
1
1
  import { DisplayFlag, DisplayFlagZero } from "isaac-typescript-definitions";
2
2
  import { game } from "../core/cachedClasses";
3
- import { getRoomDescriptor } from "./roomData";
3
+ import { addFlag } from "./flag";
4
+ import { getRoomDescriptor, getRoomGridIndex } from "./roomData";
4
5
  import { getRoomsInsideGrid } from "./rooms";
5
6
 
7
+ /**
8
+ * Helper function to add a `DisplayFlag` to a particular room's minimap display flags (e.g. whether
9
+ * or not it is visible and so on).
10
+ *
11
+ * @param roomGridIndex Set to undefined to use the current room index.
12
+ * @param displayFlag The `DisplayFlag` to set. (See the `DisplayFlag` enum.)
13
+ * @param updateVisibility Optional. Whether to call the `Level.UpdateVisibility` method in order to
14
+ * make the changes immediately visible. Default is true.
15
+ */
16
+ export function addRoomDisplayFlag(
17
+ roomGridIndex: int | undefined,
18
+ displayFlag: DisplayFlag,
19
+ updateVisibility = true,
20
+ ): void {
21
+ if (MinimapAPI === undefined) {
22
+ const roomDescriptor = getRoomDescriptor(roomGridIndex);
23
+ roomDescriptor.DisplayFlags = addFlag(
24
+ roomDescriptor.DisplayFlags,
25
+ displayFlag,
26
+ );
27
+ } else {
28
+ if (roomGridIndex === undefined) {
29
+ roomGridIndex = getRoomGridIndex();
30
+ }
31
+ const roomDescriptor = MinimapAPI.GetRoomByIdx(roomGridIndex);
32
+ if (roomDescriptor !== undefined) {
33
+ roomDescriptor.DisplayFlags = addFlag(
34
+ roomDescriptor.DisplayFlags,
35
+ displayFlag,
36
+ );
37
+ }
38
+ }
39
+
40
+ if (updateVisibility) {
41
+ const level = game.GetLevel();
42
+ level.UpdateVisibility();
43
+ }
44
+ }
45
+
6
46
  /**
7
47
  * Helper function to set the value of `DisplayFlag` for every room on the floor to 0.
8
48
  *
@@ -66,7 +106,8 @@ export function setDisplayFlags(
66
106
 
67
107
  for (const [roomGridIndex, displayFlags] of displayFlagsMap.entries()) {
68
108
  if (MinimapAPI === undefined) {
69
- setRoomDisplayFlags(roomGridIndex, displayFlags);
109
+ // We pass false to the `updateVisibility` argument as a small optimization.
110
+ setRoomDisplayFlags(roomGridIndex, displayFlags, false);
70
111
  } else {
71
112
  const roomDescriptor = MinimapAPI.GetRoomByIdx(roomGridIndex);
72
113
  if (roomDescriptor !== undefined) {
@@ -90,16 +131,46 @@ export function setFloorDisplayFlags(
90
131
  * Helper function to set a particular room's minimap display flags (e.g. whether or not it is
91
132
  * visible and so on).
92
133
  *
93
- * You must call the `Level.UpdateVisibility` method after using this function for the changes to
94
- * take effect.
95
- *
96
134
  * @param roomGridIndex Set to undefined to use the current room index.
97
135
  * @param displayFlags The bit flags value to set. (See the `DisplayFlag` enum.)
136
+ * @param updateVisibility Optional. Whether to call the `Level.UpdateVisibility` method in order to
137
+ * make the changes immediately visible. Default is true.
98
138
  */
99
139
  export function setRoomDisplayFlags(
100
140
  roomGridIndex: int | undefined,
101
141
  displayFlags: BitFlags<DisplayFlag>,
142
+ updateVisibility = true,
102
143
  ): void {
103
- const roomDescriptor = getRoomDescriptor(roomGridIndex);
104
- roomDescriptor.DisplayFlags = displayFlags;
144
+ if (MinimapAPI === undefined) {
145
+ const roomDescriptor = getRoomDescriptor(roomGridIndex);
146
+ roomDescriptor.DisplayFlags = displayFlags;
147
+ } else {
148
+ if (roomGridIndex === undefined) {
149
+ roomGridIndex = getRoomGridIndex();
150
+ }
151
+ const roomDescriptor = MinimapAPI.GetRoomByIdx(roomGridIndex);
152
+ if (roomDescriptor !== undefined) {
153
+ roomDescriptor.DisplayFlags = displayFlags;
154
+ }
155
+ }
156
+
157
+ if (updateVisibility) {
158
+ const level = game.GetLevel();
159
+ level.UpdateVisibility();
160
+ }
161
+ }
162
+
163
+ /**
164
+ * Helper function to make a single room visible in a similar way to how the Compass makes a Boss
165
+ * Room visible (e.g. by adding `DisplayFlag.SHOW_ICON`).
166
+ *
167
+ * @param roomGridIndex Set to undefined to use the current room index.
168
+ * @param updateVisibility Optional. Whether to call the `Level.UpdateVisibility` method in order to
169
+ * make the changes immediately visible. Default is true.
170
+ */
171
+ export function setRoomVisible(
172
+ roomGridIndex: int | undefined,
173
+ updateVisibility = true,
174
+ ): void {
175
+ addRoomDisplayFlag(roomGridIndex, DisplayFlag.SHOW_ICON, updateVisibility);
105
176
  }
@@ -68,6 +68,21 @@ export function addPlayerHealthType(
68
68
  }
69
69
  }
70
70
 
71
+ /**
72
+ * Helper function to see if the provided player can pick up an eternal heart. (If a player already
73
+ * has an eternal heart and full heart containers, they are not able to pick up any additional
74
+ * eternal hearts.)
75
+ *
76
+ * This function's name matches the existing `EntityPlayer` methods.
77
+ */
78
+ export function canPickEternalHearts(player: EntityPlayer): boolean {
79
+ const eternalHearts = player.GetEternalHearts();
80
+ const maxHearts = player.GetMaxHearts();
81
+ const heartLimit = player.GetHeartLimit();
82
+
83
+ return eternalHearts === 0 || maxHearts !== heartLimit;
84
+ }
85
+
71
86
  /**
72
87
  * Returns whether or not all of the player's soul-heart-type hearts are black hearts.
73
88
  *