isaacscript-common 4.5.2 → 4.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) 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/features/runInNFrames.d.ts +38 -4
  8. package/features/runInNFrames.lua +90 -19
  9. package/functions/array.d.ts +30 -1
  10. package/functions/array.lua +84 -5
  11. package/functions/bitwise.d.ts +17 -0
  12. package/functions/bitwise.lua +41 -0
  13. package/functions/color.d.ts +1 -1
  14. package/functions/doors.d.ts +6 -0
  15. package/functions/doors.lua +23 -2
  16. package/functions/gridEntity.d.ts +12 -0
  17. package/functions/gridEntity.lua +15 -2
  18. package/functions/kColor.d.ts +1 -1
  19. package/functions/log.d.ts +2 -2
  20. package/functions/rng.d.ts +1 -1
  21. package/functions/rng.lua +5 -0
  22. package/functions/roomShape.d.ts +2 -2
  23. package/functions/rooms.d.ts +1 -0
  24. package/functions/rooms.lua +1 -0
  25. package/functions/set.d.ts +17 -0
  26. package/functions/set.lua +24 -0
  27. package/functions/stage.d.ts +6 -1
  28. package/functions/stage.lua +7 -0
  29. package/functions/vector.d.ts +1 -1
  30. package/index.d.ts +0 -1
  31. package/index.lua +0 -8
  32. package/initFeatures.lua +0 -3
  33. package/maps/roomTypeMap.lua +0 -1
  34. package/objects/doorSlotToDoorSlotFlag.d.ts +4 -0
  35. package/objects/doorSlotToDoorSlotFlag.lua +17 -0
  36. package/objects/roomShapeBounds.d.ts +1 -1
  37. package/objects/roomShapeBounds.lua +8 -8
  38. package/objects/roomShapeLayoutSizes.d.ts +1 -1
  39. package/objects/roomShapeLayoutSizes.lua +4 -4
  40. package/objects/roomTypeGotoPrefixes.d.ts +4 -0
  41. package/objects/roomTypeGotoPrefixes.lua +35 -0
  42. package/objects/roomTypeNames.lua +0 -1
  43. package/package.json +2 -2
  44. package/types/CollectibleIndex.d.ts +1 -1
  45. package/types/PickingUpItem.d.ts +3 -3
  46. package/types/PickingUpItem.lua +3 -3
  47. package/types/PlayerIndex.d.ts +1 -1
  48. package/types/private/IsaacAPIClass.d.ts +1 -1
  49. package/types/private/SerializedIsaacAPIClass.d.ts +1 -1
  50. package/types/private/TSTLClass.d.ts +1 -1
  51. package/enums/StageTravelEntityState.d.ts +0 -4
  52. package/enums/StageTravelEntityState.lua +0 -7
  53. package/enums/StageTravelState.d.ts +0 -6
  54. package/enums/StageTravelState.lua +0 -11
  55. package/features/customTrapdoor/constants.d.ts +0 -5
  56. package/features/customTrapdoor/constants.lua +0 -7
  57. package/features/customTrapdoor/exports.d.ts +0 -37
  58. package/features/customTrapdoor/exports.lua +0 -124
  59. package/features/customTrapdoor/init.d.ts +0 -1
  60. package/features/customTrapdoor/init.lua +0 -11
  61. package/features/customTrapdoor/stageTravel.d.ts +0 -0
  62. package/features/customTrapdoor/stageTravel.lua +0 -0
  63. package/features/customTrapdoor/trapdoor.d.ts +0 -0
  64. package/features/customTrapdoor/trapdoor.lua +0 -0
  65. package/features/customTrapdoor/v.d.ts +0 -14
  66. package/features/customTrapdoor/v.lua +0 -16
  67. package/interfaces/StageTravelEntityDescription.d.ts +0 -5
  68. package/interfaces/StageTravelEntityDescription.lua +0 -2
@@ -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