Skip to content

Commit

Permalink
Merge pull request #6 from adambennett/main
Browse files Browse the repository at this point in the history
Add hook for custom mod menus
  • Loading branch information
Steamopollys authored Feb 25, 2024
2 parents 4ebc54b + 4fb8d56 commit d8b3cc0
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 6 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -175,5 +175,15 @@ poetry.toml
# LSP config files
pyrightconfig.json

## IntelliJ
/.idea/
/shelf/
/workspace.xml
/httpRequests/
/dataSources/
/dataSources.local.xml

# End of https://www.toptal.com/developers/gitignore/api/python

/injector/steamodded_injector.dist/
/injector/steamodded_injector.exe
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ The code is NOT recompiled after injection. It might change in the future but it

All the previous depencies are automaticaly downloaded during the injection.

- [pyinstaller](https://pyinstaller.org/en/stable/) - Used to compile the injector
- [Nuitka](https://pypi.org/project/Nuitka/) - Used to compile the injector

## Contributing

This project is open for contribution. Please, feel free to open a merge requeste to do so.
This project is open for contribution. Please, feel free to open a merge request to do so.

Instruction to compile the injector are provided into is dedicated directory.

Expand Down
12 changes: 11 additions & 1 deletion core/core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,11 @@ local function concatAuthors(authors)
return authors or "Unknown"
end

SMODS.customUIElements = {}


function SMODS.registerUIElement(modID, uiElements)
SMODS.customUIElements[modID] = uiElements
end

function create_UIBox_mods(arg_736_0)
local var_495_0 = 0.75 -- Scale factor for text
Expand Down Expand Up @@ -235,6 +238,13 @@ function create_UIBox_mods(arg_736_0)
}
})

local customUI = SMODS.customUIElements[G.ACTIVE_MOD_UI.id]
if customUI then
for _, uiElement in ipairs(customUI) do
table.insert(modNodes, uiElement)
end
end

return {
n = G.UIT.ROOT,
config = {
Expand Down
2 changes: 1 addition & 1 deletion example_mods/UltimateRandom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ end

function SMODS.INIT.UltimateRandomDeck()
local loc_def = {
["name"]="Ultime Random",
["name"]="Ultimate Random",
["text"]={
[1]="Start with a Deck",
[2]="full of",
Expand Down
4 changes: 2 additions & 2 deletions injector/fix build.sh to reflect old locations
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
# Navigate to the script's directory (optional)
cd "$(dirname "$0")"

# Run PyInstaller
nuitka3 --static-libpython=no --standalone --onefile --include-data-dir=core=../core --include-data-dir=debug=../debug --include-data-dir=loader=../loader steamodded_injector.py
# Run Nuitka
nuitka3 --static-libpython=no --standalone --onefile --include-data-dir=core=../core --include-data-dir=debug=../debug --include-data-dir=loader=../loader steamodded_injector.py

0 comments on commit d8b3cc0

Please sign in to comment.