First working version of colony.
Harversters and spawn work.
This commit is contained in:
22
src/loop.cpp
22
src/loop.cpp
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user