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

test: add SettlementEntityManagerTest for placeParcel #107

Merged
merged 13 commits into from
Oct 7, 2021

Conversation

keturn
Copy link
Contributor

@keturn keturn commented Sep 27, 2021

Things to look for in review:

Let me know if you want any of the checkstyle fixes or other refactorings split in to other PRs to reduce the noise in this one.

@keturn
Copy link
Contributor Author

keturn commented Sep 27, 2021

Test set-up has been slow going because everything really, really wants to be configured by prefabs, and I don't know how to add a prefab only for tests. See related discussion in #gestalt.

@keturn
Copy link
Contributor Author

keturn commented Sep 27, 2021

After some fiddling to make this not dependent on other work-in-progress, this is something like a test case that runs.

It doesn't pass, but it's starting to look like something that could pass.

The changes to the non-test classes are intended to be small refactorings to make the tests a little easier to write, plus some things CheckStyle complained about along the way.

Comment on lines +69 to +70
this.coords.set(other.coords);
this.radius = other.radius;
Copy link
Member

Choose a reason for hiding this comment

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

whoops, where did we forget this 🙈

@keturn keturn added Category: Test/QA Requests, Issues and Changes targeting tests and quality assurance Topic: WorldGen Requests, Issues and Changes related to facets, rasterizers, etc. labels Oct 7, 2021
@keturn keturn mentioned this pull request Oct 7, 2021
2 tasks
ResourceFacetComponent resourceFacetComponent = region.getComponent(ResourceFacetComponent.class);
if (roughnessFacetComponent == null) {
logger.error("No RoughnessFacetComponent found for region");
static class ParcelLocationValidator {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: javadoc

Copy link
Member

@jdrueckert jdrueckert left a comment

Choose a reason for hiding this comment

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

Code-wise this looks fine to me. I didn't see anything that sparked specific concerns.
I'll give this a go in-game before approving.

entityStore.addComponent(roughnessFacetComponent);
entityStore.addComponent(resourceFacetComponent);
entityStore.addComponent(treeFacetComponent);

// FIXME: is TreeFacet optional?
Copy link
Member

Choose a reason for hiding this comment

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

I would not think so. CoreWorlds as part of the core modules should always be enabled and has a TreeFacet, so I would guess if all else fails, that one should always be there, should it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know about that.

protected WorldBuilder createWorld() {
return new WorldBuilder(worldGeneratorPluginLibrary)
.addProvider(new FlatSurfaceHeightProvider(SURFACE_HEIGHT))
.addProvider(new SeaLevelProvider(SEA_LEVEL))
.addProvider(new ConstantBiomeProvider(BIOME))
.addProvider(new RoughnessProvider())
.addProvider(new SiteFacetProvider())
.addProvider(new SettlementFacetProvider())
.addProvider(new ResourceProvider())
.addEntities(new RegionEntityProvider())
.addRasterizer(new SolidRasterizer())
is a world generator that does not provide a TreeFacet.

Can entity providers use the same @Requires annotations as FacetProviders can?

If so, then this EntityProvider could declare that it does depend on having a TreeFacet. (Once MovingBlocks/Terasology#4924 is fixed.)

Copy link
Member

Choose a reason for hiding this comment

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

You're absolutely right, only because a TreeFacet exists in at least one of the modules, the world generator doesn't need to use it.

I don't know whether or not they can 🤷

Copy link
Member

@jdrueckert jdrueckert left a comment

Choose a reason for hiding this comment

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

Found a city in-game, different kinds of buildings spawn fine, checks run through - good enough for me 👍

@jdrueckert jdrueckert merged commit cebf3f5 into develop Oct 7, 2021
@jdrueckert jdrueckert deleted the test/placeParcel branch October 7, 2021 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Test/QA Requests, Issues and Changes targeting tests and quality assurance Topic: WorldGen Requests, Issues and Changes related to facets, rasterizers, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants