From 5bd9459da23029466c257d9c2789559cf3c9ed43 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Thu, 7 Jan 2021 20:11:44 -0600 Subject: [PATCH 1/2] add parameter handling to callonmodule callbacks. IMPORTANT NOTE: cannot handle "" entries. --- .../game/core/utility/scripts/module.cs | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/Templates/BaseGame/game/core/utility/scripts/module.cs b/Templates/BaseGame/game/core/utility/scripts/module.cs index b2b7393fe..b142093a3 100644 --- a/Templates/BaseGame/game/core/utility/scripts/module.cs +++ b/Templates/BaseGame/game/core/utility/scripts/module.cs @@ -3,8 +3,9 @@ $reportModuleFileConflicts=true; if (!isObject(ExecFilesList)) new ArrayObject(ExecFilesList); -function callOnModules(%functionName, %moduleGroup) +function callOnModules(%functionName, %moduleGroup, %var0, %var1, %var2, %var3, %var4, %var5, %var6) { + %maxvars = 7; // match this to i/o signature //clear per module group file execution chain ExecFilesList.empty(); //Get our modules so we can exec any specific client-side loading/handling @@ -21,7 +22,19 @@ function callOnModules(%functionName, %moduleGroup) if(isObject(%module.scopeSet) && %module.scopeSet.isMethod(%functionName)) { - eval(%module.scopeSet @ "." @ %functionName @ "();"); + %stryng = %module.scopeSet @ "." @ %functionName @ "("; + for (%a=0;%a<%maxvars;%a++) + { + if (%var[%a] !$= "") + { + %stryng = %stryng @ %var[%a]; + if (%a<%maxvars-1 && %var[%a+1] !$= "") + %stryng = %stryng @ ","; + } + } + %stryng = %stryng @ ");"; + echo(%stryng); + eval(%stryng); } } @@ -121,9 +134,9 @@ function SimSet::registerDatablock(%scopeSet, %datablockFilePath, %isExclusive) //allows one to override exclusive with exclusive %locked = DatablockFilesList.getValue(%i); - if ((!%locked && !%isExclusive)&&($reportModuleFileConflicts)) + if ((%locked && !%isExclusive)&&($reportModuleFileConflicts)) error("found" SPC %datablockFilePath SPC "duplicate file!"); - if (!%locked || (%locked && %isExclusive)) + if (%isExclusive) { // Replacing an existing entry, update in-place DatablockFilesList.setKey(%fullPath, %i); DatablockFilesList.setValue(%isExclusive, %i); @@ -221,9 +234,9 @@ function SimSet::queueExec(%scopeSet, %execFilePath, %isExclusive) //do note that doing it in this order means setting exclusive twice //allows one to override exclusive with exclusive %locked = ExecFilesList.getValue(%i); - if ((!%locked && !%isExclusive)&&($reportModuleFileConflicts)) + if ((%locked && !%isExclusive)&&($reportModuleFileConflicts)) error("found" SPC %execFilePath SPC "duplicate file!"); - if (!%locked || (%locked && %isExclusive)) + if (%isExclusive) { // Replacing an existing entry, update in-place ExecFilesList.setKey(%fullPath, %i); ExecFilesList.setValue(%isExclusive, %i); From 2cf11fe1997c7c05eddec33845a0a0665ce42bf2 Mon Sep 17 00:00:00 2001 From: Brian Roberts Date: Fri, 8 Jan 2021 00:09:37 -0600 Subject: [PATCH 2/2] Update module.cs cleanup --- Templates/BaseGame/game/core/utility/scripts/module.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Templates/BaseGame/game/core/utility/scripts/module.cs b/Templates/BaseGame/game/core/utility/scripts/module.cs index b142093a3..dc2e1f1c4 100644 --- a/Templates/BaseGame/game/core/utility/scripts/module.cs +++ b/Templates/BaseGame/game/core/utility/scripts/module.cs @@ -33,7 +33,6 @@ function callOnModules(%functionName, %moduleGroup, %var0, %var1, %var2, %var3, } } %stryng = %stryng @ ");"; - echo(%stryng); eval(%stryng); } } @@ -294,4 +293,4 @@ function SimSet::unQueueExec(%scopeSet, %execFilePath) } if ($traceModuleCalls) ExecFilesList.echo(); -} \ No newline at end of file +}