# Hotfix: "A JSONDB can only be modified when config.developer is True." when loading a save.
# Drop this file into the game's "game" folder. Builds that already contain the fix ignore it.

init 999 python:
    if _JSONDBDict.__setitem__.__name__ != "_jsondb_release_safe_setitem":
        _hotfix_jsondb_dev_setitem = _JSONDBDict.__setitem__

        def _jsondb_release_safe_setitem(self, key, value):
            if config.developer:
                return _hotfix_jsondb_dev_setitem(self, key, value)
            _dict.__setitem__(self, key, value)

        _JSONDBDict.__setitem__ = _jsondb_release_safe_setitem
