isaacscript-common 7.5.0 → 7.5.1

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.
Files changed (45) hide show
  1. package/dist/classes/DefaultMap.d.ts +3 -2
  2. package/dist/classes/DefaultMap.d.ts.map +1 -1
  3. package/dist/classes/DefaultMap.lua +2 -1
  4. package/dist/features/customStage/customStageUtils.d.ts +2 -1
  5. package/dist/features/customStage/customStageUtils.d.ts.map +1 -1
  6. package/dist/features/customStage/customStageUtils.lua +40 -1
  7. package/dist/features/customStage/exports.d.ts +1 -25
  8. package/dist/features/customStage/exports.d.ts.map +1 -1
  9. package/dist/features/customStage/exports.lua +28 -29
  10. package/dist/features/customStage/v.d.ts +0 -2
  11. package/dist/features/customStage/v.d.ts.map +1 -1
  12. package/dist/features/customStage/v.lua +0 -2
  13. package/dist/features/customStage/versusScreen.d.ts.map +1 -1
  14. package/dist/features/customStage/versusScreen.lua +74 -60
  15. package/dist/functions/doors.d.ts +6 -5
  16. package/dist/functions/doors.d.ts.map +1 -1
  17. package/dist/functions/doors.lua +25 -12
  18. package/dist/functions/enums.d.ts +3 -3
  19. package/dist/functions/enums.lua +3 -3
  20. package/dist/functions/players.d.ts.map +1 -1
  21. package/dist/functions/players.lua +3 -2
  22. package/dist/index.d.ts +105 -102
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/interfaces/{CustomStageLua.d.ts → CustomStageTSConfig.d.ts} +86 -60
  25. package/dist/interfaces/CustomStageTSConfig.d.ts.map +1 -0
  26. package/dist/interfaces/{CustomStageLua.lua → CustomStageTSConfig.lua} +0 -0
  27. package/dist/interfaces/JSONRoomsFile.d.ts +6 -5
  28. package/dist/interfaces/JSONRoomsFile.d.ts.map +1 -1
  29. package/dist/interfaces/private/CustomStage.d.ts +1 -1
  30. package/dist/interfaces/private/CustomStage.d.ts.map +1 -1
  31. package/package.json +1 -1
  32. package/src/classes/DefaultMap.ts +3 -2
  33. package/src/features/customStage/customStageUtils.ts +52 -1
  34. package/src/features/customStage/exports.ts +33 -45
  35. package/src/features/customStage/init.ts +1 -1
  36. package/src/features/customStage/v.ts +0 -6
  37. package/src/features/customStage/versusScreen.ts +70 -55
  38. package/src/functions/doors.ts +37 -21
  39. package/src/functions/enums.ts +3 -3
  40. package/src/functions/players.ts +7 -3
  41. package/src/index.ts +1 -1
  42. package/src/interfaces/{CustomStageLua.ts → CustomStageTSConfig.ts} +107 -41
  43. package/src/interfaces/JSONRoomsFile.ts +6 -5
  44. package/src/interfaces/private/CustomStage.ts +4 -1
  45. package/dist/interfaces/CustomStageLua.d.ts.map +0 -1
@@ -1,5 +1,6 @@
1
1
  /**
2
- * `DefaultMap` is a data structure that makes working with default values easier.
2
+ * `DefaultMap` is a data structure that makes working with default values easier. It extends a
3
+ * `Map` and adds additional methods.
3
4
  *
4
5
  * It is a common pattern to look up a value in a `Map`, and then, if the value does not exist, set
5
6
  * a default value for the key, and then return the default value. `DefaultMap` abstracts this
@@ -83,7 +84,7 @@ export declare class DefaultMap<Key, Value, Args extends unknown[] = []> extends
83
84
  private defaultValueFactory;
84
85
  /**
85
86
  * See the main `DefaultMap` documentation:
86
- * https://isaacscript.github.io/isaacscript-common/classes/classes_DefaultMap.DefaultMap
87
+ * https://isaacscript.github.io/isaacscript-common/other/classes/DefaultMap
87
88
  */
88
89
  constructor(defaultValueOrFactoryFunction: Value | FactoryFunction<Value, Args>, initializerArray?: Iterable<[Key, Value]>);
89
90
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultMap.d.ts","sourceRoot":"","sources":["../../src/classes/DefaultMap.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+EG;AACH,qBAAa,UAAU,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,SAAS,OAAO,EAAE,GAAG,EAAE,CAAE,SAAQ,GAAG,CAC1E,GAAG,EACH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G,IAAI,EAAE,IAAI,GAAG,KAAK;IAWhD;;;OAGG;IACH,eAAe,CAAC,GAAG,IAAI,EAAE,IAAI,GAAG,KAAK;IAYrC;;;OAGG;IACH,iBAAiB,IAAI,KAAK,GAAG,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC;CAW1D;AAGD;;;GAGG;AACH,oBAAY,eAAe,CAAC,CAAC,EAAE,IAAI,SAAS,OAAO,EAAE,IAAI,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,CAAC,CAAC"}
@@ -8,7 +8,8 @@ local ____exports = {}
8
8
  local ____types = require("functions.types")
9
9
  local isFunction = ____types.isFunction
10
10
  local isPrimitive = ____types.isPrimitive
11
- --- `DefaultMap` is a data structure that makes working with default values easier.
11
+ --- `DefaultMap` is a data structure that makes working with default values easier. It extends a
12
+ -- `Map` and adds additional methods.
12
13
  --
13
14
  -- It is a common pattern to look up a value in a `Map`, and then, if the value does not exist, set
14
15
  -- a default value for the key, and then return the default value. `DefaultMap` abstracts this
@@ -1,6 +1,6 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  /// <reference types="isaac-typescript-definitions" />
3
- import { CustomStageRoomMetadata } from "../../interfaces/CustomStageLua";
3
+ import { CustomStageBossPoolEntry, CustomStageRoomMetadata } from "../../interfaces/CustomStageTSConfig";
4
4
  /**
5
5
  * Helper function to get a random custom stage room from an array of custom stage rooms.
6
6
  *
@@ -9,4 +9,5 @@ import { CustomStageRoomMetadata } from "../../interfaces/CustomStageLua";
9
9
  * https://stackoverflow.com/questions/1761626/weighted-random-numbers
10
10
  */
11
11
  export declare function getRandomCustomStageRoom(roomsMetadata: readonly CustomStageRoomMetadata[], seedOrRNG?: Seed | RNG, verbose?: boolean): CustomStageRoomMetadata;
12
+ export declare function getRandomBossRoomFromPool(roomsMetadata: readonly CustomStageRoomMetadata[], bossPool: readonly CustomStageBossPoolEntry[], seedOrRNG?: Seed | RNG, verbose?: boolean): CustomStageRoomMetadata;
12
13
  //# sourceMappingURL=customStageUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"customStageUtils.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/customStageUtils.ts"],"names":[],"mappings":";;AAIA,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAE1E;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,aAAa,EAAE,SAAS,uBAAuB,EAAE,EACjD,SAAS,GAAE,IAAI,GAAG,GAAqB,EACvC,OAAO,UAAQ,GACd,uBAAuB,CAYzB"}
1
+ {"version":3,"file":"customStageUtils.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/customStageUtils.ts"],"names":[],"mappings":";;AAIA,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,sCAAsC,CAAC;AAE9C;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,aAAa,EAAE,SAAS,uBAAuB,EAAE,EACjD,SAAS,GAAE,IAAI,GAAG,GAAqB,EACvC,OAAO,UAAQ,GACd,uBAAuB,CAYzB;AA0BD,wBAAgB,yBAAyB,CACvC,aAAa,EAAE,SAAS,uBAAuB,EAAE,EACjD,QAAQ,EAAE,SAAS,wBAAwB,EAAE,EAC7C,SAAS,GAAE,IAAI,GAAG,GAAqB,EACvC,OAAO,UAAQ,GACd,uBAAuB,CAiBzB"}
@@ -1,7 +1,8 @@
1
1
  local ____lualib = require("lualib_bundle")
2
2
  local __TS__ArrayMap = ____lualib.__TS__ArrayMap
3
+ local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
3
4
  local ____exports = {}
4
- local getTotalWeightOfCustomStageRooms, getCustomStageRoomWithChosenWeight
5
+ local getTotalWeightOfCustomStageRooms, getCustomStageRoomWithChosenWeight, getTotalWeightOfBossPool, getBossEntryWithChosenWeight
5
6
  local ____array = require("functions.array")
6
7
  local sumArray = ____array.sumArray
7
8
  local ____log = require("functions.log")
@@ -26,6 +27,22 @@ function getCustomStageRoomWithChosenWeight(self, roomsMetadata, chosenWeight)
26
27
  end
27
28
  error("Failed to get a custom stage room with chosen weight: " .. tostring(chosenWeight))
28
29
  end
30
+ function getTotalWeightOfBossPool(self, bossPool)
31
+ local weights = __TS__ArrayMap(
32
+ bossPool,
33
+ function(____, bossEntry) return bossEntry.weight end
34
+ )
35
+ return sumArray(nil, weights)
36
+ end
37
+ function getBossEntryWithChosenWeight(self, bossPool, chosenWeight)
38
+ for ____, bossEntry in ipairs(bossPool) do
39
+ if chosenWeight < bossEntry.weight then
40
+ return bossEntry
41
+ end
42
+ chosenWeight = chosenWeight - bossEntry.weight
43
+ end
44
+ error("Failed to get a custom stage boss entry with chosen weight: " .. tostring(chosenWeight))
45
+ end
29
46
  --- Helper function to get a random custom stage room from an array of custom stage rooms.
30
47
  --
31
48
  -- Note that this function does not simply choose a random element in the provided array; it will
@@ -48,4 +65,26 @@ function ____exports.getRandomCustomStageRoom(self, roomsMetadata, seedOrRNG, ve
48
65
  end
49
66
  return getCustomStageRoomWithChosenWeight(nil, roomsMetadata, chosenWeight)
50
67
  end
68
+ function ____exports.getRandomBossRoomFromPool(self, roomsMetadata, bossPool, seedOrRNG, verbose)
69
+ if seedOrRNG == nil then
70
+ seedOrRNG = getRandomSeed(nil)
71
+ end
72
+ if verbose == nil then
73
+ verbose = false
74
+ end
75
+ local totalWeight = getTotalWeightOfBossPool(nil, bossPool)
76
+ if verbose then
77
+ log("Total weight of the custom stage boss pool provided: " .. tostring(totalWeight))
78
+ end
79
+ local chosenWeight = getRandomFloat(nil, 0, totalWeight, seedOrRNG)
80
+ if verbose then
81
+ log("Randomly chose weight for custom stage boss pool: " .. tostring(chosenWeight))
82
+ end
83
+ local bossEntry = getBossEntryWithChosenWeight(nil, bossPool, chosenWeight)
84
+ local roomsMetadataForBoss = __TS__ArrayFilter(
85
+ roomsMetadata,
86
+ function(____, roomMetadata) return roomMetadata.subType == bossEntry.subType end
87
+ )
88
+ return ____exports.getRandomCustomStageRoom(nil, roomsMetadataForBoss, seedOrRNG, verbose)
89
+ end
51
90
  return ____exports
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * @module
7
7
  */
8
- import { EntityType, LevelStage, StageType } from "isaac-typescript-definitions";
8
+ import { LevelStage, StageType } from "isaac-typescript-definitions";
9
9
  export declare const DEFAULT_BASE_STAGE = LevelStage.BASEMENT_2;
10
10
  export declare const DEFAULT_BASE_STAGE_TYPE = StageType.ORIGINAL;
11
11
  export declare const INVALID_STAGE_VALUE: LevelStage;
@@ -23,30 +23,6 @@ export declare const INVALID_STAGE_VALUE: LevelStage;
23
23
  * Default is false.
24
24
  */
25
25
  export declare function setCustomStage(name: string, firstFloor?: boolean, verbose?: boolean): void;
26
- /**
27
- * By default, unknown bosses will be drawn on the boss "versus" screen as "???". If your custom
28
- * stage has custom bosses, you can use this function to register the corresponding graphic file
29
- * files for them.
30
- *
31
- * For reference:
32
- * - The vanilla name sprite for Monstro is located at:
33
- * `resources/gfx/ui/boss/bossname_20.0_monstro.png`
34
- * - The vanilla portrait sprite for Monstro is located at:
35
- * `resources/gfx/ui/boss/portrait_20.0_monstro.png`
36
- *
37
- * (Note that boss metadata like this cannot be specified with the rest of the custom stage metadata
38
- * in the "tsconfig.json" file because there is not a way to retrieve the name of an entity at
39
- * run-time.)
40
- *
41
- * @param entityType The entity type of the custom boss.
42
- * @param variant The variant of the custom boss.
43
- * @param subType The sub-type of the custom boss.
44
- * @param namePNGPath The full path to the PNG file that contains the name of the boss that will be
45
- * displayed on the top of the boss "versus" screen.
46
- * @param portraitPNGPath The full path to the PNG file that contains the portrait of the boss that
47
- * will be displayed on the right side of the boss "versus" screen.
48
- */
49
- export declare function registerCustomBoss(entityType: EntityType, variant: int, subType: int, namePNGPath: string, portraitPNGPath: string): void;
50
26
  /**
51
27
  * Helper function to disable the custom stage. This is typically called before taking the player to
52
28
  * a vanilla floor.
@@ -1 +1 @@
1
- {"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/exports.ts"],"names":[],"mappings":"AACA;;;;;;GAMG;AAEH,OAAO,EACL,UAAU,EACV,UAAU,EAGV,SAAS,EACV,MAAM,8BAA8B,CAAC;AAoBtC,eAAO,MAAM,kBAAkB,wBAAwB,CAAC;AACxD,eAAO,MAAM,uBAAuB,qBAAqB,CAAC;AAE1D,eAAO,MAAM,mBAAmB,YAAmB,CAAC;AAEpD;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,UAAU,UAAO,EACjB,OAAO,UAAQ,GACd,IAAI,CAwDN;AA4ED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,GAAG,EACZ,OAAO,EAAE,GAAG,EACZ,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,MAAM,GACtB,IAAI,CAGN;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC"}
1
+ {"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/exports.ts"],"names":[],"mappings":"AACA;;;;;;GAMG;AAEH,OAAO,EAEL,UAAU,EAGV,SAAS,EACV,MAAM,8BAA8B,CAAC;AAoBtC,eAAO,MAAM,kBAAkB,wBAAwB,CAAC;AACxD,eAAO,MAAM,uBAAuB,qBAAqB,CAAC;AAE1D,eAAO,MAAM,mBAAmB,YAAmB,CAAC;AAEpD;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,UAAU,UAAO,EACjB,OAAO,UAAQ,GACd,IAAI,CAwDN;AAkGD;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC"}
@@ -1,8 +1,10 @@
1
1
  local ____lualib = require("lualib_bundle")
2
2
  local Map = ____lualib.Map
3
+ local __TS__ArrayMap = ____lualib.__TS__ArrayMap
3
4
  local ____exports = {}
4
5
  local setStageRoomsData
5
6
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
7
+ local DoorSlot = ____isaac_2Dtypescript_2Ddefinitions.DoorSlot
6
8
  local LevelStage = ____isaac_2Dtypescript_2Ddefinitions.LevelStage
7
9
  local RoomShape = ____isaac_2Dtypescript_2Ddefinitions.RoomShape
8
10
  local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
@@ -11,8 +13,8 @@ local ____reorderedCallbacks = require("callbacks.reorderedCallbacks")
11
13
  local reorderedCallbacksSetStageInternal = ____reorderedCallbacks.reorderedCallbacksSetStageInternal
12
14
  local ____cachedClasses = require("core.cachedClasses")
13
15
  local game = ____cachedClasses.game
14
- local ____entities = require("functions.entities")
15
- local getEntityIDFromConstituents = ____entities.getEntityIDFromConstituents
16
+ local ____doors = require("functions.doors")
17
+ local doorSlotFlagsToDoorSlots = ____doors.doorSlotFlagsToDoorSlots
16
18
  local ____log = require("functions.log")
17
19
  local logError = ____log.logError
18
20
  local ____rng = require("functions.rng")
@@ -25,10 +27,10 @@ local setStage = ____stage.setStage
25
27
  local ____types = require("functions.types")
26
28
  local asNumber = ____types.asNumber
27
29
  local ____customStageUtils = require("features.customStage.customStageUtils")
30
+ local getRandomBossRoomFromPool = ____customStageUtils.getRandomBossRoomFromPool
28
31
  local getRandomCustomStageRoom = ____customStageUtils.getRandomCustomStageRoom
29
32
  local ____v = require("features.customStage.v")
30
33
  local v = ____v.default
31
- local customBossPNGPaths = ____v.customBossPNGPaths
32
34
  local customStageCachedRoomData = ____v.customStageCachedRoomData
33
35
  local customStagesMap = ____v.customStagesMap
34
36
  function setStageRoomsData(self, customStage, rng, verbose)
@@ -60,9 +62,31 @@ function setStageRoomsData(self, customStage, rng, verbose)
60
62
  local roomsMetadata = roomDoorSlotFlagMap:get(doorSlotFlags)
61
63
  if roomsMetadata == nil then
62
64
  logError((((((((((("Failed to find any custom rooms for RoomType." .. tostring(RoomType[roomType])) .. " (") .. tostring(roomType)) .. ") + RoomShape.") .. tostring(RoomShape[roomShape])) .. " (") .. tostring(roomShape)) .. ") + DoorSlotFlags ") .. tostring(doorSlotFlags)) .. " for custom stage: ") .. customStage.name)
65
+ local header = ("For reference, a DoorSlotFlags of " .. tostring(doorSlotFlags)) .. " is equal to the following doors being enabled:\n"
66
+ local doorSlots = doorSlotFlagsToDoorSlots(nil, doorSlotFlags)
67
+ local doorSlotLines = __TS__ArrayMap(
68
+ doorSlots,
69
+ function(____, doorSlot) return ((("- DoorSlot." .. tostring(DoorSlot[doorSlot])) .. " (") .. tostring(doorSlot)) .. ")" end
70
+ )
71
+ local explanation = header .. table.concat(doorSlotLines, "\n")
72
+ logError(explanation)
63
73
  goto __continue7
64
74
  end
65
- local randomRoom = getRandomCustomStageRoom(nil, roomsMetadata, rng, verbose)
75
+ local randomRoom
76
+ if roomType == RoomType.BOSS then
77
+ if customStage.bossPool == nil then
78
+ goto __continue7
79
+ end
80
+ randomRoom = getRandomBossRoomFromPool(
81
+ nil,
82
+ roomsMetadata,
83
+ customStage.bossPool,
84
+ rng,
85
+ verbose
86
+ )
87
+ else
88
+ randomRoom = getRandomCustomStageRoom(nil, roomsMetadata, rng, verbose)
89
+ end
66
90
  local newRoomData = customStageCachedRoomData:get(randomRoom.variant)
67
91
  if newRoomData == nil then
68
92
  newRoomData = getRoomDataForTypeVariant(nil, roomType, randomRoom.variant, false)
@@ -125,31 +149,6 @@ function ____exports.setCustomStage(self, name, firstFloor, verbose)
125
149
  level:SetStage(targetStage, targetStageType)
126
150
  reorderedCallbacksSetStageInternal(nil, targetStage, targetStageType)
127
151
  end
128
- --- By default, unknown bosses will be drawn on the boss "versus" screen as "???". If your custom
129
- -- stage has custom bosses, you can use this function to register the corresponding graphic file
130
- -- files for them.
131
- --
132
- -- For reference:
133
- -- - The vanilla name sprite for Monstro is located at:
134
- -- `resources/gfx/ui/boss/bossname_20.0_monstro.png`
135
- -- - The vanilla portrait sprite for Monstro is located at:
136
- -- `resources/gfx/ui/boss/portrait_20.0_monstro.png`
137
- --
138
- -- (Note that boss metadata like this cannot be specified with the rest of the custom stage metadata
139
- -- in the "tsconfig.json" file because there is not a way to retrieve the name of an entity at
140
- -- run-time.)
141
- --
142
- -- @param entityType The entity type of the custom boss.
143
- -- @param variant The variant of the custom boss.
144
- -- @param subType The sub-type of the custom boss.
145
- -- @param namePNGPath The full path to the PNG file that contains the name of the boss that will be
146
- -- displayed on the top of the boss "versus" screen.
147
- -- @param portraitPNGPath The full path to the PNG file that contains the portrait of the boss that
148
- -- will be displayed on the right side of the boss "versus" screen.
149
- function ____exports.registerCustomBoss(self, entityType, variant, subType, namePNGPath, portraitPNGPath)
150
- local entityID = getEntityIDFromConstituents(nil, entityType, variant, subType)
151
- customBossPNGPaths:set(entityID, {namePNGPath, portraitPNGPath})
152
- end
153
152
  --- Helper function to disable the custom stage. This is typically called before taking the player to
154
153
  -- a vanilla floor.
155
154
  function ____exports.disableCustomStage(self)
@@ -30,6 +30,4 @@ export default v;
30
30
  export declare const customStagesMap: Map<string, CustomStage>;
31
31
  /** Indexed by room variant. */
32
32
  export declare const customStageCachedRoomData: Map<number, Readonly<RoomConfig>>;
33
- /** Indexed by entity ID. */
34
- export declare const customBossPNGPaths: Map<string, [namePNGPath: string, portraitPNGPath: string]>;
35
33
  //# sourceMappingURL=v.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"v.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/v.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,QAAA,MAAM,CAAC;;;QAIH,iDAAiD;;;QAKjD,oFAAoF;;;;;;;;;;;;;;;;;CAqBvF,CAAC;AACF,eAAe,CAAC,CAAC;AAEjB,oCAAoC;AACpC,eAAO,MAAM,eAAe,0BAAiC,CAAC;AAE9D,+BAA+B;AAC/B,eAAO,MAAM,yBAAyB,mCAAuC,CAAC;AAE9E,4BAA4B;AAC5B,eAAO,MAAM,kBAAkB,6DAG5B,CAAC"}
1
+ {"version":3,"file":"v.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/v.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,QAAA,MAAM,CAAC;;;QAIH,iDAAiD;;;QAKjD,oFAAoF;;;;;;;;;;;;;;;;;CAqBvF,CAAC;AACF,eAAe,CAAC,CAAC;AAEjB,oCAAoC;AACpC,eAAO,MAAM,eAAe,0BAAiC,CAAC;AAE9D,+BAA+B;AAC/B,eAAO,MAAM,yBAAyB,mCAAuC,CAAC"}
@@ -21,6 +21,4 @@ ____exports.default = v
21
21
  ____exports.customStagesMap = __TS__New(Map)
22
22
  --- Indexed by room variant.
23
23
  ____exports.customStageCachedRoomData = __TS__New(Map)
24
- --- Indexed by entity ID.
25
- ____exports.customBossPNGPaths = __TS__New(Map)
26
24
  return ____exports
@@ -1 +1 @@
1
- {"version":3,"file":"versusScreen.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/versusScreen.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AA2EnE;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAavC;AAED,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,CAwExE;AAoFD,wBAAgB,sBAAsB,IAAI,IAAI,CAoC7C"}
1
+ {"version":3,"file":"versusScreen.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/versusScreen.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AA2EnE;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAavC;AAED,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,CA2ExE;AAkGD,wBAAgB,sBAAsB,IAAI,IAAI,CAkC7C"}
@@ -1,8 +1,8 @@
1
1
  local ____lualib = require("lualib_bundle")
2
- local Map = ____lualib.Map
3
2
  local __TS__ArraySome = ____lualib.__TS__ArraySome
3
+ local __TS__ArrayFind = ____lualib.__TS__ArrayFind
4
4
  local ____exports = {}
5
- local willVanillaVersusScreenPlay, getPlayerPNGPaths, getBossPNGPaths, DEFAULT_CHARACTER, PNG_PATH_PREFIX, PLAYER_PORTRAIT_PNG_PATH_PREFIX
5
+ local willVanillaVersusScreenPlay, getPlayerPNGPaths, getBossPNGPaths, getBossPNGPathsCustom, DEFAULT_CHARACTER, PNG_PATH_PREFIX, PLAYER_PORTRAIT_PNG_PATH_PREFIX
6
6
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
7
7
  local BossID = ____isaac_2Dtypescript_2Ddefinitions.BossID
8
8
  local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
@@ -17,8 +17,8 @@ local ____array = require("functions.array")
17
17
  local arrayRemove = ____array.arrayRemove
18
18
  local ____bosses = require("functions.bosses")
19
19
  local getBosses = ____bosses.getBosses
20
- local ____entities = require("functions.entities")
21
- local getEntityID = ____entities.getEntityID
20
+ local ____roomData = require("functions.roomData")
21
+ local getRoomSubType = ____roomData.getRoomSubType
22
22
  local ____utils = require("functions.utils")
23
23
  local erange = ____utils.erange
24
24
  local ____bossNamePNGFileNames = require("objects.bossNamePNGFileNames")
@@ -46,7 +46,6 @@ local DEFAULT_BASE_STAGE_TYPE = ____exports.DEFAULT_BASE_STAGE_TYPE
46
46
  local INVALID_STAGE_VALUE = ____exports.INVALID_STAGE_VALUE
47
47
  local ____v = require("features.customStage.v")
48
48
  local v = ____v.default
49
- local customBossPNGPaths = ____v.customBossPNGPaths
50
49
  function willVanillaVersusScreenPlay(self)
51
50
  local bosses = getBosses(nil)
52
51
  return __TS__ArraySome(
@@ -57,40 +56,51 @@ end
57
56
  function getPlayerPNGPaths(self)
58
57
  local player = Isaac.GetPlayer()
59
58
  local character = player:GetPlayerType()
60
- local playerNamePNGFileName = PLAYER_NAME_PNG_FILE_NAMES[character]
61
- if playerNamePNGFileName == nil then
62
- playerNamePNGFileName = PLAYER_NAME_PNG_FILE_NAMES[DEFAULT_CHARACTER]
59
+ local namePNGFileName = PLAYER_NAME_PNG_FILE_NAMES[character]
60
+ if namePNGFileName == nil then
61
+ namePNGFileName = PLAYER_NAME_PNG_FILE_NAMES[DEFAULT_CHARACTER]
63
62
  end
64
- local playerNamePNGPath = (PNG_PATH_PREFIX .. "/") .. tostring(playerNamePNGFileName)
65
- local playerPortraitFileName = PLAYER_PORTRAIT_PNG_FILE_NAMES[character]
66
- if playerNamePNGFileName == nil then
67
- playerPortraitFileName = PLAYER_PORTRAIT_PNG_FILE_NAMES[DEFAULT_CHARACTER]
63
+ local namePNGPath = (PNG_PATH_PREFIX .. "/") .. tostring(namePNGFileName)
64
+ local portraitFileName = PLAYER_PORTRAIT_PNG_FILE_NAMES[character]
65
+ if namePNGFileName == nil then
66
+ portraitFileName = PLAYER_PORTRAIT_PNG_FILE_NAMES[DEFAULT_CHARACTER]
68
67
  end
69
- local playerPortraitPNGPath = (PLAYER_PORTRAIT_PNG_PATH_PREFIX .. "/") .. tostring(playerPortraitFileName)
70
- return {playerNamePNGPath, playerPortraitPNGPath}
68
+ local portraitPNGPath = (PLAYER_PORTRAIT_PNG_PATH_PREFIX .. "/") .. tostring(portraitFileName)
69
+ return {namePNGPath = namePNGPath, portraitPNGPath = portraitPNGPath}
71
70
  end
72
- function getBossPNGPaths(self)
71
+ function getBossPNGPaths(self, customStage)
72
+ local paths = getBossPNGPathsCustom(nil, customStage)
73
+ if paths ~= nil then
74
+ return paths
75
+ end
73
76
  local bosses = getBosses(nil)
74
77
  local firstBoss = bosses[1]
75
- if firstBoss ~= nil then
76
- local entityID = getEntityID(nil, firstBoss)
77
- local pngPaths = customBossPNGPaths:get(entityID)
78
- if pngPaths ~= nil then
79
- return pngPaths
80
- end
81
- end
82
78
  local bossID = firstBoss == nil and 0 or firstBoss:GetBossID()
83
79
  if bossID == 0 then
84
80
  local questionMarkSprite = (PNG_PATH_PREFIX .. "/") .. BOSS_NAME_PNG_FILE_NAMES[BossID.BLUE_BABY]
85
- local bossNamePNGPath = questionMarkSprite
86
- local bossPortraitPNGPath = questionMarkSprite
87
- return {bossNamePNGPath, bossPortraitPNGPath}
88
- end
89
- local bossNamePNGFileName = BOSS_NAME_PNG_FILE_NAMES[bossID]
90
- local bossNamePNGPath = (PNG_PATH_PREFIX .. "/") .. bossNamePNGFileName
91
- local bossPortraitPNGFileName = BOSS_PORTRAIT_PNG_FILE_NAMES[bossID]
92
- local bossPortraitPNGPath = (PNG_PATH_PREFIX .. "/") .. bossPortraitPNGFileName
93
- return {bossNamePNGPath, bossPortraitPNGPath}
81
+ local namePNGPath = questionMarkSprite
82
+ local portraitPNGPath = questionMarkSprite
83
+ return {namePNGPath = namePNGPath, portraitPNGPath = portraitPNGPath}
84
+ end
85
+ local namePNGFileName = BOSS_NAME_PNG_FILE_NAMES[bossID]
86
+ local namePNGPath = (PNG_PATH_PREFIX .. "/") .. namePNGFileName
87
+ local portraitPNGFileName = BOSS_PORTRAIT_PNG_FILE_NAMES[bossID]
88
+ local portraitPNGPath = (PNG_PATH_PREFIX .. "/") .. portraitPNGFileName
89
+ return {namePNGPath = namePNGPath, portraitPNGPath = portraitPNGPath}
90
+ end
91
+ function getBossPNGPathsCustom(self, customStage)
92
+ if customStage.bossPool == nil then
93
+ return nil
94
+ end
95
+ local roomSubType = getRoomSubType(nil)
96
+ local matchingBossEntry = __TS__ArrayFind(
97
+ customStage.bossPool,
98
+ function(____, bossEntry) return bossEntry.subType == roomSubType end
99
+ )
100
+ if matchingBossEntry == nil then
101
+ return nil
102
+ end
103
+ return matchingBossEntry.versusScreen
94
104
  end
95
105
  DEFAULT_CHARACTER = PlayerType.ISAAC
96
106
  local DEFAULT_STAGE_ID = StageID.BASEMENT
@@ -164,37 +174,45 @@ function ____exports.playVersusScreenAnimation(self, customStage)
164
174
  v.run.showingBossVersusScreen = true
165
175
  pause(nil)
166
176
  hud:SetVisible(false)
167
- local playerNamePNGPath, playerPortraitPNGPath = table.unpack(getPlayerPNGPaths(nil))
168
- versusScreenSprite:ReplaceSpritesheet(PLAYER_NAME_ANM2_LAYER, playerNamePNGPath)
169
- versusScreenSprite:ReplaceSpritesheet(PLAYER_PORTRAIT_ANM2_LAYER, playerPortraitPNGPath)
170
- local bossNamePNGPath, bossPortraitPNGPath = table.unpack(getBossPNGPaths(nil))
171
- versusScreenSprite:ReplaceSpritesheet(BOSS_NAME_ANM2_LAYER, bossNamePNGPath)
172
- versusScreenSprite:ReplaceSpritesheet(BOSS_PORTRAIT_ANM2_LAYER, bossPortraitPNGPath)
177
+ do
178
+ local ____getPlayerPNGPaths_result_0 = getPlayerPNGPaths(nil)
179
+ local namePNGPath = ____getPlayerPNGPaths_result_0.namePNGPath
180
+ local portraitPNGPath = ____getPlayerPNGPaths_result_0.portraitPNGPath
181
+ versusScreenSprite:ReplaceSpritesheet(PLAYER_NAME_ANM2_LAYER, namePNGPath)
182
+ versusScreenSprite:ReplaceSpritesheet(PLAYER_PORTRAIT_ANM2_LAYER, portraitPNGPath)
183
+ end
184
+ do
185
+ local ____getBossPNGPaths_result_1 = getBossPNGPaths(nil, customStage)
186
+ local namePNGPath = ____getBossPNGPaths_result_1.namePNGPath
187
+ local portraitPNGPath = ____getBossPNGPaths_result_1.portraitPNGPath
188
+ versusScreenSprite:ReplaceSpritesheet(BOSS_NAME_ANM2_LAYER, namePNGPath)
189
+ versusScreenSprite:ReplaceSpritesheet(BOSS_PORTRAIT_ANM2_LAYER, portraitPNGPath)
190
+ end
173
191
  versusScreenSprite:LoadGraphics()
174
192
  local backgroundColor = VERSUS_SCREEN_BACKGROUND_COLORS[DEFAULT_STAGE_ID]
175
- local ____customStage_versusScreen_backgroundColor_0 = customStage.versusScreen
176
- if ____customStage_versusScreen_backgroundColor_0 ~= nil then
177
- ____customStage_versusScreen_backgroundColor_0 = ____customStage_versusScreen_backgroundColor_0.backgroundColor
178
- end
179
- if ____customStage_versusScreen_backgroundColor_0 ~= nil then
180
- local ____customStage_versusScreen_backgroundColor_2 = customStage.versusScreen.backgroundColor
181
- local r = ____customStage_versusScreen_backgroundColor_2.r
182
- local g = ____customStage_versusScreen_backgroundColor_2.g
183
- local b = ____customStage_versusScreen_backgroundColor_2.b
184
- local a = ____customStage_versusScreen_backgroundColor_2.a
193
+ local ____customStage_versusScreen_backgroundColor_2 = customStage.versusScreen
194
+ if ____customStage_versusScreen_backgroundColor_2 ~= nil then
195
+ ____customStage_versusScreen_backgroundColor_2 = ____customStage_versusScreen_backgroundColor_2.backgroundColor
196
+ end
197
+ if ____customStage_versusScreen_backgroundColor_2 ~= nil then
198
+ local ____customStage_versusScreen_backgroundColor_4 = customStage.versusScreen.backgroundColor
199
+ local r = ____customStage_versusScreen_backgroundColor_4.r
200
+ local g = ____customStage_versusScreen_backgroundColor_4.g
201
+ local b = ____customStage_versusScreen_backgroundColor_4.b
202
+ local a = ____customStage_versusScreen_backgroundColor_4.a
185
203
  backgroundColor = Color(r, g, b, a)
186
204
  end
187
205
  versusScreenBackgroundSprite.Color = backgroundColor
188
206
  local dirtSpotColor = VERSUS_SCREEN_DIRT_SPOT_COLORS[DEFAULT_STAGE_ID]
189
- local ____customStage_versusScreen_dirtSpotColor_3 = customStage.versusScreen
190
- if ____customStage_versusScreen_dirtSpotColor_3 ~= nil then
191
- ____customStage_versusScreen_dirtSpotColor_3 = ____customStage_versusScreen_dirtSpotColor_3.dirtSpotColor
192
- end
193
- if ____customStage_versusScreen_dirtSpotColor_3 ~= nil then
194
- local ____customStage_versusScreen_dirtSpotColor_5 = customStage.versusScreen.dirtSpotColor
195
- local r = ____customStage_versusScreen_dirtSpotColor_5.r
196
- local g = ____customStage_versusScreen_dirtSpotColor_5.g
197
- local b = ____customStage_versusScreen_dirtSpotColor_5.b
207
+ local ____customStage_versusScreen_dirtSpotColor_5 = customStage.versusScreen
208
+ if ____customStage_versusScreen_dirtSpotColor_5 ~= nil then
209
+ ____customStage_versusScreen_dirtSpotColor_5 = ____customStage_versusScreen_dirtSpotColor_5.dirtSpotColor
210
+ end
211
+ if ____customStage_versusScreen_dirtSpotColor_5 ~= nil then
212
+ local ____customStage_versusScreen_dirtSpotColor_7 = customStage.versusScreen.dirtSpotColor
213
+ local r = ____customStage_versusScreen_dirtSpotColor_7.r
214
+ local g = ____customStage_versusScreen_dirtSpotColor_7.g
215
+ local b = ____customStage_versusScreen_dirtSpotColor_7.b
198
216
  dirtSpotColor = Color(r, g, b)
199
217
  end
200
218
  versusScreenDirtSpotSprite.Color = dirtSpotColor
@@ -214,10 +232,6 @@ function ____exports.versusScreenPostRender(self)
214
232
  if not v.run.showingBossVersusScreen then
215
233
  return
216
234
  end
217
- local isPaused = game:IsPaused()
218
- if isPaused then
219
- return
220
- end
221
235
  if versusScreenSprite:IsFinished(VERSUS_SCREEN_ANIMATION_NAME) then
222
236
  finishVersusScreenAnimation(nil)
223
237
  return
@@ -6,8 +6,14 @@ export declare function closeAllDoors(): void;
6
6
  */
7
7
  export declare function closeDoorFast(door: GridEntityDoor): void;
8
8
  export declare function doorSlotFlagToDoorSlot(doorSlotFlag: DoorSlotFlag): DoorSlot;
9
+ export declare function doorSlotFlagsToDoorSlots(doorSlotFlags: BitFlags<DoorSlotFlag>): DoorSlot[];
9
10
  export declare function doorSlotToDirection(doorSlot: DoorSlot): Direction;
10
11
  export declare function doorSlotToDoorSlotFlag(doorSlot: DoorSlot): DoorSlotFlag;
12
+ /**
13
+ * Helper function to convert an array of door slots or a set of door slots to the resulting bit
14
+ * flag number.
15
+ */
16
+ export declare function doorSlotsToDoorSlotFlags(doorSlots: DoorSlot[] | readonly DoorSlot[] | Set<DoorSlot> | ReadonlySet<DoorSlot>): BitFlags<DoorSlotFlag>;
11
17
  export declare function getAngelRoomDoor(): GridEntityDoor | undefined;
12
18
  export declare function getDevilRoomDoor(): GridEntityDoor | undefined;
13
19
  /**
@@ -31,11 +37,6 @@ export declare function getDoorEnterPosition(door: GridEntityDoor): Readonly<Vec
31
37
  * amount of units.
32
38
  */
33
39
  export declare function getDoorSlotEnterPositionOffset(doorSlot: DoorSlot): Readonly<Vector>;
34
- /**
35
- * Helper function to convert an array of door slots or a set of door slots to the resulting bit
36
- * flag number.
37
- */
38
- export declare function getDoorSlotFlags(doorSlots: DoorSlot[] | readonly DoorSlot[] | Set<DoorSlot> | ReadonlySet<DoorSlot>): BitFlags<DoorSlotFlag>;
39
40
  /** Helper function to get the possible door slots that can exist for a given room shape. */
40
41
  export declare function getDoorSlotsForRoomShape(roomShape: RoomShape): ReadonlySet<DoorSlot>;
41
42
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"doors.d.ts","sourceRoot":"","sources":["../../src/functions/doors.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,QAAQ,EACR,YAAY,EAIZ,SAAS,EACT,QAAQ,EACT,MAAM,8BAA8B,CAAC;AAwBtC,wBAAgB,aAAa,IAAI,IAAI,CAIpC;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAKxD;AAED,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,YAAY,GAAG,QAAQ,CAG3E;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAEjE;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,QAAQ,GAAG,YAAY,CAEvE;AAED,wBAAgB,gBAAgB,IAAI,cAAc,GAAG,SAAS,CAG7D;AAED,wBAAgB,gBAAgB,IAAI,cAAc,GAAG,SAAS,CAG7D;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,IAAI,cAAc,GAAG,SAAS,CAKxE;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAo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,wBAAgB,aAAa,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAU3D;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAU/D;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAKpE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAE9D;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAM9D;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAUnD;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI,IAAI,CAMnC;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAKvD;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,GAAG,SAAS,EAAE,QAAQ,EAAE,GAAG,GAAG,CAK5D;AAED,+CAA+C;AAC/C,wBAAgB,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAGrD;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,KAAK,EAAE,cAAc,EAAE,GAAG,IAAI,CAI5D"}
@@ -10,6 +10,7 @@ local ____exports = {}
10
10
  local ROOM_ENTRY_OFFSET_FROM_DOOR
11
11
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
12
12
  local DoorSlot = ____isaac_2Dtypescript_2Ddefinitions.DoorSlot
13
+ local DoorSlotFlag = ____isaac_2Dtypescript_2Ddefinitions.DoorSlotFlag
13
14
  local DoorState = ____isaac_2Dtypescript_2Ddefinitions.DoorState
14
15
  local DoorVariant = ____isaac_2Dtypescript_2Ddefinitions.DoorVariant
15
16
  local GridRoom = ____isaac_2Dtypescript_2Ddefinitions.GridRoom
@@ -35,6 +36,8 @@ local ____direction = require("functions.direction")
35
36
  local directionToVector = ____direction.directionToVector
36
37
  local ____enums = require("functions.enums")
37
38
  local getEnumValues = ____enums.getEnumValues
39
+ local ____flag = require("functions.flag")
40
+ local hasFlag = ____flag.hasFlag
38
41
  local ____tstlClass = require("functions.tstlClass")
39
42
  local isTSTLSet = ____tstlClass.isTSTLSet
40
43
  local ____types = require("functions.types")
@@ -66,13 +69,13 @@ function ____exports.getDoors(self, ...)
66
69
  do
67
70
  local door = room:GetDoor(doorSlot)
68
71
  if door == nil then
69
- goto __continue18
72
+ goto __continue22
70
73
  end
71
74
  if roomTypesSet.size == 0 or roomTypesSet:has(door.TargetRoomType) then
72
75
  doors[#doors + 1] = door
73
76
  end
74
77
  end
75
- ::__continue18::
78
+ ::__continue22::
76
79
  end
77
80
  return doors
78
81
  end
@@ -120,9 +123,29 @@ function ____exports.doorSlotFlagToDoorSlot(self, doorSlotFlag)
120
123
  local doorSlot = DOOR_SLOT_FLAG_TO_DOOR_SLOT[doorSlotFlag]
121
124
  return doorSlot == nil and DEFAULT_DOOR_SLOT or doorSlot
122
125
  end
126
+ function ____exports.doorSlotFlagsToDoorSlots(self, doorSlotFlags)
127
+ local doorSlots = {}
128
+ for ____, doorSlotFlag in ipairs(getEnumValues(nil, DoorSlotFlag)) do
129
+ if hasFlag(nil, doorSlotFlags, doorSlotFlag) then
130
+ local doorSlot = ____exports.doorSlotFlagToDoorSlot(nil, doorSlotFlag)
131
+ doorSlots[#doorSlots + 1] = doorSlot
132
+ end
133
+ end
134
+ return doorSlots
135
+ end
123
136
  function ____exports.doorSlotToDoorSlotFlag(self, doorSlot)
124
137
  return DOOR_SLOT_TO_DOOR_SLOT_FLAG[doorSlot]
125
138
  end
139
+ --- Helper function to convert an array of door slots or a set of door slots to the resulting bit
140
+ -- flag number.
141
+ function ____exports.doorSlotsToDoorSlotFlags(self, doorSlots)
142
+ local doorSlotArray = isTSTLSet(nil, doorSlots) and ({__TS__Spread(doorSlots:values())}) or doorSlots
143
+ local doorSlotFlagArray = __TS__ArrayMap(
144
+ doorSlotArray,
145
+ function(____, doorSlot) return ____exports.doorSlotToDoorSlotFlag(nil, doorSlot) end
146
+ )
147
+ return arrayToBitFlags(nil, doorSlotFlagArray)
148
+ end
126
149
  function ____exports.getAngelRoomDoor(self)
127
150
  local angelRoomDoors = ____exports.getDoors(nil, RoomType.ANGEL)
128
151
  local ____temp_0
@@ -164,16 +187,6 @@ function ____exports.getDoorEnterPosition(self, door)
164
187
  local offset = ____exports.getDoorSlotEnterPositionOffset(nil, door.Slot)
165
188
  return door.Position + offset
166
189
  end
167
- --- Helper function to convert an array of door slots or a set of door slots to the resulting bit
168
- -- flag number.
169
- function ____exports.getDoorSlotFlags(self, doorSlots)
170
- local doorSlotArray = isTSTLSet(nil, doorSlots) and ({__TS__Spread(doorSlots:values())}) or doorSlots
171
- local doorSlotFlagArray = __TS__ArrayMap(
172
- doorSlotArray,
173
- function(____, doorSlot) return ____exports.doorSlotToDoorSlotFlag(nil, doorSlot) end
174
- )
175
- return arrayToBitFlags(nil, doorSlotFlagArray)
176
- end
177
190
  --- Helper function to get the possible door slots that can exist for a given room shape.
178
191
  function ____exports.getDoorSlotsForRoomShape(self, roomShape)
179
192
  return ROOM_SHAPE_TO_DOOR_SLOTS[roomShape]
@@ -16,7 +16,7 @@
16
16
  * Also see the `getEnumKeys` and `getEnumValues` helper functions.
17
17
  *
18
18
  * For a more in depth explanation, see:
19
- * https://isaacscript.github.io/gotchas#iterating-over-enums
19
+ * https://isaacscript.github.io/main/gotchas#iterating-over-enums
20
20
  */
21
21
  export declare function getEnumEntries<T>(transpiledEnum: T): Array<[key: string, value: T[keyof T]]>;
22
22
  /**
@@ -33,7 +33,7 @@ export declare function getEnumEntries<T>(transpiledEnum: T): Array<[key: string
33
33
  * Also see the `getEnumEntries` and `getEnumValues` helper functions.
34
34
  *
35
35
  * For a more in depth explanation, see:
36
- * https://isaacscript.github.io/gotchas#iterating-over-enums
36
+ * https://isaacscript.github.io/main/gotchas#iterating-over-enums
37
37
  */
38
38
  export declare function getEnumKeys<T>(transpiledEnum: T): string[];
39
39
  /** Helper function to get the amount of entries inside of an enum. */
@@ -52,7 +52,7 @@ export declare function getEnumLength<T>(transpiledEnum: T): int;
52
52
  * Also see the `getEnumEntries` and `getEnumKeys` helper functions.
53
53
  *
54
54
  * For a more in depth explanation, see:
55
- * https://isaacscript.github.io/gotchas#iterating-over-enums
55
+ * https://isaacscript.github.io/main/gotchas#iterating-over-enums
56
56
  */
57
57
  export declare function getEnumValues<T>(transpiledEnum: T): Array<T[keyof T]>;
58
58
  /**