add hot Chunk reload
All checks were successful
Dynamic Branch Deploy / build-and-deploy (push) Successful in 2m27s
All checks were successful
Dynamic Branch Deploy / build-and-deploy (push) Successful in 2m27s
This commit is contained in:
@@ -74,6 +74,7 @@ func handleWebSocket(w http.ResponseWriter, r *http.Request) {
|
||||
Ticks: 0,
|
||||
PosY: PlayerYBase,
|
||||
NextSpawnTick: 0,
|
||||
Chunks: loadChunksFromRedis(),
|
||||
}
|
||||
|
||||
// Channel größer machen, damit bei Lag nichts blockiert
|
||||
@@ -246,10 +247,10 @@ func generateFutureObjects(s *SimState, tick int, speed float64) ([]ActiveObstac
|
||||
if tick >= s.NextSpawnTick {
|
||||
spawnX := SpawnXStart
|
||||
|
||||
chunkCount := len(defaultConfig.Chunks)
|
||||
chunkCount := len(s.Chunks)
|
||||
if chunkCount > 0 && s.RNG.NextFloat() > 0.8 {
|
||||
idx := int(s.RNG.NextRange(0, float64(chunkCount)))
|
||||
chunk := defaultConfig.Chunks[idx]
|
||||
chunk := s.Chunks[idx]
|
||||
|
||||
for _, p := range chunk.Platforms {
|
||||
createdPlats = append(createdPlats, ActivePlatform{X: spawnX + p.X, Y: p.Y, Width: p.Width, Height: p.Height})
|
||||
|
||||
Reference in New Issue
Block a user