Skip to content

Add duplicate mod import check and user-friendly error screen #122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

4onen
Copy link
Contributor

@4onen 4onen commented Mar 28, 2025

image

Detects when mods are imported from multiple places, but their metadata reports the same name. Prevents the user/mod developer from launching the game fully until this name duplication has been resolved.

Without this, current behavior is to import the __init__.py and *.rpy files of both mods, but silently only call mod_load and mod_complete on whichever mod was imported second. Without duplicate labels in *.rpy files, this could be entirely silent and result in numerous confusing behaviors.

Credit to JoeyJumper94 for exposing this issue with a heisenbug that had different behavior on Linux vs Wine (due to different folder sort order.)


def add_mod(mod_name, mod):
"""Add a mod in the registry"""
print "Adding mod {}".format(mod_name)
if mod_name in modlist:
print("IMPORT ISSUE: Given a mod name of {0!r} by both {1!r} and {2!r}.".format(mod_name, modlist[mod_name].__module__, mod.__module__))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this print statement only for debugging?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was not. In case something goes wrong from the multiple import of these mods, I wanted to give some kind of output as soon as it's discovered, at least for mod developers, just in case they manage to create a corner case where we can't show the error screen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants