main
Nick Dumas 2 weeks ago
parent 98c15d6b5f
commit 55ddb818d9

@ -29,7 +29,7 @@ func main() {
logLevel = slog.LevelError
}
l := slog.New(slog.NewJSONHandler(
l := slog.New(slog.NewTextHandler(
os.Stderr, &slog.HandlerOptions{
Level: logLevel,
},
@ -40,13 +40,14 @@ func main() {
rs := &systems.RoomSystem{
Rooms: make(map[uint64]*systems.Room, 0),
L: l.WithGroup("rooms"),
L: l.With(slog.String("system", "room")),
}
world.AddSystem(rs)
world.Update(1)
l.With(
slog.Int("room count", len(rs.Rooms)),
).Info("setup complete")
world.Update(1)
}

@ -1,6 +1,7 @@
package systems
import (
"fmt"
"log/slog"
"github.com/EngoEngine/ecs"
@ -17,6 +18,7 @@ type Room struct {
type RoomSystem struct {
L *slog.Logger
// replace this with cache fronted db access later
Rooms map[uint64]*Room
}
@ -33,20 +35,26 @@ func (rs *RoomSystem) New(w *ecs.World) {
X: int64(i),
Y: int64(j),
},
Observable: &components.Observable{},
Observable: &components.Observable{
Name: fmt.Sprintf("Room (%d,%d)", i, j),
Description: fmt.Sprintf("%s", "A non-descript room."),
},
Inventory: &components.Inventory{},
}
rs.L.With(
slog.Int("X", i),
slog.Int("Y", j),
slog.Int("ID", z),
).Debug("loaded room")
z++
}
}
// locationMapper := ecs.NewMap4[ID, Location, Observable, Inventory](w)
}
func (rs *RoomSystem) Update(dt float32) {
rs.L.Debug("room system tick")
// flush changes to persistent storage
}
func (rs *RoomSystem) Remove(e ecs.BasicEntity) {}
// Finalize the system.
func (rs *RoomSystem) Finalize(w *ecs.World) {}

Loading…
Cancel
Save