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

Implement LightAndShadow Capture-The-Flag World! #105

Open
wants to merge 5 commits into
base: master
from

Conversation

@darshan3
Copy link
Member

commented Aug 18, 2019

No description provided.

@@ -17,7 +17,10 @@

import org.terasology.cities.BlockTheme;
import org.terasology.cities.DefaultBlockType;
import org.terasology.core.world.generator.facetProviders.SeaLevelProvider;
import org.terasology.core.world.generator.facetProviders.*;

This comment has been minimized.

Copy link
@iaronaraujo

iaronaraujo Aug 18, 2019

Contributor

star import

This comment has been minimized.

Copy link
@darshan3

darshan3 Aug 25, 2019

Author Member

Done

.addProvider(new BaseProvider())
.addProvider(new FloatingPlatformProvider())
.addPlugins()
.addRasterizer(new LaSSimpleWorldRasterizer())
.addRasterizer(new SolidRasterizer())
// .addRasterizer(new LaSSimpleWorldRasterizer())

This comment has been minimized.

Copy link
@iaronaraujo

iaronaraujo Aug 18, 2019

Contributor

remove comment

This comment has been minimized.

Copy link
@darshan3

darshan3 Aug 25, 2019

Author Member

Done

@@ -28,7 +28,7 @@

@Override
public Vector3f getSpawnPosition(World world, EntityRef clientEntity) {
return new Vector3f(0, 65, 0);
return new Vector3f(0, 65, 252);

This comment has been minimized.

Copy link
@iaronaraujo

iaronaraujo Aug 18, 2019

Contributor

Magic numbers

@@ -39,7 +39,7 @@ public void process(GeneratingRegion region) {
// Loop through every position in our 2d array
Rect2i processRegion = facet.getWorldRegion();
for (BaseVector2i position : processRegion.contents()) {
facet.setWorld(position, 10f);
facet.setWorld(position, 9f);

This comment has been minimized.

Copy link
@iaronaraujo

iaronaraujo Aug 18, 2019

Contributor

magic number

public void process(GeneratingRegion region) {
SurfaceHeightFacet facet = region.getRegionFacet(SurfaceHeightFacet.class);
PlayAreaFacet playAreaFacet = region.getRegionFacet(PlayAreaFacet.class);
float mountainHeight = 40;

This comment has been minimized.

Copy link
@iaronaraujo

iaronaraujo Aug 18, 2019

Contributor

Magic numbers here and in the line below

This comment has been minimized.

Copy link
@skaldarnar

skaldarnar Aug 21, 2019

Contributor

These numbers have a name, though 😉 as longs as they are only used locally here I don't mind whether they are top-level constants or not.
I don't think that one can avoid magic numbers in world gen..

This comment has been minimized.

Copy link
@Cervator

Cervator Sep 7, 2019

Member

Yeah a number assigned to a variable usually loses its magic :-) The concern is primarily when using numbers anonymously so to say, like a parameter in a method call

// Loop through every position in our 2d array
Rect2i processRegion = facet.getWorldRegion();
for (BaseVector2i position: processRegion.contents()) {
if (position.distanceSquared(new Vector2i(0, 0)) <= 2500) {

This comment has been minimized.

Copy link
@iaronaraujo

iaronaraujo Aug 18, 2019

Contributor

2500 is a magic number

This comment has been minimized.

Copy link
@Cervator

Cervator Sep 7, 2019

Member

So yep, 2500 here is very magical

@@ -36,16 +36,16 @@

@Override
public void process(Region region, EntityBuffer buffer) {
if (region.getRegion().encompasses(0, 64, 24)) {
if (region.getRegion().encompasses(0, 64, 276)) {

This comment has been minimized.

Copy link
@iaronaraujo

iaronaraujo Aug 18, 2019

Contributor

magic numbers


Prefab chooseFactionNpc = Assets.getPrefab("LightAndShadow:MagicFool").get();
EntityStore entity = new EntityStore(chooseFactionNpc);
entity.addComponent(new LocationComponent(new Vector3f(0, 61, 24)));
entity.addComponent(new LocationComponent(new Vector3f(0, 61, 276)));

This comment has been minimized.

Copy link
@iaronaraujo

iaronaraujo Aug 18, 2019

Contributor

same

buffer.enqueue(entity);

Prefab beaconMark = Assets.getPrefab("BeaconMark").get();
EntityStore entityStore = new EntityStore(beaconMark);
entityStore.addComponent(new LocationComponent(new Vector3f(0, 63, 24)));
entityStore.addComponent(new LocationComponent(new Vector3f(0, 63, 276)));

This comment has been minimized.

Copy link
@iaronaraujo

iaronaraujo Aug 18, 2019

Contributor

same

public void process(GeneratingRegion region) {
SurfaceHeightFacet facet = region.getRegionFacet(SurfaceHeightFacet.class);
PlayAreaFacet playAreaFacet = region.getRegionFacet(PlayAreaFacet.class);
float mountainHeight = 40;

This comment has been minimized.

Copy link
@skaldarnar

skaldarnar Aug 21, 2019

Contributor

These numbers have a name, though 😉 as longs as they are only used locally here I don't mind whether they are top-level constants or not.
I don't think that one can avoid magic numbers in world gen..

@Updates(@Facet(SurfaceHeightFacet.class))
public class MountainsProvider implements FacetProvider {
private Noise mountainNoise;
// private Noise hillNoise;

This comment has been minimized.

Copy link
@skaldarnar

skaldarnar Aug 21, 2019

Contributor

If you don't want to commit your changes on hillNoise you can try to use git add -p next time and don't add the respective lines to your commit. It can also help to git stash those changes temporarily such that they are out of the way.

@RegisterPlugin
@Produces(YingYangFacet.class)
@Requires(@Facet(value = SurfaceHeightFacet.class, border = @FacetBorder(sides = 5)))
public class YingYangProvider implements FacetProviderPlugin {

This comment has been minimized.

Copy link
@skaldarnar

skaldarnar Aug 21, 2019

Contributor

This class is a provider for a single YingYang pattern located at position (0,10,0), is that correct? Please note that in the JavaDoc for this class (and similarly for other "Singleton Facets" or whatever a good name would be for them...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.