SCRIPTS: Script modules are reused when they are imported (#461)

Also corrects some compile race conditions.
This commit is contained in:
Snarling
2023-04-07 00:33:51 -04:00
committed by GitHub
parent f5cddb6984
commit 04d49e3a6d
67 changed files with 428 additions and 561 deletions
+2 -2
View File
@@ -20,7 +20,7 @@ import { HacknetNode } from "../../Hacknet/HacknetNode";
import { HashManager } from "../../Hacknet/HashManager";
import { MoneySourceTracker } from "../../utils/MoneySourceTracker";
import { Reviver, Generic_toJSON, Generic_fromJSON, IReviverValue } from "../../utils/JSONReviver";
import { constructorsForReviver, Generic_toJSON, Generic_fromJSON, IReviverValue } from "../../utils/JSONReviver";
import { PlayerAchievement } from "../../Achievements/Achievements";
import { cyrb53 } from "../../utils/StringHelperFunctions";
import { getRandomInt } from "../../utils/helpers/getRandomInt";
@@ -175,4 +175,4 @@ export class PlayerObject extends Person implements IPlayer {
setPlayer(new PlayerObject());
Reviver.constructors.PlayerObject = PlayerObject;
constructorsForReviver.PlayerObject = PlayerObject;
+2 -2
View File
@@ -22,7 +22,7 @@ import { CityName, CrimeType, GymType, LocationName, UniversityClassType } from
import { Factions } from "../../Faction/Factions";
import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../../utils/JSONReviver";
import { Generic_fromJSON, Generic_toJSON, IReviverValue, constructorsForReviver } from "../../utils/JSONReviver";
import { formatPercent } from "../../ui/formatNumber";
import { FactionWorkType } from "../../Enums";
import { SleeveWork } from "./Work/Work";
@@ -480,4 +480,4 @@ export class Sleeve extends Person implements SleevePerson {
}
}
Reviver.constructors.Sleeve = Sleeve;
constructorsForReviver.Sleeve = Sleeve;
@@ -1,5 +1,5 @@
import { Player } from "@player";
import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../../../utils/JSONReviver";
import { Generic_fromJSON, Generic_toJSON, IReviverValue, constructorsForReviver } from "../../../utils/JSONReviver";
import { Sleeve } from "../Sleeve";
import { applySleeveGains, Work, WorkType } from "./Work";
import { CONSTANTS } from "../../../Constants";
@@ -84,4 +84,4 @@ export class SleeveBladeburnerWork extends Work {
}
}
Reviver.constructors.SleeveBladeburnerWork = SleeveBladeburnerWork;
constructorsForReviver.SleeveBladeburnerWork = SleeveBladeburnerWork;
@@ -1,4 +1,4 @@
import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../../../utils/JSONReviver";
import { Generic_fromJSON, Generic_toJSON, IReviverValue, constructorsForReviver } from "../../../utils/JSONReviver";
import { applySleeveGains, Work, WorkType } from "./Work";
import { Classes, ClassType } from "../../../Work/ClassWork";
import { LocationName } from "../../../Enums";
@@ -60,4 +60,4 @@ export class SleeveClassWork extends Work {
}
}
Reviver.constructors.SleeveClassWork = SleeveClassWork;
constructorsForReviver.SleeveClassWork = SleeveClassWork;
@@ -1,4 +1,4 @@
import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../../../utils/JSONReviver";
import { Generic_fromJSON, Generic_toJSON, IReviverValue, constructorsForReviver } from "../../../utils/JSONReviver";
import { Sleeve } from "../Sleeve";
import { applySleeveGains, Work, WorkType } from "./Work";
import { LocationName } from "../../../Enums";
@@ -63,4 +63,4 @@ export class SleeveCompanyWork extends Work {
}
}
Reviver.constructors.SleeveCompanyWork = SleeveCompanyWork;
constructorsForReviver.SleeveCompanyWork = SleeveCompanyWork;
@@ -1,5 +1,5 @@
import { Player } from "@player";
import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../../../utils/JSONReviver";
import { Generic_fromJSON, Generic_toJSON, IReviverValue, constructorsForReviver } from "../../../utils/JSONReviver";
import { Sleeve } from "../Sleeve";
import { applySleeveGains, Work, WorkType } from "./Work";
import { CrimeType } from "../../../Enums";
@@ -72,4 +72,4 @@ export class SleeveCrimeWork extends Work {
}
}
Reviver.constructors.SleeveCrimeWork = SleeveCrimeWork;
constructorsForReviver.SleeveCrimeWork = SleeveCrimeWork;
@@ -1,5 +1,5 @@
import { Player } from "@player";
import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../../../utils/JSONReviver";
import { Generic_fromJSON, Generic_toJSON, IReviverValue, constructorsForReviver } from "../../../utils/JSONReviver";
import { Sleeve } from "../Sleeve";
import { applySleeveGains, Work, WorkType } from "./Work";
import { FactionWorkType } from "../../../Enums";
@@ -74,4 +74,4 @@ export class SleeveFactionWork extends Work {
}
}
Reviver.constructors.SleeveFactionWork = SleeveFactionWork;
constructorsForReviver.SleeveFactionWork = SleeveFactionWork;
@@ -1,5 +1,5 @@
import { Player } from "@player";
import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../../../utils/JSONReviver";
import { Generic_fromJSON, Generic_toJSON, IReviverValue, constructorsForReviver } from "../../../utils/JSONReviver";
import { Sleeve } from "../Sleeve";
import { Work, WorkType } from "./Work";
import { CONSTANTS } from "../../../Constants";
@@ -45,4 +45,4 @@ export class SleeveInfiltrateWork extends Work {
}
}
Reviver.constructors.SleeveInfiltrateWork = SleeveInfiltrateWork;
constructorsForReviver.SleeveInfiltrateWork = SleeveInfiltrateWork;
@@ -1,4 +1,4 @@
import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../../../utils/JSONReviver";
import { Generic_fromJSON, Generic_toJSON, IReviverValue, constructorsForReviver } from "../../../utils/JSONReviver";
import { Sleeve } from "../Sleeve";
import { Work, WorkType } from "./Work";
import { calculateIntelligenceBonus } from "../../formulas/intelligence";
@@ -32,4 +32,4 @@ export class SleeveRecoveryWork extends Work {
}
}
Reviver.constructors.SleeveRecoveryWork = SleeveRecoveryWork;
constructorsForReviver.SleeveRecoveryWork = SleeveRecoveryWork;
@@ -1,5 +1,5 @@
import { Player } from "@player";
import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../../../utils/JSONReviver";
import { Generic_fromJSON, Generic_toJSON, IReviverValue, constructorsForReviver } from "../../../utils/JSONReviver";
import { Work, WorkType } from "./Work";
export const isSleeveSupportWork = (w: Work | null): w is SleeveSupportWork =>
@@ -35,4 +35,4 @@ export class SleeveSupportWork extends Work {
}
}
Reviver.constructors.SleeveSupportWork = SleeveSupportWork;
constructorsForReviver.SleeveSupportWork = SleeveSupportWork;
@@ -1,5 +1,5 @@
import { Player } from "@player";
import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../../../utils/JSONReviver";
import { Generic_fromJSON, Generic_toJSON, IReviverValue, constructorsForReviver } from "../../../utils/JSONReviver";
import { Sleeve } from "../Sleeve";
import { Work, WorkType } from "./Work";
import { calculateIntelligenceBonus } from "../../formulas/intelligence";
@@ -33,4 +33,4 @@ export class SleeveSynchroWork extends Work {
}
}
Reviver.constructors.SleeveSynchroWork = SleeveSynchroWork;
constructorsForReviver.SleeveSynchroWork = SleeveSynchroWork;