42 lines
1.0 KiB
C++
42 lines
1.0 KiB
C++
#ifndef DOUWCO_HIVEMIND_HARVESTER_HPP
|
|
#define DOUWCO_HIVEMIND_HARVESTER_HPP
|
|
|
|
#include <Screeps/Creep.hpp>
|
|
|
|
#include "Creeps/Creep.hpp"
|
|
|
|
namespace DouwcoHivemind
|
|
{
|
|
class HarvesterRole : public Creep
|
|
{
|
|
private:
|
|
bool harvesting;
|
|
int taskCounter;
|
|
|
|
public:
|
|
HarvesterRole(Screeps::Creep crp) : Creep(crp)
|
|
{
|
|
harvesting = memory.contains("harvesting") ? static_cast<bool>(memory["harvesting"]) : false;
|
|
taskCounter = memory.contains("taskCounter") ? static_cast<int>(memory["taskCounter"]) : 0;
|
|
}
|
|
|
|
~HarvesterRole() override
|
|
{
|
|
memory["harvesting"] = harvesting;
|
|
memory["taskCounter"] = taskCounter;
|
|
}
|
|
|
|
void loop() override;
|
|
|
|
private:
|
|
void harvestSource();
|
|
std::unique_ptr<Screeps::Source> getSourceTarget();
|
|
void searchSource();
|
|
|
|
void depositEnergy();
|
|
std::unique_ptr<Screeps::Structure> getDepositTarget();
|
|
void searchDeposit();
|
|
};
|
|
}
|
|
|
|
#endif // DOUWCO_HIVEMIND_HARVESTER_HPP
|