diff --git a/src/modules/ConstructionController/index.ts b/src/modules/ConstructionController/index.ts index f3a253dd..16cf88b0 100644 --- a/src/modules/ConstructionController/index.ts +++ b/src/modules/ConstructionController/index.ts @@ -39,8 +39,10 @@ export const buildCompleteSite: { [constructionSiteId: string]: Structure } = {} */ const saveWaiting = function (): void { if (!Game._needSaveConstructionData) return; - if (waitingConstruction.length <= 0) delete Memory[SAVE_KEY]; - else Memory[SAVE_KEY] = JSON.stringify(waitingConstruction); + if (waitingConstruction.length <= 0) { + Game._needSaveConstructionData = false; + delete Memory[SAVE_KEY]; + } else Memory[SAVE_KEY] = JSON.stringify(waitingConstruction); }; /** @@ -48,6 +50,7 @@ const saveWaiting = function (): void { * 在全局重置时调用 */ export function initConstructionController(): void { + if (!Game._needSaveConstructionData) return; // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access waitingConstruction = JSON.parse(Memory[SAVE_KEY] || "[]").map(({ pos, type }) => { // 这里把位置重建出来 diff --git a/src/modules/room/spawn/CreepRelease.ts b/src/modules/room/spawn/CreepRelease.ts index 40dcd954..26d001a8 100644 --- a/src/modules/room/spawn/CreepRelease.ts +++ b/src/modules/room/spawn/CreepRelease.ts @@ -421,9 +421,10 @@ export default class RoomCreepReleaseController { * * @param targetFlagName 进攻旗帜名称 * @param num 要孵化的数量 + * @param keepSpawn 是否持续生成 * @param wayPoint 路径点 */ - public attacker(targetFlagName = "", num = 1, wayPoint?: WayPoint): string { + public attacker(targetFlagName = "", num = 1, keepSpawn = false, wayPoint?: WayPoint): string { if (num <= 0 || num > 10) num = 1; for (let i = 0; i < num; i++) { @@ -432,7 +433,7 @@ export default class RoomCreepReleaseController { role: "attacker", data: { targetFlagName: targetFlagName || DEFAULT_FLAG_NAME.ATTACK, - keepSpawn: false, + keepSpawn, wayPoint } }); diff --git a/src/modules/room/spawn/nameGetter.ts b/src/modules/room/spawn/nameGetter.ts index 9114cf0b..b31af0d6 100644 --- a/src/modules/room/spawn/nameGetter.ts +++ b/src/modules/room/spawn/nameGetter.ts @@ -28,5 +28,5 @@ export class GetName { public static boostDismantler = (roomName: string): string => `${roomName} dismantler ${Game.time}`; public static boostRangedAttacker = (roomName: string): string => `${roomName} boostRangedAttacker ${Game.time}`; public static defender = (roomName: string): string => `${roomName} defender`; - public static scout = (roomName: string, index: number): string => `${roomName} scout ${Game.time}-${index}`; + public static scout = (roomName: string, index: number): string => `${roomName} scout ${index}`; }