isaacscript-common 4.5.2 → 4.6.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.
Files changed (41) hide show
  1. package/constants.d.ts +0 -3
  2. package/constantsFirstLast.d.ts +0 -3
  3. package/features/characterHealthConversion.d.ts +6 -0
  4. package/features/characterStats.d.ts +5 -0
  5. package/features/deployJSONRoom.lua +2 -4
  6. package/features/disableAllSound.d.ts +0 -3
  7. package/functions/gridEntity.d.ts +12 -0
  8. package/functions/gridEntity.lua +15 -2
  9. package/functions/rng.lua +5 -0
  10. package/functions/rooms.d.ts +1 -0
  11. package/functions/rooms.lua +1 -0
  12. package/functions/stage.d.ts +6 -1
  13. package/functions/stage.lua +7 -0
  14. package/index.d.ts +0 -1
  15. package/index.lua +0 -8
  16. package/initFeatures.lua +0 -3
  17. package/maps/roomTypeMap.lua +0 -1
  18. package/objects/roomTypeGotoPrefixes.d.ts +4 -0
  19. package/objects/roomTypeGotoPrefixes.lua +35 -0
  20. package/objects/roomTypeNames.lua +0 -1
  21. package/package.json +2 -2
  22. package/types/PickingUpItem.d.ts +3 -3
  23. package/types/PickingUpItem.lua +3 -3
  24. package/enums/StageTravelEntityState.d.ts +0 -4
  25. package/enums/StageTravelEntityState.lua +0 -7
  26. package/enums/StageTravelState.d.ts +0 -6
  27. package/enums/StageTravelState.lua +0 -11
  28. package/features/customTrapdoor/constants.d.ts +0 -5
  29. package/features/customTrapdoor/constants.lua +0 -7
  30. package/features/customTrapdoor/exports.d.ts +0 -37
  31. package/features/customTrapdoor/exports.lua +0 -124
  32. package/features/customTrapdoor/init.d.ts +0 -1
  33. package/features/customTrapdoor/init.lua +0 -11
  34. package/features/customTrapdoor/stageTravel.d.ts +0 -0
  35. package/features/customTrapdoor/stageTravel.lua +0 -0
  36. package/features/customTrapdoor/trapdoor.d.ts +0 -0
  37. package/features/customTrapdoor/trapdoor.lua +0 -0
  38. package/features/customTrapdoor/v.d.ts +0 -14
  39. package/features/customTrapdoor/v.lua +0 -16
  40. package/interfaces/StageTravelEntityDescription.d.ts +0 -5
  41. package/interfaces/StageTravelEntityDescription.lua +0 -2
package/constants.d.ts CHANGED
@@ -1,6 +1,3 @@
1
- /**
2
- * @module core/Constants
3
- */
4
1
  import { CollectibleType, ItemPoolType, LevelStage, RoomType } from "isaac-typescript-definitions";
5
2
  /**
6
3
  * The distance of the laser when Azazel does not have any range up items yet. For more info, see
@@ -1,6 +1,3 @@
1
- /**
2
- * @module Constants (First and Last)
3
- */
4
1
  import { Card, CollectibleType, PillColor, PillEffect, PlayerType, TrinketType } from "isaac-typescript-definitions";
5
2
  /** Equal to `CollectibleType.SAD_ONION`. */
6
3
  export declare const FIRST_COLLECTIBLE_TYPE = CollectibleType.SAD_ONION;
@@ -1,3 +1,9 @@
1
+ /**
2
+ * Easily create custom characters that have the same health mechanic as Blue Baby (red heart
3
+ * containers --> soul hearts) or Black Judas (red heart containers --> black hearts).
4
+ *
5
+ * @module
6
+ */
1
7
  import { HeartSubType, PlayerType } from "isaac-typescript-definitions";
2
8
  export declare type ConversionHeartSubType = HeartSubType.SOUL | HeartSubType.BLACK;
3
9
  /**
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Easily create custom characters that have base stats different from that of Isaac.
3
+ *
4
+ * @module
5
+ */
1
6
  import { CacheFlag, PlayerType } from "isaac-typescript-definitions";
2
7
  /**
3
8
  * Helper function to manage the stats for a vanilla or custom character. Call this function once at
@@ -37,6 +37,7 @@ local removeAllBombs = ____entitySpecific.removeAllBombs
37
37
  local removeAllPickups = ____entitySpecific.removeAllPickups
38
38
  local ____gridEntity = require("functions.gridEntity")
39
39
  local convertXMLGridEntityType = ____gridEntity.convertXMLGridEntityType
40
+ local getAllGridIndexes = ____gridEntity.getAllGridIndexes
40
41
  local getGridEntities = ____gridEntity.getGridEntities
41
42
  local removeAllGridExcept = ____gridEntity.removeAllGridExcept
42
43
  local removeGrid = ____gridEntity.removeGrid
@@ -59,8 +60,6 @@ local setRoomCleared = ____rooms.setRoomCleared
59
60
  local setRoomUncleared = ____rooms.setRoomUncleared
60
61
  local ____spawnCollectible = require("functions.spawnCollectible")
61
62
  local spawnCollectible = ____spawnCollectible.spawnCollectible
62
- local ____utils = require("functions.utils")
63
- local erange = ____utils.erange
64
63
  local ____runInNFrames = require("features.runInNFrames")
65
64
  local runNextGameFrame = ____runInNFrames.runNextGameFrame
66
65
  local ____exports = require("features.saveDataManager.exports")
@@ -182,10 +181,9 @@ function removeSpecificNPCs(self)
182
181
  end
183
182
  function fillRoomWithDecorations(self)
184
183
  local room = game:GetRoom()
185
- local gridSize = room:GetGridSize()
186
184
  local roomListIndex = getRoomListIndex(nil)
187
185
  local decorationGridIndexes = v.level.roomToDecorationGridIndexesMap:getAndSetDefault(roomListIndex)
188
- for ____, gridIndex in ipairs(erange(nil, gridSize)) do
186
+ for ____, gridIndex in ipairs(getAllGridIndexes(nil)) do
189
187
  do
190
188
  local existingGridEntity = room:GetGridEntity(gridIndex)
191
189
  if existingGridEntity ~= nil then
@@ -1,6 +1,3 @@
1
- /**
2
- * @module Disable All Sound
3
- */
4
1
  /**
5
2
  * Helper function to stop muting all sound effects and music.
6
3
  *
@@ -5,6 +5,12 @@ import { GridEntityType, GridEntityXMLType } from "isaac-typescript-definitions"
5
5
  * 1000.0 in a room XML file, but `GridEntityType.ROCK` is equal to 2.
6
6
  */
7
7
  export declare function convertXMLGridEntityType(gridEntityXMLType: GridEntityXMLType, gridEntityXMLVariant: int): [GridEntityType, int] | undefined;
8
+ /**
9
+ * Helper function to get every legal grid index for the current room.
10
+ *
11
+ * Under the hood, this uses the `Room.GetGridSize` method.
12
+ */
13
+ export declare function getAllGridIndexes(): int[];
8
14
  /**
9
15
  * Gets the entities that have a hitbox that overlaps with any part of the square that the grid
10
16
  * entity is on.
@@ -79,6 +85,9 @@ export declare function isPostBossVoidPortal(gridEntity: GridEntity): boolean;
79
85
  * Helper function to all grid entities in the room except for ones matching the grid entity types
80
86
  * provided.
81
87
  *
88
+ * Note that this function will automatically update the room. (This means that you can spawn new
89
+ * grid entities on the same tile on the same frame, if needed.)
90
+ *
82
91
  * For example:
83
92
  *
84
93
  * ```ts
@@ -95,6 +104,9 @@ export declare function removeAllGridExcept(...gridEntityTypes: GridEntityType[]
95
104
  * Helper function to remove all of the grid entities in the room that match the grid entity types
96
105
  * provided.
97
106
  *
107
+ * Note that this function will automatically update the room. (This means that you can spawn new
108
+ * grid entities on the same tile on the same frame, if needed.)
109
+ *
98
110
  * For example:
99
111
  *
100
112
  * ```ts
@@ -32,11 +32,18 @@ local ____utils = require("functions.utils")
32
32
  local erange = ____utils.erange
33
33
  local ____vector = require("functions.vector")
34
34
  local isVector = ____vector.isVector
35
- function getAllGridEntities(self)
35
+ --- Helper function to get every legal grid index for the current room.
36
+ --
37
+ -- Under the hood, this uses the `Room.GetGridSize` method.
38
+ function ____exports.getAllGridIndexes(self)
36
39
  local room = game:GetRoom()
37
40
  local gridSize = room:GetGridSize()
41
+ return erange(nil, gridSize)
42
+ end
43
+ function getAllGridEntities(self)
44
+ local room = game:GetRoom()
38
45
  local gridEntities = {}
39
- for ____, gridIndex in ipairs(erange(nil, gridSize)) do
46
+ for ____, gridIndex in ipairs(____exports.getAllGridIndexes(nil)) do
40
47
  local gridEntity = room:GetGridEntity(gridIndex)
41
48
  if gridEntity ~= nil then
42
49
  gridEntities[#gridEntities + 1] = gridEntity
@@ -277,6 +284,9 @@ end
277
284
  --- Helper function to all grid entities in the room except for ones matching the grid entity types
278
285
  -- provided.
279
286
  --
287
+ -- Note that this function will automatically update the room. (This means that you can spawn new
288
+ -- grid entities on the same tile on the same frame, if needed.)
289
+ --
280
290
  -- For example:
281
291
  --
282
292
  -- ```ts
@@ -307,6 +317,9 @@ end
307
317
  --- Helper function to remove all of the grid entities in the room that match the grid entity types
308
318
  -- provided.
309
319
  --
320
+ -- Note that this function will automatically update the room. (This means that you can spawn new
321
+ -- grid entities on the same tile on the same frame, if needed.)
322
+ --
310
323
  -- For example:
311
324
  --
312
325
  -- ```ts
package/functions/rng.lua CHANGED
@@ -122,11 +122,16 @@ function ____exports.setAllRNGToSeed(self, object, seed)
122
122
  if not isTable(nil, object) then
123
123
  error("Failed to iterate over the object containing RNG objects since the type of the provided object was: " .. __TS__TypeOf(object))
124
124
  end
125
+ local setAtLeastOneSeed = false
125
126
  for _key, value in pairs(object) do
126
127
  if ____exports.isRNG(nil, value) then
127
128
  ____exports.setSeed(nil, value, seed)
129
+ setAtLeastOneSeed = true
128
130
  end
129
131
  end
132
+ if not setAtLeastOneSeed then
133
+ error(("Failed to set all RNG objects to seed " .. tostring(seed)) .. " because the parent object did not contain any RNG objects.")
134
+ end
130
135
  end
131
136
  --- Helper function to iterate over the provided object and set the seed for all of the values that
132
137
  -- are RNG objects equal to the start seed for the current run.
@@ -9,6 +9,7 @@ export declare function changeRoom(roomGridIndex: int): void;
9
9
  * Helper function to get an array with every valid `Dimension` (not including `Dimension.CURRENT`).
10
10
  */
11
11
  export declare function getAllDimensions(): Dimension[];
12
+ /** Helper function to get the grid index for every room on the entire floor. */
12
13
  export declare function getAllRoomGridIndexes(): int[];
13
14
  /**
14
15
  * Helper function to get the current dimension. Most of the time, this will be `Dimension.MAIN`,
@@ -123,6 +123,7 @@ end
123
123
  function ____exports.getAllDimensions(self)
124
124
  return erange(nil, NUM_DIMENSIONS)
125
125
  end
126
+ --- Helper function to get the grid index for every room on the entire floor.
126
127
  function ____exports.getAllRoomGridIndexes(self)
127
128
  local rooms = ____exports.getRooms(nil)
128
129
  return __TS__ArrayMap(
@@ -1,4 +1,4 @@
1
- import { LevelStage, StageType } from "isaac-typescript-definitions";
1
+ import { LevelStage, RoomType, StageType } from "isaac-typescript-definitions";
2
2
  /**
3
3
  * Helper function that calculates what the stage type should be for the provided stage. This
4
4
  * emulates what the game's internal code does.
@@ -15,6 +15,11 @@ export declare function calculateStageTypeRepentance(stage: LevelStage): StageTy
15
15
  * consider Downpour 2 to have a stage of 3.
16
16
  */
17
17
  export declare function getEffectiveStage(): int;
18
+ /**
19
+ * Helper function to get the prefix to use with the "goto" console command that would correspond to
20
+ * the provided room type.
21
+ */
22
+ export declare function getGotoCommandPrefix(roomType: RoomType): string;
18
23
  /** Alias for the `Level.GetStage` method. */
19
24
  export declare function getStage(): LevelStage;
20
25
  /** Alias for the `Level.GetStageType` method. */
@@ -4,6 +4,8 @@ local LevelStage = ____isaac_2Dtypescript_2Ddefinitions.LevelStage
4
4
  local StageType = ____isaac_2Dtypescript_2Ddefinitions.StageType
5
5
  local ____cachedClasses = require("cachedClasses")
6
6
  local game = ____cachedClasses.game
7
+ local ____roomTypeGotoPrefixes = require("objects.roomTypeGotoPrefixes")
8
+ local ROOM_TYPE_GOTO_PREFIXES = ____roomTypeGotoPrefixes.ROOM_TYPE_GOTO_PREFIXES
7
9
  local ____stageTypeSuffixes = require("objects.stageTypeSuffixes")
8
10
  local STAGE_TYPE_SUFFIXES = ____stageTypeSuffixes.STAGE_TYPE_SUFFIXES
9
11
  local ____stageTypeToLetter = require("objects.stageTypeToLetter")
@@ -62,6 +64,11 @@ function ____exports.getEffectiveStage(self)
62
64
  end
63
65
  return stage
64
66
  end
67
+ --- Helper function to get the prefix to use with the "goto" console command that would correspond to
68
+ -- the provided room type.
69
+ function ____exports.getGotoCommandPrefix(self, roomType)
70
+ return ROOM_TYPE_GOTO_PREFIXES[roomType]
71
+ end
65
72
  --- Alias for the `Level.GetStage` method.
66
73
  function ____exports.getStage(self)
67
74
  local level = game:GetLevel()
package/index.d.ts CHANGED
@@ -12,7 +12,6 @@ export * from "./enums/SerializationType";
12
12
  export { ConversionHeartSubType, registerCharacterHealthConversion, } from "./features/characterHealthConversion";
13
13
  export { registerCharacterStats } from "./features/characterStats";
14
14
  export { getCollectibleItemPoolType } from "./features/collectibleItemPoolType";
15
- export * from "./features/customTrapdoor/exports";
16
15
  export * from "./features/debugDisplay/exports";
17
16
  export { deployJSONRoom, deployRandomJSONRoom, emptyRoom, } from "./features/deployJSONRoom";
18
17
  export { disableAllSound, enableAllSound } from "./features/disableAllSound";
package/index.lua CHANGED
@@ -100,14 +100,6 @@ do
100
100
  local getCollectibleItemPoolType = ____collectibleItemPoolType.getCollectibleItemPoolType
101
101
  ____exports.getCollectibleItemPoolType = getCollectibleItemPoolType
102
102
  end
103
- do
104
- local ____export = require("features.customTrapdoor.exports")
105
- for ____exportKey, ____exportValue in pairs(____export) do
106
- if ____exportKey ~= "default" then
107
- ____exports[____exportKey] = ____exportValue
108
- end
109
- end
110
- end
111
103
  do
112
104
  local ____export = require("features.debugDisplay.exports")
113
105
  for ____exportKey, ____exportValue in pairs(____export) do
package/initFeatures.lua CHANGED
@@ -5,8 +5,6 @@ local ____characterStats = require("features.characterStats")
5
5
  local characterStatsInit = ____characterStats.characterStatsInit
6
6
  local ____collectibleItemPoolType = require("features.collectibleItemPoolType")
7
7
  local collectibleItemPoolTypeInit = ____collectibleItemPoolType.collectibleItemPoolTypeInit
8
- local ____init = require("features.customTrapdoor.init")
9
- local stageTravelInit = ____init.stageTravelInit
10
8
  local ____deployJSONRoom = require("features.deployJSONRoom")
11
9
  local deployJSONRoomInit = ____deployJSONRoom.deployJSONRoomInit
12
10
  local ____disableAllSound = require("features.disableAllSound")
@@ -60,7 +58,6 @@ function ____exports.initFeaturesMinor(self, mod)
60
58
  roomClearFrameInit(nil, mod)
61
59
  sirenHelpersInit(nil, mod)
62
60
  stageHistoryInit(nil, mod)
63
- stageTravelInit(nil)
64
61
  taintedLazarusPlayersInit(nil, mod)
65
62
  end
66
63
  return ____exports
@@ -6,7 +6,6 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitio
6
6
  local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
7
7
  --- Maps room type names to room types.
8
8
  ____exports.ROOM_TYPE_MAP = __TS__New(Map, {
9
- {"null", RoomType.NULL},
10
9
  {"default", RoomType.DEFAULT},
11
10
  {"shop", RoomType.SHOP},
12
11
  {"error", RoomType.ERROR},
@@ -0,0 +1,4 @@
1
+ import { RoomType } from "isaac-typescript-definitions";
2
+ export declare const ROOM_TYPE_GOTO_PREFIXES: {
3
+ readonly [key in RoomType]: string;
4
+ };
@@ -0,0 +1,35 @@
1
+ local ____exports = {}
2
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
3
+ local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
4
+ ____exports.ROOM_TYPE_GOTO_PREFIXES = {
5
+ [RoomType.DEFAULT] = "d.",
6
+ [RoomType.SHOP] = "s.shop.",
7
+ [RoomType.ERROR] = "s.error.",
8
+ [RoomType.TREASURE] = "s.treasure.",
9
+ [RoomType.BOSS] = "s.boss.",
10
+ [RoomType.MINI_BOSS] = "s.miniboss.",
11
+ [RoomType.SECRET] = "s.secret.",
12
+ [RoomType.SUPER_SECRET] = "s.supersecret.",
13
+ [RoomType.ARCADE] = "s.arcade.",
14
+ [RoomType.CURSE] = "s.curse.",
15
+ [RoomType.CHALLENGE] = "s.challenge.",
16
+ [RoomType.LIBRARY] = "s.library.",
17
+ [RoomType.SACRIFICE] = "s.sacrifice.",
18
+ [RoomType.DEVIL] = "s.devil.",
19
+ [RoomType.ANGEL] = "s.angel.",
20
+ [RoomType.DUNGEON] = "s.itemdungeon.",
21
+ [RoomType.BOSS_RUSH] = "s.bossrush.",
22
+ [RoomType.CLEAN_BEDROOM] = "s.isaacs.",
23
+ [RoomType.DIRTY_BEDROOM] = "s.barren.",
24
+ [RoomType.CHEST] = "s.chest.",
25
+ [RoomType.DICE] = "s.dice.",
26
+ [RoomType.BLACK_MARKET] = "s.blackmarket.",
27
+ [RoomType.GREED_EXIT] = "s.greedexit.",
28
+ [RoomType.PLANETARIUM] = "s.planetarium.",
29
+ [RoomType.TELEPORTER] = "s.teleporter.",
30
+ [RoomType.TELEPORTER_EXIT] = "s.teleporterexit.",
31
+ [RoomType.SECRET_EXIT] = "s.secretexit.",
32
+ [RoomType.BLUE] = "s.blue.",
33
+ [RoomType.ULTRA_SECRET] = "s.ultrasecret."
34
+ }
35
+ return ____exports
@@ -3,7 +3,6 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitio
3
3
  local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
4
4
  ____exports.DEFAULT_ROOM_TYPE_NAME = "Unknown"
5
5
  ____exports.ROOM_TYPE_NAMES = {
6
- [RoomType.NULL] = "null room",
7
6
  [RoomType.DEFAULT] = "default room",
8
7
  [RoomType.SHOP] = "shop",
9
8
  [RoomType.ERROR] = "I AM ERROR Room",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "4.5.2",
3
+ "version": "4.6.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -22,6 +22,6 @@
22
22
  "main": "index",
23
23
  "types": "index.d.ts",
24
24
  "dependencies": {
25
- "isaac-typescript-definitions": "^3.0.13"
25
+ "isaac-typescript-definitions": "^3.0.14"
26
26
  }
27
27
  }
@@ -27,8 +27,8 @@ export interface PickingUpItemTrinket {
27
27
  subType: TrinketType;
28
28
  }
29
29
  /** Helper function to narrow the type of `PickingUpItem`. */
30
- export declare function pickingUpItemIsNull(pickingUpItem: PickingUpItem): pickingUpItem is PickingUpItemTrinket;
30
+ export declare function isPickingUpItemNull(pickingUpItem: PickingUpItem): pickingUpItem is PickingUpItemTrinket;
31
31
  /** Helper function to narrow the type of `PickingUpItem`. */
32
- export declare function pickingUpItemIsCollectible(pickingUpItem: PickingUpItem): pickingUpItem is PickingUpItemCollectible;
32
+ export declare function isPickingUpItemCollectible(pickingUpItem: PickingUpItem): pickingUpItem is PickingUpItemCollectible;
33
33
  /** Helper function to narrow the type of `PickingUpItem`. */
34
- export declare function pickingUpItemIsTrinket(pickingUpItem: PickingUpItem): pickingUpItem is PickingUpItemTrinket;
34
+ export declare function isPickingUpItemTrinket(pickingUpItem: PickingUpItem): pickingUpItem is PickingUpItemTrinket;
@@ -20,15 +20,15 @@ function ____exports.resetPickingUpItem(self, pickingUpItem)
20
20
  end
21
21
  local COLLECTIBLE_ITEM_TYPES = __TS__New(Set, {ItemType.PASSIVE, ItemType.ACTIVE, ItemType.FAMILIAR})
22
22
  --- Helper function to narrow the type of `PickingUpItem`.
23
- function ____exports.pickingUpItemIsNull(self, pickingUpItem)
23
+ function ____exports.isPickingUpItemNull(self, pickingUpItem)
24
24
  return pickingUpItem.itemType == ItemType.NULL
25
25
  end
26
26
  --- Helper function to narrow the type of `PickingUpItem`.
27
- function ____exports.pickingUpItemIsCollectible(self, pickingUpItem)
27
+ function ____exports.isPickingUpItemCollectible(self, pickingUpItem)
28
28
  return COLLECTIBLE_ITEM_TYPES:has(pickingUpItem.itemType)
29
29
  end
30
30
  --- Helper function to narrow the type of `PickingUpItem`.
31
- function ____exports.pickingUpItemIsTrinket(self, pickingUpItem)
31
+ function ____exports.isPickingUpItemTrinket(self, pickingUpItem)
32
32
  return pickingUpItem.itemType == ItemType.TRINKET
33
33
  end
34
34
  return ____exports
@@ -1,4 +0,0 @@
1
- export declare enum StageTravelEntityState {
2
- OPEN = 0,
3
- CLOSED = 1
4
- }
@@ -1,7 +0,0 @@
1
- local ____exports = {}
2
- ____exports.StageTravelEntityState = {}
3
- ____exports.StageTravelEntityState.OPEN = 0
4
- ____exports.StageTravelEntityState[____exports.StageTravelEntityState.OPEN] = "OPEN"
5
- ____exports.StageTravelEntityState.CLOSED = 1
6
- ____exports.StageTravelEntityState[____exports.StageTravelEntityState.CLOSED] = "CLOSED"
7
- return ____exports
@@ -1,6 +0,0 @@
1
- export declare enum StageTravelState {
2
- DISABLED = 0,
3
- FADING_TO_BLACK = 1,
4
- GOING_TO_NEW_FLOOR = 2,
5
- FADING_IN = 3
6
- }
@@ -1,11 +0,0 @@
1
- local ____exports = {}
2
- ____exports.StageTravelState = {}
3
- ____exports.StageTravelState.DISABLED = 0
4
- ____exports.StageTravelState[____exports.StageTravelState.DISABLED] = "DISABLED"
5
- ____exports.StageTravelState.FADING_TO_BLACK = 1
6
- ____exports.StageTravelState[____exports.StageTravelState.FADING_TO_BLACK] = "FADING_TO_BLACK"
7
- ____exports.StageTravelState.GOING_TO_NEW_FLOOR = 2
8
- ____exports.StageTravelState[____exports.StageTravelState.GOING_TO_NEW_FLOOR] = "GOING_TO_NEW_FLOOR"
9
- ____exports.StageTravelState.FADING_IN = 3
10
- ____exports.StageTravelState[____exports.StageTravelState.FADING_IN] = "FADING_IN"
11
- return ____exports
@@ -1,5 +0,0 @@
1
- export declare const CUSTOM_TRAPDOOR_FEATURE_NAME = "customTrapdoor";
2
- /** This also applies to crawl spaces. The value was determined through trial and error. */
3
- export declare const TRAPDOOR_OPEN_DISTANCE = 60;
4
- export declare const TRAPDOOR_OPEN_DISTANCE_AFTER_BOSS: number;
5
- export declare const TRAPDOOR_BOSS_REACTION_FRAMES = 30;
@@ -1,7 +0,0 @@
1
- local ____exports = {}
2
- ____exports.CUSTOM_TRAPDOOR_FEATURE_NAME = "customTrapdoor"
3
- --- This also applies to crawl spaces. The value was determined through trial and error.
4
- ____exports.TRAPDOOR_OPEN_DISTANCE = 60
5
- ____exports.TRAPDOOR_OPEN_DISTANCE_AFTER_BOSS = ____exports.TRAPDOOR_OPEN_DISTANCE * 2.5
6
- ____exports.TRAPDOOR_BOSS_REACTION_FRAMES = 30
7
- return ____exports
@@ -1,37 +0,0 @@
1
- import { LevelStage, StageType } from "isaac-typescript-definitions";
2
- /**
3
- * Helper function to spawn a trapdoor grid entity that will have one or more of the following
4
- * attributes:
5
- *
6
- * - custom destination (or custom logic for after the player enters)
7
- * - custom graphics
8
- * - custom logic for opening/closing
9
- * - TODO: animation
10
- *
11
- * You can use this function to take the player to your custom stage. (See the `registerCustomStage`
12
- * helper function.)
13
- *
14
- * Under the hood, the custom trapdoor is represented by a decoration grid entity and is manually
15
- * respawned every time the player re-enters the room.
16
- *
17
- * @param gridIndexOrPosition The location in the room to spawn the trapdoor.
18
- * @param _destination Used to specify where the player will go after jumping into the trapdoor. Can
19
- * either be a tuple containing the stage and stage type, a string containing
20
- * the name of a custom stage, or a function that returns one of these things.
21
- * You can also specify a function that returns undefined in order to perform
22
- * some custom behavior and/or handle the traveling part yourself. By default,
23
- * the destination will be set to the next floor like that of a vanilla
24
- * trapdoor.
25
- * @param _anm2 Optional. The path to the anm2 file to use. By default, the vanilla trapdoor anm2 of
26
- * "gfx/grid/door_11_trapdoor.anm2" will be used.
27
- * @param _shouldOpenFunc Optional. If the trapdoor is currently closed, this function will run on
28
- * every frame to determine if it should open. By default, a function that
29
- * emulates a vanilla trapdoor will be used.
30
- * @param _shouldCloseFunc Optional. If the trapdoor is currently open, this function will run on
31
- * every frame to determine if it should close. By default, a function that
32
- * emulates a vanilla trapdoor will be used.
33
- * @param _spawnOpen Optional. Whether or not to spawn the trapdoor in an open state. Can either be
34
- * a boolean or a function returning a boolean. By default, a function that
35
- * emulates a vanilla trapdoor will be used.
36
- */
37
- export declare function spawnCustomTrapdoor(gridIndexOrPosition: int | Vector, _destination?: [stage: LevelStage, stageType: StageType] | string | ((gridEntity: GridEntity) => [stage: LevelStage, stageType: StageType] | string | undefined), _anm2?: string, _shouldOpenFunc?: (gridEntity: GridEntity) => boolean, _shouldCloseFunc?: (gridEntity: GridEntity) => boolean, _spawnOpen?: boolean | ((gridEntity: GridEntity) => boolean)): GridEntity;
@@ -1,124 +0,0 @@
1
- local ____exports = {}
2
- local defaultDestinationFunc, defaultShouldOpenFunc, isPlayerCloseAfterBoss, shouldBeClosedFromStartingInRoomWithEnemies, defaultShouldCloseFunc, defaultShouldSpawnOpenFunc
3
- local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
4
- local GridEntityType = ____isaac_2Dtypescript_2Ddefinitions.GridEntityType
5
- local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
6
- local ____cachedClasses = require("cachedClasses")
7
- local game = ____cachedClasses.game
8
- local ____featuresInitialized = require("featuresInitialized")
9
- local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNotInitialized
10
- local ____gridEntity = require("functions.gridEntity")
11
- local spawnGrid = ____gridEntity.spawnGrid
12
- local ____nextStage = require("functions.nextStage")
13
- local getNextStage = ____nextStage.getNextStage
14
- local getNextStageType = ____nextStage.getNextStageType
15
- local ____positionVelocity = require("functions.positionVelocity")
16
- local anyPlayerCloserThan = ____positionVelocity.anyPlayerCloserThan
17
- local ____roomClearFrame = require("features.roomClearFrame")
18
- local getRoomClearGameFrame = ____roomClearFrame.getRoomClearGameFrame
19
- local ____constants = require("features.customTrapdoor.constants")
20
- local CUSTOM_TRAPDOOR_FEATURE_NAME = ____constants.CUSTOM_TRAPDOOR_FEATURE_NAME
21
- local TRAPDOOR_BOSS_REACTION_FRAMES = ____constants.TRAPDOOR_BOSS_REACTION_FRAMES
22
- local TRAPDOOR_OPEN_DISTANCE = ____constants.TRAPDOOR_OPEN_DISTANCE
23
- local TRAPDOOR_OPEN_DISTANCE_AFTER_BOSS = ____constants.TRAPDOOR_OPEN_DISTANCE_AFTER_BOSS
24
- local ____v = require("features.customTrapdoor.v")
25
- local getCustomTrapdoorDescription = ____v.getCustomTrapdoorDescription
26
- function defaultDestinationFunc(self)
27
- local nextStage = getNextStage(nil)
28
- local nextStageType = getNextStageType(nil)
29
- return {nextStage, nextStageType}
30
- end
31
- function defaultShouldOpenFunc(self, gridEntity)
32
- local entityDescription = getCustomTrapdoorDescription(nil, gridEntity)
33
- if entityDescription == nil then
34
- return false
35
- end
36
- local room = game:GetRoom()
37
- local roomClear = room:IsClear()
38
- return not anyPlayerCloserThan(nil, gridEntity.Position, TRAPDOOR_OPEN_DISTANCE) and not isPlayerCloseAfterBoss(nil, gridEntity.Position) and not shouldBeClosedFromStartingInRoomWithEnemies(nil, entityDescription.initial, roomClear)
39
- end
40
- function isPlayerCloseAfterBoss(self, position)
41
- local gameFrameCount = game:GetFrameCount()
42
- local room = game:GetRoom()
43
- local roomType = room:GetType()
44
- local roomClearGameFrame = getRoomClearGameFrame(nil)
45
- if roomType ~= RoomType.BOSS or roomClearGameFrame == nil or gameFrameCount >= roomClearGameFrame + TRAPDOOR_BOSS_REACTION_FRAMES then
46
- return false
47
- end
48
- return anyPlayerCloserThan(nil, position, TRAPDOOR_OPEN_DISTANCE_AFTER_BOSS)
49
- end
50
- function shouldBeClosedFromStartingInRoomWithEnemies(self, initial, roomClear)
51
- return initial and not roomClear
52
- end
53
- function defaultShouldCloseFunc(self)
54
- return false
55
- end
56
- function defaultShouldSpawnOpenFunc(self, gridEntity)
57
- local room = game:GetRoom()
58
- local roomFrameCount = room:GetFrameCount()
59
- local roomClear = room:IsClear()
60
- if roomFrameCount > 0 then
61
- return false
62
- end
63
- if not roomClear then
64
- return false
65
- end
66
- return defaultShouldOpenFunc(nil, gridEntity)
67
- end
68
- --- Helper function to spawn a trapdoor grid entity that will have one or more of the following
69
- -- attributes:
70
- --
71
- -- - custom destination (or custom logic for after the player enters)
72
- -- - custom graphics
73
- -- - custom logic for opening/closing
74
- -- - TODO: animation
75
- --
76
- -- You can use this function to take the player to your custom stage. (See the `registerCustomStage`
77
- -- helper function.)
78
- --
79
- -- Under the hood, the custom trapdoor is represented by a decoration grid entity and is manually
80
- -- respawned every time the player re-enters the room.
81
- --
82
- -- @param gridIndexOrPosition The location in the room to spawn the trapdoor.
83
- -- @param _destination Used to specify where the player will go after jumping into the trapdoor. Can
84
- -- either be a tuple containing the stage and stage type, a string containing
85
- -- the name of a custom stage, or a function that returns one of these things.
86
- -- You can also specify a function that returns undefined in order to perform
87
- -- some custom behavior and/or handle the traveling part yourself. By default,
88
- -- the destination will be set to the next floor like that of a vanilla
89
- -- trapdoor.
90
- -- @param _anm2 Optional. The path to the anm2 file to use. By default, the vanilla trapdoor anm2 of
91
- -- "gfx/grid/door_11_trapdoor.anm2" will be used.
92
- -- @param _shouldOpenFunc Optional. If the trapdoor is currently closed, this function will run on
93
- -- every frame to determine if it should open. By default, a function that
94
- -- emulates a vanilla trapdoor will be used.
95
- -- @param _shouldCloseFunc Optional. If the trapdoor is currently open, this function will run on
96
- -- every frame to determine if it should close. By default, a function that
97
- -- emulates a vanilla trapdoor will be used.
98
- -- @param _spawnOpen Optional. Whether or not to spawn the trapdoor in an open state. Can either be
99
- -- a boolean or a function returning a boolean. By default, a function that
100
- -- emulates a vanilla trapdoor will be used.
101
- function ____exports.spawnCustomTrapdoor(self, gridIndexOrPosition, _destination, _anm2, _shouldOpenFunc, _shouldCloseFunc, _spawnOpen)
102
- if _destination == nil then
103
- _destination = defaultDestinationFunc
104
- end
105
- if _anm2 == nil then
106
- _anm2 = "gfx/grid/door_11_trapdoor.anm2"
107
- end
108
- if _shouldOpenFunc == nil then
109
- _shouldOpenFunc = defaultShouldOpenFunc
110
- end
111
- if _shouldCloseFunc == nil then
112
- _shouldCloseFunc = defaultShouldCloseFunc
113
- end
114
- if _spawnOpen == nil then
115
- _spawnOpen = defaultShouldSpawnOpenFunc
116
- end
117
- errorIfFeaturesNotInitialized(nil, CUSTOM_TRAPDOOR_FEATURE_NAME)
118
- local decoration = spawnGrid(nil, GridEntityType.DECORATION, gridIndexOrPosition)
119
- if decoration == nil then
120
- error("Failed to spawn a custom trapdoor.")
121
- end
122
- return decoration
123
- end
124
- return ____exports
@@ -1 +0,0 @@
1
- export declare function stageTravelInit(): void;
@@ -1,11 +0,0 @@
1
- local ____exports = {}
2
- local ____exports = require("features.saveDataManager.exports")
3
- local saveDataManager = ____exports.saveDataManager
4
- local ____constants = require("features.customTrapdoor.constants")
5
- local CUSTOM_TRAPDOOR_FEATURE_NAME = ____constants.CUSTOM_TRAPDOOR_FEATURE_NAME
6
- local ____v = require("features.customTrapdoor.v")
7
- local v = ____v.default
8
- function ____exports.stageTravelInit(self)
9
- saveDataManager(nil, CUSTOM_TRAPDOOR_FEATURE_NAME, v)
10
- end
11
- return ____exports
File without changes
File without changes
File without changes
File without changes
@@ -1,14 +0,0 @@
1
- /// <reference types="isaac-typescript-definitions" />
2
- import { StageTravelState } from "../../enums/StageTravelState";
3
- import { StageTravelEntityDescription } from "../../interfaces/StageTravelEntityDescription";
4
- declare const v: {
5
- run: {
6
- state: StageTravelState;
7
- };
8
- room: {
9
- /** Indexed by grid index. */
10
- trapdoors: Map<number, StageTravelEntityDescription>;
11
- };
12
- };
13
- export default v;
14
- export declare function getCustomTrapdoorDescription(gridEntity: GridEntity): StageTravelEntityDescription | undefined;
@@ -1,16 +0,0 @@
1
- local ____lualib = require("lualib_bundle")
2
- local Map = ____lualib.Map
3
- local __TS__New = ____lualib.__TS__New
4
- local ____exports = {}
5
- local ____StageTravelState = require("enums.StageTravelState")
6
- local StageTravelState = ____StageTravelState.StageTravelState
7
- local v = {
8
- run = {state = StageTravelState.DISABLED},
9
- room = {trapdoors = __TS__New(Map)}
10
- }
11
- ____exports.default = v
12
- function ____exports.getCustomTrapdoorDescription(self, gridEntity)
13
- local gridIndex = gridEntity:GetGridIndex()
14
- return v.room.trapdoors:get(gridIndex)
15
- end
16
- return ____exports
@@ -1,5 +0,0 @@
1
- import { StageTravelEntityState } from "../enums/StageTravelEntityState";
2
- export interface StageTravelEntityDescription {
3
- initial: boolean;
4
- state: StageTravelEntityState;
5
- }
@@ -1,2 +0,0 @@
1
- local ____exports = {}
2
- return ____exports