From faa1271c5a01bb555ceb3fc9d678e333bd5a4691 Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Sun, 19 Jul 2020 13:57:45 +0100 Subject: [PATCH] Try and very rarely spawn a dormant rover --- pkg/atlas/worldgen.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/atlas/worldgen.go b/pkg/atlas/worldgen.go index 590596a..8ec8571 100644 --- a/pkg/atlas/worldgen.go +++ b/pkg/atlas/worldgen.go @@ -31,6 +31,7 @@ func NewNoiseWorldGen(seed int64) WorldGen { const ( terrainNoiseScale = 6 rockNoiseScale = 3 + dormantRoverScale = 25 ) // GetTile returns the chosen tile at a location @@ -56,5 +57,14 @@ func (g *NoiseWorldGen) GetObject(v maths.Vector) Object { case o > 0.5: obj = roveapi.Object_RockSmall } + + // Very rarely spawn a dormant rover + if obj == roveapi.Object_ObjectUnknown { + o = g.noise.Eval2(float64(v.X)/dormantRoverScale, float64(v.Y)/dormantRoverScale) + if o > 0.8 { + obj = roveapi.Object_RoverDormant + } + } + return Object{Type: roveapi.Object(obj)} }