You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The sideEffect of a message represents the game state changes caused when a message is rendered. It's stored on the message object and called by the Dialogue component
selectFollowup is also included on a message, in particular when this message is an optional choice to be made by the player (returned by the getResponses method). It is provided by the DialogueContext and executed in getResponse - ultimately called when the response choice is clicked by the player
Current Behaviour
Reproducible 1: When a dialogue response choice has a method selectFollowup containing logic which checks game state before choosing which message to display (such as hasRelationshipPair), and it also has a sideEffect method which changes the same game state properties, the selectFollowup code will run before sideEffect and the messages will have been queued with an out-of-date game state
Reproducible 2: Writing a selectFollowup method which queues many messages, when one of those messages includes a sideEffect, the later messages in the queue will have been
Expected Behaviour
The selectFollowup code should not be running until the game state is up-to-date with previous messages
Fixing it now
Moving game state changing code into selectFollowup to maintain the correct order
The text was updated successfully, but these errors were encountered:
Context
sideEffect
of a message represents the game state changes caused when a message is rendered. It's stored on the message object and called by theDialogue
componentselectFollowup
is also included on a message, in particular when this message is an optional choice to be made by the player (returned by thegetResponses
method). It is provided by theDialogueContext
and executed ingetResponse
- ultimately called when the response choice is clicked by the playerCurrent Behaviour
Reproducible 1: When a dialogue response choice has a method
selectFollowup
containing logic which checks game state before choosing which message to display (such ashasRelationshipPair
), and it also has asideEffect
method which changes the same game state properties, theselectFollowup
code will run beforesideEffect
and the messages will have been queued with an out-of-date game stateReproducible 2: Writing a
selectFollowup
method which queues many messages, when one of those messages includes asideEffect
, the later messages in the queue will have beenExpected Behaviour
The
selectFollowup
code should not be running until the game state is up-to-date with previous messagesFixing it now
Moving game state changing code into
selectFollowup
to maintain the correct orderThe text was updated successfully, but these errors were encountered: