From 018c122861f7a1536b3fe8ee754dfd1c2207a477 Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Sat, 1 Aug 2020 11:24:53 +0100 Subject: [PATCH] Stop spawning dormant rovers in the world --- pkg/rove/worldgen.go | 40 ---------------------------------------- 1 file changed, 40 deletions(-) diff --git a/pkg/rove/worldgen.go b/pkg/rove/worldgen.go index a1593c6..2abb447 100644 --- a/pkg/rove/worldgen.go +++ b/pkg/rove/worldgen.go @@ -1,10 +1,6 @@ package rove import ( - "encoding/json" - "log" - "math/rand" - "github.com/mdiluz/rove/pkg/maths" "github.com/mdiluz/rove/proto/roveapi" "github.com/ojrac/opensimplex-go" @@ -70,41 +66,5 @@ func (g *NoiseWorldGen) GetObject(v maths.Vector) (obj Object) { } } - // Very rarely spawn a dormant rover - if obj.Type == roveapi.Object_ObjectUnknown { - // TODO: Make this better, ideally with noise - if v.X%25 == 0 && v.Y%25 == 0 && v.X != 0 && v.Y != 0 { - obj.Type = roveapi.Object_RoverDormant - } - } - - // Post process any spawned objects - switch obj.Type { - case roveapi.Object_RoverDormant: - // Create the rover - r := DefaultRover() - - // Set the rover variables - r.Pos = v - - // Upgrade this rover randomly - r.MaximumCharge += rand.Int() % 3 - r.MaximumIntegrity += rand.Int() % 3 - r.Capacity += rand.Int() % 3 - r.Range += rand.Int() % 3 - - // For now, mark the log as corrupted - r.AddLogEntryf("log corrupted") - - // Marshal the rover data into the object data - b, err := json.Marshal(r) - if err != nil { - log.Fatalf("couldn't marshal rover, should never fail: %s", err) - } - - // Store the bytes - obj.Data = b - } - return obj }