<commit_before>import OvermindProcess = require("../overmind");
import { OvermindMemory } from "../memory/overmind";
//import RemoteMiningProcess = require("../room/remote-mining");
//import { addProcess } from "../../kernel/kernel";
interface RemoteMiningStarterMemory extends OvermindMemory {
    targetRoomName: string;
    scout: string;
}
class RemoteMiningStarter extends OvermindProcess {
    public classPath = "components.processes.mining.remote-mining-starter";
    public memory: RemoteMiningStarterMemory;

    private scout(): number {
        let creep = Game.creeps[this.memory.scout];
        if (!creep) {
            this.spawnCreep("scout", { MOVE: 1 });
        } else {
            creep.moveTo(new RoomPosition(25, 25, this.memory.targetRoomName));
        }

        return 0;
    }
    public run(): number {
        let memory = this.memory;
        let room = Game.rooms[memory.targetRoomName];
        if (!room) {
            return this.scout();
        } else {

            let sources = room.find(FIND_SOURCES) as Source[];
            for (let source of sources) {
                let result = source.pos.createFlag(source.id, COLOR_YELLOW);
                if (_.isString(result)) {
                    /*let mining = new RemoteMiningProcess(0, 0);
                    addProcess(mining);
                    mining.memory.sourceId = source.id;
                    mining.memory.flagName = result;*/
                }
            }
            console.log("Mining process started, terminate RemoteMiningStarter process");
            return this.stop(0);
        }
    }

    public creepDies() { };
    public receiveCreep(creepID: string, creep: Creep) {
        if (creepID === "scout") {
            this.memory.scout = creep.name;
        }
    }
}

export = RemoteMiningStarter;<commit_msg>Remote mining bootstrap process now starts the correct mining process<commit_after>import OvermindProcess = require("../overmind");
import { OvermindMemory } from "../memory/overmind";
import MiningProcess = require("./mining");
interface RemoteMiningStarterMemory extends OvermindMemory {
    targetRoomName: string;
    scout: string;
}
class RemoteMiningStarter extends OvermindProcess {
    public classPath = "components.processes.mining.remote-mining-starter";
    public memory: RemoteMiningStarterMemory;

    public run(): number {
        let memory = this.memory;
        let room = Game.rooms[memory.targetRoomName];
        if (!room) {
            return this.scout();
        } else {

            let sources = room.find(FIND_SOURCES) as Source[];
            for (let source of sources) {
                let result = source.pos.createFlag(source.id, COLOR_YELLOW);
                if (_.isString(result)) {
                    let mining = new MiningProcess(0, 0);
                    RemoteMiningStarter.addProcess(mining);
                    mining.memory.sourceId = source.id;
                    mining.memory.flagName = result;
                    mining.memory.spawningRoomName = this.memory.spawningRoomName;
                }
            }
            console.log("Mining process started, terminate RemoteMiningStarter process");
            return this.stop(0);
        }
    }

    public creepDies() { };
    public receiveCreep(creepID: string, creep: Creep) {
        if (creepID === "scout") {
            this.memory.scout = creep.name;
        }
    }

    private scout(): number {
        let creep = Game.creeps[this.memory.scout];
        if (!creep) {
            this.spawnCreep("scout", { MOVE: 1 });
        } else {
            creep.moveTo(new RoomPosition(25, 25, this.memory.targetRoomName));
        }

        return 0;
    }
}

export = RemoteMiningStarter;
{'fraction_non_alphanumeric': 0.1123896173401124, 'fraction_numerical': 0.004816697886004816, 'mean_word_length': 2.1020746887966806, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4902955', 'n_tokens_mistral': 1073, 'n_tokens_neox': 1011, 'n_words': 230}