isaacscript-common 13.2.0 → 13.3.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/dist/index.d.ts +37 -8
- package/dist/isaacscript-common.lua +6695 -6631
- package/dist/src/callbacks/customRevive.d.ts.map +1 -1
- package/dist/src/callbacks/customRevive.lua +2 -1
- package/dist/src/callbacks/postNewRoomEarly.lua +2 -2
- package/dist/src/classes/ModUpgraded.d.ts +5 -2
- package/dist/src/classes/ModUpgraded.d.ts.map +1 -1
- package/dist/src/classes/ModUpgraded.lua +39 -3
- package/dist/src/core/upgradeMod.d.ts +6 -1
- package/dist/src/core/upgradeMod.d.ts.map +1 -1
- package/dist/src/core/upgradeMod.lua +9 -2
- package/dist/src/features/customStage/exports.lua +2 -2
- package/dist/src/features/extraConsoleCommands/listCommands.lua +5 -5
- package/dist/src/features/pause.lua +2 -2
- package/dist/src/features/saveDataManager/load.d.ts.map +1 -1
- package/dist/src/features/saveDataManager/load.lua +2 -1
- package/dist/src/features/saveDataManager/main.lua +2 -2
- package/dist/src/features/taintedLazarusPlayers.lua +2 -2
- package/dist/src/functions/benchmark.d.ts +12 -0
- package/dist/src/functions/benchmark.d.ts.map +1 -1
- package/dist/src/functions/benchmark.lua +19 -0
- package/dist/src/functions/debugFunctions.d.ts +1 -0
- package/dist/src/functions/debugFunctions.d.ts.map +1 -1
- package/dist/src/functions/debugFunctions.lua +15 -23
- package/dist/src/functions/globals.lua +1 -1
- package/dist/src/functions/hex.lua +2 -2
- package/dist/src/functions/jsonHelpers.lua +2 -2
- package/dist/src/functions/log.d.ts +9 -70
- package/dist/src/functions/log.d.ts.map +1 -1
- package/dist/src/functions/log.lua +18 -504
- package/dist/src/functions/logMisc.d.ts +69 -0
- package/dist/src/functions/logMisc.d.ts.map +1 -0
- package/dist/src/functions/logMisc.lua +498 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.lua +8 -0
- package/dist/src/indexLua.d.ts +185 -0
- package/dist/src/indexLua.d.ts.map +1 -0
- package/dist/src/indexLua.lua +1314 -0
- package/package.json +2 -2
- package/src/callbacks/customRevive.ts +2 -1
- package/src/callbacks/postNewRoomEarly.ts +1 -1
- package/src/classes/ModUpgraded.ts +50 -4
- package/src/core/upgradeMod.ts +10 -2
- package/src/features/customStage/exports.ts +1 -1
- package/src/features/extraConsoleCommands/listCommands.ts +1 -1
- package/src/features/pause.ts +1 -1
- package/src/features/saveDataManager/load.ts +2 -1
- package/src/features/saveDataManager/main.ts +1 -1
- package/src/features/taintedLazarusPlayers.ts +1 -1
- package/src/functions/benchmark.ts +23 -0
- package/src/functions/debugFunctions.ts +15 -25
- package/src/functions/globals.ts +1 -1
- package/src/functions/hex.ts +1 -1
- package/src/functions/jsonHelpers.ts +1 -1
- package/src/functions/log.ts +24 -455
- package/src/functions/logMisc.ts +441 -0
- package/src/index.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customRevive.d.ts","sourceRoot":"","sources":["../../../src/callbacks/customRevive.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"customRevive.d.ts","sourceRoot":"","sources":["../../../src/callbacks/customRevive.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AA2CrD,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,CAiBhE"}
|
|
@@ -20,7 +20,8 @@ local ____entitiesSpecific = require("src.functions.entitiesSpecific")
|
|
|
20
20
|
local removeAllFamiliars = ____entitiesSpecific.removeAllFamiliars
|
|
21
21
|
local ____log = require("src.functions.log")
|
|
22
22
|
local log = ____log.log
|
|
23
|
-
local
|
|
23
|
+
local ____logMisc = require("src.functions.logMisc")
|
|
24
|
+
local logError = ____logMisc.logError
|
|
24
25
|
local ____playerIndex = require("src.functions.playerIndex")
|
|
25
26
|
local getPlayerFromIndex = ____playerIndex.getPlayerFromIndex
|
|
26
27
|
local getPlayerIndex = ____playerIndex.getPlayerIndex
|
|
@@ -8,8 +8,8 @@ local game = ____cachedClasses.game
|
|
|
8
8
|
local ____gridEntities = require("src.functions.gridEntities")
|
|
9
9
|
local getTopLeftWallGridIndex = ____gridEntities.getTopLeftWallGridIndex
|
|
10
10
|
local spawnGridEntity = ____gridEntities.spawnGridEntity
|
|
11
|
-
local
|
|
12
|
-
local logError =
|
|
11
|
+
local ____logMisc = require("src.functions.logMisc")
|
|
12
|
+
local logError = ____logMisc.logError
|
|
13
13
|
local ____postNewRoomEarly = require("src.callbacks.subscriptions.postNewRoomEarly")
|
|
14
14
|
local postNewRoomEarlyFire = ____postNewRoomEarly.postNewRoomEarlyFire
|
|
15
15
|
local postNewRoomEarlyHasSubscriptions = ____postNewRoomEarly.postNewRoomEarlyHasSubscriptions
|
|
@@ -4,7 +4,8 @@ import { AddCallbackParameterCustom } from "../interfaces/private/AddCallbackPar
|
|
|
4
4
|
/**
|
|
5
5
|
* `isaacscript-common` has many custom callbacks that you can use in your mods. Instead of
|
|
6
6
|
* hijacking the vanilla `Mod` object, we provide a `ModUpgraded` object for you to use, which
|
|
7
|
-
* extends the base class and adds a new method of `AddCallbackCustom`.
|
|
7
|
+
* extends the base class and adds a new method of `AddCallbackCustom`. (There is no corresponding
|
|
8
|
+
* `RemoveCallbackCustom`.)
|
|
8
9
|
*
|
|
9
10
|
* To upgrade your mod, use the `upgradeMod` helper function.
|
|
10
11
|
*/
|
|
@@ -16,7 +17,9 @@ export declare class ModUpgraded implements Mod {
|
|
|
16
17
|
Name: string;
|
|
17
18
|
/** We store a copy of the original mod object so that we can re-implement its functions. */
|
|
18
19
|
Mod: Mod;
|
|
19
|
-
|
|
20
|
+
Debug: boolean;
|
|
21
|
+
TimeThreshold: float | undefined;
|
|
22
|
+
constructor(mod: Mod, debug: boolean, timeThreshold?: float);
|
|
20
23
|
AddCallback<T extends ModCallback>(modCallback: T, ...args: AddCallbackParameter[T]): void;
|
|
21
24
|
HasData(): boolean;
|
|
22
25
|
LoadData(): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModUpgraded.d.ts","sourceRoot":"","sources":["../../../src/classes/ModUpgraded.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"ModUpgraded.d.ts","sourceRoot":"","sources":["../../../src/classes/ModUpgraded.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAG/D,OAAO,EAAE,0BAA0B,EAAE,MAAM,kDAAkD,CAAC;AAG9F;;;;;;;GAOG;AACH,qBAAa,WAAY,YAAW,GAAG;IAKrC;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IAMb,4FAA4F;IAC5F,GAAG,EAAE,GAAG,CAAC;IAET,KAAK,EAAE,OAAO,CAAC;IACf,aAAa,EAAE,KAAK,GAAG,SAAS,CAAC;gBAErB,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,CAAC,EAAE,KAAK;IAW3D,WAAW,CAAC,CAAC,SAAS,WAAW,EAC/B,WAAW,EAAE,CAAC,EACd,GAAG,IAAI,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAC/B,IAAI;IA2CP,OAAO,IAAI,OAAO;IAIlB,QAAQ,IAAI,MAAM;IAIlB;;;OAGG;IACH,cAAc,CAAC,CAAC,SAAS,WAAW,EAClC,WAAW,EAAE,CAAC,EACd,QAAQ,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GACnC,IAAI;IAIP,UAAU,IAAI,IAAI;IAIlB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAS5B,iBAAiB,CAAC,CAAC,SAAS,iBAAiB,EAC3C,iBAAiB,EAAE,CAAC,EACpB,GAAG,IAAI,EAAE,0BAA0B,CAAC,CAAC,CAAC,GACrC,IAAI;CAKR"}
|
|
@@ -1,22 +1,58 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local __TS__Class = ____lualib.__TS__Class
|
|
3
|
+
local __TS__Spread = ____lualib.__TS__Spread
|
|
3
4
|
local ____exports = {}
|
|
5
|
+
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
6
|
+
local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
|
|
7
|
+
local ____benchmark = require("src.functions.benchmark")
|
|
8
|
+
local getTime = ____benchmark.getTime
|
|
9
|
+
local ____log = require("src.functions.log")
|
|
10
|
+
local getParentFunctionDescription = ____log.getParentFunctionDescription
|
|
4
11
|
local ____callbackRegisterFunctions = require("src.objects.callbackRegisterFunctions")
|
|
5
12
|
local CALLBACK_REGISTER_FUNCTIONS = ____callbackRegisterFunctions.CALLBACK_REGISTER_FUNCTIONS
|
|
6
13
|
--- `isaacscript-common` has many custom callbacks that you can use in your mods. Instead of
|
|
7
14
|
-- hijacking the vanilla `Mod` object, we provide a `ModUpgraded` object for you to use, which
|
|
8
|
-
-- extends the base class and adds a new method of `AddCallbackCustom`.
|
|
15
|
+
-- extends the base class and adds a new method of `AddCallbackCustom`. (There is no corresponding
|
|
16
|
+
-- `RemoveCallbackCustom`.)
|
|
9
17
|
--
|
|
10
18
|
-- To upgrade your mod, use the `upgradeMod` helper function.
|
|
11
19
|
____exports.ModUpgraded = __TS__Class()
|
|
12
20
|
local ModUpgraded = ____exports.ModUpgraded
|
|
13
21
|
ModUpgraded.name = "ModUpgraded"
|
|
14
|
-
function ModUpgraded.prototype.____constructor(self, mod)
|
|
22
|
+
function ModUpgraded.prototype.____constructor(self, mod, ____debug, timeThreshold)
|
|
15
23
|
self.Name = mod.Name
|
|
16
24
|
self.Mod = mod
|
|
25
|
+
self.Debug = ____debug
|
|
26
|
+
self.TimeThreshold = timeThreshold
|
|
17
27
|
end
|
|
18
28
|
function ModUpgraded.prototype.AddCallback(self, modCallback, ...)
|
|
19
|
-
|
|
29
|
+
local args = {...}
|
|
30
|
+
if self.Debug then
|
|
31
|
+
local callback = args[1]
|
|
32
|
+
local optionalArg = args[2]
|
|
33
|
+
local parentFunctionDescription = getParentFunctionDescription(nil)
|
|
34
|
+
local callbackName = "ModCallback." .. tostring(ModCallback[modCallback])
|
|
35
|
+
local signature = parentFunctionDescription == nil and callbackName or (parentFunctionDescription .. " - ") .. callbackName
|
|
36
|
+
--- We don't use the "log" helper function since it will always show the same "unknown" prefix.
|
|
37
|
+
local function callbackWithLogger(____, ...)
|
|
38
|
+
local startTime = getTime(nil)
|
|
39
|
+
Isaac.DebugString(signature .. " - START")
|
|
40
|
+
callback(nil, ...)
|
|
41
|
+
local endTime = getTime(nil)
|
|
42
|
+
local elapsedTime = endTime - startTime
|
|
43
|
+
if self.TimeThreshold == nil or self.TimeThreshold >= elapsedTime then
|
|
44
|
+
Isaac.DebugString((signature .. " - END - time: ") .. tostring(elapsedTime))
|
|
45
|
+
else
|
|
46
|
+
Isaac.DebugString(signature .. " - END")
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
self.Mod:AddCallback(modCallback, callbackWithLogger, optionalArg)
|
|
50
|
+
else
|
|
51
|
+
self.Mod:AddCallback(
|
|
52
|
+
modCallback,
|
|
53
|
+
__TS__Spread(args)
|
|
54
|
+
)
|
|
55
|
+
end
|
|
20
56
|
end
|
|
21
57
|
function ModUpgraded.prototype.HasData(self)
|
|
22
58
|
return self.Mod:HasData()
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
2
3
|
import { ModUpgraded } from "../classes/ModUpgraded";
|
|
3
4
|
/**
|
|
4
5
|
* Use this function to enable the custom callbacks and other optional features provided by
|
|
@@ -18,7 +19,11 @@ import { ModUpgraded } from "../classes/ModUpgraded";
|
|
|
18
19
|
* ```
|
|
19
20
|
*
|
|
20
21
|
* @param modVanilla The mod object returned by the `RegisterMod` function.
|
|
22
|
+
* @param debug Optional. Whether to log additional output when a callback is fired. Default is
|
|
23
|
+
* false.
|
|
24
|
+
* @param timeThreshold Optional. If provided, will only log callbacks that take longer than the
|
|
25
|
+
* specified number of seconds.
|
|
21
26
|
* @returns The upgraded mod object.
|
|
22
27
|
*/
|
|
23
|
-
export declare function upgradeMod(modVanilla: Mod): ModUpgraded;
|
|
28
|
+
export declare function upgradeMod(modVanilla: Mod, debug?: boolean, timeThreshold?: float): ModUpgraded;
|
|
24
29
|
//# sourceMappingURL=upgradeMod.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgradeMod.d.ts","sourceRoot":"","sources":["../../../src/core/upgradeMod.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"upgradeMod.d.ts","sourceRoot":"","sources":["../../../src/core/upgradeMod.ts"],"names":[],"mappings":";;AACA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAWrD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,UAAU,CACxB,UAAU,EAAE,GAAG,EACf,KAAK,UAAQ,EACb,aAAa,CAAC,EAAE,KAAK,GACpB,WAAW,CAwBb"}
|
|
@@ -35,9 +35,16 @@ local loadShaderCrashFix = ____shaderCrashFix.loadShaderCrashFix
|
|
|
35
35
|
-- ```
|
|
36
36
|
--
|
|
37
37
|
-- @param modVanilla The mod object returned by the `RegisterMod` function.
|
|
38
|
+
-- @param debug Optional. Whether to log additional output when a callback is fired. Default is
|
|
39
|
+
-- false.
|
|
40
|
+
-- @param timeThreshold Optional. If provided, will only log callbacks that take longer than the
|
|
41
|
+
-- specified number of seconds.
|
|
38
42
|
-- @returns The upgraded mod object.
|
|
39
|
-
function ____exports.upgradeMod(self, modVanilla)
|
|
40
|
-
|
|
43
|
+
function ____exports.upgradeMod(self, modVanilla, ____debug, timeThreshold)
|
|
44
|
+
if ____debug == nil then
|
|
45
|
+
____debug = false
|
|
46
|
+
end
|
|
47
|
+
local mod = __TS__New(ModUpgraded, modVanilla, ____debug, timeThreshold)
|
|
41
48
|
if not areFeaturesInitialized(nil) then
|
|
42
49
|
setFeaturesInitialized(nil)
|
|
43
50
|
patchErrorFunction(nil)
|
|
@@ -15,8 +15,8 @@ local ____cachedClasses = require("src.core.cachedClasses")
|
|
|
15
15
|
local game = ____cachedClasses.game
|
|
16
16
|
local ____doors = require("src.functions.doors")
|
|
17
17
|
local doorSlotFlagsToDoorSlots = ____doors.doorSlotFlagsToDoorSlots
|
|
18
|
-
local
|
|
19
|
-
local logError =
|
|
18
|
+
local ____logMisc = require("src.functions.logMisc")
|
|
19
|
+
local logError = ____logMisc.logError
|
|
20
20
|
local ____rng = require("src.functions.rng")
|
|
21
21
|
local newRNG = ____rng.newRNG
|
|
22
22
|
local ____rooms = require("src.functions.rooms")
|
|
@@ -59,11 +59,11 @@ local ____gridEntities = require("src.functions.gridEntities")
|
|
|
59
59
|
local spawnGridEntity = ____gridEntities.spawnGridEntity
|
|
60
60
|
local ____levelGrid = require("src.functions.levelGrid")
|
|
61
61
|
local getRoomGridIndexesForType = ____levelGrid.getRoomGridIndexesForType
|
|
62
|
-
local
|
|
63
|
-
local logPlayerEffects =
|
|
64
|
-
local logRoom =
|
|
65
|
-
local logSeedEffects =
|
|
66
|
-
local logSounds =
|
|
62
|
+
local ____logMisc = require("src.functions.logMisc")
|
|
63
|
+
local logPlayerEffects = ____logMisc.logPlayerEffects
|
|
64
|
+
local logRoom = ____logMisc.logRoom
|
|
65
|
+
local logSeedEffects = ____logMisc.logSeedEffects
|
|
66
|
+
local logSounds = ____logMisc.logSounds
|
|
67
67
|
local ____map = require("src.functions.map")
|
|
68
68
|
local getMapPartialMatch = ____map.getMapPartialMatch
|
|
69
69
|
local ____mergeTests = require("src.functions.mergeTests")
|
|
@@ -21,8 +21,8 @@ local removeAllProjectiles = ____entitiesSpecific.removeAllProjectiles
|
|
|
21
21
|
local removeAllTears = ____entitiesSpecific.removeAllTears
|
|
22
22
|
local ____isaacAPIClass = require("src.functions.isaacAPIClass")
|
|
23
23
|
local isTear = ____isaacAPIClass.isTear
|
|
24
|
-
local
|
|
25
|
-
local logError =
|
|
24
|
+
local ____logMisc = require("src.functions.logMisc")
|
|
25
|
+
local logError = ____logMisc.logError
|
|
26
26
|
local ____playerIndex = require("src.functions.playerIndex")
|
|
27
27
|
local getAllPlayers = ____playerIndex.getAllPlayers
|
|
28
28
|
local ____players = require("src.functions.players")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../../../src/features/saveDataManager/load.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../../../src/features/saveDataManager/load.ts"],"names":[],"mappings":";;AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AASrD,wBAAgB,YAAY,CAC1B,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GACpC,IAAI,CAuDN"}
|
|
@@ -6,7 +6,8 @@ local ____jsonHelpers = require("src.functions.jsonHelpers")
|
|
|
6
6
|
local jsonDecode = ____jsonHelpers.jsonDecode
|
|
7
7
|
local ____log = require("src.functions.log")
|
|
8
8
|
local log = ____log.log
|
|
9
|
-
local
|
|
9
|
+
local ____logMisc = require("src.functions.logMisc")
|
|
10
|
+
local logError = ____logMisc.logError
|
|
10
11
|
local ____table = require("src.functions.table")
|
|
11
12
|
local iterateTableInOrder = ____table.iterateTableInOrder
|
|
12
13
|
local ____types = require("src.functions.types")
|
|
@@ -16,8 +16,8 @@ local ____SerializationType = require("src.enums.SerializationType")
|
|
|
16
16
|
local SerializationType = ____SerializationType.SerializationType
|
|
17
17
|
local ____deepCopy = require("src.functions.deepCopy")
|
|
18
18
|
local deepCopy = ____deepCopy.deepCopy
|
|
19
|
-
local
|
|
20
|
-
local logError =
|
|
19
|
+
local ____logMisc = require("src.functions.logMisc")
|
|
20
|
+
local logError = ____logMisc.logError
|
|
21
21
|
local ____stage = require("src.functions.stage")
|
|
22
22
|
local onFirstFloor = ____stage.onFirstFloor
|
|
23
23
|
local ____table = require("src.functions.table")
|
|
@@ -8,8 +8,8 @@ local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
|
|
|
8
8
|
local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
|
|
9
9
|
local ____featuresInitialized = require("src.featuresInitialized")
|
|
10
10
|
local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNotInitialized
|
|
11
|
-
local
|
|
12
|
-
local logError =
|
|
11
|
+
local ____logMisc = require("src.functions.logMisc")
|
|
12
|
+
local logError = ____logMisc.logError
|
|
13
13
|
local ____exports = require("src.features.saveDataManager.exports")
|
|
14
14
|
local saveDataManager = ____exports.saveDataManager
|
|
15
15
|
function postPlayerInit(self, player)
|
|
@@ -13,4 +13,16 @@
|
|
|
13
13
|
* be printed to the log.)
|
|
14
14
|
*/
|
|
15
15
|
export declare function benchmark(numTrials: int, ...functions: Array<() => void>): int[];
|
|
16
|
+
/**
|
|
17
|
+
* Helper function to get the current time in seconds for benchmarking / profiling purposes.
|
|
18
|
+
*
|
|
19
|
+
* - If the "--luadebug" flag is enabled, then this function will use the `socket.gettime` method,
|
|
20
|
+
* which returns the epoch timestamp in seconds (e.g. "1640320492.5779"). This is preferable over
|
|
21
|
+
* the `Isaac.GetTime` method, since it has one extra decimal point of precision.
|
|
22
|
+
* - If the "--luadebug" flag is disabled, then this function will use the `Isaac.GetTime` method,
|
|
23
|
+
* which returns the number of seconds since the computer's operating system was started (e.g.
|
|
24
|
+
* "739454.963"). (The milliseconds return value of `Isaac.GetTime` is converted to seconds to
|
|
25
|
+
* align with the return value of `socket.gettime`.)
|
|
26
|
+
*/
|
|
27
|
+
export declare function getTime(): float;
|
|
16
28
|
//# sourceMappingURL=benchmark.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"benchmark.d.ts","sourceRoot":"","sources":["../../../src/functions/benchmark.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"benchmark.d.ts","sourceRoot":"","sources":["../../../src/functions/benchmark.ts"],"names":[],"mappings":";AAGA;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CACvB,SAAS,EAAE,GAAG,EACd,GAAG,SAAS,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC,GAC9B,GAAG,EAAE,CAsBP;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,OAAO,IAAI,KAAK,CAS/B"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
|
|
3
3
|
local ____exports = {}
|
|
4
|
+
local ____constants = require("src.core.constants")
|
|
5
|
+
local SECOND_IN_MILLISECONDS = ____constants.SECOND_IN_MILLISECONDS
|
|
4
6
|
local ____log = require("src.functions.log")
|
|
5
7
|
local log = ____log.log
|
|
6
8
|
--- Helper function to benchmark the performance of a function.
|
|
@@ -46,4 +48,21 @@ function ____exports.benchmark(self, numTrials, ...)
|
|
|
46
48
|
)
|
|
47
49
|
return averages
|
|
48
50
|
end
|
|
51
|
+
--- Helper function to get the current time in seconds for benchmarking / profiling purposes.
|
|
52
|
+
--
|
|
53
|
+
-- - If the "--luadebug" flag is enabled, then this function will use the `socket.gettime` method,
|
|
54
|
+
-- which returns the epoch timestamp in seconds (e.g. "1640320492.5779"). This is preferable over
|
|
55
|
+
-- the `Isaac.GetTime` method, since it has one extra decimal point of precision.
|
|
56
|
+
-- - If the "--luadebug" flag is disabled, then this function will use the `Isaac.GetTime` method,
|
|
57
|
+
-- which returns the number of seconds since the computer's operating system was started (e.g.
|
|
58
|
+
-- "739454.963"). (The milliseconds return value of `Isaac.GetTime` is converted to seconds to
|
|
59
|
+
-- align with the return value of `socket.gettime`.)
|
|
60
|
+
function ____exports.getTime(self)
|
|
61
|
+
local ok, requiredSocket = pcall(require, "socket")
|
|
62
|
+
if ok then
|
|
63
|
+
local socket = requiredSocket
|
|
64
|
+
return socket.gettime()
|
|
65
|
+
end
|
|
66
|
+
return Isaac.GetTime() / SECOND_IN_MILLISECONDS
|
|
67
|
+
end
|
|
49
68
|
return ____exports
|
|
@@ -46,6 +46,7 @@ export declare function isLuaDebugEnabled(): boolean;
|
|
|
46
46
|
* This is useful when printing out variables from the in-game debug console.
|
|
47
47
|
*/
|
|
48
48
|
export declare function setLogFunctionsGlobal(): void;
|
|
49
|
+
export declare function setTracebackFunctionsGlobal(): void;
|
|
49
50
|
/**
|
|
50
51
|
* Helper function to print a stack trace to the "log.txt" file, similar to JavaScript's
|
|
51
52
|
* `console.trace` function.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debugFunctions.d.ts","sourceRoot":"","sources":["../../../src/functions/debugFunctions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"debugFunctions.d.ts","sourceRoot":"","sources":["../../../src/functions/debugFunctions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAUrD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,CAOxD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAYrC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAI3C;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAS5C;AAED,wBAAgB,2BAA2B,IAAI,IAAI,CAKlD;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,IAAI,IAAI,CAGhC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local __TS__ObjectEntries = ____lualib.__TS__ObjectEntries
|
|
3
3
|
local ____exports = {}
|
|
4
|
-
local setDebugFunctionsGlobal
|
|
5
4
|
local ____exports = require("src.features.extraConsoleCommands.exports")
|
|
6
5
|
local enableExtraConsoleCommands = ____exports.enableExtraConsoleCommands
|
|
7
6
|
local ____fadeInRemover = require("src.features.fadeInRemover")
|
|
@@ -14,6 +13,7 @@ local logExports = require("src.functions.log")
|
|
|
14
13
|
local ____log = require("src.functions.log")
|
|
15
14
|
local log = ____log.log
|
|
16
15
|
local logEntitiesExports = require("src.functions.logEntities")
|
|
16
|
+
local logMiscExports = require("src.functions.logMisc")
|
|
17
17
|
--- Helper function to get a stack trace.
|
|
18
18
|
--
|
|
19
19
|
-- This will only work if the `--luadebug` launch option is enabled or the Racing+ sandbox is
|
|
@@ -22,8 +22,8 @@ function ____exports.getTraceback(self)
|
|
|
22
22
|
if debug ~= nil then
|
|
23
23
|
return debug.traceback()
|
|
24
24
|
end
|
|
25
|
-
if
|
|
26
|
-
return
|
|
25
|
+
if SandboxGetTraceback ~= nil then
|
|
26
|
+
return SandboxGetTraceback()
|
|
27
27
|
end
|
|
28
28
|
return "stack traceback:\n(the \"--luadebug\" flag is not enabled)"
|
|
29
29
|
end
|
|
@@ -32,17 +32,19 @@ end
|
|
|
32
32
|
-- This is useful when printing out variables from the in-game debug console.
|
|
33
33
|
function ____exports.setLogFunctionsGlobal(self)
|
|
34
34
|
local globals = _G
|
|
35
|
-
for ____,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
local logFuncName = ____value[1]
|
|
42
|
-
local logFunc = ____value[2]
|
|
43
|
-
globals[logFuncName] = logFunc
|
|
35
|
+
for ____, exports in ipairs({logExports, logMiscExports, logEntitiesExports}) do
|
|
36
|
+
for ____, ____value in ipairs(__TS__ObjectEntries(exports)) do
|
|
37
|
+
local logFuncName = ____value[1]
|
|
38
|
+
local logFunc = ____value[2]
|
|
39
|
+
globals[logFuncName] = logFunc
|
|
40
|
+
end
|
|
44
41
|
end
|
|
45
42
|
end
|
|
43
|
+
function ____exports.setTracebackFunctionsGlobal(self)
|
|
44
|
+
local globals = _G
|
|
45
|
+
globals.getTraceback = ____exports.getTraceback
|
|
46
|
+
globals.traceback = ____exports.traceback
|
|
47
|
+
end
|
|
46
48
|
--- Helper function to print a stack trace to the "log.txt" file, similar to JavaScript's
|
|
47
49
|
-- `console.trace` function.
|
|
48
50
|
--
|
|
@@ -52,14 +54,6 @@ function ____exports.traceback(self)
|
|
|
52
54
|
local tracebackOutput = ____exports.getTraceback(nil)
|
|
53
55
|
log(nil, tracebackOutput)
|
|
54
56
|
end
|
|
55
|
-
function setDebugFunctionsGlobal(self)
|
|
56
|
-
if _G.debug == nil and sandboxGetTraceback == nil then
|
|
57
|
-
return
|
|
58
|
-
end
|
|
59
|
-
local globals = _G
|
|
60
|
-
globals.getTraceback = ____exports.getTraceback
|
|
61
|
-
globals.traceback = ____exports.traceback
|
|
62
|
-
end
|
|
63
57
|
--- Helper function to enable some IsaacScript features that are useful when developing a mod. They
|
|
64
58
|
-- should not be enabled when your mod goes to production (i.e. when it is uploaded to the Steam
|
|
65
59
|
-- Workshop).
|
|
@@ -78,6 +72,7 @@ end
|
|
|
78
72
|
function ____exports.enableDevFeatures(self, mod)
|
|
79
73
|
saveDataManagerSetGlobal(nil)
|
|
80
74
|
____exports.setLogFunctionsGlobal(nil)
|
|
75
|
+
____exports.setTracebackFunctionsGlobal(nil)
|
|
81
76
|
enableExtraConsoleCommands(nil, mod)
|
|
82
77
|
enableFastReset(nil)
|
|
83
78
|
removeFadeIn(nil)
|
|
@@ -98,7 +93,4 @@ end
|
|
|
98
93
|
function ____exports.isLuaDebugEnabled(self)
|
|
99
94
|
return _G.package ~= nil
|
|
100
95
|
end
|
|
101
|
-
if ____exports.isLuaDebugEnabled(nil) or sandboxGetTraceback ~= nil then
|
|
102
|
-
setDebugFunctionsGlobal(nil)
|
|
103
|
-
end
|
|
104
96
|
return ____exports
|
|
@@ -15,7 +15,7 @@ local copySet = ____set.copySet
|
|
|
15
15
|
local ____utils = require("src.functions.utils")
|
|
16
16
|
local twoDimensionalSort = ____utils.twoDimensionalSort
|
|
17
17
|
function isRacingPlusSandboxEnabled(self)
|
|
18
|
-
return
|
|
18
|
+
return SandboxGetParentFunctionDescription ~= nil
|
|
19
19
|
end
|
|
20
20
|
local DEFAULT_GLOBALS = __TS__New(Set, {
|
|
21
21
|
"ActionTriggers",
|
|
@@ -3,8 +3,8 @@ local __TS__StringReplace = ____lualib.__TS__StringReplace
|
|
|
3
3
|
local __TS__StringSubstring = ____lualib.__TS__StringSubstring
|
|
4
4
|
local ____exports = {}
|
|
5
5
|
local hexToRGB, HEX_STRING_LENGTH
|
|
6
|
-
local
|
|
7
|
-
local logError =
|
|
6
|
+
local ____logMisc = require("src.functions.logMisc")
|
|
7
|
+
local logError = ____logMisc.logError
|
|
8
8
|
function hexToRGB(self, hexString)
|
|
9
9
|
hexString = __TS__StringReplace(hexString, "#", "")
|
|
10
10
|
if #hexString ~= HEX_STRING_LENGTH then
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
local ____exports = {}
|
|
2
2
|
local jsonLua = require("src.lib.jsonLua")
|
|
3
|
-
local
|
|
4
|
-
local logError =
|
|
3
|
+
local ____logMisc = require("src.functions.logMisc")
|
|
4
|
+
local logError = ____logMisc.logError
|
|
5
5
|
local function tryDecode(jsonString)
|
|
6
6
|
return jsonLua.decode(jsonString)
|
|
7
7
|
end
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
2
|
-
import { CollectibleType, DamageFlag, EntityFlag, ProjectileFlag, TearFlag, UseFlag } from "isaac-typescript-definitions";
|
|
3
1
|
/**
|
|
4
|
-
* Helper function to
|
|
2
|
+
* Helper function to get the name and the line number of the current calling function.
|
|
3
|
+
*
|
|
4
|
+
* For this function to work properly, the "--luadebug" flag must be enabled. Otherwise, it will
|
|
5
|
+
* always return undefined.
|
|
6
|
+
*
|
|
7
|
+
* @param levels Optional. The amount of levels to look backwards in the call stack. Default is 3
|
|
8
|
+
* (because the first level is this function, the second level is the calling
|
|
9
|
+
* function, and the third level is the parent of the calling function).
|
|
5
10
|
*/
|
|
6
|
-
export declare function
|
|
11
|
+
export declare function getParentFunctionDescription(levels?: number): string | undefined;
|
|
7
12
|
/**
|
|
8
13
|
* Helper function to avoid typing out `Isaac.DebugString()`.
|
|
9
14
|
*
|
|
@@ -11,70 +16,4 @@ export declare function getDebugPrependString(msg: string, numParentFunctions?:
|
|
|
11
16
|
* function will also prepend the function name and the line number before the string.
|
|
12
17
|
*/
|
|
13
18
|
export declare function log(msg: string): void;
|
|
14
|
-
export declare function logArray<T>(array: T[] | readonly T[]): void;
|
|
15
|
-
export declare function logCollectibleTypes(collectibleTypes: CollectibleType[]): void;
|
|
16
|
-
export declare function logColor(color: Color): void;
|
|
17
|
-
/** Helper function for printing out every damage flag that is turned on. Useful when debugging. */
|
|
18
|
-
export declare function logDamageFlags(flags: DamageFlag | BitFlags<DamageFlag>): void;
|
|
19
|
-
/** Helper function for printing out every entity flag that is turned on. Useful when debugging. */
|
|
20
|
-
export declare function logEntityFlags(flags: EntityFlag | BitFlags<EntityFlag>): void;
|
|
21
|
-
export declare function logEntityID(entity: Entity): void;
|
|
22
|
-
/**
|
|
23
|
-
* Helper function to log an error message and also print it to the console for better visibility.
|
|
24
|
-
*
|
|
25
|
-
* This is useful in situations where using the `error` function would be dangerous (since it
|
|
26
|
-
* prevents all of the subsequent code in the callback from running).
|
|
27
|
-
*/
|
|
28
|
-
export declare function logError(msg: string): void;
|
|
29
|
-
/** Helper function for printing out every flag that is turned on. Useful when debugging. */
|
|
30
|
-
export declare function logFlags<T extends BitFlag | BitFlag128>(flags: T | BitFlags<T>, flagEnum: Record<string, T>, description?: string): void;
|
|
31
|
-
/**
|
|
32
|
-
* Helper function for printing out every game state flag that is turned on. Useful when debugging.
|
|
33
|
-
*/
|
|
34
|
-
export declare function logGameStateFlags(): void;
|
|
35
|
-
export declare function logKColor(kColor: KColor): void;
|
|
36
|
-
/**
|
|
37
|
-
* Helper function for printing out every level state flag that is turned on. Useful when debugging.
|
|
38
|
-
*/
|
|
39
|
-
export declare function logLevelStateFlags(): void;
|
|
40
|
-
export declare function logMap(map: Map<AnyNotNil, unknown>): void;
|
|
41
|
-
export declare function logPlayerEffects(player: EntityPlayer): void;
|
|
42
|
-
export declare function logPlayerHealth(player: EntityPlayer): void;
|
|
43
|
-
/**
|
|
44
|
-
* Helper function for printing out every projectile flag that is turned on. Useful when debugging.
|
|
45
|
-
*/
|
|
46
|
-
export declare function logProjectileFlags(flags: ProjectileFlag | BitFlags<ProjectileFlag>): void;
|
|
47
|
-
/** Helper function for logging information about the current room. */
|
|
48
|
-
export declare function logRoom(): void;
|
|
49
|
-
/**
|
|
50
|
-
* Helper function for printing out every seed effect (i.e. Easter Egg) that is turned on for the
|
|
51
|
-
* particular run.
|
|
52
|
-
*/
|
|
53
|
-
export declare function logSeedEffects(): void;
|
|
54
|
-
export declare function logSet(set: Set<AnyNotNil> | ReadonlySet<AnyNotNil>): void;
|
|
55
|
-
/** Helper function for logging every sound effect that is currently playing. */
|
|
56
|
-
export declare function logSounds(): void;
|
|
57
|
-
/**
|
|
58
|
-
* Helper function for logging every key and value of a table. This is a deep log; the function will
|
|
59
|
-
* recursively call itself if it counters a table within a table.
|
|
60
|
-
*
|
|
61
|
-
* This function will only work on tables that have string keys (because it logs the keys in order,
|
|
62
|
-
* instead of randomly). It will throw a run-time error if it encounters a non-string key.
|
|
63
|
-
*/
|
|
64
|
-
export declare function logTable(luaTable: unknown, parentTables?: number): void;
|
|
65
|
-
/**
|
|
66
|
-
* Helper function to print out the differences between the entries of two tables. Note that this
|
|
67
|
-
* will only do a shallow comparison.
|
|
68
|
-
*/
|
|
69
|
-
export declare function logTableDifferences<K extends AnyNotNil, V>(table1: LuaMap<K, V>, table2: LuaMap<K, V>): void;
|
|
70
|
-
/** Helper function for printing out every tear flag that is turned on. Useful when debugging. */
|
|
71
|
-
export declare function logTearFlags(flags: TearFlag | BitFlags<TearFlag>): void;
|
|
72
|
-
/** Helper function for printing out every use flag that is turned on. Useful when debugging. */
|
|
73
|
-
export declare function logUseFlags(flags: UseFlag | BitFlags<UseFlag>): void;
|
|
74
|
-
/**
|
|
75
|
-
* Helper function to enumerate all of the properties of a "userdata" object (i.e. an object from
|
|
76
|
-
* the Isaac API).
|
|
77
|
-
*/
|
|
78
|
-
export declare function logUserdata(userdata: unknown): void;
|
|
79
|
-
export declare function logVector(vector: Vector, round?: boolean): void;
|
|
80
19
|
//# sourceMappingURL=log.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../src/functions/log.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../src/functions/log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,CAK1C,MAAM,SAAI,GACT,MAAM,GAAG,SAAS,CAiBpB;AAED;;;;;GAKG;AACH,wBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAOrC"}
|