Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added settlement growth rate function #58

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ public class SettlementEntityManager extends BaseComponentSystem {

private int minDistance = 500;
private int settlementMaxRadius = 150;
private int cyclesLeft = 2; // 1 cycle = approx. 20 seconds
private int cyclesLeft; // 1 cycle = approx. 20 seconds
private int NumberOfCyclesOnReset = 2;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pleas use lower case names for variables. If this should be a constant, it should be

private static final int NUMBER_OF_CYCLES_ON_RESET = 2;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private int NumberOfCyclesOnReset = 2;
private int numberOfCyclesOnReset = 2;

private Random rng;
private Multimap<String, String> roadCache = MultimapBuilder.hashKeys().hashSetValues().build();

Expand All @@ -144,6 +145,7 @@ public void postBegin() {
settlementEntities = settlementCachingSystem.getSettlementCacheEntity();
long seed = regionEntityManager.hashCode() & 0x921233;
rng = new FastRandom(seed);
cyclesLeft = NumberOfCyclesOnReset;

}

Expand Down Expand Up @@ -178,7 +180,7 @@ public void onWorldTimeEvent(WorldTimeEvent worldTimeEvent, EntityRef entityRef)
build(settlement);
buildRoads(settlement);
}
cyclesLeft = 2;
cyclesLeft = NumberOfCyclesOnReset;
}


Expand Down Expand Up @@ -648,5 +650,8 @@ private boolean checkIfTerrainIsBuildable(Rect2i area) {
return true;
}

public void setCityCyclesBeforeGrowth(int cycles){
skaldarnar marked this conversation as resolved.
Show resolved Hide resolved
NumberOfCyclesOnReset = cycles;
}

}