Skip to content
Denys edited this page Sep 3, 2019 · 1 revision

Domains Feature

The Domain is isolated, standalone sandbox, modder's personal storage of JContainers' data. The feature enables automatic removal of the data stored in a domain once a mod linked to the domain gets uninstalled. Every domain is virtual, self-sufficient copy of JContainers. You can't transport your data across domains (unless you share the data with JSON files).

The Purpose
  • Automatic removal of JContainers' data on per-mod basis if the mod is not installed anymore. The mod stores its data in its own domain. Next time a save file loaded the domain and its data which belongs to the mod won't be loaded.
  • Since modder works with his own domain this feature reduces the chances that an author will erroneously mess someone else's data. Atually there are lot of ways to make a mistake: remove some random entry from JDB, use JValue.release on a range of integer values..
How to create and use a domain
  • Pick an unique domain name. For example PSM_JCDomain.
  • Rename the JContainers_DomainsExample.psc (the file is distributed with JContainers) into PSM_JCDomain.psc (edit the file to change the script name also), compile the script and distribute this PSM_JCDomain.pex file with your mod.
  • Put an empty PSM_JCDomain folder into Data/SKSE/Plugins/JCData/Domains/. Distribute the folder with your mod as well.
  • Import PSM_JCDomain script into your Papyrus scripts.
How to switch your code to use your own domain
  • Find and replace JXXX.yyyy with JXXX_yyyy. For instance, JArray.object() should be replaced with JArray_object(). Note that the functions from JContainers.psc do not belong to any domain, and their usage should not be changed (and JContainers_DomainsExample.psc simply doesn't declare them).

An example of Papyrus source code that enables use of domain feature - https://github.com/SilverIce/PosePicker/commit/38d09404bb8db6c8e07548650bb327a445c452fd