Various fixes
This commit is contained in:
parent
cf2d3878f3
commit
1fd58092e4
@ -5,6 +5,9 @@ import { ForgeImprovementTask } from './ForgeImprovementTask';
|
||||
import { path, PathList, uniqPaths } from '../../Helpers/Path';
|
||||
import { registerTask } from '../TaskMap';
|
||||
import { ImmutableTaskList, Task } from '../../Queue/Task';
|
||||
import * as _ from 'underscore';
|
||||
|
||||
const MAX_PATHS = 5;
|
||||
|
||||
@registerTask()
|
||||
export class UpdateResourceContractsTask extends BaseTask {
|
||||
@ -15,11 +18,15 @@ export class UpdateResourceContractsTask extends BaseTask {
|
||||
.map((v) => this.factory.getById(v.id).taskCollection().getTasks())
|
||||
.reduce((acc, tasks) => acc.concat(tasks), []);
|
||||
|
||||
const paths = uniqPaths([
|
||||
let paths = uniqPaths([
|
||||
...this.walkUpgradeTasks(tasks),
|
||||
...this.walkImprovementTask(tasks),
|
||||
]);
|
||||
|
||||
if (paths.length > MAX_PATHS) {
|
||||
paths = _.sample(paths, MAX_PATHS);
|
||||
}
|
||||
|
||||
return paths.map((p) => ({
|
||||
name: GoToPageAction.name,
|
||||
args: { path: path(p.name, p.query) },
|
||||
|
@ -39,7 +39,8 @@ export class WarehouseBuildingPlan implements ConstructionPlan {
|
||||
|
||||
const firstSlot = first(storageSlots);
|
||||
if (firstSlot) {
|
||||
this.taskCollection.addTask(UpgradeBuildingTask.name, {
|
||||
// @todo change to "add task before first required"
|
||||
this.taskCollection.addTaskAsFirst(UpgradeBuildingTask.name, {
|
||||
buildId: firstSlot.buildId,
|
||||
buildTypeId: this.buildTypeId,
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user