mirror of
https://github.com/devZoGok/PlanetFleet.git
synced 2026-08-26 19:43:29 +00:00
separate resource loading and unloading orders
removing fulfiled orders
This commit is contained in:
+10
-7
@@ -14,20 +14,23 @@ namespace battleship{
|
||||
ResourceRover(Player*, int, vb01::Vector3, vb01::Quaternion, Unit::State = Unit::State::STAND_GROUND);
|
||||
~ResourceRover();
|
||||
void update();
|
||||
inline int getLoad(int id){return load[id];}
|
||||
inline int calcTotalLoad(){return load[0] + load[1] + load[2];}
|
||||
inline int getLoad(int id){return cargo[id];}
|
||||
inline int calcTotalLoad(){return cargo[0] + cargo[1] + cargo[2];}
|
||||
inline int getCapacity(){return capacity;}
|
||||
inline bool canLoad(){return vb01::getTime() - lastLoadTime > loadRate && calcTotalLoad() < capacity;}
|
||||
inline bool canUnload(int id){return vb01::getTime() - lastLoadTime > loadRate && cargo[id] > 0;}
|
||||
private:
|
||||
void initProperties();
|
||||
void supply(Order);
|
||||
void collectRefineds(Order, float);
|
||||
void transferResource(Structure*, float);
|
||||
void supply(Order);
|
||||
void handleTransfer(Structure*, float, bool);
|
||||
void transfer(Order, bool);
|
||||
void load(Order);
|
||||
void unload(Order);
|
||||
Unit* getClosestUnit(std::vector<Structure*>);
|
||||
inline bool canLoad(){return vb01::getTime() - lastLoadTime > loadRate && calcTotalLoad() < capacity;}
|
||||
inline bool canUnload(int id){return vb01::getTime() - lastLoadTime > loadRate && load[id] > 0;}
|
||||
|
||||
vb01::s64 lastLoadTime = 0;
|
||||
int load[3]{0, 0, 0}, capacity, loadRate, loadSpeed;
|
||||
int cargo[3]{0, 0, 0}, capacity, loadRate, loadSpeed;
|
||||
Extractor *nearestExtractor = nullptr;
|
||||
Unit *nearestRefinery = nullptr;
|
||||
vb01::Node *loadBackground = nullptr, *loadForeground = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user