Skip to content
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

Lua mod INI file configuration #7615

Merged
merged 1 commit into from
Jan 8, 2025

Conversation

StephenCWills
Copy link
Member

@StephenCWills StephenCWills commented Jan 5, 2025

Reads a list of mods from diablo.ini and loads init.lua scripts based on that list.


Example:

[Mods]
clockmod=1
helloworld=0
scwmod=1

The INI configuration above will attempt to execute the following scripts from assets.

  • lua/mods/clockmod/init.lua
  • lua/mods/scwmod/init.lua

The value that comes after the name of the mod is simply an "enabled" flag to indicate whether the mod should be loaded. Hence why it does not attempt to load lua/mods/helloworld/init.lua.


Notes:

  • The devilutionx.events script was moved to the LuaReloadActiveMods() function in preparation for adding a Settings menu page to enable/disable mods.
  • The GameBoot event was replaced with LoadModsComplete for the same reason. It's no longer "Game Boot" if the mods were reloaded by enabling/disabling them in the Settings menu.
  • The mod scripts will be executed in the same order they appear in the INI, giving the user some basic control over the order of precedence of installed mods.

@StephenCWills StephenCWills requested a review from glebm January 5, 2025 16:44
glebm
glebm previously approved these changes Jan 6, 2025
Copy link
Collaborator

@glebm glebm left a comment

Choose a reason for hiding this comment

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

Looks great!

Source/utils/ini.cpp Outdated Show resolved Hide resolved
Source/utils/ini.cpp Show resolved Hide resolved
@AJenbo AJenbo merged commit 4931cc6 into diasurgical:master Jan 8, 2025
23 checks passed
@AJenbo
Copy link
Member

AJenbo commented Jan 8, 2025

Excellent work. Also thanks for help with reviewing.

@StephenCWills StephenCWills deleted the lua-mod-list branch January 8, 2025 01:01
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.

3 participants