diff --git a/src/main/java/org/terasology/metalrenegades/world/dynamic/HumidityProvider.java b/src/main/java/org/terasology/metalrenegades/world/dynamic/HumidityProvider.java index d1601ad7..1636809a 100644 --- a/src/main/java/org/terasology/metalrenegades/world/dynamic/HumidityProvider.java +++ b/src/main/java/org/terasology/metalrenegades/world/dynamic/HumidityProvider.java @@ -29,6 +29,8 @@ import org.terasology.world.generation.Produces; import org.terasology.world.generation.facets.SurfaceHumidityFacet; +import java.util.Random; + @Produces(SurfaceHumidityFacet.class) public class HumidityProvider implements ConfigurableFacetProvider { private static final int SAMPLE_RATE = 4; @@ -65,7 +67,7 @@ public void process(GeneratingRegion region) { // TODO: Setup humidity Rect2i processRegion = facet.getWorldRegion(); for (BaseVector2i position: processRegion.contents()) { - double hum = getRandomHumidity(position); + double hum = getRandomHumidity(); facet.setWorld(position, (float) hum); } @@ -98,8 +100,10 @@ private void reload() { noise = new SubSampledNoise(brown, scale, SAMPLE_RATE); } - private float getRandomHumidity(BaseVector2i pos) { - return 0.1f; + private double getRandomHumidity() { + Random random = new Random(); + return 1-Math.pow(random.nextFloat(),0.04); + } public static class Configuration implements Component { diff --git a/src/main/java/org/terasology/metalrenegades/world/dynamic/TemperatureProvider.java b/src/main/java/org/terasology/metalrenegades/world/dynamic/TemperatureProvider.java index db31a452..ca732de0 100644 --- a/src/main/java/org/terasology/metalrenegades/world/dynamic/TemperatureProvider.java +++ b/src/main/java/org/terasology/metalrenegades/world/dynamic/TemperatureProvider.java @@ -54,7 +54,7 @@ public void process(GeneratingRegion region) { // TODO: Set temperature Rect2i processRegion = facet.getWorldRegion(); for (BaseVector2i position: processRegion.contents()) { - double temp = getRandomTemp(position); + double temp = getRandomTemp(); facet.setWorld(position, (float) temp); } @@ -65,11 +65,8 @@ private float generateWeight() { return 0; } - private double getRandomTemp(BaseVector2i pos) { -// float sumOfWeights = 10; // TODO -// Random random = new Random(); -//// float f = random.nextFloat() * sumOfWeights; -// return Math.sqrt(random.nextFloat()); - return 0.6f; + private double getRandomTemp() { + Random random = new Random(); + return Math.pow(random.nextFloat(),0.08); } }