Quote: Original post by aarbro
Actually I have one question about the state machine which I'm working with in an entity. I understand a state is a table of functions that replace the "global" events in the entity. When in a state, the events with the same name inside that state are used instead of the "global" ones. Is that right?
Yes you are right. Usually you also have different handlers between client and server.
EntityName.Server.Idle = { OnWhatever = function() end}EntityName.Client.Idle = { OnWhatever = function() end}
that is the common case for multiplayer entities.
Quote:
I know how to start the states but how do I stop using them and return to the ordinary events in the entity?
You can't. if an entity has states, you are always in one state. Usually I create a state 'Idle' that works as normal beahaviour.
ciao
Alberto