mirror of
https://github.com/devZoGok/PlanetFleet.git
synced 2026-08-26 19:43:29 +00:00
cost property factored out into configs
This commit is contained in:
@@ -496,6 +496,7 @@ units = {
|
||||
lineOfSight = 5,
|
||||
generationRate = 10000,
|
||||
generationSpeed = 10,
|
||||
researchCost = 1,
|
||||
name = 'Lab',
|
||||
basePath = PATH .. structurePrefix .. 'Labs/',
|
||||
meshPath = 'lab.xml',
|
||||
|
||||
+3
-3
@@ -10,15 +10,15 @@ namespace battleship{
|
||||
sol::table unitTable = generateView()["units"][id + 1];
|
||||
generationRate = unitTable["generationRate"];
|
||||
generationSpeed = unitTable["generationSpeed"];
|
||||
researchCost = unitTable["researchCost"];
|
||||
}
|
||||
|
||||
void ResearchStruct::update(){
|
||||
Structure::update();
|
||||
int cost = 1;
|
||||
|
||||
if(player->getRefineds() >= cost && canGenerateResearch()){
|
||||
if(player->getRefineds() >= researchCost && canGenerateResearch()){
|
||||
player->addResearch(generationSpeed);
|
||||
player->subtractRefineds(cost);
|
||||
player->subtractRefineds(researchCost);
|
||||
lastGenTime = getTime();
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ namespace battleship{
|
||||
void update();
|
||||
private:
|
||||
vb01::s64 lastGenTime = 0;
|
||||
int generationRate, generationSpeed;
|
||||
int researchCost, generationRate, generationSpeed;
|
||||
|
||||
bool canGenerateResearch(){return vb01::getTime() - lastGenTime > generationRate;}
|
||||
void generateResearch();
|
||||
|
||||
Reference in New Issue
Block a user