Try and very rarely spawn a dormant rover

This commit is contained in:
Marc Di Luzio 2020-07-19 13:57:45 +01:00
parent 37d828c457
commit faa1271c5a

View file

@ -31,6 +31,7 @@ func NewNoiseWorldGen(seed int64) WorldGen {
const ( const (
terrainNoiseScale = 6 terrainNoiseScale = 6
rockNoiseScale = 3 rockNoiseScale = 3
dormantRoverScale = 25
) )
// GetTile returns the chosen tile at a location // GetTile returns the chosen tile at a location
@ -56,5 +57,14 @@ func (g *NoiseWorldGen) GetObject(v maths.Vector) Object {
case o > 0.5: case o > 0.5:
obj = roveapi.Object_RockSmall 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)} return Object{Type: roveapi.Object(obj)}
} }