Set event source for group variable changes to the variable name (#2231)

This commit is contained in:
Nazrin 2023-06-25 07:45:37 -07:00 committed by GitHub
parent 30d093f348
commit 4ec274f5c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -403,7 +403,7 @@ public class ScriptLib {
val old = variables.getOrDefault(var, value); val old = variables.getOrDefault(var, value);
variables.put(var, value); variables.put(var, value);
getSceneScriptManager().callEvent(new ScriptArgs(groupId, EventType.EVENT_VARIABLE_CHANGE, value, old)); getSceneScriptManager().callEvent(new ScriptArgs(groupId, EventType.EVENT_VARIABLE_CHANGE, value, old).setEventSource(var));
return 0; return 0;
} }
@ -418,7 +418,7 @@ public class ScriptLib {
variables.put(var, old + value); variables.put(var, old + value);
logger.debug("[LUA] Call ChangeGroupVariableValue with {},{}", logger.debug("[LUA] Call ChangeGroupVariableValue with {},{}",
old, old+value); old, old+value);
getSceneScriptManager().callEvent(new ScriptArgs(groupId, EventType.EVENT_VARIABLE_CHANGE, old+value, old)); getSceneScriptManager().callEvent(new ScriptArgs(groupId, EventType.EVENT_VARIABLE_CHANGE, old+value, old).setEventSource(var));
return LuaValue.ZERO; return LuaValue.ZERO;
} }