Basic setup for Cpp based screeping.
This commit is contained in:
18
src/spawn.cpp
Normal file
18
src/spawn.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#include <Screeps/Game.hpp>
|
||||
#include <Screeps/Room.hpp>
|
||||
#include <Screeps/StructureSpawn.hpp>
|
||||
|
||||
#include <emscripten.h>
|
||||
|
||||
#include "structures/spawn.hpp"
|
||||
|
||||
void SpawnManager::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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user