Miner not working properly but implementation is close.
This commit is contained in:
@@ -3,47 +3,35 @@
|
||||
|
||||
#include <Screeps/Creep.hpp>
|
||||
|
||||
namespace Screeps{
|
||||
class RoomPosition;
|
||||
class RoomObject;
|
||||
class PathStep;
|
||||
}
|
||||
namespace Screeps {
|
||||
class RoomPosition;
|
||||
class RoomObject;
|
||||
class PathStep;
|
||||
} // namespace Screeps
|
||||
|
||||
namespace DouwcoHivemind
|
||||
{
|
||||
enum CreepRole
|
||||
{
|
||||
UNEMPLOYED,
|
||||
SUPPLIER,
|
||||
UPGRADER,
|
||||
BUILDER,
|
||||
MAINTAINER
|
||||
};
|
||||
namespace DouwcoHivemind {
|
||||
enum CreepRole { UNEMPLOYED, SUPPLIER, UPGRADER, BUILDER, MAINTAINER, MINER };
|
||||
|
||||
class CreepBase
|
||||
{
|
||||
public:
|
||||
CreepRole role;
|
||||
std::string target_id;
|
||||
class CreepBase {
|
||||
public:
|
||||
CreepRole role;
|
||||
std::string target_id;
|
||||
|
||||
protected:
|
||||
Screeps::Creep creep;
|
||||
JSON memory;
|
||||
protected:
|
||||
Screeps::Creep creep;
|
||||
JSON memory;
|
||||
|
||||
public:
|
||||
CreepBase(Screeps::Creep crp);
|
||||
virtual ~CreepBase();
|
||||
virtual void loop() {}
|
||||
public:
|
||||
CreepBase(Screeps::Creep crp);
|
||||
virtual ~CreepBase();
|
||||
virtual void loop() {}
|
||||
|
||||
bool isNearTo(const Screeps::RoomPosition &pos, int dist);
|
||||
|
||||
|
||||
bool isNearTo(const Screeps::RoomPosition &pos, int dist);
|
||||
|
||||
|
||||
protected:
|
||||
void moveToTarget(int dist = 1);
|
||||
std::unique_ptr<Screeps::RoomObject> getRoomObjectTarget();
|
||||
};
|
||||
}
|
||||
protected:
|
||||
void moveToTarget(int dist = 1);
|
||||
std::unique_ptr<Screeps::RoomObject> getRoomObjectTarget();
|
||||
};
|
||||
} // namespace DouwcoHivemind
|
||||
|
||||
#endif // DOUWCO_HIVEMIND_CREEPBASE_HPP
|
||||
21
douwco_hivemind/include/Creeps/Miner.hpp
Normal file
21
douwco_hivemind/include/Creeps/Miner.hpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef DOUWCO_HIVEMIND_MINER_HPP
|
||||
#define DOUWCO_HIVEMIND_MINER_HPP
|
||||
|
||||
#include "Creeps/CreepBase.hpp"
|
||||
#include <string>
|
||||
|
||||
namespace DouwcoHivemind
|
||||
{
|
||||
class Miner : public CreepBase
|
||||
{
|
||||
private:
|
||||
bool arrivedAtContainer;
|
||||
|
||||
public:
|
||||
Miner(Screeps::Creep crp);
|
||||
~Miner() override;
|
||||
void loop() override;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // DOUWCO_HIVEMIND_MINER_HPP
|
||||
@@ -20,6 +20,7 @@ namespace DouwcoHivemind
|
||||
virtual void depositEnergy(){}
|
||||
|
||||
private:
|
||||
void getEnergy();
|
||||
void harvestSource();
|
||||
std::unique_ptr<Screeps::Source> getSourceTarget();
|
||||
void searchSource();
|
||||
|
||||
Reference in New Issue
Block a user