Fixing loop when setting variables
Setting a variable would makes the application enter in an infinite loop of events (between all the scripts and the back) This fix makes sure a variable does not emit any event if it is changed to a value it already has.
This commit is contained in:
parent
84df25f863
commit
2aba6b1c27
6 changed files with 61 additions and 23 deletions
|
@ -327,6 +327,11 @@ export class GameRoom {
|
|||
|
||||
const readableBy = variableManager.setVariable(name, value, user);
|
||||
|
||||
// If the variable was not changed, let's not dispatch anything.
|
||||
if (readableBy === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: should we batch those every 100ms?
|
||||
const variableMessage = new VariableWithTagMessage();
|
||||
variableMessage.setName(name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue