feat: westworldwithmessaging. add entitymanager, telegram, messagehandlers, delayedmessages, expand baseentity
This commit is contained in:
1 parent
0e7482e04c
commit
129dd5d8b8
18 files changed
+505
-19
No files matched your search
@@ -1,4 +1,4 @@
|
||||
package westworldwithwoman
|
||||
package westworldwithmessaging
|
||||
|
||||
// Elsa is the miner's wife, introduced in this section of the book.
|
||||
// She's built the exact same way Miner is: embed *BaseGameEntity for
|
||||
@@ -28,6 +28,10 @@ func NewElsa(id int) *Elsa {
|
||||
e.stateMachine.SetCurrentState(DoHousework())
|
||||
e.stateMachine.SetGlobalState(WifesGlobalState())
|
||||
|
||||
// Register with the entity manager automatically, same reasoning
|
||||
// as NewMiner - one less manual step for every caller to remember.
|
||||
EntityMgr.RegisterEntity(e)
|
||||
|
||||
return e
|
||||
}
|
||||
|
||||
@@ -47,3 +51,9 @@ func (e *Elsa) Update() {
|
||||
func (e *Elsa) ChangeState(newState State[Elsa]) {
|
||||
e.stateMachine.ChangeState(newState)
|
||||
}
|
||||
|
||||
// HandleMessage forwards to the state machine, same as
|
||||
// Miner.HandleMessage.
|
||||
func (e *Elsa) HandleMessage(msg Telegram) bool {
|
||||
return e.stateMachine.HandleMessage(msg)
|
||||
}
|
||||
Reference in new issue
Block a user