You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
970 B
Go
53 lines
970 B
Go
package systems
|
|
|
|
import (
|
|
"log/slog"
|
|
|
|
"github.com/EngoEngine/ecs"
|
|
|
|
"code.ndumas.com/ndumas/muddy/components"
|
|
)
|
|
|
|
type Room struct {
|
|
*components.ID
|
|
*components.Location
|
|
*components.Observable
|
|
*components.Inventory
|
|
}
|
|
|
|
type RoomSystem struct {
|
|
L *slog.Logger
|
|
Rooms map[uint64]*Room
|
|
}
|
|
|
|
func (rs *RoomSystem) New(w *ecs.World) {
|
|
rs.L.Debug("initializing room system")
|
|
z := 0
|
|
for i := range 10 {
|
|
for j := range 10 {
|
|
rs.Rooms[uint64(z)] = &Room{
|
|
ID: &components.ID{
|
|
ID: uint64(z),
|
|
},
|
|
Location: &components.Location{
|
|
X: int64(i),
|
|
Y: int64(j),
|
|
},
|
|
Observable: &components.Observable{},
|
|
Inventory: &components.Inventory{},
|
|
}
|
|
z++
|
|
}
|
|
}
|
|
// locationMapper := ecs.NewMap4[ID, Location, Observable, Inventory](w)
|
|
}
|
|
|
|
func (rs *RoomSystem) Update(dt float32) {
|
|
rs.L.Debug("room system tick")
|
|
}
|
|
|
|
func (rs *RoomSystem) Remove(e ecs.BasicEntity) {}
|
|
|
|
// Finalize the system.
|
|
func (rs *RoomSystem) Finalize(w *ecs.World) {}
|