Created a base engine class and let it handle all creeps.
This commit is contained in:
@@ -6,19 +6,23 @@
|
||||
#include <emscripten.h>
|
||||
|
||||
#include "Constants.hpp"
|
||||
#include "structures/spawn.hpp"
|
||||
#include "Structures/Spawn.hpp"
|
||||
|
||||
void DouwcoHivemind::Spawn::process()
|
||||
{
|
||||
int creepcount = structure->room().find(Screeps::FIND_MY_CREEPS).size();
|
||||
if (creepcount > 10) return;
|
||||
if (creepcount > 10)
|
||||
{
|
||||
EM_ASM({ console.log('To much creeps in this room'); });
|
||||
return;
|
||||
}
|
||||
EM_ASM({ console.log('Creating a harvester'); });
|
||||
|
||||
JSON opts;
|
||||
opts["memory"]["role"] = DouwcoHivemind::ROLE_HARVESTER;
|
||||
opts["memory"]["role"] = Roles::HARVESTER;
|
||||
|
||||
int resp = structure->spawnCreep(
|
||||
{"work", "carry", "move"},
|
||||
{"work", "carry", "move"},
|
||||
"harvester" + std::to_string(Screeps::Game.time()),
|
||||
opts
|
||||
);
|
||||
opts);
|
||||
}
|
||||
Reference in New Issue
Block a user