First working version of colony.
Harversters and spawn work.
This commit is contained in:
@@ -1,18 +1,25 @@
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <Screeps/JS.hpp>
|
||||
#include <Screeps/Game.hpp>
|
||||
#include <Screeps/Room.hpp>
|
||||
#include <Screeps/StructureSpawn.hpp>
|
||||
|
||||
#include <emscripten.h>
|
||||
|
||||
#include "Constants.hpp"
|
||||
#include "structures/spawn.hpp"
|
||||
|
||||
void SpawnManager::process()
|
||||
void DouwcoHivemind::Spawn::process()
|
||||
{
|
||||
for (auto& spawn : Screeps::Game.spawns())
|
||||
{
|
||||
int creepcount = spawn.second.room().find(Screeps::FIND_MY_CREEPS, nullptr).size();
|
||||
// EM_ASM({ console.log('creepcount: ' + $0); }, creepcount);
|
||||
if (creepcount >= 3) continue;
|
||||
int resp = spawn.second.spawnCreep({"work", "carry", "move"}, "harvester" + std::to_string(creepcount + 1));
|
||||
}
|
||||
int creepcount = structure->room().find(Screeps::FIND_MY_CREEPS, nullptr).size();
|
||||
EM_ASM({ console.log('creepcount: ' + $0); }, creepcount);
|
||||
if (creepcount >= 10) return;
|
||||
|
||||
JSON opts;
|
||||
opts["memory"]["role"] = DouwcoHivemind::ROLE_HARVESTER;
|
||||
|
||||
int resp = structure->spawnCreep(
|
||||
{"work", "carry", "move"},
|
||||
"harvester" + std::to_string(creepcount + 1),
|
||||
opts
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user