Whitelist and checking it outside of the game - THDigi/SE-ModScript-Examples GitHub Wiki

What is the whitelist

The mod scripts obey a whitelist of types (and in some cases specific methods in types) so that they cannot access things outside of the game context or mess around with too many game internals. This list is pretty complicated.

Official API docs site: keensoftwarehouse.github.io
However this list is incomplete even in terms of SE's own objects, for example MyGunBase does not show up there.
It also does not include whitelisted .NET/C# things which there are plenty, like System.Math or System.IO.Path.

The actual whitelist patterns from the game: Whitelist Overview (there's one for PB API on MDK wiki too).

If you wish to look at it using a decompiler then it's added to in 3 places:
  • MyScriptWhitelist.ctor()
  • MySpaceGameCustomInitialization.InitIlChecker()
  • MySandboxGame.InitIlChecker()

Checking whitelist automatically

Analyzers for IDEs can be used to automatically check the current code for whitelist to let you know in realtime if a type/method/prop/etc is prohibited.

There's currently 2 analyzers which can be used in probably any IDE:

  • MDK2 Analyzer
    The VS setup guide already includes this analyzer.
    To add this to existing or older projects, rightclick project -> Manage NuGet packages then search for Mal.Mdk2.ModAnalyzers and install it, done!

  • SE Whitelist Diagnostic
    No longer maintained.

⚠️ **GitHub.com Fallback** ⚠️