Yet another v3.3
Pre-release
Pre-release
·
1 commit
to feature/form-observing
since this release
Form observing:
- Remove extra strict test when loading forms' identifiers from JSON files. In previous alpha version the test marks a form's identifier as invalid if the form is not loaded in game. For now it assumes that the form exists, even if it's not possible to test that.
- Retain and observe EVERY form that gets passed into JContainers which prevents a form from being unloaded. This also involves persistent forms. Still, the forms imported from JSON files, especially object-reference forms may not be retained if those forms belong to some unloaded cells and are unloaded.
- Form observing code: make it really thread safe, almost lock free, use concurrent hashmap collections.
Cosmetic API changes, on hold:
-
JValue
:string getTag(int object)
,setTag(int object, string tag)
functions. Mostly for debugging purposes. Note that it the functions will share the same tag withJValue.retain
function -
JValue.toJSONString
-
JString:
FormId|Form <-> "__formData|'pluginName'|'lowFormId'" conversion functions -
Set of new
JMap|JFormMap|JIntMap.allKeysPArray
functions -
JLua
interface for convenient Papyrus -> Lua parameter transporting. Example:-- replace all non-letter, non-number characters with empty space string function normalizeString(string value) global return JLua.evalLuaStr("return string.gsub(args.str, ' ', '%W')", JLua.setStr("str",value)) endfunction
-
JDB.autoremoveKeyIfPluginMissing(string rootKey, string pluginFileName)
. IMO it's best to replace rootKey with path -
Feel free to suggest better function naming etc.
Other changes:
- Improve
nextKey
functions. Note that theJFormMap.nextKey
function is not much reliable (unlikeallKeys
&allKeysPArray
). It is not very much reliable to use it onJFormMap
containing object-reference form keys, because Skyrim may unload some of the forms and in the result iteration will be interrupted asnextKey
will return None form. Note that v3.3 retains all forms including object-reference forms, thus it's likely impossible to unload such form anymore. Still, the forms imported from JSON files, especially object-reference forms may not be retained if those forms belong to some unloaded cells and are unloaded. For nowJFormMap.nextKey
will not return unloaded (None) forms, except if it's end of iteration.- The functions will not return, skip the keys equal to
endKey
parameter (that would interrupt iteration whenkey == endKey
). - If map container gets modified during iteration process, some container's keys may not be visited. It is valid behavior. See https://groups.google.com/forum/#!topic/jcontainers-users/fy9jmgDplRA
- The functions will not return, skip the keys equal to
- Log attempts to access deleted JContainers' objects. Useful for debugging, troubleshooting, etc. Note that the logging feature is not disable-able (yet?)