isaacscript-common 11.2.4 → 12.0.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.d.ts +8 -3
- package/dist/isaacscript-common.lua +138 -62
- package/dist/package.lua +1 -1
- package/dist/src/features/customStage/backdrop.lua +2 -2
- package/dist/src/features/customStage/{customStageConstants.d.ts → constants.d.ts} +1 -1
- package/dist/src/features/customStage/constants.d.ts.map +1 -0
- package/dist/src/features/customStage/{customStageConstants.lua → constants.lua} +0 -0
- package/dist/src/features/customStage/init.lua +2 -2
- package/dist/src/features/customStage/shadows.lua +2 -2
- package/dist/src/features/customStage/streakText.d.ts.map +1 -1
- package/dist/src/features/customStage/streakText.lua +3 -3
- package/dist/src/features/customStage/v.d.ts +1 -1
- package/dist/src/features/customStage/v.d.ts.map +1 -1
- package/dist/src/features/customStage/v.lua +2 -2
- package/dist/src/features/customStage/versusScreen.lua +3 -3
- package/dist/src/features/customTrapdoor/{customTrapdoorConstants.d.ts → constants.d.ts} +1 -1
- package/dist/src/features/customTrapdoor/constants.d.ts.map +1 -0
- package/dist/src/features/customTrapdoor/{customTrapdoorConstants.lua → constants.lua} +0 -0
- package/dist/src/features/customTrapdoor/exports.lua +2 -2
- package/dist/src/features/customTrapdoor/init.lua +4 -4
- package/dist/src/features/customTrapdoor/openClose.lua +4 -4
- package/dist/src/features/customTrapdoor/spawn.lua +2 -2
- package/dist/src/features/customTrapdoor/touched.lua +6 -6
- package/dist/src/features/saveDataManager/constants.d.ts +10 -0
- package/dist/src/features/saveDataManager/constants.d.ts.map +1 -0
- package/dist/src/features/saveDataManager/constants.lua +10 -0
- package/dist/src/features/saveDataManager/exports.d.ts +8 -3
- package/dist/src/features/saveDataManager/exports.d.ts.map +1 -1
- package/dist/src/features/saveDataManager/exports.lua +10 -5
- package/dist/src/features/saveDataManager/load.d.ts.map +1 -1
- package/dist/src/features/saveDataManager/load.lua +9 -9
- package/dist/src/features/saveDataManager/main.d.ts.map +1 -1
- package/dist/src/features/saveDataManager/main.lua +67 -4
- package/dist/src/features/saveDataManager/maps.d.ts +5 -0
- package/dist/src/features/saveDataManager/maps.d.ts.map +1 -1
- package/dist/src/features/saveDataManager/maps.lua +3 -0
- package/dist/src/features/saveDataManager/merge.lua +2 -2
- package/dist/src/features/saveDataManager/save.lua +3 -3
- package/dist/src/functions/deepCopy.lua +2 -2
- package/package.json +1 -1
- package/src/features/customStage/backdrop.ts +1 -1
- package/src/features/customStage/{customStageConstants.ts → constants.ts} +0 -0
- package/src/features/customStage/init.ts +1 -1
- package/src/features/customStage/shadows.ts +1 -1
- package/src/features/customStage/streakText.ts +1 -4
- package/src/features/customStage/v.ts +1 -1
- package/src/features/customStage/versusScreen.ts +1 -1
- package/src/features/customTrapdoor/{customTrapdoorConstants.ts → constants.ts} +0 -0
- package/src/features/customTrapdoor/exports.ts +1 -1
- package/src/features/customTrapdoor/init.ts +1 -1
- package/src/features/customTrapdoor/openClose.ts +1 -1
- package/src/features/customTrapdoor/spawn.ts +1 -1
- package/src/features/customTrapdoor/touched.ts +1 -1
- package/src/features/saveDataManager/constants.ts +15 -0
- package/src/features/saveDataManager/exports.ts +9 -4
- package/src/features/saveDataManager/load.ts +13 -9
- package/src/features/saveDataManager/main.ts +78 -4
- package/src/features/saveDataManager/maps.ts +6 -0
- package/src/features/saveDataManager/merge.ts +1 -1
- package/src/features/saveDataManager/save.ts +1 -1
- package/src/functions/deepCopy.ts +1 -1
- package/dist/src/features/customStage/customStageConstants.d.ts.map +0 -1
- package/dist/src/features/customTrapdoor/customTrapdoorConstants.d.ts.map +0 -1
- package/dist/src/features/saveDataManager/saveDataManagerConstants.d.ts +0 -4
- package/dist/src/features/saveDataManager/saveDataManagerConstants.d.ts.map +0 -1
- package/dist/src/features/saveDataManager/saveDataManagerConstants.lua +0 -5
- package/src/features/saveDataManager/saveDataManagerConstants.ts +0 -4
|
@@ -9,17 +9,20 @@ import { logError } from "../../functions/log";
|
|
|
9
9
|
import { onFirstFloor } from "../../functions/stage";
|
|
10
10
|
import { clearTable, iterateTableInOrder } from "../../functions/table";
|
|
11
11
|
import { SaveData } from "../../interfaces/SaveData";
|
|
12
|
+
import {
|
|
13
|
+
SAVE_DATA_MANAGER_DEBUG,
|
|
14
|
+
SAVE_DATA_MANAGER_FEATURE_NAME,
|
|
15
|
+
SAVE_DATA_MANAGER_GLOWING_HOUR_GLASS_BACKUP_KEYS,
|
|
16
|
+
} from "./constants";
|
|
12
17
|
import { loadFromDisk } from "./load";
|
|
13
18
|
import {
|
|
14
19
|
saveDataConditionalFuncMap,
|
|
15
20
|
saveDataDefaultsMap,
|
|
21
|
+
saveDataGlowingHourGlassMap,
|
|
16
22
|
saveDataMap,
|
|
17
23
|
} from "./maps";
|
|
24
|
+
import { merge } from "./merge";
|
|
18
25
|
import { saveToDisk } from "./save";
|
|
19
|
-
import {
|
|
20
|
-
SAVE_DATA_MANAGER_DEBUG,
|
|
21
|
-
SAVE_DATA_MANAGER_FEATURE_NAME,
|
|
22
|
-
} from "./saveDataManagerConstants";
|
|
23
26
|
|
|
24
27
|
const RESETTABLE_SAVE_DATA_KEYS: ReadonlySet<SaveDataKey> = new Set([
|
|
25
28
|
SaveDataKey.RUN,
|
|
@@ -29,6 +32,7 @@ const RESETTABLE_SAVE_DATA_KEYS: ReadonlySet<SaveDataKey> = new Set([
|
|
|
29
32
|
|
|
30
33
|
let mod: ModUpgraded | null = null;
|
|
31
34
|
let loadedDataOnThisRun = false;
|
|
35
|
+
let restoreGlowingHourGlassDataOnNextRoom = false;
|
|
32
36
|
|
|
33
37
|
export function saveDataManagerInit(incomingMod: ModUpgraded): void {
|
|
34
38
|
mod = incomingMod;
|
|
@@ -50,6 +54,7 @@ export function saveDataManagerInit(incomingMod: ModUpgraded): void {
|
|
|
50
54
|
// ModCallback.POST_USE_ITEM (3)
|
|
51
55
|
// CollectibleType.GLOWING_HOUR_GLASS (422)
|
|
52
56
|
function postUseItemGlowingHourGlass() {
|
|
57
|
+
restoreGlowingHourGlassDataOnNextRoom = true;
|
|
53
58
|
return undefined;
|
|
54
59
|
}
|
|
55
60
|
|
|
@@ -118,6 +123,75 @@ function postNewLevel() {
|
|
|
118
123
|
// ModCallbackCustom.POST_NEW_ROOM_EARLY
|
|
119
124
|
function postNewRoomEarly() {
|
|
120
125
|
restoreDefaults(SaveDataKey.ROOM);
|
|
126
|
+
|
|
127
|
+
// Handle the Glowing Hour Glass.
|
|
128
|
+
if (restoreGlowingHourGlassDataOnNextRoom) {
|
|
129
|
+
restoreGlowingHourGlassDataOnNextRoom = false;
|
|
130
|
+
restoreGlowingHourGlassBackup();
|
|
131
|
+
} else {
|
|
132
|
+
makeGlowingHourGlassBackup();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function makeGlowingHourGlassBackup() {
|
|
137
|
+
iterateTableInOrder(
|
|
138
|
+
saveDataMap,
|
|
139
|
+
(subscriberName, saveData) => {
|
|
140
|
+
for (const saveDataKey of SAVE_DATA_MANAGER_GLOWING_HOUR_GLASS_BACKUP_KEYS) {
|
|
141
|
+
const childTable = saveData[saveDataKey];
|
|
142
|
+
if (childTable === undefined) {
|
|
143
|
+
// This feature does not happen to store any variables on this particular child table.
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
let saveDataGlowingHourGlass =
|
|
148
|
+
saveDataGlowingHourGlassMap.get(subscriberName);
|
|
149
|
+
if (saveDataGlowingHourGlass === undefined) {
|
|
150
|
+
saveDataGlowingHourGlass = new LuaMap<string, unknown>() as SaveData;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const copiedChildTable = deepCopy(childTable);
|
|
154
|
+
saveDataGlowingHourGlass[saveDataKey] = copiedChildTable;
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
SAVE_DATA_MANAGER_DEBUG,
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function restoreGlowingHourGlassBackup() {
|
|
162
|
+
iterateTableInOrder(
|
|
163
|
+
saveDataMap,
|
|
164
|
+
(subscriberName, saveData) => {
|
|
165
|
+
for (const saveDataKey of SAVE_DATA_MANAGER_GLOWING_HOUR_GLASS_BACKUP_KEYS) {
|
|
166
|
+
const childTable = saveData[saveDataKey];
|
|
167
|
+
if (childTable === undefined) {
|
|
168
|
+
// This feature does not happen to store any variables on this particular child table.
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const saveDataGlowingHourGlass =
|
|
173
|
+
saveDataGlowingHourGlassMap.get(subscriberName);
|
|
174
|
+
if (saveDataGlowingHourGlass === undefined) {
|
|
175
|
+
// This should never happen.
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const childTableBackup = saveDataGlowingHourGlass[saveDataKey];
|
|
180
|
+
if (childTableBackup === undefined) {
|
|
181
|
+
// This should never happen.
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
merge(
|
|
186
|
+
childTable as LuaMap<AnyNotNil, unknown>,
|
|
187
|
+
childTableBackup as LuaMap<AnyNotNil, unknown>,
|
|
188
|
+
// Append an arbitrary suffix for better error messages.
|
|
189
|
+
`${subscriberName}__glowingHourGlass`,
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
SAVE_DATA_MANAGER_DEBUG,
|
|
194
|
+
);
|
|
121
195
|
}
|
|
122
196
|
|
|
123
197
|
function restoreDefaultsAll() {
|
|
@@ -9,3 +9,9 @@ export const saveDataMap = new LuaMap<string, SaveData>();
|
|
|
9
9
|
|
|
10
10
|
export const saveDataDefaultsMap = new LuaMap<string, SaveData>();
|
|
11
11
|
export const saveDataConditionalFuncMap = new LuaMap<string, () => boolean>();
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* We backup some save data keys on every new room for the purposes of restoring it when Glowing
|
|
15
|
+
* Hour Glass is used.
|
|
16
|
+
*/
|
|
17
|
+
export const saveDataGlowingHourGlassMap = new LuaMap<string, SaveData>();
|
|
@@ -11,7 +11,7 @@ import { clearTable, iterateTableInOrder } from "../../functions/table";
|
|
|
11
11
|
import { isDefaultMap, isTSTLMap, isTSTLSet } from "../../functions/tstlClass";
|
|
12
12
|
import { isTable } from "../../functions/types";
|
|
13
13
|
import { getTraversalDescription } from "../../functions/utils";
|
|
14
|
-
import { SAVE_DATA_MANAGER_DEBUG } from "./
|
|
14
|
+
import { SAVE_DATA_MANAGER_DEBUG } from "./constants";
|
|
15
15
|
import { isSerializationBrand } from "./serializationBrands";
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DefaultMap } from "../classes/DefaultMap";
|
|
2
2
|
import { SerializationBrand } from "../enums/private/SerializationBrand";
|
|
3
3
|
import { SerializationType } from "../enums/SerializationType";
|
|
4
|
-
import { SAVE_DATA_MANAGER_DEBUG } from "../features/saveDataManager/
|
|
4
|
+
import { SAVE_DATA_MANAGER_DEBUG } from "../features/saveDataManager/constants";
|
|
5
5
|
import { isSerializationBrand } from "../features/saveDataManager/serializationBrands";
|
|
6
6
|
import { TSTLClass } from "../types/TSTLClass";
|
|
7
7
|
import { isArray } from "./array";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"customStageConstants.d.ts","sourceRoot":"","sources":["../../../../src/features/customStage/customStageConstants.ts"],"names":[],"mappings":";AAAA,eAAO,MAAM,yBAAyB,gBAAgB,CAAC;AAEvD,eAAO,MAAM,iCAAiC,iCAAiC,CAAC;AAEhF,uCAAuC;AACvC,oBAAY,iBAAiB;IAC3B,IAAI,IAAA;IACJ,IAAI,IAAA;IACJ,SAAS,IAAA;CACV;AAED,uCAAuC;AACvC,eAAO,MAAM,8BAA8B,EAAE;IAC3C,QAAQ,EAAE,GAAG,IAAI,iBAAiB,GAAG,GAAG;CAKhC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"customTrapdoorConstants.d.ts","sourceRoot":"","sources":["../../../../src/features/customTrapdoor/customTrapdoorConstants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,eAAO,MAAM,4BAA4B,mBAAmB,CAAC;AAE7D,eAAO,MAAM,oBAAoB;IAC/B;;;OAGG;;CAEK,CAAC;AAEX,2FAA2F;AAC3F,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC,eAAO,MAAM,iCAAiC,QAA+B,CAAC;AAC9E,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAEhD,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAE5C,eAAO,MAAM,oCAAoC,EAAE,WAAW,CAAC,MAAM,CAClC,CAAC;AAEpC,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAE7C,eAAO,MAAM,4CAA4C,IAAI,CAAC;AAC9D,eAAO,MAAM,+CAA+C,IAAI,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"saveDataManagerConstants.d.ts","sourceRoot":"","sources":["../../../../src/features/saveDataManager/saveDataManagerConstants.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,eAAO,MAAM,uBAAuB,SAAmB,CAAC;AAExD,eAAO,MAAM,8BAA8B,sBAAsB,CAAC"}
|