[Feature request] DashStudio: PluginSdk plugins to be able to define custom NCalc/Js functions
Is your feature request related to a problem? Please describe. It would be simpler and more performant if plugins made with the PluginSdk could define their own custom NCalc/Js functions to be used in DashStudio formulas. This would allow formulas to pass parameters to the functions and get the specified data accordingly.
For example, a plugin could create new leaderboard functions that return new data fields:
-
bo2_drivercountryflag(raceposition)Returns for the race position the driver's country flag name. -
bo2_driverjokerlaps(raceposition)Returns for the race position the driver's amount of joker laps completed. - etc.
Describe the solution you'd like
Add an API, for example: IPluginExtensions.AddFunction<T>(string functionName, Function function)
Functions would probably need to be prefixed with pluginname_ not to clash with official SimHub functions.
Describe alternatives you've considered
The alternative is to create a custom property for each possible index in the leaderboard, and have helper js functions that return the correct property for the specified raceposition parameter.
Additional context