From 5430213699537f21aa3e4d31df15776a4bf8db79 Mon Sep 17 00:00:00 2001 From: Nick Dumas Date: Tue, 20 Jan 2026 17:17:10 -0500 Subject: [PATCH] moving to a simpler (hopefully?) ecs system --- cmd/cli/guest/main.go | 5 ++-- components.go => components/components.go | 0 systems.go | 25 ++++++++----------- systems/room.go | 30 +++++++++++++++++++++++ 4 files changed, 42 insertions(+), 18 deletions(-) rename components.go => components/components.go (100%) create mode 100644 systems/room.go diff --git a/cmd/cli/guest/main.go b/cmd/cli/guest/main.go index ff4432b..0b925ec 100644 --- a/cmd/cli/guest/main.go +++ b/cmd/cli/guest/main.go @@ -1,11 +1,10 @@ package main import ( - "fmt" + // "fmt" "github.com/EngoEngine/ecs" - - "code.ndumas.com/ndumas/muddy" + // "code.ndumas.com/ndumas/muddy" ) func main() { diff --git a/components.go b/components/components.go similarity index 100% rename from components.go rename to components/components.go diff --git a/systems.go b/systems.go index 7bbf128..383e975 100644 --- a/systems.go +++ b/systems.go @@ -1,16 +1,18 @@ -package muddy +package systems import ( - "fmt" + // "fmt" "github.com/EngoEngine/ecs" + + "code.ndumas.com/ndumas/muddy/components" ) type Room struct { - ID - Location - Observable - Inventory + components.ID + components.Location + components.Observable + components.Inventory } type RoomRepository interface { @@ -23,12 +25,5 @@ type RoomSystem struct { repository RoomRepository } -func (s *RoomSystem) Initialize(w *ecs.World) { - fmt.Println("initializing room system") - // locationMapper := ecs.NewMap4[ID, Location, Observable, Inventory](w) -} - -func (s *RoomSystem) Update(w *ecs.World) {} - -// Finalize the system. -func (s *RoomSystem) Finalize(w *ecs.World) {} +func (rs *RoomSystem) Update(dt float32) {} +func (rs *RoomSystem) Remove(e ecs.BasicEntity) {} diff --git a/systems/room.go b/systems/room.go new file mode 100644 index 0000000..db6a60f --- /dev/null +++ b/systems/room.go @@ -0,0 +1,30 @@ +package muddy + +import ( + "fmt" + + "github.com/EngoEngine/ecs" + + "code.ndumas.com/ndumas/muddy/components" +) + +type Room struct { + components.ID + components.Location + components.Observable + components.Inventory +} + +type RoomSystem struct { + repository RoomRepository +} + +func (s *RoomSystem) Initialize(w *ecs.World) { + fmt.Println("initializing room system") + // locationMapper := ecs.NewMap4[ID, Location, Observable, Inventory](w) +} + +func (s *RoomSystem) Update(w *ecs.World) {} + +// Finalize the system. +func (s *RoomSystem) Finalize(w *ecs.World) {}