REFACTOR: Handle migration of ActionIdentifier in Bladeburner code instead of GenericReviver (#1799)

This commit is contained in:
catloversg
2024-11-27 16:22:23 +07:00
committed by GitHub
parent 3846c69204
commit 22b6458c22
2 changed files with 21 additions and 3 deletions
+1 -3
View File
@@ -1,4 +1,3 @@
import { loadActionIdentifier } from "../Bladeburner/utils/loadActionIdentifier";
import { constructorsForReviver, isReviverValue } from "./JSONReviver";
import { validateObject } from "./Validator";
@@ -21,10 +20,9 @@ export function Reviver(_key: string, value: unknown): any {
case "Employee": // Entire object removed from game in v2.2.0 (employees abstracted)
case "Company": // Reviver removed in v2.6.1
case "Faction": // Reviver removed in v2.6.1
case "ActionIdentifier": // No longer a class as of v2.6.1
console.warn(`Legacy load type ${value.ctor} converted to expected format while loading.`);
return value.data;
case "ActionIdentifier": // No longer a class as of v2.6.1
return loadActionIdentifier(value.data);
}
// Missing constructor with no special handling. Throw error.
throw new Error(`Could not locate constructor named ${value.ctor}. If the save data is valid, this is a bug.`);