feat: westworldwithmessaging. add entitymanager, telegram, messagehandlers, delayedmessages, expand baseentity

This commit is contained in:
jonas committed 2026-09-03 21:57:52 +02:00
1 parent 0e7482e04c
commit 129dd5d8b8
18 files changed
+505 -19

No files matched your search

@@ -1,15 +1,21 @@
package westworldwithwoman
package westworldwithmessaging
// Entity is what every game object in the world must be able to do.
// The C++ code used a pure virtual function (Update()=0) to force
// every subclass to write its own Update. Go has no subclasses, so
// instead we say: "anything with an Update() and an ID() method
// counts as an Entity." A type only satisfies this interface once
// it has its own Update method - just like the C++ version couldn't
// be used until Update was implemented.
// The C++ code used pure virtual functions (Update()=0, and now
// HandleMessage()=0) to force every subclass to write its own
// versions. Go has no subclasses, so instead we say: "anything with
// Update(), ID() and HandleMessage() methods counts as an Entity." A
// type only satisfies this interface once it has all three - just
// like the C++ version couldn't be used until both were implemented.
type Entity interface {
Update()
ID() int
// HandleMessage lets an entity respond to a Telegram sent to it
// by the message dispatcher. It returns true if the message was
// actually handled, false otherwise - callers use that to decide
// whether to try routing the message somewhere else instead.
HandleMessage(msg Telegram) bool
}
// nextValidID plays the role of the C++ "static int m_iNextValidID".