From b0a05aa2d741e9a4acd7a8486b27b2d516e1c4e4 Mon Sep 17 00:00:00 2001 From: dreamscached Date: Fri, 21 Oct 2022 08:50:12 +0200 Subject: [PATCH 01/16] Implement override mechanism --- mod/config.rpy | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mod/config.rpy b/mod/config.rpy index 8c86044..f2f9860 100644 --- a/mod/config.rpy +++ b/mod/config.rpy @@ -41,11 +41,10 @@ init 90 python in _fom_presence_config: ui_message_report="Could not load some presence configs, see log/submod_log.log." ) - _WARNING_CONFIG_CLASH = error.Error( - log_message_report="Config from file {0} has conflicting name with some other config: {1}.", - ui_message_report="There were some warnings during loading some of the presence configs, see log/submod_log.log.", - warning=True - ) + + # Logger + + _logger = logging.DEFAULT # Supplier and related functions and constructors @@ -489,9 +488,10 @@ init 90 python in _fom_presence_config: _configs.append((_file, config)) if config.id is not None: - if config.id in _config_id_map: - _WARNING_CONFIG_CLASH.report(_file[len(_config_dir) + 1:], config.id) - _config_id_map[config.id] = config + if not config.id in _config_id_map or config.priority > _config_id_map[config.id].priority: + _logger.info("Config {0} has existing ID and higher priority over existing config {1}, overriding.".format(_file[len(_config_dir) + 1:], e)) + _config_id_map[config.id] = config + except Exception as e: _ERROR_CONFIG_LOADING.report(_file[len(_config_dir) + 1:], e) From 0a263a21f32c2e43fd7b23c5a532edd23846b76e Mon Sep 17 00:00:00 2001 From: dreamscached Date: Fri, 21 Oct 2022 08:53:46 +0200 Subject: [PATCH 02/16] Revert "Implement override mechanism" This reverts commit b0a05aa2d741e9a4acd7a8486b27b2d516e1c4e4. --- mod/config.rpy | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mod/config.rpy b/mod/config.rpy index f2f9860..8c86044 100644 --- a/mod/config.rpy +++ b/mod/config.rpy @@ -41,10 +41,11 @@ init 90 python in _fom_presence_config: ui_message_report="Could not load some presence configs, see log/submod_log.log." ) - - # Logger - - _logger = logging.DEFAULT + _WARNING_CONFIG_CLASH = error.Error( + log_message_report="Config from file {0} has conflicting name with some other config: {1}.", + ui_message_report="There were some warnings during loading some of the presence configs, see log/submod_log.log.", + warning=True + ) # Supplier and related functions and constructors @@ -488,10 +489,9 @@ init 90 python in _fom_presence_config: _configs.append((_file, config)) if config.id is not None: - if not config.id in _config_id_map or config.priority > _config_id_map[config.id].priority: - _logger.info("Config {0} has existing ID and higher priority over existing config {1}, overriding.".format(_file[len(_config_dir) + 1:], e)) - _config_id_map[config.id] = config - + if config.id in _config_id_map: + _WARNING_CONFIG_CLASH.report(_file[len(_config_dir) + 1:], config.id) + _config_id_map[config.id] = config except Exception as e: _ERROR_CONFIG_LOADING.report(_file[len(_config_dir) + 1:], e) From 6875dcaff5f9a689ebe774a4a286460f08b4eea5 Mon Sep 17 00:00:00 2001 From: dreamscached Date: Fri, 21 Oct 2022 09:05:38 +0200 Subject: [PATCH 03/16] File fix --- mod/config.rpy | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/mod/config.rpy b/mod/config.rpy index 8c86044..8630f47 100644 --- a/mod/config.rpy +++ b/mod/config.rpy @@ -483,20 +483,20 @@ init 90 python in _fom_presence_config: try: _file = os.path.join(_dir, _file) - config = Config.from_file(_file) - if config.condition is not None: - eval(config.condition, dict(), store.__dict__) - - _configs.append((_file, config)) - if config.id is not None: - if config.id in _config_id_map: - _WARNING_CONFIG_CLASH.report(_file[len(_config_dir) + 1:], config.id) - _config_id_map[config.id] = config + file_rel = _file[len(_config_dir) + 1:] except Exception as e: - _ERROR_CONFIG_LOADING.report(_file[len(_config_dir) + 1:], e) + _ERROR_CONFIG_LOADING.report(file_rel, e) + + config = Config.from_file(_file) + if config.condition is not None: + eval(config.condition, dict(), store.__dict__) + + _configs.append((file_rel, config)) + if config.id is not None: + _config_id_map[config.id] = config # Once configs are loaded, we now copy inherited values. - def inherit(config): + def inherit(config, _file): # Prevent loops and infinite recursions. if config.inherited: return True @@ -504,7 +504,7 @@ init 90 python in _fom_presence_config: if config.inherit_id is not None: parent = _config_id_map.get(config.inherit_id) if parent is None: - _ERROR_CONFIG_INHERITANCE.report(_file[len(_config_dir) + 1:], config.inherit_id) + _ERROR_CONFIG_INHERITANCE.report(_file, config.inherit_id) return False # Inheritance is done recursively. @@ -517,8 +517,10 @@ init 90 python in _fom_presence_config: idx = 0 while idx < len(_configs): _file, config = _configs[idx] - if not inherit(config): + if not inherit(config, _file): del _configs[idx] + if config.id is not None: + del _config_id_map[config.id] else: idx += 1 From 7f1361f2229ede59604cf95aa4190cd525954ab8 Mon Sep 17 00:00:00 2001 From: dreamscached Date: Fri, 21 Oct 2022 09:33:28 +0200 Subject: [PATCH 04/16] Implement override with name clash --- mod/config.rpy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mod/config.rpy b/mod/config.rpy index 8630f47..7df14a7 100644 --- a/mod/config.rpy +++ b/mod/config.rpy @@ -493,7 +493,8 @@ init 90 python in _fom_presence_config: _configs.append((file_rel, config)) if config.id is not None: - _config_id_map[config.id] = config + if _config_id_map[config.id].priority < config.priority: + _config_id_map[config.id] = config # Once configs are loaded, we now copy inherited values. def inherit(config, _file): From 6e2fb2bcdedb92f39dbfed328ac2ee008ce2a422 Mon Sep 17 00:00:00 2001 From: dreamscached Date: Fri, 21 Oct 2022 10:43:52 +0200 Subject: [PATCH 05/16] Use dicts for simplified removal --- mod/config.rpy | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/mod/config.rpy b/mod/config.rpy index 7df14a7..bba926a 100644 --- a/mod/config.rpy +++ b/mod/config.rpy @@ -469,8 +469,8 @@ init 90 python in _fom_presence_config: error context. Reported errors are not resolved on successful loads. """ - del _configs[:] - _config_id_map.clear() + configs = dict() + id_map = dict() for _dir, _, files in os.walk(_config_dir): for _file in files: @@ -481,22 +481,25 @@ init 90 python in _fom_presence_config: ): continue + _file = os.path.join(_dir, _file) + rel_file = _file[len(_config_dir) + 1:] + try: - _file = os.path.join(_dir, _file) - file_rel = _file[len(_config_dir) + 1:] + config = Config.from_file(_file) + if config.condition is not None: + eval(config.condition, dict(), store.__dict__) except Exception as e: _ERROR_CONFIG_LOADING.report(file_rel, e) + continue - config = Config.from_file(_file) - if config.condition is not None: - eval(config.condition, dict(), store.__dict__) - - _configs.append((file_rel, config)) + configs[rel_file] = config if config.id is not None: - if _config_id_map[config.id].priority < config.priority: - _config_id_map[config.id] = config + ids = id_map.get(config.id) + if ids is None: + id_map[config.id] = [config] + else: + ids.append(config) - # Once configs are loaded, we now copy inherited values. def inherit(config, _file): # Prevent loops and infinite recursions. if config.inherited: @@ -515,18 +518,18 @@ init 90 python in _fom_presence_config: return True - idx = 0 - while idx < len(_configs): - _file, config = _configs[idx] - if not inherit(config, _file): - del _configs[idx] + for rel_file, config in list(configs.items()): + if not inherit(config, rel_file): + del configs[rel_file] if config.id is not None: - del _config_id_map[config.id] - else: - idx += 1 + del id_map[config.id] + + del _configs[:] + _config_id_map.clear() # Sort configs on reload to save precious time on every loop. - _configs.sort(key=lambda it: it[1].priority, reverse=True) + _configs.extend(sorted(configs.values(), key=lambda it: it[1].priority, reverse=True)) + _config_id_map.update(id_map) def get_active_config(): """ From 6e1f2382c901e7d4f27c9b3fcc3516e4cced3eb8 Mon Sep 17 00:00:00 2001 From: dreamscached Date: Fri, 21 Oct 2022 10:46:40 +0200 Subject: [PATCH 06/16] Fix --- mod/config.rpy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mod/config.rpy b/mod/config.rpy index bba926a..c0701b5 100644 --- a/mod/config.rpy +++ b/mod/config.rpy @@ -527,10 +527,12 @@ init 90 python in _fom_presence_config: del _configs[:] _config_id_map.clear() - # Sort configs on reload to save precious time on every loop. - _configs.extend(sorted(configs.values(), key=lambda it: it[1].priority, reverse=True)) + _configs.extend(list(configs.items())) _config_id_map.update(id_map) + # Sort configs on reload to save precious time on every loop. + _configs.sort(key=lambda it: it[1].priority, reverse=True) + def get_active_config(): """ Evaluates conditions in configs in global Ren'Py scope and returns From 0b00ba00712166acc0be69ece715772714e23e6e Mon Sep 17 00:00:00 2001 From: dreamscached Date: Fri, 21 Oct 2022 11:04:04 +0200 Subject: [PATCH 07/16] Implement override --- mod/config.rpy | 111 ++++++++++++++++++++++++++++++------------------- 1 file changed, 69 insertions(+), 42 deletions(-) diff --git a/mod/config.rpy b/mod/config.rpy index c0701b5..68a9f45 100644 --- a/mod/config.rpy +++ b/mod/config.rpy @@ -41,6 +41,11 @@ init 90 python in _fom_presence_config: ui_message_report="Could not load some presence configs, see log/submod_log.log." ) + _ERROR_CONFIG_OVERRIDE = error.Error( + log_message_report="Presence config {0} overrides nonexistent config ID: {1}.", + ui_message_report="Could not load some presence configs, see log/submod_log.log." + ) + _WARNING_CONFIG_CLASH = error.Error( log_message_report="Config from file {0} has conflicting name with some other config: {1}.", ui_message_report="There were some warnings during loading some of the presence configs, see log/submod_log.log.", @@ -324,6 +329,7 @@ init 90 python in _fom_presence_config: self.dynamic = parser.get_value("Presence", "Dynamic", _parse_bool, True) self.id = parser.get_value("Presence", "ID", str, None) self.inherit_id = parser.get_value("Presence", "Inherit", str, None) + self.override_id = parser.get_value("Presence", "Override", str, None) self.app_id = parser.get_value("Client", "ApplicationID", int) @@ -339,7 +345,7 @@ init 90 python in _fom_presence_config: self.stop_ts = parser.get_value("Timestamps", "End", _parse_ts_supplier, _none_supplier) self._activity = None - self._inherit_applied = False + self._file = None @staticmethod def from_file(path): @@ -358,28 +364,32 @@ init 90 python in _fom_presence_config: c = configparser.ConfigParser() with _open_with_encoding(path, "r", encoding="utf-8") as f: c.readfp(f, path.replace("\\", "/").split("/")[:-1]) - return Config(_ParserWrapper(c)) - def inherit(self, config, force=False): + config = Config(_ParserWrapper(c)) + config._file = path + return config + + @property + def file(self): + """ + Returns path to file this config was loaded from. + + OUT: + str: + Path to config file. + """ + + return self._file + + def copy_from(self, config): """ Copies values from another config (only omitted, None or - _none_supplier values) over to this config. Unless force parameter - is set to True, does nothing on next call. + _none_supplier values) over to this config. IN: config -> Config: - Config to copy values from. Inherit method is not called, - inheritance is not done recursively by this method, users - should care about this themselves. - - force -> bool, default False: - If True, skips inheritance status checks and applies values - over again. + Config to copy values from. """ - - if self._inherit_applied and not force: - return - if self.app_id is None: self.app_id = config.app_id if self.details is _none_supplier: @@ -399,23 +409,6 @@ init 90 python in _fom_presence_config: if self.stop_ts is _none_supplier: self.stop_ts = config.stop_ts - self._inherit_applied = True - - @property - def inherited(self): - """ - Returns inheritance status flag value. - - OUT: - True: - If this config has inherited from other config. - - False: - If this config has not inherited from another config. - """ - - return self._inherit_applied - def to_activity(self): """ Creates Activity instance from the values stored in Config. @@ -472,6 +465,9 @@ init 90 python in _fom_presence_config: configs = dict() id_map = dict() + inherited = set() + overridden = set() + for _dir, _, files in os.walk(_config_dir): for _file in files: if not ( @@ -488,6 +484,7 @@ init 90 python in _fom_presence_config: config = Config.from_file(_file) if config.condition is not None: eval(config.condition, dict(), store.__dict__) + config._file = rel_file except Exception as e: _ERROR_CONFIG_LOADING.report(file_rel, e) continue @@ -500,29 +497,59 @@ init 90 python in _fom_presence_config: else: ids.append(config) - def inherit(config, _file): + def inherit(config): # Prevent loops and infinite recursions. - if config.inherited: + if config in inherited: return True if config.inherit_id is not None: - parent = _config_id_map.get(config.inherit_id) + parent = id_map.get(config.inherit_id) if parent is None: - _ERROR_CONFIG_INHERITANCE.report(_file, config.inherit_id) + _ERROR_CONFIG_INHERITANCE.report(config.file, config.inherit_id) return False # Inheritance is done recursively. if not inherit(parent): return False - config.inherit(parent) + config.copy_from(parent) + # Add to list of applied inheritances. + inherited.add(config) return True + def override(config): + # Prevent loops and infinite recursions. + if config in overridden: + return True + + if config.override_id is not None: + ov = id_map.get(config.override_id) + if ov is None: + _ERROR_CONFIG_OVERRIDE.report(config.file, config.override_id) + return False + + if not override(ov): + return False + + remove_config(ov) + config.id = ov.id + id_map[ov.id] = config + + overridden.add(config) + return True + + def remove_config(config): + del configs[rel_file] + if config.id is not None: + del id_map[config.id] + for rel_file, config in list(configs.items()): - if not inherit(config, rel_file): - del configs[rel_file] - if config.id is not None: - del id_map[config.id] + if rel_file not in configs: + continue + + if not (inherit(config) and override(config)): + remove_config(config) + continue del _configs[:] _config_id_map.clear() From 8bd6d6f6e56ff825498541e23be92f888f93a77f Mon Sep 17 00:00:00 2001 From: dreamscached Date: Fri, 21 Oct 2022 11:06:33 +0200 Subject: [PATCH 08/16] Fix --- mod/config.rpy | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mod/config.rpy b/mod/config.rpy index 68a9f45..c7be4ae 100644 --- a/mod/config.rpy +++ b/mod/config.rpy @@ -491,11 +491,9 @@ init 90 python in _fom_presence_config: configs[rel_file] = config if config.id is not None: - ids = id_map.get(config.id) - if ids is None: - id_map[config.id] = [config] - else: - ids.append(config) + ov = id_map.get(config.id) + if ov is None or ov.priority <= config.priority: + id_map[config.id] = config def inherit(config): # Prevent loops and infinite recursions. From a512e612e2b5cf3a828589ffa48d38ce33c0c457 Mon Sep 17 00:00:00 2001 From: dreamscached Date: Fri, 21 Oct 2022 11:09:05 +0200 Subject: [PATCH 09/16] Fix --- mod/config.rpy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/config.rpy b/mod/config.rpy index c7be4ae..6fb8555 100644 --- a/mod/config.rpy +++ b/mod/config.rpy @@ -537,7 +537,7 @@ init 90 python in _fom_presence_config: return True def remove_config(config): - del configs[rel_file] + del configs[config.file] if config.id is not None: del id_map[config.id] From 55ffa2bae9ac8f32a97fa0d62a3003013e419956 Mon Sep 17 00:00:00 2001 From: dreamscached Date: Fri, 21 Oct 2022 11:15:08 +0200 Subject: [PATCH 10/16] Use file path as ID if it's missing --- mod/config.rpy | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mod/config.rpy b/mod/config.rpy index 6fb8555..d5bd94c 100644 --- a/mod/config.rpy +++ b/mod/config.rpy @@ -490,10 +490,13 @@ init 90 python in _fom_presence_config: continue configs[rel_file] = config - if config.id is not None: - ov = id_map.get(config.id) - if ov is None or ov.priority <= config.priority: - id_map[config.id] = config + if config.id is None: + config.id = rel_file + + ov = id_map.get(config.id) + if ov is not None: + _WARNING_CONFIG_CLASH.report(rel_file, config.id) + id_map[config.id] = config def inherit(config): # Prevent loops and infinite recursions. From 0e86035495f23e7ff9c16a866bdbfdf766f7db66 Mon Sep 17 00:00:00 2001 From: dreamscached Date: Fri, 21 Oct 2022 11:34:41 +0200 Subject: [PATCH 11/16] Implement disabling --- mod/config.rpy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mod/config.rpy b/mod/config.rpy index d5bd94c..6e1fe13 100644 --- a/mod/config.rpy +++ b/mod/config.rpy @@ -330,6 +330,7 @@ init 90 python in _fom_presence_config: self.id = parser.get_value("Presence", "ID", str, None) self.inherit_id = parser.get_value("Presence", "Inherit", str, None) self.override_id = parser.get_value("Presence", "Override", str, None) + self.override_id = parser.get_value("Presence", "Disable", _parse_bool, False) self.app_id = parser.get_value("Client", "ApplicationID", int) @@ -575,7 +576,7 @@ init 90 python in _fom_presence_config: for _file, conf in _configs: if conf.condition is not None: try: - if bool(eval(conf.condition, dict(), store.__dict__)): + if not conf.disable and bool(eval(conf.condition, dict(), store.__dict__)): return conf except Exception as e: _ERROR_CONFIG_LOADING.report(_file[len(_config_dir) + 1:], e) From f1632e4a6bd39188ad89942d7a8f875b06ff0556 Mon Sep 17 00:00:00 2001 From: dreamscached Date: Fri, 21 Oct 2022 11:37:57 +0200 Subject: [PATCH 12/16] Fix typo --- mod/config.rpy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/config.rpy b/mod/config.rpy index 6e1fe13..a130196 100644 --- a/mod/config.rpy +++ b/mod/config.rpy @@ -330,7 +330,7 @@ init 90 python in _fom_presence_config: self.id = parser.get_value("Presence", "ID", str, None) self.inherit_id = parser.get_value("Presence", "Inherit", str, None) self.override_id = parser.get_value("Presence", "Override", str, None) - self.override_id = parser.get_value("Presence", "Disable", _parse_bool, False) + self.disable = parser.get_value("Presence", "Disable", _parse_bool, False) self.app_id = parser.get_value("Client", "ApplicationID", int) From 7e6824cb327faaacb3879b36b49cb74d71a23b48 Mon Sep 17 00:00:00 2001 From: dreamscached Date: Fri, 21 Oct 2022 11:52:41 +0200 Subject: [PATCH 13/16] Use path as ID --- mod/config.rpy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mod/config.rpy b/mod/config.rpy index a130196..9f497b4 100644 --- a/mod/config.rpy +++ b/mod/config.rpy @@ -497,7 +497,9 @@ init 90 python in _fom_presence_config: ov = id_map.get(config.id) if ov is not None: _WARNING_CONFIG_CLASH.report(rel_file, config.id) + id_map[config.id] = config + id_map[rel_file] = config def inherit(config): # Prevent loops and infinite recursions. From e8a88ea759e2ad2763e372d0256ad4c61b50b405 Mon Sep 17 00:00:00 2001 From: dreamscached Date: Fri, 21 Oct 2022 12:00:07 +0200 Subject: [PATCH 14/16] Documentation --- doc/CUSTOMIZING.md | 62 +++++++++++++++++++++++++++++++++++++++++++++- mod/config.rpy | 1 + 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/doc/CUSTOMIZING.md b/doc/CUSTOMIZING.md index b390745..b0edcc3 100644 --- a/doc/CUSTOMIZING.md +++ b/doc/CUSTOMIZING.md @@ -113,4 +113,64 @@ inherit values from another (B), then one more config (C) would inherit values from A and have values both from A and from B. Only omitted values are replaced, in case some value is present in the child -config it will never be replaced. \ No newline at end of file +config it will never be replaced. + +### Overriding + +Continuing to counter issues with default config customization, in patch 0.3.1 +two more important parameters have been introduced with one of them being +`Override =`. + +With `Override`, you can replace existing config by its ID or path (relative to +config directory, see example below) *entirely*, combined with `Inherit` (see +above) you could could use it to alter just a part of existing config without +a need to copy it entirely. + +#### Existing config + +```ini +[Presence] +ID = MyAwesomeConfig + +[Activity] +State = Having fun at [loc_prompt] +``` + +#### Overriding config + +```ini +[Presence] +Override = MyAwesomeConfig + +[Activity] +State = Spending time together at [loc_prompt] +``` + +Sometimes however, if an existing config has no ID assigned and you don't want +to edit it, you can use a path (relative to config directory) instead: + +```ini +[Presence] +# Full path would be game/Submods/Discord Presence Submod/config/default/... +# but you only need part AFTER config/, without a leading slash (/) +Override = default/configs/default.conf +``` + +### Disabling + +Another parameter introduced in 0.3.1 is `Disable =`, which if set to `True` +will disable the config and prevent it from being chosen. This however does not +affect inheriting and overriding and you can still use it as a base for other +configs or override some other config and disable it. + +For example, if there is a default config you want to disable, you'd create +another config and use `Override` like this: + +```ini +[Presence] +Override = default/configs/some-config-to-disable.conf +Disable = True +``` + +This config will replace a config you specified in `Override` and disable it, +making it never be chosen. \ No newline at end of file diff --git a/mod/config.rpy b/mod/config.rpy index 9f497b4..42fdc9a 100644 --- a/mod/config.rpy +++ b/mod/config.rpy @@ -391,6 +391,7 @@ init 90 python in _fom_presence_config: config -> Config: Config to copy values from. """ + if self.app_id is None: self.app_id = config.app_id if self.details is _none_supplier: From 0b5ccd4209f477b30d7fc6fa57c45729a3c137a8 Mon Sep 17 00:00:00 2001 From: dreamscached Date: Fri, 21 Oct 2022 12:01:46 +0200 Subject: [PATCH 15/16] Bump version --- mod/header.rpy | 5 +++-- mod/updates.rpy | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/mod/header.rpy b/mod/header.rpy index 2324d52..6c5e70e 100644 --- a/mod/header.rpy +++ b/mod/header.rpy @@ -9,7 +9,7 @@ init -990 python in mas_submod_utils: author="Friends of Monika", name="Discord Presence Submod", description="Show everyone who's the person you're spending your time with~", - version="0.3.0", + version="0.3.1", settings_pane="fom_presence_settings_pane", version_updates={ "friends_of_monika_discord_presence_submod_v0_0_1": "friends_of_monika_discord_presence_submod_v0_0_2", @@ -18,7 +18,8 @@ init -990 python in mas_submod_utils: "friends_of_monika_discord_presence_submod_v0_0_4": "friends_of_monika_discord_presence_submod_v0_1_2", "friends_of_monika_discord_presence_submod_v0_1_2": "friends_of_monika_discord_presence_submod_v0_2_0", "friends_of_monika_discord_presence_submod_v0_2_0": "friends_of_monika_discord_presence_submod_v0_2_1", - "friends_of_monika_discord_presence_submod_v0_2_1": "friends_of_monika_discord_presence_submod_v0_3_0" + "friends_of_monika_discord_presence_submod_v0_2_1": "friends_of_monika_discord_presence_submod_v0_3_0", + "friends_of_monika_discord_presence_submod_v0_3_0": "friends_of_monika_discord_presence_submod_v0_3_1" } ) diff --git a/mod/updates.rpy b/mod/updates.rpy index 09ef7af..8fc9063 100644 --- a/mod/updates.rpy +++ b/mod/updates.rpy @@ -70,4 +70,7 @@ label friends_of_monika_discord_presence_submod_v0_2_1(version="v0_2_1"): return label friends_of_monika_discord_presence_submod_v0_3_0(version="v0_3_0"): + return + +label friends_of_monika_discord_presence_submod_v0_3_1(version="v0_3_1"): return \ No newline at end of file From b2d9e84c57a37cc05604928761e03f2dbdc139d1 Mon Sep 17 00:00:00 2001 From: dreamscached Date: Fri, 21 Oct 2022 12:03:14 +0200 Subject: [PATCH 16/16] Fix condition --- mod/config.rpy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mod/config.rpy b/mod/config.rpy index 42fdc9a..c252e4c 100644 --- a/mod/config.rpy +++ b/mod/config.rpy @@ -577,9 +577,9 @@ init 90 python in _fom_presence_config: """ for _file, conf in _configs: - if conf.condition is not None: + if not conf.disable and conf.condition is not None: try: - if not conf.disable and bool(eval(conf.condition, dict(), store.__dict__)): + if bool(eval(conf.condition, dict(), store.__dict__)): return conf except Exception as e: _ERROR_CONFIG_LOADING.report(_file[len(_config_dir) + 1:], e)