RulesDSL: add triggeringGroup and triggeringGroupName to rule context (#4273)

Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
This commit is contained in:
jimtng 2024-06-24 02:40:17 +10:00 committed by GitHub
parent 2aacdcd4e8
commit 9b39f625e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -131,6 +131,10 @@ class RulesJvmModelInferrer extends ScriptJvmModelInferrer {
rule.toMethod("_" + rule.name, ruleModel.newTypeRef(Void.TYPE)) [ rule.toMethod("_" + rule.name, ruleModel.newTypeRef(Void.TYPE)) [
static = true static = true
if ((containsCommandTrigger(rule)) || (containsStateChangeTrigger(rule)) || (containsStateUpdateTrigger(rule))) { if ((containsCommandTrigger(rule)) || (containsStateChangeTrigger(rule)) || (containsStateUpdateTrigger(rule))) {
val groupTypeRef = ruleModel.newTypeRef(Item)
parameters += rule.toParameter(VAR_TRIGGERING_GROUP, groupTypeRef)
val groupNameRef = ruleModel.newTypeRef(String)
parameters += rule.toParameter(VAR_TRIGGERING_GROUP_NAME, groupNameRef)
val itemTypeRef = ruleModel.newTypeRef(Item) val itemTypeRef = ruleModel.newTypeRef(Item)
parameters += rule.toParameter(VAR_TRIGGERING_ITEM, itemTypeRef) parameters += rule.toParameter(VAR_TRIGGERING_ITEM, itemTypeRef)
val itemNameRef = ruleModel.newTypeRef(String) val itemNameRef = ruleModel.newTypeRef(String)