Looking inside game.js file I discovered that inside onLeavingState callback I cannot access state args and it could have sense.
BUT
How can I implement this game mechanics without creating an empty new game state?
Suppose you have a simple game turn game divided in phase. Each phase has a "captain" that is the player that plays the first turn of the phase (exacly as in Puerto Rico).
The progression of "captain" token is not linear but it has to be recalculated every phase (it could happen that the previous captain became also the next captain).
Inside user panels I want to put a little icon that show who's the current captain.
After turn state (activeplayer), there is a endTurn (game) state that calculates if every player has played (if not it's not, it go back to turn) and go to nextPhase (game). Inside my nextPhase I calculate who is the next captain, activate him and return to turn state allows him to play.
I want to notify the clients about the new captain but i can't do this inside onEnteringState because it's to early (i'll receive old captain) neither inside onLeavingState because I have no information because args are not available.
Should I create an empty state just to get this information?
Do I have to retrieve this inside turn state? It's not redundant?
BUT
How can I implement this game mechanics without creating an empty new game state?
Suppose you have a simple game turn game divided in phase. Each phase has a "captain" that is the player that plays the first turn of the phase (exacly as in Puerto Rico).
The progression of "captain" token is not linear but it has to be recalculated every phase (it could happen that the previous captain became also the next captain).
Inside user panels I want to put a little icon that show who's the current captain.
After turn state (activeplayer), there is a endTurn (game) state that calculates if every player has played (if not it's not, it go back to turn) and go to nextPhase (game). Inside my nextPhase I calculate who is the next captain, activate him and return to turn state allows him to play.
I want to notify the clients about the new captain but i can't do this inside onEnteringState because it's to early (i'll receive old captain) neither inside onLeavingState because I have no information because args are not available.
Should I create an empty state just to get this information?
Do I have to retrieve this inside turn state? It's not redundant?