isaacscript-common 4.5.0 → 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 (78) 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/characterHealthConversion.lua +4 -1
  5. package/features/characterStats.d.ts +5 -0
  6. package/features/characterStats.lua +1 -1
  7. package/features/collectibleItemPoolType.lua +2 -2
  8. package/features/debugDisplay/debugDisplay.d.ts +4 -0
  9. package/features/debugDisplay/debugDisplay.lua +2 -0
  10. package/features/deployJSONRoom.lua +4 -6
  11. package/features/{disableSound.d.ts → disableAllSound.d.ts} +0 -0
  12. package/features/{disableSound.lua → disableAllSound.lua} +3 -3
  13. package/features/disableInputs.lua +2 -2
  14. package/features/extraConsoleCommands/exports.d.ts +26 -0
  15. package/features/extraConsoleCommands/exports.lua +54 -0
  16. package/features/extraConsoleCommands/init.d.ts +1 -25
  17. package/features/extraConsoleCommands/init.lua +166 -195
  18. package/features/extraConsoleCommands/v.d.ts +8 -0
  19. package/features/extraConsoleCommands/v.lua +11 -0
  20. package/features/fadeInRemover.lua +2 -2
  21. package/features/fastReset.lua +1 -1
  22. package/features/forgottenSwitch.lua +2 -2
  23. package/features/persistentEntities.lua +6 -1
  24. package/features/playerInventory.lua +2 -2
  25. package/features/ponyDetection.lua +2 -2
  26. package/features/preventCollectibleRotation.lua +2 -2
  27. package/features/registerHotkey.d.ts +3 -0
  28. package/features/registerHotkey.lua +50 -0
  29. package/features/roomClearFrame.lua +2 -2
  30. package/features/runInNFrames.lua +2 -2
  31. package/features/saveDataManager/exports.lua +1 -0
  32. package/features/sirenHelpers.lua +2 -2
  33. package/features/stageHistory.lua +2 -2
  34. package/features/taintedLazarusPlayers.lua +2 -2
  35. package/featuresInitialized.lua +1 -1
  36. package/functions/gridEntity.d.ts +12 -0
  37. package/functions/gridEntity.lua +15 -2
  38. package/functions/rng.lua +6 -2
  39. package/functions/rooms.d.ts +1 -0
  40. package/functions/rooms.lua +1 -0
  41. package/functions/run.d.ts +5 -2
  42. package/functions/run.lua +5 -2
  43. package/functions/saveFile.lua +3 -0
  44. package/functions/stage.d.ts +6 -1
  45. package/functions/stage.lua +7 -0
  46. package/functions/utils.d.ts +5 -0
  47. package/functions/utils.lua +7 -0
  48. package/index.d.ts +4 -4
  49. package/index.lua +22 -24
  50. package/initFeatures.lua +6 -6
  51. package/lualib_bundle.lua +6 -3
  52. package/maps/roomTypeMap.lua +0 -1
  53. package/objects/roomTypeGotoPrefixes.d.ts +4 -0
  54. package/objects/roomTypeGotoPrefixes.lua +35 -0
  55. package/objects/roomTypeNames.lua +0 -1
  56. package/package.json +2 -2
  57. package/sets/consoleCommandsSet.d.ts +5 -0
  58. package/sets/consoleCommandsSet.lua +61 -0
  59. package/types/PickingUpItem.d.ts +3 -3
  60. package/types/PickingUpItem.lua +3 -3
  61. package/enums/StageTravelEntityState.d.ts +0 -4
  62. package/enums/StageTravelEntityState.lua +0 -7
  63. package/enums/StageTravelState.d.ts +0 -6
  64. package/enums/StageTravelState.lua +0 -11
  65. package/features/customTrapdoor/constants.d.ts +0 -5
  66. package/features/customTrapdoor/constants.lua +0 -7
  67. package/features/customTrapdoor/exports.d.ts +0 -37
  68. package/features/customTrapdoor/exports.lua +0 -120
  69. package/features/customTrapdoor/init.d.ts +0 -1
  70. package/features/customTrapdoor/init.lua +0 -11
  71. package/features/customTrapdoor/stageTravel.d.ts +0 -0
  72. package/features/customTrapdoor/stageTravel.lua +0 -0
  73. package/features/customTrapdoor/trapdoor.d.ts +0 -0
  74. package/features/customTrapdoor/trapdoor.lua +0 -0
  75. package/features/customTrapdoor/v.d.ts +0 -14
  76. package/features/customTrapdoor/v.lua +0 -16
  77. package/interfaces/StageTravelEntityDescription.d.ts +0 -5
  78. package/interfaces/StageTravelEntityDescription.lua +0 -2
@@ -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 STAGE_TRAVEL_FEATURE_NAME = "stageTravel";
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.STAGE_TRAVEL_FEATURE_NAME = "stageTravel"
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,120 +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 ____gridEntity = require("functions.gridEntity")
9
- local spawnGrid = ____gridEntity.spawnGrid
10
- local ____nextStage = require("functions.nextStage")
11
- local getNextStage = ____nextStage.getNextStage
12
- local getNextStageType = ____nextStage.getNextStageType
13
- local ____positionVelocity = require("functions.positionVelocity")
14
- local anyPlayerCloserThan = ____positionVelocity.anyPlayerCloserThan
15
- local ____roomClearFrame = require("features.roomClearFrame")
16
- local getRoomClearGameFrame = ____roomClearFrame.getRoomClearGameFrame
17
- local ____constants = require("features.customTrapdoor.constants")
18
- local TRAPDOOR_BOSS_REACTION_FRAMES = ____constants.TRAPDOOR_BOSS_REACTION_FRAMES
19
- local TRAPDOOR_OPEN_DISTANCE = ____constants.TRAPDOOR_OPEN_DISTANCE
20
- local TRAPDOOR_OPEN_DISTANCE_AFTER_BOSS = ____constants.TRAPDOOR_OPEN_DISTANCE_AFTER_BOSS
21
- local ____v = require("features.customTrapdoor.v")
22
- local getCustomTrapdoorDescription = ____v.getCustomTrapdoorDescription
23
- function defaultDestinationFunc(self)
24
- local nextStage = getNextStage(nil)
25
- local nextStageType = getNextStageType(nil)
26
- return {nextStage, nextStageType}
27
- end
28
- function defaultShouldOpenFunc(self, gridEntity)
29
- local entityDescription = getCustomTrapdoorDescription(nil, gridEntity)
30
- if entityDescription == nil then
31
- return false
32
- end
33
- local room = game:GetRoom()
34
- local roomClear = room:IsClear()
35
- return not anyPlayerCloserThan(nil, gridEntity.Position, TRAPDOOR_OPEN_DISTANCE) and not isPlayerCloseAfterBoss(nil, gridEntity.Position) and not shouldBeClosedFromStartingInRoomWithEnemies(nil, entityDescription.initial, roomClear)
36
- end
37
- function isPlayerCloseAfterBoss(self, position)
38
- local gameFrameCount = game:GetFrameCount()
39
- local room = game:GetRoom()
40
- local roomType = room:GetType()
41
- local roomClearGameFrame = getRoomClearGameFrame(nil)
42
- if roomType ~= RoomType.BOSS or roomClearGameFrame == nil or gameFrameCount >= roomClearGameFrame + TRAPDOOR_BOSS_REACTION_FRAMES then
43
- return false
44
- end
45
- return anyPlayerCloserThan(nil, position, TRAPDOOR_OPEN_DISTANCE_AFTER_BOSS)
46
- end
47
- function shouldBeClosedFromStartingInRoomWithEnemies(self, initial, roomClear)
48
- return initial and not roomClear
49
- end
50
- function defaultShouldCloseFunc(self)
51
- return false
52
- end
53
- function defaultShouldSpawnOpenFunc(self, gridEntity)
54
- local room = game:GetRoom()
55
- local roomFrameCount = room:GetFrameCount()
56
- local roomClear = room:IsClear()
57
- if roomFrameCount > 0 then
58
- return false
59
- end
60
- if not roomClear then
61
- return false
62
- end
63
- return defaultShouldOpenFunc(nil, gridEntity)
64
- end
65
- --- Helper function to spawn a trapdoor grid entity that will have one or more of the following
66
- -- attributes:
67
- --
68
- -- - custom destination (or custom logic for after the player enters)
69
- -- - custom graphics
70
- -- - custom logic for opening/closing
71
- -- - TODO: animation
72
- --
73
- -- You can use this function to take the player to your custom stage. (See the `registerCustomStage`
74
- -- helper function.)
75
- --
76
- -- Under the hood, the custom trapdoor is represented by a decoration grid entity and is manually
77
- -- respawned every time the player re-enters the room.
78
- --
79
- -- @param gridIndexOrPosition The location in the room to spawn the trapdoor.
80
- -- @param _destination Used to specify where the player will go after jumping into the trapdoor. Can
81
- -- either be a tuple containing the stage and stage type, a string containing
82
- -- the name of a custom stage, or a function that returns one of these things.
83
- -- You can also specify a function that returns undefined in order to perform
84
- -- some custom behavior and/or handle the traveling part yourself. By default,
85
- -- the destination will be set to the next floor like that of a vanilla
86
- -- trapdoor.
87
- -- @param _anm2 Optional. The path to the anm2 file to use. By default, the vanilla trapdoor anm2 of
88
- -- "gfx/grid/door_11_trapdoor.anm2" will be used.
89
- -- @param _shouldOpenFunc Optional. If the trapdoor is currently closed, this function will run on
90
- -- every frame to determine if it should open. By default, a function that
91
- -- emulates a vanilla trapdoor will be used.
92
- -- @param _shouldCloseFunc Optional. If the trapdoor is currently open, this function will run on
93
- -- every frame to determine if it should close. By default, a function that
94
- -- emulates a vanilla trapdoor will be used.
95
- -- @param _spawnOpen Optional. Whether or not to spawn the trapdoor in an open state. Can either be
96
- -- a boolean or a function returning a boolean. By default, a function that
97
- -- emulates a vanilla trapdoor will be used.
98
- function ____exports.spawnCustomTrapdoor(self, gridIndexOrPosition, _destination, _anm2, _shouldOpenFunc, _shouldCloseFunc, _spawnOpen)
99
- if _destination == nil then
100
- _destination = defaultDestinationFunc
101
- end
102
- if _anm2 == nil then
103
- _anm2 = "gfx/grid/door_11_trapdoor.anm2"
104
- end
105
- if _shouldOpenFunc == nil then
106
- _shouldOpenFunc = defaultShouldOpenFunc
107
- end
108
- if _shouldCloseFunc == nil then
109
- _shouldCloseFunc = defaultShouldCloseFunc
110
- end
111
- if _spawnOpen == nil then
112
- _spawnOpen = defaultShouldSpawnOpenFunc
113
- end
114
- local decoration = spawnGrid(nil, GridEntityType.DECORATION, gridIndexOrPosition)
115
- if decoration == nil then
116
- error("Failed to spawn a custom trapdoor.")
117
- end
118
- return decoration
119
- end
120
- 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 STAGE_TRAVEL_FEATURE_NAME = ____constants.STAGE_TRAVEL_FEATURE_NAME
6
- local ____v = require("features.customTrapdoor.v")
7
- local v = ____v.default
8
- function ____exports.stageTravelInit(self)
9
- saveDataManager(nil, STAGE_TRAVEL_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