isaacscript-common 4.5.0 → 4.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.
- package/constants.d.ts +1 -1
- package/features/characterHealthConversion.lua +4 -1
- package/features/characterStats.lua +1 -1
- package/features/collectibleItemPoolType.lua +2 -2
- package/features/customTrapdoor/constants.d.ts +1 -1
- package/features/customTrapdoor/constants.lua +1 -1
- package/features/customTrapdoor/exports.lua +4 -0
- package/features/customTrapdoor/init.lua +2 -2
- package/features/debugDisplay/debugDisplay.d.ts +4 -0
- package/features/debugDisplay/debugDisplay.lua +2 -0
- package/features/deployJSONRoom.lua +2 -2
- package/features/{disableSound.d.ts → disableAllSound.d.ts} +3 -0
- package/features/{disableSound.lua → disableAllSound.lua} +3 -3
- package/features/disableInputs.lua +2 -2
- package/features/extraConsoleCommands/exports.d.ts +26 -0
- package/features/extraConsoleCommands/exports.lua +54 -0
- package/features/extraConsoleCommands/init.d.ts +1 -25
- package/features/extraConsoleCommands/init.lua +166 -195
- package/features/extraConsoleCommands/v.d.ts +8 -0
- package/features/extraConsoleCommands/v.lua +11 -0
- package/features/fadeInRemover.lua +2 -2
- package/features/fastReset.lua +1 -1
- package/features/forgottenSwitch.lua +2 -2
- package/features/persistentEntities.lua +6 -1
- package/features/playerInventory.lua +2 -2
- package/features/ponyDetection.lua +2 -2
- package/features/preventCollectibleRotation.lua +2 -2
- package/features/registerHotkey.d.ts +3 -0
- package/features/registerHotkey.lua +50 -0
- package/features/roomClearFrame.lua +2 -2
- package/features/runInNFrames.lua +2 -2
- package/features/saveDataManager/exports.lua +1 -0
- package/features/sirenHelpers.lua +2 -2
- package/features/stageHistory.lua +2 -2
- package/features/taintedLazarusPlayers.lua +2 -2
- package/featuresInitialized.lua +1 -1
- package/functions/run.d.ts +5 -2
- package/functions/run.lua +5 -2
- package/functions/saveFile.lua +3 -0
- package/functions/utils.d.ts +5 -0
- package/functions/utils.lua +7 -0
- package/index.d.ts +4 -3
- package/index.lua +22 -16
- package/initFeatures.lua +3 -3
- package/lualib_bundle.lua +6 -3
- package/package.json +1 -1
- package/sets/consoleCommandsSet.d.ts +5 -0
- package/sets/consoleCommandsSet.lua +61 -0
package/constants.d.ts
CHANGED
|
@@ -65,7 +65,7 @@ function prePickupCollisionHeart(self, pickup, collider)
|
|
|
65
65
|
end
|
|
66
66
|
return false
|
|
67
67
|
end
|
|
68
|
-
local FEATURE_NAME = "
|
|
68
|
+
local FEATURE_NAME = "characterHealthConversion"
|
|
69
69
|
characterHealthReplacementMap = __TS__New(Map)
|
|
70
70
|
---
|
|
71
71
|
-- @internal
|
|
@@ -79,6 +79,9 @@ end
|
|
|
79
79
|
-- Call this function once at the beginning of your mod to declare the health conversion type.
|
|
80
80
|
function ____exports.registerCharacterHealthConversion(self, playerType, conversionHeartSubType)
|
|
81
81
|
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
82
|
+
if characterHealthReplacementMap:has(playerType) then
|
|
83
|
+
error(("Failed to register a character of type " .. tostring(playerType)) .. " because there is already an existing registered character with that type.")
|
|
84
|
+
end
|
|
82
85
|
characterHealthReplacementMap:set(playerType, conversionHeartSubType)
|
|
83
86
|
end
|
|
84
87
|
return ____exports
|
|
@@ -25,7 +25,7 @@ function evaluateCache(self, player, cacheFlag)
|
|
|
25
25
|
local delta = stat - defaultStat
|
|
26
26
|
addStat(nil, player, cacheFlag, delta)
|
|
27
27
|
end
|
|
28
|
-
local FEATURE_NAME = "
|
|
28
|
+
local FEATURE_NAME = "characterStats"
|
|
29
29
|
charactersStatMap = __TS__New(Map)
|
|
30
30
|
---
|
|
31
31
|
-- @internal
|
|
@@ -24,12 +24,12 @@ function postPickupInitCollectible(self, pickup)
|
|
|
24
24
|
local lastItemPoolType = itemPool:GetLastPool()
|
|
25
25
|
v.run.collectibleItemPoolTypeMap:set(ptrHash, lastItemPoolType)
|
|
26
26
|
end
|
|
27
|
-
local FEATURE_NAME = "
|
|
27
|
+
local FEATURE_NAME = "collectibleItemPoolType"
|
|
28
28
|
v = {run = {collectibleItemPoolTypeMap = __TS__New(Map)}}
|
|
29
29
|
---
|
|
30
30
|
-- @internal
|
|
31
31
|
function ____exports.collectibleItemPoolTypeInit(self, mod)
|
|
32
|
-
saveDataManager(nil,
|
|
32
|
+
saveDataManager(nil, FEATURE_NAME, v)
|
|
33
33
|
mod:AddCallback(ModCallback.POST_PICKUP_INIT, postPickupInitCollectible, PickupVariant.COLLECTIBLE)
|
|
34
34
|
end
|
|
35
35
|
--- Helper function to get the item pool type that a given collectible came from. Since there is no
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const CUSTOM_TRAPDOOR_FEATURE_NAME = "customTrapdoor";
|
|
2
2
|
/** This also applies to crawl spaces. The value was determined through trial and error. */
|
|
3
3
|
export declare const TRAPDOOR_OPEN_DISTANCE = 60;
|
|
4
4
|
export declare const TRAPDOOR_OPEN_DISTANCE_AFTER_BOSS: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
local ____exports = {}
|
|
2
|
-
____exports.
|
|
2
|
+
____exports.CUSTOM_TRAPDOOR_FEATURE_NAME = "customTrapdoor"
|
|
3
3
|
--- This also applies to crawl spaces. The value was determined through trial and error.
|
|
4
4
|
____exports.TRAPDOOR_OPEN_DISTANCE = 60
|
|
5
5
|
____exports.TRAPDOOR_OPEN_DISTANCE_AFTER_BOSS = ____exports.TRAPDOOR_OPEN_DISTANCE * 2.5
|
|
@@ -5,6 +5,8 @@ local GridEntityType = ____isaac_2Dtypescript_2Ddefinitions.GridEntityType
|
|
|
5
5
|
local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
|
|
6
6
|
local ____cachedClasses = require("cachedClasses")
|
|
7
7
|
local game = ____cachedClasses.game
|
|
8
|
+
local ____featuresInitialized = require("featuresInitialized")
|
|
9
|
+
local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNotInitialized
|
|
8
10
|
local ____gridEntity = require("functions.gridEntity")
|
|
9
11
|
local spawnGrid = ____gridEntity.spawnGrid
|
|
10
12
|
local ____nextStage = require("functions.nextStage")
|
|
@@ -15,6 +17,7 @@ local anyPlayerCloserThan = ____positionVelocity.anyPlayerCloserThan
|
|
|
15
17
|
local ____roomClearFrame = require("features.roomClearFrame")
|
|
16
18
|
local getRoomClearGameFrame = ____roomClearFrame.getRoomClearGameFrame
|
|
17
19
|
local ____constants = require("features.customTrapdoor.constants")
|
|
20
|
+
local CUSTOM_TRAPDOOR_FEATURE_NAME = ____constants.CUSTOM_TRAPDOOR_FEATURE_NAME
|
|
18
21
|
local TRAPDOOR_BOSS_REACTION_FRAMES = ____constants.TRAPDOOR_BOSS_REACTION_FRAMES
|
|
19
22
|
local TRAPDOOR_OPEN_DISTANCE = ____constants.TRAPDOOR_OPEN_DISTANCE
|
|
20
23
|
local TRAPDOOR_OPEN_DISTANCE_AFTER_BOSS = ____constants.TRAPDOOR_OPEN_DISTANCE_AFTER_BOSS
|
|
@@ -111,6 +114,7 @@ function ____exports.spawnCustomTrapdoor(self, gridIndexOrPosition, _destination
|
|
|
111
114
|
if _spawnOpen == nil then
|
|
112
115
|
_spawnOpen = defaultShouldSpawnOpenFunc
|
|
113
116
|
end
|
|
117
|
+
errorIfFeaturesNotInitialized(nil, CUSTOM_TRAPDOOR_FEATURE_NAME)
|
|
114
118
|
local decoration = spawnGrid(nil, GridEntityType.DECORATION, gridIndexOrPosition)
|
|
115
119
|
if decoration == nil then
|
|
116
120
|
error("Failed to spawn a custom trapdoor.")
|
|
@@ -2,10 +2,10 @@ local ____exports = {}
|
|
|
2
2
|
local ____exports = require("features.saveDataManager.exports")
|
|
3
3
|
local saveDataManager = ____exports.saveDataManager
|
|
4
4
|
local ____constants = require("features.customTrapdoor.constants")
|
|
5
|
-
local
|
|
5
|
+
local CUSTOM_TRAPDOOR_FEATURE_NAME = ____constants.CUSTOM_TRAPDOOR_FEATURE_NAME
|
|
6
6
|
local ____v = require("features.customTrapdoor.v")
|
|
7
7
|
local v = ____v.default
|
|
8
8
|
function ____exports.stageTravelInit(self)
|
|
9
|
-
saveDataManager(nil,
|
|
9
|
+
saveDataManager(nil, CUSTOM_TRAPDOOR_FEATURE_NAME, v)
|
|
10
10
|
end
|
|
11
11
|
return ____exports
|
|
@@ -152,6 +152,8 @@ function postPressurePlateRender(self, pressurePlate)
|
|
|
152
152
|
local text = debugDisplayTextCallbacks:pressurePlate(pressurePlate)
|
|
153
153
|
renderTextOnEntity(nil, pressurePlate, text)
|
|
154
154
|
end
|
|
155
|
+
--- The debug display feature is only initialized when the extra console commands feature is
|
|
156
|
+
-- initialized.
|
|
155
157
|
function ____exports.debugDisplayInit(self, mod)
|
|
156
158
|
saveDataManager(
|
|
157
159
|
nil,
|
|
@@ -451,7 +451,7 @@ function getPitFrame(self, L, R, U, D, UL, UR, DL, DR)
|
|
|
451
451
|
end
|
|
452
452
|
return F
|
|
453
453
|
end
|
|
454
|
-
FEATURE_NAME = "
|
|
454
|
+
FEATURE_NAME = "deployJSONRoom"
|
|
455
455
|
NPC_TYPES_TO_NOT_REMOVE = __TS__New(Set, {EntityType.DARK_ESAU})
|
|
456
456
|
PERSISTENT_ENTITY_TYPES = __TS__New(Set, {EntityType.WALL_HUGGER})
|
|
457
457
|
v = {
|
|
@@ -471,7 +471,7 @@ v = {
|
|
|
471
471
|
---
|
|
472
472
|
-- @internal
|
|
473
473
|
function ____exports.deployJSONRoomInit(self, mod)
|
|
474
|
-
saveDataManager(nil,
|
|
474
|
+
saveDataManager(nil, FEATURE_NAME, v)
|
|
475
475
|
mod:AddCallback(ModCallback.PRE_USE_ITEM, preUseItemWeNeedToGoDeeper, CollectibleType.WE_NEED_TO_GO_DEEPER)
|
|
476
476
|
mod:AddCallbackCustom(ModCallbackCustom.POST_NEW_ROOM_REORDERED, postNewRoomReordered)
|
|
477
477
|
end
|
|
@@ -19,13 +19,13 @@ function postRender(self)
|
|
|
19
19
|
end
|
|
20
20
|
stopAllSoundEffects(nil)
|
|
21
21
|
end
|
|
22
|
-
local FEATURE_NAME = "
|
|
22
|
+
local FEATURE_NAME = "disableAllSound"
|
|
23
23
|
local musicWasEnabled = false
|
|
24
24
|
v = {run = {disableSoundSet = __TS__New(Set)}}
|
|
25
25
|
---
|
|
26
26
|
-- @internal
|
|
27
|
-
function ____exports.
|
|
28
|
-
saveDataManager(nil,
|
|
27
|
+
function ____exports.disableAllSoundInit(self, mod)
|
|
28
|
+
saveDataManager(nil, FEATURE_NAME, v)
|
|
29
29
|
mod:AddCallback(ModCallback.POST_RENDER, postRender)
|
|
30
30
|
end
|
|
31
31
|
--- Helper function to stop muting all sound effects and music.
|
|
@@ -44,7 +44,7 @@ function getReturnValue(self, buttonAction, booleanCallback)
|
|
|
44
44
|
end
|
|
45
45
|
return nil
|
|
46
46
|
end
|
|
47
|
-
local FEATURE_NAME = "
|
|
47
|
+
local FEATURE_NAME = "disableInputs"
|
|
48
48
|
v = {run = {
|
|
49
49
|
disableInputsWithWhitelistMap = __TS__New(Map),
|
|
50
50
|
enableInputsWithBlacklistMap = __TS__New(Map)
|
|
@@ -52,7 +52,7 @@ v = {run = {
|
|
|
52
52
|
---
|
|
53
53
|
-- @internal
|
|
54
54
|
function ____exports.disableInputsInit(self, mod)
|
|
55
|
-
saveDataManager(nil,
|
|
55
|
+
saveDataManager(nil, FEATURE_NAME, v)
|
|
56
56
|
mod:AddCallback(ModCallback.INPUT_ACTION, isActionPressed, InputHook.IS_ACTION_PRESSED)
|
|
57
57
|
mod:AddCallback(ModCallback.INPUT_ACTION, isActionTriggered, InputHook.IS_ACTION_TRIGGERED)
|
|
58
58
|
mod:AddCallback(ModCallback.INPUT_ACTION, getActionValue, InputHook.GET_ACTION_VALUE)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ModUpgraded } from "../../classes/ModUpgraded";
|
|
2
|
+
/**
|
|
3
|
+
* Enables extra console commands which are useful for debugging. See [the
|
|
4
|
+
* docs](https://isaacscript.github.io/isaacscript-common/features/extraConsoleCommands_listCommands)
|
|
5
|
+
* for the specific commands that are added.
|
|
6
|
+
*/
|
|
7
|
+
export declare function enableExtraConsoleCommands(mod: ModUpgraded): void;
|
|
8
|
+
/**
|
|
9
|
+
* Helper function to add a custom console command.
|
|
10
|
+
*
|
|
11
|
+
* The standard library comes with many existing console commands that are useful for debugging, but
|
|
12
|
+
* you can also add your own commands that are useful for your particular mod. It's easier to add
|
|
13
|
+
* commands to the existing command system than to add logic manually to the ExecuteCmd callback.
|
|
14
|
+
*
|
|
15
|
+
* Before using this function, you must first invoke `enableExtraConsoleCommands`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function addConsoleCommand(commandName: string, commandFunction: (params: string) => void): void;
|
|
18
|
+
/**
|
|
19
|
+
* Helper function to remove a custom console command.
|
|
20
|
+
*
|
|
21
|
+
* The standard library comes with many existing console commands that are useful for debugging. If
|
|
22
|
+
* you want to disable one of them, use this function.
|
|
23
|
+
*
|
|
24
|
+
* Before using this function, you must first invoke `enableExtraConsoleCommands`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function removeConsoleCommand(commandName: string): void;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local Map = ____lualib.Map
|
|
3
|
+
local ____exports = {}
|
|
4
|
+
local ____utils = require("functions.utils")
|
|
5
|
+
local isVanillaConsoleCommand = ____utils.isVanillaConsoleCommand
|
|
6
|
+
local ____init = require("features.extraConsoleCommands.init")
|
|
7
|
+
local extraConsoleCommandsInit = ____init.extraConsoleCommandsInit
|
|
8
|
+
local ____v = require("features.extraConsoleCommands.v")
|
|
9
|
+
local extraConsoleCommandsFunctionMap = ____v.extraConsoleCommandsFunctionMap
|
|
10
|
+
local isExtraConsoleCommandsInitialized = ____v.isExtraConsoleCommandsInitialized
|
|
11
|
+
--- Enables extra console commands which are useful for debugging. See [the
|
|
12
|
+
-- docs](https://isaacscript.github.io/isaacscript-common/features/extraConsoleCommands_listCommands)
|
|
13
|
+
-- for the specific commands that are added.
|
|
14
|
+
function ____exports.enableExtraConsoleCommands(self, mod)
|
|
15
|
+
if isExtraConsoleCommandsInitialized(nil) then
|
|
16
|
+
error("The extra console commands are already initialized.")
|
|
17
|
+
end
|
|
18
|
+
extraConsoleCommandsInit(nil, mod)
|
|
19
|
+
end
|
|
20
|
+
--- Helper function to add a custom console command.
|
|
21
|
+
--
|
|
22
|
+
-- The standard library comes with many existing console commands that are useful for debugging, but
|
|
23
|
+
-- you can also add your own commands that are useful for your particular mod. It's easier to add
|
|
24
|
+
-- commands to the existing command system than to add logic manually to the ExecuteCmd callback.
|
|
25
|
+
--
|
|
26
|
+
-- Before using this function, you must first invoke `enableExtraConsoleCommands`.
|
|
27
|
+
function ____exports.addConsoleCommand(self, commandName, commandFunction)
|
|
28
|
+
if not isExtraConsoleCommandsInitialized(nil) then
|
|
29
|
+
error("The \"extraConsoleCommands\" feature is not initialized. Before adding extra console commands, you must first enable the feature by invoking the \"enableExtraConsoleCommands\" function.")
|
|
30
|
+
end
|
|
31
|
+
if isVanillaConsoleCommand(nil, commandName) then
|
|
32
|
+
error(("Failed to add a new console command of \"" .. commandName) .. "\" because that name already belongs to a vanilla command. You must pick a non-colliding name.")
|
|
33
|
+
end
|
|
34
|
+
if extraConsoleCommandsFunctionMap:has(commandName) then
|
|
35
|
+
error(("Failed to add a new console command of \"" .. commandName) .. "\" because there is already an existing custom command by that name. If you want to overwrite a command from the standard library, you can use the \"removeExtraConsoleCommand\" function.")
|
|
36
|
+
end
|
|
37
|
+
extraConsoleCommandsFunctionMap:set(commandName, commandFunction)
|
|
38
|
+
end
|
|
39
|
+
--- Helper function to remove a custom console command.
|
|
40
|
+
--
|
|
41
|
+
-- The standard library comes with many existing console commands that are useful for debugging. If
|
|
42
|
+
-- you want to disable one of them, use this function.
|
|
43
|
+
--
|
|
44
|
+
-- Before using this function, you must first invoke `enableExtraConsoleCommands`.
|
|
45
|
+
function ____exports.removeConsoleCommand(self, commandName)
|
|
46
|
+
if not isExtraConsoleCommandsInitialized(nil) then
|
|
47
|
+
error("The \"extraConsoleCommands\" feature is not initialized. Before removing console commands, you must first enable the feature by invoking the \"enableExtraConsoleCommands\" function.")
|
|
48
|
+
end
|
|
49
|
+
if not extraConsoleCommandsFunctionMap:has(commandName) then
|
|
50
|
+
error(("Failed to remove the console command of \"" .. commandName) .. "\", since it does not already exist in the map.")
|
|
51
|
+
end
|
|
52
|
+
extraConsoleCommandsFunctionMap:delete(commandName)
|
|
53
|
+
end
|
|
54
|
+
return ____exports
|
|
@@ -1,26 +1,2 @@
|
|
|
1
1
|
import { ModUpgraded } from "../../classes/ModUpgraded";
|
|
2
|
-
|
|
3
|
-
* Enables extra console commands which are useful for debugging. See [the
|
|
4
|
-
* docs](https://isaacscript.github.io/isaacscript-common/features/extraConsoleCommands_listCommands)
|
|
5
|
-
* for the specific commands that are added.
|
|
6
|
-
*/
|
|
7
|
-
export declare function enableExtraConsoleCommands(mod: ModUpgraded): void;
|
|
8
|
-
/**
|
|
9
|
-
* Helper function to add a custom console command.
|
|
10
|
-
*
|
|
11
|
-
* The standard library comes with many existing console commands that are useful for debugging, but
|
|
12
|
-
* you can also add your own commands that are useful for your particular mod. It's easier to add
|
|
13
|
-
* commands to the existing command system than to add logic manually to the ExecuteCmd callback.
|
|
14
|
-
*
|
|
15
|
-
* Before using this function, you must first invoke `enableExtraConsoleCommands`.
|
|
16
|
-
*/
|
|
17
|
-
export declare function addConsoleCommand(commandName: string, commandFunction: (params: string) => void): void;
|
|
18
|
-
/**
|
|
19
|
-
* Helper function to remove a custom console command.
|
|
20
|
-
*
|
|
21
|
-
* The standard library comes with many existing console commands that are useful for debugging. If
|
|
22
|
-
* you want to disable one of them, use this function.
|
|
23
|
-
*
|
|
24
|
-
* Before using this function, you must first invoke `enableExtraConsoleCommands`.
|
|
25
|
-
*/
|
|
26
|
-
export declare function removeConsoleCommand(commandName: string): void;
|
|
2
|
+
export declare function extraConsoleCommandsInit(mod: ModUpgraded): void;
|