Created a base engine class and let it handle all creeps.

This commit is contained in:
douwe
2025-08-21 14:13:32 +02:00
parent c9ce09ba1a
commit 1e9e696b1e
16 changed files with 221 additions and 91 deletions

View File

@@ -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);
}