Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/modules/ConstructionController/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,18 @@ 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);
};

/**
* 初始化控制器
* 在全局重置时调用
*/
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 }) => {
// 这里把位置重建出来
Expand Down
5 changes: 3 additions & 2 deletions src/modules/room/spawn/CreepRelease.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand All @@ -432,7 +433,7 @@ export default class RoomCreepReleaseController {
role: "attacker",
data: {
targetFlagName: targetFlagName || DEFAULT_FLAG_NAME.ATTACK,
keepSpawn: false,
keepSpawn,
wayPoint
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/modules/room/spawn/nameGetter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
}