-
Notifications
You must be signed in to change notification settings - Fork 217
gui/mod-manager
improvements
#1481
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
Conversation
I suspect the reason why |
Interesting, but in that case why does it work in -- local ol = df.global.world.object_loader
local path = ol.object_load_order_src_dir[idx].value
table.insert(mods, {
id=ol.object_load_order_id[idx].value,
name=ol.object_load_order_name[idx].value,
version=ol.object_load_order_displayed_version[idx].value,
numeric_version=ol.object_load_order_numeric_version[idx],
path=path,
vanilla=path:startswith('data/vanilla/'), -- windows also uses forward slashes
}) |
maybe forcing it into a Lua string would work? untested code.
Edit: Your comment in |
Because This is an artifact of how our C++ object proxying into Lua works. When you directly "read" from a C++ string in order to use its value as a Lua value, the proxy handler automatically converts it into a Lua string. However, when you call a method directly on an object, this doesn't happen: instead, the metatable of the C++ proxy object is consulted, and as there is no It might be an idea to "chain" the Lua string metatable onto the C++ string proxy metatable, but I'm not at all sure how to go about doing this. Will require considerable thought. Copying the proxy object into a local variable before calling the method should provide a workaround since the C++ proxy object will be converted to a Lua object at that time. |
I haven't tried SilasD's suggestion, but ab9rf's works like a charm. |
gui/mod-manager
version compatibility
gui/mod-manager
version compatibilitygui/mod-manager
improvements
I just tested this locally with 52.02 and the arena mode functionality does not work. It's possible that the viewscreen name has changed in 52.xx, but that needs to be addressed before I can consider merging this. |
As a minor note, Lua supports multiple return values.
I'm going to go through and flag these, with suggested code. |
This doesn't really make sense to me. C++ strings returned through the Lua wrapper are Lua strings.
I see this in the PR: local function vanilla(dir)
dir = dir.value
return dir:startswith('data/vanilla')
end which appears to only work on |
gui/mod-manager.lua
Outdated
mod_index = i | ||
break | ||
end | ||
end | ||
|
||
if mod_index == nil then | ||
return false | ||
return { success= false, version= nil } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider
return false, nil
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think either is fine. And I think there is a decent argument for using "named" return values like this instead of unnamed ones (multiple returns)
Only if they pass through |
Ok, so what I'm trying to say is that there are two cases:
And there isn't a third case that looks like case 1 but where |
Correct, please do not merge it yet. I had mentioned that I need the the related PR merged but I'll move it to the top of the description in case just for more prominence.
|
Co-authored-by: SilasD <[email protected]>
Co-authored-by: SilasD <[email protected]>
Co-authored-by: SilasD <[email protected]>
Co-authored-by: SilasD <[email protected]>
Co-authored-by: SilasD <[email protected]>
Co-authored-by: SilasD <[email protected]>
Co-authored-by: SilasD <[email protected]>
Gotcha, I will go look at that PR now. |
In hindsight unpacked return types should have been obvious to me, thanks a ton for the comments and suggestions. |
I just tested this locally, after merging DFHack/dfhack#5500, and while the panel appears in arena mode and I can save profiles I cannot load a profile. I suspect that this needs updates to reflect the type changes with 52.02; if you look at the changes made for 52.02 compatibility you will note that I had to make adjustments to code in
|
I understand what you're saying now. I'm still not fully up to speed with all the metamethods on some of the proxy objects. |
Yep, we no longer need to pass |
This is now working for me in testing in arena mode. |
this looks ready to merge to me, but i'll wait if you want to give it one more pass first i want to get a release out soon for the fix to mod manager but i'd like to slide this in with that release if i can |
I've just finished testing, thanks! |
Requires DFHack/dfhack#5500 be merged for arena mode views
The manager also notifies users when a version of a vanilla module in their preset has been changed. This way they should know to update the preset to avoid the popup in future. Since mod manager no longer gives a hoot about the vanilla module versions, an entirely vanilla preset for 51.13 should theoretically also be backwards compatible with an older version.
TODO
Mod Manager is duplicating mods to both inactive and active lists. dfhack#3746Too much for this PR, I'll likely tackle it next time.