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

Conversation

agent-q1
Copy link

Related to Terasology/MetalRenegades#50 .

Adds a function that exposes DynamicCities to other modules so that they can change the settlement growth rate.

@@ -132,7 +132,8 @@

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;

*/

public void setCityCyclesBeforeGrowth(int cycles){
NUMBER_OF_CYCLES_ON_RESET = cycles;
Copy link
Contributor

Choose a reason for hiding this comment

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

Since you are setting the value of NUMBER_OF_CYCLES_ON_RESET here this cannot be a constant. Thus, it should not be capitalized.

@@ -132,7 +132,8 @@

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

As pointed out down in setCityCyclesBeforeGrowth this member is both read and written, thus, it cannot be a constant.
As setCityCyclesBeforeGrowth seems to be a good name, deriving the member name from the setter method would yield

    private int cyclesBeforeGrowth = 2;

If you want to learn more about constants in Java you may start reading here:

Copy link
Author

Choose a reason for hiding this comment

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

Alright! I got a bit confused about what constants could mean. It all depends on context doesn't it. However, thanks a lot for those resources!. Really helped me clear out some of the concepts for me. I'll go ahead and make that change!

@skaldarnar skaldarnar added the Type: Improvement Request for or addition/enhancement of a feature label Mar 31, 2020
kaen and others added 3 commits April 8, 2020 22:27
* expose set and buffer block events
* expose request raster target event
* create new vector references in block event constructors
* don't expose internal vector references
@skaldarnar
Copy link
Contributor

Looks like there are unrelated changes in this PR... Looks like the come from #31 but I'm not sure why they show up in here again...

@skaldarnar
Copy link
Contributor

Closing in favor of #59

@skaldarnar skaldarnar closed this Apr 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Improvement Request for or addition/enhancement of a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants