Miner not working properly but implementation is close.

This commit is contained in:
2026-06-22 23:30:49 +02:00
parent 50e8c81cf0
commit 6fcf742cfa
13 changed files with 391 additions and 321 deletions

View File

@@ -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