First working version of colony.

Harversters and spawn work.
This commit is contained in:
douwe
2025-08-13 20:43:26 +02:00
parent 8a39526580
commit 9a1682a857
28 changed files with 1328 additions and 114 deletions

View File

@@ -6,6 +6,8 @@
#include <emscripten/bind.h>
#include <emscripten/val.h>
#include "Constants.hpp"
#include "creeps/harvester.hpp"
#include "structures/spawn.hpp"
EMSCRIPTEN_KEEPALIVE
@@ -13,14 +15,22 @@ extern "C" void loop()
{
Screeps::Context::update();
EM_ASM({ console.log('Starting loop...'); });
auto spawnManager = SpawnManager();
spawnManager.process();
// Structures
for (auto& spawn_entry : Screeps::Game.spawns())
{
auto spawn = DouwcoHivemind::Spawn(&spawn_entry.second);
spawn.process();
}
// Creeps
auto creeps = Screeps::Game.creeps();
for (auto& creep : creeps)
creep.second.say("screepsxx");
for (auto& creep : creeps){
if (creep.second.memory()["role"] == DouwcoHivemind::ROLE_HARVESTER)
{
auto harvester = DouwcoHivemind::HarvesterRole(&creep.second);
harvester.process();
}
}
}
EMSCRIPTEN_BINDINGS(loop)