isaacscript-common 33.7.0 → 33.8.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.
- package/dist/index.rollup.d.ts +3 -0
- package/dist/isaacscript-common.lua +22 -4
- package/dist/src/classes/features/other/SaveDataManager.d.ts +3 -0
- package/dist/src/classes/features/other/SaveDataManager.d.ts.map +1 -1
- package/dist/src/classes/features/other/saveDataManager/glowingHourGlass.d.ts.map +1 -1
- package/dist/src/classes/features/other/saveDataManager/glowingHourGlass.lua +21 -5
- package/package.json +1 -1
- package/src/classes/features/other/SaveDataManager.ts +3 -0
- package/src/classes/features/other/saveDataManager/glowingHourGlass.ts +13 -2
package/dist/index.rollup.d.ts
CHANGED
|
@@ -15666,6 +15666,9 @@ declare class SaveDataManager extends Feature {
|
|
|
15666
15666
|
* your mod features that use the save data manager. If this is undesired for your specific
|
|
15667
15667
|
* use-case, then add a key of `__ignoreGlowingHourGlass: true` to your "run" or "level" object.
|
|
15668
15668
|
*
|
|
15669
|
+
* If you want the automatic variable restoring with Glowing Hour Glass functionality to apply to
|
|
15670
|
+
* a "persistent" object, you can add a key of `rewindWithGlowingHourGlass: true` to the object.
|
|
15671
|
+
*
|
|
15669
15672
|
* @param key The name of the file or feature that is submitting data to be managed by the save
|
|
15670
15673
|
* data manager. The save data manager will throw an error if the key is already
|
|
15671
15674
|
* registered. Note that you can also pass a TSTL class instead of a string and the
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 33.
|
|
3
|
+
isaacscript-common 33.8.0
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -36683,7 +36683,12 @@ end
|
|
|
36683
36683
|
return ____exports
|
|
36684
36684
|
end,
|
|
36685
36685
|
["src.classes.features.other.saveDataManager.glowingHourGlass"] = function(...)
|
|
36686
|
+
local ____lualib = require("lualib_bundle")
|
|
36687
|
+
local __TS__SparseArrayNew = ____lualib.__TS__SparseArrayNew
|
|
36688
|
+
local __TS__SparseArrayPush = ____lualib.__TS__SparseArrayPush
|
|
36689
|
+
local __TS__SparseArraySpread = ____lualib.__TS__SparseArraySpread
|
|
36686
36690
|
local ____exports = {}
|
|
36691
|
+
local getKeysToBackup, GLOWING_HOUR_GLASS_BACKUP_KEYS, REWIND_WITH_GLOWING_HOUR_GLASS_KEY
|
|
36687
36692
|
local ____SaveDataKey = require("src.enums.SaveDataKey")
|
|
36688
36693
|
local SaveDataKey = ____SaveDataKey.SaveDataKey
|
|
36689
36694
|
local ____SerializationType = require("src.enums.SerializationType")
|
|
@@ -36696,8 +36701,21 @@ local ____table = require("src.functions.table")
|
|
|
36696
36701
|
local iterateTableInOrder = ____table.iterateTableInOrder
|
|
36697
36702
|
local ____constants = require("src.classes.features.other.saveDataManager.constants")
|
|
36698
36703
|
local SAVE_DATA_MANAGER_DEBUG = ____constants.SAVE_DATA_MANAGER_DEBUG
|
|
36699
|
-
|
|
36704
|
+
function getKeysToBackup(self, saveData)
|
|
36705
|
+
local shouldBackupPersistentObject = saveData.persistent ~= nil and saveData.persistent[REWIND_WITH_GLOWING_HOUR_GLASS_KEY] ~= nil
|
|
36706
|
+
local ____shouldBackupPersistentObject_1
|
|
36707
|
+
if shouldBackupPersistentObject then
|
|
36708
|
+
local ____array_0 = __TS__SparseArrayNew(table.unpack(GLOWING_HOUR_GLASS_BACKUP_KEYS))
|
|
36709
|
+
__TS__SparseArrayPush(____array_0, SaveDataKey.PERSISTENT)
|
|
36710
|
+
____shouldBackupPersistentObject_1 = {__TS__SparseArraySpread(____array_0)}
|
|
36711
|
+
else
|
|
36712
|
+
____shouldBackupPersistentObject_1 = GLOWING_HOUR_GLASS_BACKUP_KEYS
|
|
36713
|
+
end
|
|
36714
|
+
return ____shouldBackupPersistentObject_1
|
|
36715
|
+
end
|
|
36716
|
+
GLOWING_HOUR_GLASS_BACKUP_KEYS = {SaveDataKey.RUN, SaveDataKey.LEVEL}
|
|
36700
36717
|
local IGNORE_GLOWING_HOUR_GLASS_KEY = "__ignoreGlowingHourGlass"
|
|
36718
|
+
REWIND_WITH_GLOWING_HOUR_GLASS_KEY = "__rewindWithGlowingHourGlass"
|
|
36701
36719
|
function ____exports.makeGlowingHourGlassBackup(self, saveDataMap, saveDataConditionalFuncMap, saveDataGlowingHourGlassMap)
|
|
36702
36720
|
iterateTableInOrder(
|
|
36703
36721
|
nil,
|
|
@@ -36710,7 +36728,7 @@ function ____exports.makeGlowingHourGlassBackup(self, saveDataMap, saveDataCondi
|
|
|
36710
36728
|
return
|
|
36711
36729
|
end
|
|
36712
36730
|
end
|
|
36713
|
-
for ____, saveDataKey in ipairs(
|
|
36731
|
+
for ____, saveDataKey in ipairs(getKeysToBackup(nil, saveData)) do
|
|
36714
36732
|
do
|
|
36715
36733
|
local childTable = saveData[saveDataKey]
|
|
36716
36734
|
if childTable == nil then
|
|
@@ -36746,7 +36764,7 @@ function ____exports.restoreGlowingHourGlassBackup(self, saveDataMap, saveDataCo
|
|
|
36746
36764
|
return
|
|
36747
36765
|
end
|
|
36748
36766
|
end
|
|
36749
|
-
for ____, saveDataKey in ipairs(
|
|
36767
|
+
for ____, saveDataKey in ipairs(getKeysToBackup(nil, saveData)) do
|
|
36750
36768
|
do
|
|
36751
36769
|
local childTable = saveData[saveDataKey]
|
|
36752
36770
|
if childTable == nil then
|
|
@@ -126,6 +126,9 @@ export declare class SaveDataManager extends Feature {
|
|
|
126
126
|
* your mod features that use the save data manager. If this is undesired for your specific
|
|
127
127
|
* use-case, then add a key of `__ignoreGlowingHourGlass: true` to your "run" or "level" object.
|
|
128
128
|
*
|
|
129
|
+
* If you want the automatic variable restoring with Glowing Hour Glass functionality to apply to
|
|
130
|
+
* a "persistent" object, you can add a key of `rewindWithGlowingHourGlass: true` to the object.
|
|
131
|
+
*
|
|
129
132
|
* @param key The name of the file or feature that is submitting data to be managed by the save
|
|
130
133
|
* data manager. The save data manager will throw an error if the key is already
|
|
131
134
|
* registered. Note that you can also pass a TSTL class instead of a string and the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SaveDataManager.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/SaveDataManager.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAQzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAsBhD,qBAAa,eAAgB,SAAQ,OAAO;IAC1C;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAM;IAE1B;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAkC;IAE9D;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAkC;IAEtE;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAGvC;IAEJ;;;;;;OAMG;IACH,OAAO,CAAC,QAAQ,CAAC,2BAA2B,CAAkC;IAE9E;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAkC;IAGpE,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,qCAAqC,CAAS;IAmCtD,OAAO,CAAC,QAAQ,CAAC,2BAA2B,CAU1C;IAGF,OAAO,CAAC,QAAQ,CAAC,cAAc,CA0B7B;IAGF,OAAO,CAAC,QAAQ,CAAC,WAAW,CAa1B;IAGF,OAAO,CAAC,QAAQ,CAAC,YAAY,CAY3B;IAGF,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAuB/B;IAEF
|
|
1
|
+
{"version":3,"file":"SaveDataManager.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/SaveDataManager.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAA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ACpB,GAAG,EAAE,MAAM,GAAG,MAAM,EACpB,CAAC,EAAE,QAAQ,EACX,eAAe,EAAE,KAAK,GACrB,IAAI;IA4DP;;OAEG;IACH,OAAO,CAAC,gCAAgC;IAgBxC;;;;;;;;;OASG;IAEI,mBAAmB,IAAI,IAAI;IAIlC;;;;;;OAMG;IAEI,mBAAmB,IAAI,IAAI;IAIlC;;;;;;;OAOG;IAEI,wBAAwB,IAAI,IAAI;IAIvC;;;;;;;;;;;OAWG;IAEI,4BAA4B,CAAC,GAAG,WAAW,EAAE,QAAQ,EAAE,GAAG,IAAI;IAarE;;;;;OAKG;IAEI,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAoB/C;;;;;;;;;;;;;;;;;;;;;OAqBG;IAEI,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,cAAc,EAAE,WAAW,GAAG,IAAI;IAqB3E;;;;;;;;;;;;OAYG;IAEI,qBAAqB,IAAI,OAAO;IAKhC,6BAA6B,IAAI,IAAI;CAQ7C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glowingHourGlass.d.ts","sourceRoot":"","sources":["../../../../../../src/classes/features/other/saveDataManager/glowingHourGlass.ts"],"names":[],"mappings":";AAQA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"glowingHourGlass.d.ts","sourceRoot":"","sources":["../../../../../../src/classes/features/other/saveDataManager/glowingHourGlass.ts"],"names":[],"mappings":";AAQA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAe3D,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EACrC,0BAA0B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,EACzD,2BAA2B,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GACpD,IAAI,CAkDN;AAED,wBAAgB,6BAA6B,CAC3C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EACrC,0BAA0B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,EACzD,2BAA2B,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EACrD,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAC1C,IAAI,CAqDN"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__SparseArrayNew = ____lualib.__TS__SparseArrayNew
|
|
3
|
+
local __TS__SparseArrayPush = ____lualib.__TS__SparseArrayPush
|
|
4
|
+
local __TS__SparseArraySpread = ____lualib.__TS__SparseArraySpread
|
|
1
5
|
local ____exports = {}
|
|
6
|
+
local getKeysToBackup, GLOWING_HOUR_GLASS_BACKUP_KEYS, REWIND_WITH_GLOWING_HOUR_GLASS_KEY
|
|
2
7
|
local ____SaveDataKey = require("src.enums.SaveDataKey")
|
|
3
8
|
local SaveDataKey = ____SaveDataKey.SaveDataKey
|
|
4
9
|
local ____SerializationType = require("src.enums.SerializationType")
|
|
@@ -11,10 +16,21 @@ local ____table = require("src.functions.table")
|
|
|
11
16
|
local iterateTableInOrder = ____table.iterateTableInOrder
|
|
12
17
|
local ____constants = require("src.classes.features.other.saveDataManager.constants")
|
|
13
18
|
local SAVE_DATA_MANAGER_DEBUG = ____constants.SAVE_DATA_MANAGER_DEBUG
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
local
|
|
19
|
+
function getKeysToBackup(self, saveData)
|
|
20
|
+
local shouldBackupPersistentObject = saveData.persistent ~= nil and saveData.persistent[REWIND_WITH_GLOWING_HOUR_GLASS_KEY] ~= nil
|
|
21
|
+
local ____shouldBackupPersistentObject_1
|
|
22
|
+
if shouldBackupPersistentObject then
|
|
23
|
+
local ____array_0 = __TS__SparseArrayNew(table.unpack(GLOWING_HOUR_GLASS_BACKUP_KEYS))
|
|
24
|
+
__TS__SparseArrayPush(____array_0, SaveDataKey.PERSISTENT)
|
|
25
|
+
____shouldBackupPersistentObject_1 = {__TS__SparseArraySpread(____array_0)}
|
|
26
|
+
else
|
|
27
|
+
____shouldBackupPersistentObject_1 = GLOWING_HOUR_GLASS_BACKUP_KEYS
|
|
28
|
+
end
|
|
29
|
+
return ____shouldBackupPersistentObject_1
|
|
30
|
+
end
|
|
31
|
+
GLOWING_HOUR_GLASS_BACKUP_KEYS = {SaveDataKey.RUN, SaveDataKey.LEVEL}
|
|
17
32
|
local IGNORE_GLOWING_HOUR_GLASS_KEY = "__ignoreGlowingHourGlass"
|
|
33
|
+
REWIND_WITH_GLOWING_HOUR_GLASS_KEY = "__rewindWithGlowingHourGlass"
|
|
18
34
|
function ____exports.makeGlowingHourGlassBackup(self, saveDataMap, saveDataConditionalFuncMap, saveDataGlowingHourGlassMap)
|
|
19
35
|
iterateTableInOrder(
|
|
20
36
|
nil,
|
|
@@ -27,7 +43,7 @@ function ____exports.makeGlowingHourGlassBackup(self, saveDataMap, saveDataCondi
|
|
|
27
43
|
return
|
|
28
44
|
end
|
|
29
45
|
end
|
|
30
|
-
for ____, saveDataKey in ipairs(
|
|
46
|
+
for ____, saveDataKey in ipairs(getKeysToBackup(nil, saveData)) do
|
|
31
47
|
do
|
|
32
48
|
local childTable = saveData[saveDataKey]
|
|
33
49
|
if childTable == nil then
|
|
@@ -63,7 +79,7 @@ function ____exports.restoreGlowingHourGlassBackup(self, saveDataMap, saveDataCo
|
|
|
63
79
|
return
|
|
64
80
|
end
|
|
65
81
|
end
|
|
66
|
-
for ____, saveDataKey in ipairs(
|
|
82
|
+
for ____, saveDataKey in ipairs(getKeysToBackup(nil, saveData)) do
|
|
67
83
|
do
|
|
68
84
|
local childTable = saveData[saveDataKey]
|
|
69
85
|
if childTable == nil then
|
package/package.json
CHANGED
|
@@ -297,6 +297,9 @@ export class SaveDataManager extends Feature {
|
|
|
297
297
|
* your mod features that use the save data manager. If this is undesired for your specific
|
|
298
298
|
* use-case, then add a key of `__ignoreGlowingHourGlass: true` to your "run" or "level" object.
|
|
299
299
|
*
|
|
300
|
+
* If you want the automatic variable restoring with Glowing Hour Glass functionality to apply to
|
|
301
|
+
* a "persistent" object, you can add a key of `rewindWithGlowingHourGlass: true` to the object.
|
|
302
|
+
*
|
|
300
303
|
* @param key The name of the file or feature that is submitting data to be managed by the save
|
|
301
304
|
* data manager. The save data manager will throw an error if the key is already
|
|
302
305
|
* registered. Note that you can also pass a TSTL class instead of a string and the
|
|
@@ -20,6 +20,7 @@ const GLOWING_HOUR_GLASS_BACKUP_KEYS = [
|
|
|
20
20
|
] as const;
|
|
21
21
|
|
|
22
22
|
const IGNORE_GLOWING_HOUR_GLASS_KEY = "__ignoreGlowingHourGlass";
|
|
23
|
+
const REWIND_WITH_GLOWING_HOUR_GLASS_KEY = "__rewindWithGlowingHourGlass";
|
|
23
24
|
|
|
24
25
|
export function makeGlowingHourGlassBackup(
|
|
25
26
|
saveDataMap: LuaMap<string, SaveData>,
|
|
@@ -41,7 +42,7 @@ export function makeGlowingHourGlassBackup(
|
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
for (const saveDataKey of
|
|
45
|
+
for (const saveDataKey of getKeysToBackup(saveData)) {
|
|
45
46
|
const childTable = saveData[saveDataKey];
|
|
46
47
|
if (childTable === undefined) {
|
|
47
48
|
// This feature does not happen to store any variables on this particular child table.
|
|
@@ -98,7 +99,7 @@ export function restoreGlowingHourGlassBackup(
|
|
|
98
99
|
}
|
|
99
100
|
}
|
|
100
101
|
|
|
101
|
-
for (const saveDataKey of
|
|
102
|
+
for (const saveDataKey of getKeysToBackup(saveData)) {
|
|
102
103
|
const childTable = saveData[saveDataKey];
|
|
103
104
|
if (childTable === undefined) {
|
|
104
105
|
// This feature does not happen to store any variables on this particular child table.
|
|
@@ -136,3 +137,13 @@ export function restoreGlowingHourGlassBackup(
|
|
|
136
137
|
SAVE_DATA_MANAGER_DEBUG,
|
|
137
138
|
);
|
|
138
139
|
}
|
|
140
|
+
|
|
141
|
+
function getKeysToBackup(saveData: SaveData) {
|
|
142
|
+
const shouldBackupPersistentObject =
|
|
143
|
+
saveData.persistent !== undefined &&
|
|
144
|
+
(saveData.persistent as LuaTable).has(REWIND_WITH_GLOWING_HOUR_GLASS_KEY);
|
|
145
|
+
|
|
146
|
+
return shouldBackupPersistentObject
|
|
147
|
+
? ([...GLOWING_HOUR_GLASS_BACKUP_KEYS, SaveDataKey.PERSISTENT] as const)
|
|
148
|
+
: GLOWING_HOUR_GLASS_BACKUP_KEYS;
|
|
149
|
+
}
|